-
Notifications
You must be signed in to change notification settings - Fork 6
Added integration of new model in tutorial #185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Prepare v0.3.0 by merging dev
Ready for version v0.3.0
Merge dev for preparing release v0.4.0
Prepare 0.4.1 release
Update docs repository url
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@piluc thanks for the great tutorial! I have just some comments regarding some parts.
gettables() = copy(_tables) | ||
getranges() = copy(_ranges) | ||
``` | ||
Note that the function `gettables` is exactly the one that has been used above while updating a model with modern data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't find where the function gettables
has been previously used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function is used in the code presented within the tutorial section titled "Modifying an interpolation table".
``` | ||
Observe that if the model contains multiple systems and/or multiple subsystems, then the ODE systems returned by all the subsystems have to be composed by using the function `compose` (which also asks for the connections between the variables declared and used in different subsystems). An example of a scenario using multiple systems and subsystems is defined in the file `scenarios.jl` included in the directory `world2` within the `World` model directory. | ||
|
||
Finally, the model can be solved and simulated by using the `solve` and the `plotvariables` functions that we already used above. In particular, the file `plots.jl` (we assume that also this file is contained in the directory `nonrenewablestock`) does it in order to reproduce Figure 3.9 of the chapter of the above mentioned book. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that "above" here refers to a previous page in the documentation, so I would not say "used above".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"above" refers to a previous paragraph in the same tutorial page. "solve" has been used in the paragraph titled "Solving the ODE system", while "plotvariables" has been use in the paragraph titled "Plotting the evolution of the model".
|
||
fig_3_9(; kwargs...) = plotvariables(nrs_run_solution(), (t, 0, 200), _variables_nrs(); title="Simulation output showing stocks and flows", showaxis=false, showlegend=true, kwargs...) | ||
``` | ||
Note that, for performance reasons, the definition of the function `nrs_run_solution` starts by checking whether the solution of the model is already available: in this case, nothing is done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have issue #120 regarding a cleaner approach using closures instead of defining global variables. We can keep the current approach until that issue gets solved by a PR, but we should then remember to update the tutorial.
docs/src/tutorial.md
Outdated
|
||
``` | ||
include("Duggan/Duggan.jl") | ||
Main.Duggan.NonRenewableStock.fig_3_9() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need Main
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I know, yes. But I am not a Julia expert...
using WorldDynamics | ||
using ModelingToolkit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be a very naive question, since we are currently doing that in the models we implemented, but... do we need to re-include these two modules, which are already included in Duggan.jl
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know...
No description provided.