I was wrong when I said that the new control parameter accessor values would always be constants, like they are in most models. EPS is highly data-driven to adapt to different model regions. The initial and final times are read from CSV files. Simply copying the formula text doesn't work. We need to generate code for the RHS after all.
The attached zip file illustrates the problem with a model adapted from EPS. Here's how the initial and final times are specified.
control.zip
INITIAL TIME=
GET DIRECT CONSTANTS(
'InputData/IT.csv',
',',
'B2*'
)
~ Year
~ The initial time for the simulation.
|
FINAL TIME=
GET DIRECT CONSTANTS(
'InputData/FT.csv',
',',
'B2*'
)
~ Year
~ The final time for the simulation.
|
This results in the following invalid C code for the new control parameter accessors.
double getInitialTime() {
return GET DIRECT CONSTANTS('InputData/IT.csv',',','B2*');
}
double getFinalTime() {
return GET DIRECT CONSTANTS('InputData/FT.csv',',','B2*');
}
Is it possible to define the accessors like this? Or are they not initialized yet when the runtime needs them?
double getInitialTime() {
return _initial_time;
}
double getFinalTime() {
return _final_time;
}
double getSaveper() {
return _saveper;
}
I was wrong when I said that the new control parameter accessor values would always be constants, like they are in most models. EPS is highly data-driven to adapt to different model regions. The initial and final times are read from CSV files. Simply copying the formula text doesn't work. We need to generate code for the RHS after all.
The attached zip file illustrates the problem with a model adapted from EPS. Here's how the initial and final times are specified.
control.zip
This results in the following invalid C code for the new control parameter accessors.
Is it possible to define the accessors like this? Or are they not initialized yet when the runtime needs them?