Klasse DiurnalSineWeatherTransformer
- Alle implementierten Schnittstellen:
net.simplace.sim.util.FWSimFieldContainer
Temperature follows a sine curve during daylight and an exponential decay curve during night between minimum and maximum temperature.
Radiation follows one of the curves specified by the user
- Sine - a simple sine curve ,
- SinBeta - sine of solar elevation (shifted sine curve)
- SinBetaEffective - as SinBeta, but corrected for lower atmospheric transmission at lower solar elevation.
as defined by (G).
Input variables
- The field names (column names) of date, radiation, min and max temperature in the resource (CHAR)
- The number of steps the diurnal values are calculated (default is 24, i.e. hourly values) (INT)
- Latitude of the location (DOUBLE)
- The offset from noon of max temp MaxTempTimeOffset (default 1.5, i.e. max temperature occurs at 1:30 pm) (DOUBLE)
- The nocturnal time coefficient for temperature NocturnalTimeCoefficient (default is 4 hours) (DOUBLE)
- The radiation curve that should be used - one of Sine, SinBeta or SinBetaEffective (CHAR)
Output variables
Output variables in the following order
- Key column(s) of the original resource (including date) in the same order and same datatype
- Time - Array of time for each step (h) (INTARRAY)
- Temperature - Array of Temperature for each step (°C) (DOUBLEARRAY)
- Radiation intensity - Array of radiation intensity for each time step (J m^-2 h^-1, kJ m^-2 h^-1 or MJ m^-2 h^-1) (DOUBLEARRAY)
- Radiation - Array of radiation accumulated between two time steps (DOUBLEARRAY)
- DOY - day of year (d) (INT)
- Daylength - (h) (DOUBLE)
- Daily total radiation - (J m^-2, kJ m^-2 or MJ m^-2) (DOUBLE)
Example
First we need a resource with daily weather, including min and max temp and radiation.
| <resource id="weather" interface="weatherfile" frequence="DAILY"> | <header> | <res id="KeyValue" datatype="CHAR" key="vWeatherKey"/> | <res id="PolygonCode" datatype="CHAR" /> | <res id="CURRENTDATE" datatype="DATE" key="CURRENT.DATE" /> | <res id="Rain" unit="mm" datatype="DOUBLE" /> | <res id="AirTemperatureMax" unit="°C" datatype="DOUBLE" /> | <res id="AirTemperatureMin" unit="°C" datatype="DOUBLE" /> | <res id="GlobalSolarRadiation" unit="MJ*m**-2" datatype="DOUBLE" /> | <res id="WindSpeed" unit="m*s**-1" datatype="DOUBLE" /> | <res id="ReferenceEvapotranspiration" unit="mm" datatype="DOUBLE" /> | </header> | </resource>
The transformer needs the resource id in it's resource attribute. Output variables in the header section start with the resources key variables, followed by calculated variables. The inputs for DateField, MinTempField, MaxTempField and RadiationField contain the names of the columns as defined in the resource above.
| <transform id="diurnal" frequence="DAILY" resource="weather" class="net.simplace.sim.transformers.DiurnalSineWeatherTransformer"> | <header> | <res id="KeyValue" datatype="CHAR" key="vWeatherKey"/> | <res id="CURRENTDATE" datatype="DATE" key="CURRENT.DATE" /> | <res id="Hours" datatype="DOUBLEARRAY" /> | <res id="Temperature" datatype="DOUBLEARRAY" /> | <res id="RadiationIntensity" datatype="DOUBLEARRAY" /> | <res id="Radiation" datatype="DOUBLEARRAY" /> | <res id="Doy" datatype="INT" /> | <res id="Daylength" datatype="DOUBLE" /> | <res id="GlobalRadiation" datatype="DOUBLE" /> | </header> | <input id="DateField">CURRENTDATE</input> | <input id="MinTempField">AirTemperatureMin</input> | <input id="MaxTempField">AirTemperatureMax</input> | <input id="RadiationField">GlobalSolarRadiation</input> | <input id="Steps">48</input> | <input id="Latitude" source="vLatitude" /> | <input id="RadiationCurve">Sine</input> | <input id="MaxTempTimeOffset">1.5</input> | <input id="NocturnalTimeCoefficient">4.0</input> | </transform>
Temperature
Temperature is calculated according to (G) eq. 3.9 for daytime
\(12-d/2 < t_h < 12+d/2\): \[ T_a(t_h) =T_{min} + (T_{max} - T_{min})\sin(\pi \frac{t_h - 12 + \frac{d}{2}}{d + 2p}) \]and (G) eq. 3.10 for nighttime
\(t_h \leq 12-d/2 \quad\text{or}\quad 12+d/2 \leq t_h\): \[ T_a(t_h) = \frac{T_{min}-T_{sset} e^{-\frac{n}{TC}} + (T_{sset}-T_{min})e^{-\frac{t_h - t_{sset}}{TC}}}{1-e^{-\frac{n}{TC}}} \] where \(T_a\) is the air temperature at hour \(t_h\), \(d, n\) are day- and nightlength, \(p\) is the offset from noon of max temperature and \(TC\) the nocturnal time coefficient. \(T_{sset}, t_{sset}\) are temperature and time at sunsset.Radiation
If RadiationCurve has the value 'Sine', then the radiation intensitiy follows the curve
\[ I(t) \propto s(t) = \sin(\frac{\pi}{d} (t - (12-\frac{d}{2}))) \]If it has the value SinBeta the curve (G), eq. 3.2 is used:
\[ I(t) \propto sin\beta(t) = a + b\cos(2\pi \frac{t - 12}{24}) \] where parameters \(a,b\) depend on latitude and daylength. Diurnal Radiation at a timestep \(t_i\) is the radiation accumulated between the previous and actual timestep. \[ R(t_i) = \int_{t_{i-1}}^{t_i}I(t)dt \]References
(G) Goudriaan, Modeling Potential Crop Growth Processes, 1994, (revised version Nov. 2004)
- Autor:
- Gunther Krauss
Component Variables
| Content Type | Name | Description | Data Type | Unit | Min Value | Max Value | Default Value |
|---|---|---|---|---|---|---|---|
| constant | DateField | - | CHAR | - | - | ||
| constant | Latitude | - | DOUBLE | ° | - | - | 0.0 |
| constant | MaxTempField | - | CHAR | - | - | ||
| constant | MaxTempTimeOffset | - | DOUBLE | h | - | - | 1.5 |
| constant | MinTempField | - | CHAR | - | - | ||
| constant | NocturnalTimeCoefficient | - | DOUBLE | h | - | - | 4.0 |
| constant | RadiationCurve | - | CHAR | - | - | SinBeta | |
| constant | RadiationField | - | CHAR | - | - | ||
| constant | Steps | - | INT | - | - | 24 |
-
Verschachtelte Klassen - Übersicht
Von Klasse geerbte verschachtelte Klassen/Schnittstellen net.simplace.sim.io.FWSimIOAdapter
net.simplace.sim.io.FWSimIOAdapter.FREQUENCE -
Feldübersicht
Von Klasse geerbte Felder net.simplace.sim.io.resources.FWSimResourceTransformer
iFieldMap, iIntColumnMap, iLastInputValuesMap, iLastProjectID, iLastUniqueID, iPoolName, iSourceNameVon Klasse geerbte Felder net.simplace.sim.io.resources.FWSimInputAdapter
iJexlScript, iShouldCacheToDBVon Klasse geerbte Felder net.simplace.sim.io.FWSimIOAdapter
iArrayMode, iFieldcount, iFrequence, iHeaderVariables, iInterface, iJexlRule, iKeyMap, iName, iOrderNumber, iProcessTime, iResourceElement, iSession, iSourceKey -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungused for ClassForNameDiurnalSineWeatherTransformer(net.simplace.sim.FWSimSession aSession, Integer aOrderNumber) DiurnalSineWeatherTransformer(net.simplace.sim.FWSimSession aSession, org.jdom2.Element aResourceElement, Integer aOrderNumber) -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungnet.simplace.sim.io.resources.FWSimResourceCachecalculateDiurnalValues(int aSteps, double aLatitude, double aTimeOffset, double timeCoefficient, String radiationCurve, String aDateField, String aMinTempField, String aMaxTempField, String aRadiationField, String aProjectID, net.simplace.sim.io.resources.FWSimResourceCache aCache) Calculates Daylengthsnet.simplace.sim.io.resources.FWSimResourceCachegetData(net.simplace.sim.util.FWSimVarMap aVarMap) standard method from outsidenet.simplace.sim.io.resources.FWSimResourceCachegetData(net.simplace.sim.util.FWSimVarMap aVarMap, net.simplace.sim.io.resources.FWSimResourceCache aResourceCache) used by test casesprotected Object[]MergeKeysAndValues(int aKeyFieldCount, Object aKeys, DiurnalWeatherCalculator.DiurnalValues aValues) voidupdateFields(net.simplace.core.FWObservable aObservable) Von Klasse geerbte Methoden net.simplace.sim.io.resources.FWSimResourceTransformer
addVariable, createFormFields, createResourceTransformer, createResourceTransformer, createResourceTransformer, createSimTransformer, fillVarMap, getCreateFormXML, getEditFormXML, getSourceResourceCache, getVariable, isUpdated, toDocXML, toXMLVon Klasse geerbte Methoden net.simplace.sim.io.resources.FWSimInputAdapter
getContentType, getInputVariables, getJexlScript, getOutputVariables, getVarMap, isTransformer, shouldCacheToDB, toHTMLTablestringVon Klasse geerbte Methoden net.simplace.sim.io.FWSimIOAdapter
addProcessTime, checkCondition, createFormFields, finalize, getFieldMap, getFrequence, getHeaderVariables, getHeaderXML, getInterface, getJexlRule, getKeyMap, getName, getOrderNumber, isArrayMode, isConditionCheck, removeVariable, setInterface, setOrderNumber, toString, writeHeaderList
-
Konstruktordetails
-
DiurnalSineWeatherTransformer
public DiurnalSineWeatherTransformer(net.simplace.sim.FWSimSession aSession, org.jdom2.Element aResourceElement, Integer aOrderNumber) - Parameter:
aSession-aResourceElement-aOrderNumber-
-
DiurnalSineWeatherTransformer
- Parameter:
aSession-aOrderNumber-
-
DiurnalSineWeatherTransformer
public DiurnalSineWeatherTransformer()used for ClassForName
-
-
Methodendetails
-
createVariables
- Angegeben von:
createVariablesin Schnittstellenet.simplace.sim.util.FWSimFieldContainer- Setzt außer Kraft:
createVariablesin Klassenet.simplace.sim.io.FWSimIOAdapter
-
getData
public net.simplace.sim.io.resources.FWSimResourceCache getData(net.simplace.sim.util.FWSimVarMap aVarMap) throws net.simplace.sim.exceptions.MissingSimResourceException standard method from outside- Angegeben von:
getDatain Klassenet.simplace.sim.io.resources.FWSimInputAdapter- Löst aus:
net.simplace.sim.exceptions.MissingSimResourceException- Siehe auch:
-
MergeKeysAndValues
protected Object[] MergeKeysAndValues(int aKeyFieldCount, Object aKeys, DiurnalWeatherCalculator.DiurnalValues aValues) - Parameter:
aKeyFieldCount-aKeys-aValues-- Gibt zurück:
-
getData
public net.simplace.sim.io.resources.FWSimResourceCache getData(net.simplace.sim.util.FWSimVarMap aVarMap, net.simplace.sim.io.resources.FWSimResourceCache aResourceCache) throws net.simplace.sim.exceptions.MissingSimResourceException used by test cases- Parameter:
aVarMap- variable mapaResourceCache- Cached resources (soil data)- Gibt zurück:
- delivered new data from transformer
- Löst aus:
net.simplace.sim.exceptions.MissingSimResourceException
-
calculateDiurnalValues
public net.simplace.sim.io.resources.FWSimResourceCache calculateDiurnalValues(int aSteps, double aLatitude, double aTimeOffset, double timeCoefficient, String radiationCurve, String aDateField, String aMinTempField, String aMaxTempField, String aRadiationField, String aProjectID, net.simplace.sim.io.resources.FWSimResourceCache aCache) throws net.simplace.sim.exceptions.MissingSimResourceException Calculates Daylengths- Parameter:
aSteps-aLatitude-aTimeOffset-timeCoefficient-radiationCurve-aDateField-aMinTempField-aMaxTempField-aRadiationField-aProjectID- id of the projectaCache- original weather- Gibt zurück:
- the new created
FWSimResourceCache - Löst aus:
net.simplace.sim.exceptions.MissingSimResourceException
-
updateFields
public void updateFields(net.simplace.core.FWObservable aObservable) - Angegeben von:
updateFieldsin Klassenet.simplace.sim.io.resources.FWSimResourceTransformer- Siehe auch:
-