2. Start/End Dates

Top  Previous  Next

Now that you learned how to execute a ModelSolution let's see how to open and modify an XML file containing a ModelSolution.

 

In this example you will learn how to open a ModelSolution XML file and modify the start and end dates for which the SIMPLACE will execute its simulations. In Eclipse, just navigate to the XML file "simplace_modules\test\training\solution\1_WorkingWithSolutions\01_FirstSolution.sol.xml":

 

clip0027

 

 

Once the file is open, it will show the model solution structure where the "startdate" and "enddate" variables controlling the start and end of simulations are declared. Note that, by convention, the XML solution files have a suffix ".sol.xml" which we use to easily identify an XML file as ModelSolution and not a SimulationProject (which should have suffix ".prj.xml").

 

 


 

 

Now let's edit our first ModelSolution following the task below.

 

 

Hints: For each task create a Class (e.g. Task2) and inside the class body create the method main(String[]args) where the filename of the ModelSolution will be specified.

 

 

Task 2.1 Change the start/end dates in the first solution (01_FirstSolution.sol.xml) so it runs from 1st-Jan-1987 until 31st-Dec-1987. Then run the Java Application which uses this solution.

 

 Hints:

  - What happened with the output file, does it exist? It can be found under simplace_modules/output/training/simple1.txt

  - Did you change variables startdate and enddate using the format dd.mm.yyyy?

  - Those variables are located between <variables>...</variables> tags

  - Don't forget to save the file after doing the modifications

 

 Solution:

  Follow this link.

 

 


 

 

Task 2.2 Change the start and end dates in the solution file(from Task 1) beyond the range of the weather data.

 Was the test successful, what about the output file?

 

 Hints:

  - Definitely you have to know for which period of time you have the weather data, open the weather data file. Its path can be found in the ModelSolution interfaces section (<filename>${_WORKDIR_}/training/data/lintul/weather1.txt</filename>).

  - Don't forget to run the RunFirstSolution.java test after changing the start or end dates.

  - Don't forget to save the file after doing the modifications

 

 Solution:

  Follow this link.

 

 

*ModelSolutions are found in simplace_modules\test\training\solution\1_WorkingWithSolutions