Skip to content
Snippets Groups Projects
Commit f3d058ba authored by Peter Alexander's avatar Peter Alexander
Browse files

Changes to try to allow start timestep other than 0

parent 0ad2fbd3
No related branches found
No related tags found
No related merge requests found
...@@ -19,13 +19,17 @@ public class Timestep implements Serializable { ...@@ -19,13 +19,17 @@ public class Timestep implements Serializable {
return timestep; return timestep;
} }
private static int getYear(int tstep) {
return ModelConfig.TIMESTEP_SIZE * tstep + ModelConfig.BASE_YEAR;
}
public int getYear() { public int getYear() {
return ModelConfig.TIMESTEP_SIZE * (timestep - ModelConfig.START_TIMESTEP) + ModelConfig.BASE_YEAR; return getYear(timestep);
} }
public int getYieldYear() { public int getYieldYear() {
if (isInitialTimestep()) { if (isInitialTimestep()) {
return ModelConfig.BASE_YEAR; return getYear(ModelConfig.START_TIMESTEP);
} }
else { else {
return getPreviousTimestep().getYear(); return getPreviousTimestep().getYear();
......
...@@ -167,7 +167,7 @@ public class CountryAgent extends AbstractCountryAgent { ...@@ -167,7 +167,7 @@ public class CountryAgent extends AbstractCountryAgent {
private GamsRasterInput getGamsRasterInput(RasterSet<IrrigationItem> irrigData, YieldRaster countryYieldSurfaces) { private GamsRasterInput getGamsRasterInput(RasterSet<IrrigationItem> irrigData, YieldRaster countryYieldSurfaces) {
double allowedImportChange; double allowedImportChange;
if (currentTimestep.isInitialTimestep() || (ModelConfig.IS_CALIBRATION_RUN && currentTimestep.getTimestep() <= ModelConfig.END_FIRST_STAGE_CALIBRATION)) { // initialisation time-step if (ModelConfig.IS_CALIBRATION_RUN && currentTimestep.getTimestep() <= ModelConfig.END_FIRST_STAGE_CALIBRATION) { // initialisation time-step
allowedImportChange = 0.0; allowedImportChange = 0.0;
} }
else { // normal (not the initial) time-step else { // normal (not the initial) time-step
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment