J2KBuechTest.java 12.20 KiB
/*
 * J2KProcessInterception_conv_potET
 * Created on 29-03-2013 after J2KProcessInterception.java by P. Krause
 * 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 * 
 * Dans ce module, on a change l'initialisation de l'ET0
 * et on a applique un changement d'unite pour potET (conversion de mm en L)
package cowattools;
import jams.data.*;
import jams.model.*;
/**
 * @author Francois Tilmant
@JAMSComponentDescription(
        title = "J2K_buech",
        author = "TOTO",
        description = "PLOP ",
        version = "1.0_0",
        date = "2013-03-19"
public class J2KBuechTest extends JAMSComponent {
     *  Component variables
    @JAMSVarDescription(
            access = JAMSVarDescription.AccessType.READ,
            update = JAMSVarDescription.UpdateType.RUN,
            description = "attribute area",
            unit = "m^2"
    public JAMSDouble area;
    @JAMSVarDescription(
            access = JAMSVarDescription.AccessType.READ,
            update = JAMSVarDescription.UpdateType.RUN,
            description = "state variable mean tempeature",
            unit = "degC"
    public JAMSDouble tmean;
    @JAMSVarDescription(
            access = JAMSVarDescription.AccessType.READ,
            update = JAMSVarDescription.UpdateType.RUN,
            description = "state variable rain",
            unit = "L"
    public JAMSDouble rain;
    @JAMSVarDescription(
            access = JAMSVarDescription.AccessType.READ,
            update = JAMSVarDescription.UpdateType.RUN,
            description = "state variable snow",
            unit = "L"
    public JAMSDouble snow;
    @JAMSVarDescription(
            access = JAMSVarDescription.AccessType.READWRITE,
            update = JAMSVarDescription.UpdateType.RUN,
            description = "state variable potET",
            unit = "mm(i)-L(o)"
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
public JAMSDouble potET; @JAMSVarDescription( access = JAMSVarDescription.AccessType.READWRITE, update = JAMSVarDescription.UpdateType.RUN, description = "state variable actET", unit = "L" ) public JAMSDouble actET; @JAMSVarDescription( access = JAMSVarDescription.AccessType.READ, update = JAMSVarDescription.UpdateType.RUN, description = "state variable LAI" ) public JAMSDouble actLAI; @JAMSVarDescription( access = JAMSVarDescription.AccessType.READ, update = JAMSVarDescription.UpdateType.INIT, description = "Snow parameter TRS", lowerBound = -10.0, upperBound = 10.0, defaultValue = "0.0", unit = "degC" ) public JAMSDouble snow_trs; @JAMSVarDescription( access = JAMSVarDescription.AccessType.READ, update = JAMSVarDescription.UpdateType.INIT, description = "Snow parameter TRANS", lowerBound = 0.0, upperBound = 5.0, defaultValue = "2.0", unit = "K" ) public JAMSDouble snow_trans; @JAMSVarDescription( access = JAMSVarDescription.AccessType.READ, update = JAMSVarDescription.UpdateType.INIT, description = "Interception parameter a_rain", lowerBound = 0.0, upperBound = 5.0, defaultValue = "0.2", unit = "mm" ) public JAMSDouble a_rain; @JAMSVarDescription( access = JAMSVarDescription.AccessType.READ, update = JAMSVarDescription.UpdateType.INIT, description = "Interception parameter a_snow", lowerBound = 0.0, upperBound = 5.0, defaultValue = "0.5", unit = "mm" ) public JAMSDouble a_snow; @JAMSVarDescription( access = JAMSVarDescription.AccessType.READWRITE, update = JAMSVarDescription.UpdateType.RUN, description = "state variable net-rain", unit = "L" ) public JAMSDouble netRain; @JAMSVarDescription(
141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
access = JAMSVarDescription.AccessType.WRITE, update = JAMSVarDescription.UpdateType.RUN, description = "state variable net-snow", unit = "L" ) public JAMSDouble netSnow; @JAMSVarDescription( access = JAMSVarDescription.AccessType.WRITE, update = JAMSVarDescription.UpdateType.RUN, description = "state variable throughfall", unit = "L" ) public JAMSDouble throughfall; @JAMSVarDescription( access = JAMSVarDescription.AccessType.WRITE, update = JAMSVarDescription.UpdateType.RUN, description = "state variable dy-interception", unit = "L" ) public JAMSDouble interception; @JAMSVarDescription( access = JAMSVarDescription.AccessType.READWRITE, update = JAMSVarDescription.UpdateType.RUN, description = "state variable interception storage", unit = "L" ) public JAMSDouble intercStorage; @JAMSVarDescription(access = JAMSVarDescription.AccessType.READ, description = "The current hru entityyz") public Attribute.Entity entity; @JAMSVarDescription(access = JAMSVarDescription.AccessType.READ, description = "The current hru entity") public Attribute.EntityCollection hrus; /* @JAMSVarDescription( access = JAMSVarDescription.AccessType.READ, update = JAMSVarDescription.UpdateType.RUN, description = "id de la HRU pour Debug", unit="-" ) @JAMSVarDescription( access = JAMSVarDescription.AccessType.READ, update = JAMSVarDescription.UpdateType.RUN, description = "id de la HRU pour debug" ) public JAMSDouble HRU_id; @JAMSVarDescription(access = JAMSVarDescription.AccessType.READ, description = "Current time step", unit = "d") public Attribute.Calendar time; */ /* * Component run stages */ public void init() throws JAMSEntity.NoSuchAttributeException { //this.intercStorage.setValue(0); //Whatasit.plop(); System.out.println("POET initialized"); } public void run() throws JAMSEntity.NoSuchAttributeException { //System.out.println("Sprinkle bell " + Whatasit.getSprinkleIrrig());
211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
/*if (area == null) { System.out.println("AREA is null"); } else { double in_Area = area.getValue(); System.out.println("AREA: " + in_Area); }*/ try { if (hrus == null) { System.out.println("ACTHRU is null"); } else { System.out.println("ACTHRU is NOT null"); Attribute.Entity actHRU = hrus.getCurrent(); Double hruId = actHRU.getDouble("ID"); int iHruId = hruId.intValue(); String sHruId = String.valueOf(iHruId); System.out.println("HRUID: " + sHruId); if (netRain != null) { double outVal = CouplingCommunication.getTableValue("aspersion", String.valueOf(sHruId)); if (outVal != 0.0) { double net_rain = netRain.getValue(); System.out.println("NET RAIN BEFORE => "+net_rain); netRain.setValue(net_rain + outVal); net_rain = netRain.getValue(); System.out.println("NET RAIN AFTER => "+net_rain); } } } /*if (entity == null) { System.out.println("entity is null"); } else { System.out.println("entity is NOT null"); double ID_HRU = entity.getDouble("ID"); System.out.println("ENTITY HRU ID: "+ID_HRU); } */ } catch (java.lang.NullPointerException e) { System.out.println(e); } return; // double alpha = 0; // double out_throughfall = 0; // double out_interception = 0; // // /*double ID_HRU = HRU_id.getDouble();/*/ // // double in_rain = rain.getValue(); // double in_snow = snow.getValue(); // double in_temp = tmean.getValue(); // // double in_potETP = potET.getValue()*area.getValue(); // double in_actETP = 0; // // double in_LAI = this.actLAI.getValue(); // double in_Area = area.getValue(); // // double out_InterceptionStorage = intercStorage.getValue(); // double out_actETP = in_actETP; // // double sum_precip = in_rain + in_snow; // // // if (HRU_id.getValue() == 1.0){ // //System.out.println(time.toString()); // // } // // double deltaETP = in_potETP - in_actETP; // // double relRain, relSnow;