Commit bdb543e4 authored by Ronan Trepos's avatar Ronan Trepos
Browse files

Pea: fix the calculation of coef_fixmax3

parent 5d2b1d3e
......@@ -37,6 +37,7 @@
#include <vle/utils/DateTime.hpp>
#include <vle/DiscreteTime.hpp>
#include <vle/reader/table_file_reader.hpp>
#include "AzodynUtils.hpp"
namespace AZODYN {
......@@ -240,7 +241,7 @@ public:
m_table_reader.getFilePath().c_str(),
vu::DateTime::toJulianDay(begin_date).c_str()));
}
for (int toskip = int(begin_date + 1) - begin_date_file;
for (int toskip = int(begin_date) - (begin_date_file);
toskip > 0; toskip--) {
res = m_table_reader.readLine(line_read);
}
......@@ -248,16 +249,19 @@ public:
res = m_table_reader.readLine(line_read);
}
//*** compute coef_fixmax3
// *** compute coef_fixmax3
//jump to sowing
coef_fixmax3.init(this, "coef_fixmax3", events);
int current_time = int(begin_date);
int sowing_time = vu::DateTime::toJulianDayNumber(events.getString("date_S"));
for (; current_time < sowing_time; current_time++) {}
for (; current_time < sowing_time; current_time++) {
res = m_table_reader.readLine(line_read);
}
//sum temperature betwenn sowing and crop emergence
double sumT_sowing_emergence = 0;
double ST_S_LEVEE = events.getDouble("ST_S_LEVEE");
double sumT_sowing_emergence = line_read.getDouble(indexVar_TMC);
double ST_S_LEVEE = Utils::extractDouble(events, "ST_S_LEVEE");
for (; sumT_sowing_emergence < ST_S_LEVEE ; current_time++) {
res = m_table_reader.readLine(line_read);
sumT_sowing_emergence += line_read.getDouble(indexVar_TMC);
......@@ -265,16 +269,17 @@ public:
std::string date_levee = vu::DateTime::toJulianDay(current_time);
//sum temperature between crop emergence and flowering
double sumT_emergence_flowering = 0;
double sumT_emergence_flowering = line_read.getDouble(indexVar_TMC);
int flowering_time = vu::DateTime::toJulianDayNumber(events.getString("date_FLO"));
for (; current_time <= flowering_time ; current_time++) {
for (; current_time < flowering_time ; current_time++) {
res = m_table_reader.readLine(line_read);
sumT_emergence_flowering += line_read.getDouble(indexVar_TMC);
}
//regression equation
double coef_fixmax1 = events.getDouble("coef_fixmax1");
double coef_fixmax2 = events.getDouble("coef_fixmax2");
double ST_DF_DRG = events.getDouble("ST_DF_DRG");
double coef_fixmax1 = Utils::extractDouble(events, "coef_fixmax1");
double coef_fixmax2 = Utils::extractDouble(events, "coef_fixmax2");
double ST_DF_DRG = Utils::extractDouble(events, "ST_DF_DRG");
coef_fixmax3.init_value(
coef_fixmax2 - (coef_fixmax1*(sumT_emergence_flowering + ST_DF_DRG)));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment