net.simplace.client.simulation.lap.transformer.DayLengthTransformer

Calculates the Daylengths for a given latitude.

Inputs and Outputs

Takes Latitude in degrees as input

Outputs

Formulas

Sine and cosine of latitude, maximal declination.

\[ \begin{eqnarray} rad &=& \frac{\pi}{180}\\ sinlat &=& \sin(rad \cdot latitutde)\\ coslat &=& \cos(rad \cdot latitutde)\\ sindcm &=& \sin(rad \cdot 23.45) \end{eqnarray} \]

Sine and cosine of declination of the sun as function of day of year. Calculation is taken from (G). Some models first calculate \(dec\) as the arcsine of \(sindec\) and then take the sine and cosine. The methods are mathematically equivalent due to \(sin^2+cos^2=1\)

\[ \begin{eqnarray} sindec &=& -sindcm \cos(2 \pi \frac{doy+10}{365})\\ cosdec &=& \sqrt{1-sindec^2}\\ sinld &=& sinlat \cdot sindec\\ cosld &=& coslat \cdot cosdec \end{eqnarray} \]

Daylength calculation.

\[ \begin{eqnarray} arg &=& \min(1,\max(-1,\frac{sinld}{cosld}))\\ daylength &=& 12 (1 + \frac{2}{\pi} \arcsin(arg))\\ \end{eqnarray} \]

Notice

The transformer generates a resource, without transforming an existing one.

References

(G) Goudriaan, Modeling Potential Crop Growth Processes, 1994, (revised version Nov. 2004)




public class DayLengthTransformer extends
net.simplace.simulation.io.resources.FWSimResourceTransformer {
// Public Constructors
public DayLengthTransformer(FWSimSession aSession, Element aResourceElement,
Integer aOrderNumber);
public DayLengthTransformer(FWSimSession aSession, Integer aOrderNumber);


// Public Instance Methods
public HashMap createVariables(); // Defines
net.simplace.simulation.io.FWSimIOAdapter


public FWSimResourceCache getData(FWSimVarMap aVarMap)
throws MissingSimResourceException; // Defines
net.simplace.simulation.io.resources.FWSimInputAdapter


standard method from outside
public FWSimResourceCache getData(FWSimVarMap aVarMap, FWSimResourceCache
aResourceCache) throws MissingSimResourceException;

used by test cases
returns delivered new data from transformer
public void updateFields(FWObservable aObservable);
// Defines
net.simplace.simulation.io.resources.FWSimResourceTransformer




}



Hierarchy: java.lang.Object - net.simplace.simulation.io.FWSimIOAdapter (net.simplace.simulation.util.FWSimFieldContainer) - net.simplace.simulation.io.resources.FWSimInputAdapter - net.simplace.simulation.io.resources.FWSimResourceTransformer - DayLengthTransformer