Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
scrollbar |
---|
Before we start running the model, we need to configure the model times. This can by done by adding the following line :
Code Block | ||||
---|---|---|---|---|
| ||||
SetModelTimes(fmModel, datetime(2014,1,1startTime, 12,0,0)endTime, datetime(2014,1,8, 12,0,0), time(12,0,0,time(0,20,0)) |
This sets the model start time, end time and timestep time-step to the times used in our timeseriestime series.
Now, we can run the model by adding using the runmodel RunModel statement :
Code Block | ||||
---|---|---|---|---|
| ||||
RunModel(fmModel, showDialog = True) |
This will run the whole model from start to end time time, so this can what may take some time.
There is also an An alternative way to run a your model , like this :can be used by decomposing the run action into its different steps.
Code Block | ||
---|---|---|
| ||
numberOfTimeSteps = int((fmModel.StopTime - fmModel.StartTime).TotalSeconds / fmModel.TimeStep.TotalSeconds) fmModel.Initialize() for i in range(numberOfTimeSteps): fmModel.Execute() fmModel.Finish() fmModel.Cleanup() |
Here In this manner, you can control the run by calling the model run functions yourself , and maybe add your own logic for every timestepand, if you want, add some additional script code to be run at every time step.
scrollbar |
---|