Skip to content
Snippets Groups Projects

Main

Merged Tor-Einar Skog requested to merge main into release
1 file
+ 55
7
Compare changes
  • Side-by-side
  • Inline
@@ -755,7 +755,25 @@ public class RoughageNutritionModelImpl implements CostFunction {
return wUtil.normalizeToExactDate(cal.getTime(), timeZone);
}
/**
* @return
* @throws ModelExcecutionException
*/
private Date getSyvendeApril() throws ModelExcecutionException
{
// Calculating start and end date of weather data retrieval
// Start is April 1st
Calendar cal = Calendar.getInstance(timeZone);
cal.setTime(this.getVekstStart());
cal.set(Calendar.MONTH, Calendar.APRIL);
cal.set(Calendar.DATE, 7);
WeatherUtil wUtil = new WeatherUtil();
return wUtil.normalizeToExactDate(cal.getTime(), timeZone);
}
/**
* Løper gjennom eksisterende klimadatasett og beregner utvikling
* (MSC_BEREGNET) Dette trenger man bare å gjøre en gang pr. modellberegning
@@ -779,16 +797,46 @@ public class RoughageNutritionModelImpl implements CostFunction {
//Setter Ts1
// At første april (og ikke f.eks. vekststart) er grense her, er pr. 2023-09 til vurdering av Anne Kjersti Bakken
if (temperatur.getTimeMeasured().compareTo(this.getForsteApril()) >= 0)
// Endret fra mars 2024 etter innspill fra Anne Kjersti Bakken:
// Dersom vekststart er før 7 april akkumuleres temperatursum fra vekststart
// Dersom vekstart er 7 april eller senere, akkumuleres temperatursum fra 1 april
// Dvs at
// if (temperatur.getTimeMeasured().compareTo(this.getForsteApril()) >= 0)
// {
// if (firstTemperaturSum) {
// this.AIBakgrunnsdataMatrise.setParamDoubleValueForDate(temperatur.getTimeMeasured(), AIDataMatrix.TS1, temperatur.getValue());
// firstTemperaturSum = false;
// } else {
// this.AIBakgrunnsdataMatrise.setParamDoubleValueForDate(temperatur.getTimeMeasured(), AIDataMatrix.TS1, temperatur.getValue() + this.AIBakgrunnsdataMatrise.getParamDoubleValueForDate(forrigeDato, AIDataMatrix.TS1));
// }
// }
// fra mars 2024 er byttet ut med
if (this.getVekstStart().compareTo(this.getSyvendeApril()) >= 0 )
{
if (firstTemperaturSum) {
this.AIBakgrunnsdataMatrise.setParamDoubleValueForDate(temperatur.getTimeMeasured(), AIDataMatrix.TS1, temperatur.getValue());
firstTemperaturSum = false;
} else {
this.AIBakgrunnsdataMatrise.setParamDoubleValueForDate(temperatur.getTimeMeasured(), AIDataMatrix.TS1, temperatur.getValue() + this.AIBakgrunnsdataMatrise.getParamDoubleValueForDate(forrigeDato, AIDataMatrix.TS1));
if (temperatur.getTimeMeasured().compareTo(this.getForsteApril()) >= 0)
{
if (firstTemperaturSum) {
this.AIBakgrunnsdataMatrise.setParamDoubleValueForDate(temperatur.getTimeMeasured(), AIDataMatrix.TS1, temperatur.getValue());
firstTemperaturSum = false;
} else {
this.AIBakgrunnsdataMatrise.setParamDoubleValueForDate(temperatur.getTimeMeasured(), AIDataMatrix.TS1, temperatur.getValue() + this.AIBakgrunnsdataMatrise.getParamDoubleValueForDate(forrigeDato, AIDataMatrix.TS1));
}
}
}
else
{
if (temperatur.getTimeMeasured().compareTo(this.getVekstStart()) >= 0)
{
if (firstTemperaturSum) {
this.AIBakgrunnsdataMatrise.setParamDoubleValueForDate(temperatur.getTimeMeasured(), AIDataMatrix.TS1, temperatur.getValue());
firstTemperaturSum = false;
} else {
this.AIBakgrunnsdataMatrise.setParamDoubleValueForDate(temperatur.getTimeMeasured(), AIDataMatrix.TS1, temperatur.getValue() + this.AIBakgrunnsdataMatrise.getParamDoubleValueForDate(forrigeDato, AIDataMatrix.TS1));
}
}
}
// Beregner DVR
double DVR;
if (temperatur.getTimeMeasured().compareTo(this.getVekstStart()) >= 0 && this.AIBakgrunnsdataMatrise.getParamDoubleValueForDate(temperatur.getTimeMeasured(), AIDataMatrix.TS1) > 150) {
Loading