- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » World3 Model in OM and first steps
World3 Model in OM and first steps
World3 Model in OM and first steps
Hello Community,
I am very new to programming and to the OM software.
My "simple" goal is to run an existing World3 System Dynamics Model. To be precise, this file:
https://www.modelica.org/libraries/Syst … leases/2.0
How do I integrate it into the software?
I also have problems getting started with OM. I downloaded the newest version of OM, but I am not even able to start the software. There are different folders in the extracted package, but no application starts the software. When I start "OMC" nothing happens apart from the "black DOS input window" appearing for 2 seconds.
Can anybody help me?
Thank you very much!
Best regards, Chris
Re: World3 Model in OM and first steps
It sounds like you are using Windows. Doesn't the application install the OMShell shortcut? Anyway, the model seems to run, but I guess there is some problem with initialization because the following commands gave a life expectancy of 0.0 for all values.
Code:
loadModel(Modelica);
loadFile("SystemDynamics.mo");
getClassNamesRecursive(SystemDynamics);
res:=simulate(SystemDynamics.WorldDynamics.World3.Life_Expectancy,
startTime=1900,stopTime=2200,outputFormat="mat");
s:=res.resultFile;
readSimulationResultVars(s);getErrorString();
1900;val(life_expectancy,1900);getErrorString();
1950;val(life_expectancy,1950);getErrorString();
1990;val(population,1990);getErrorString();
2000;val(life_expectancy,2000);getErrorString();
2010;val(life_expectancy,2010);getErrorString();
- sjoelund.se
- 1700 Posts
Re: World3 Model in OM and first steps
Hm, it seems like Visual Studio 2010 runtime is missing from your computer. Try to install it from this link:
http://www.microsoft.com/downloads/en/d … bf0912db84
I'll try to include the required dlls in the next build.
Question: what system are you on? Windows Xp, 7?
Cheers,
Adrian Pop/
- adrpo
- 885 Posts
Re: World3 Model in OM and first steps
Thank you very much.
Problem is fixed and I am ready to use OM.
I am using Windows XP.
I am able to load the model and to simulate it.
It says:
>> simulate(SystemDynamics)
record SimulationResult
resultFile = "SystemDynamics_res.plt",
simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'SystemDynamics', storeInTemp = false, noClean = false, options = '', outputFormat = 'plt'",
messages = "",
timeFrontend = 0.0728983711616979,
timeBackend = 0.000237180982499172,
timeSimCode = 0.000157841289884608,
timeTemplates = 0.00322052104387569,
timeCompile = 1.52449515231684,
timeSimulation = 0.176943158976909,
timeTotal = 1.77801089244583
end SimulationResult;
How do I plot results? How could I change parameters?
Sorry I am very new. My aim is to plot some graphs with the model and to change some parameters if possible. I do not need to understand the model in detail.
As the author of the model only gives instructions for Dymola, I am confused.
Does anyone have experience with the World3 Model? My aim is to rebuilt and to understand the methods described in "The Limits to Growth - The 30 year Update" by the Club of Rome.
http://www.sustainer.org/pubs/limitstogrowth.pdf
Thanks a lot in advance!
Re: World3 Model in OM and first steps
Hi,
I'm glad you fixed the issue.
You can use OMEdit to simulate/plot.
Otherwise in OMShell you use plot({x, y}).
See more in User's Manual in OpenModelica documentation.
Cheers,
Adrian Pop/
- adrpo
- 885 Posts
Re: World3 Model in OM and first steps
Cheers!
The OMEdit looks very handy.
I loaded my model in there and I am able to see the source code and the different functions of the model.
According to my instructions the next steps would be:
• Run Dymola
• Run File/Clear All.
• Run File/Libraries/Modelica Standard Library.
• Open the SystemDynamics.mo file from within Dymola
• run File/Export HTML to generate the documentation for the System Dynamics library - this generates a new subdirectory of SystemDynamics called help
• run File/Save All to store the documentation.
This accounts for Dymola. How would I do this with OM?
Could anyone try to run the model or could try to plot some graphs?
My final aim is to run the model and to have the option to change some parameters (like population growth etc.).
As before, Thanks a lot for your help. I really appreciate it!
Re: World3 Model in OM and first steps
Hi,
You can load your model in OMEdit and plot some graphs.
- Start OMEdit.
- Open the SystemDynamics.mo file from OMEdit
- Go to SImulation->Simulate and then simulate your model.
- You will get the plot variables list on the RHS after the simulation is finished.
- Select/check the variable that you want to plot.
Adeel.
- adeas
- 454 Posts
Re: World3 Model in OM and first steps
Yes that is how I wanted to do it.
Unfortunately I am unable to run the scenarios of the World3 Model.
The option "check" shows:
[C:/Dokumente und Einstellungen/Christopher/Desktop/Diplomarbeit LEE/W3 Model/SystemDynamics/SystemDynamics.mo:441:5-463:43:writable] Error: Class Modelica.Blocks.Interfaces.RealSignal not found in scope SystemDynamics.Interfaces.MassOutPort.
Error: Error occured while flattening model SystemDynamics.WorldDynamics.World3.Scenario_1
Do you have any idea how to fix this?
Re: World3 Model in OM and first steps
Oh yea, I forgot to mention it uses MSL 2.2. OMEdit uses MSL 3.1 by default, which is not compatible.
- sjoelund.se
- 1700 Posts
Re: World3 Model in OM and first steps
Well, the current OMC kernel handles it just fine. For example, if you use OMShell, you can use (modify for Windows paths; these are Mac ones):
Code:
setEnvironmentVar("OPENMODELICALIBRARY","/opt/openmodelica/lib/omlibrary/msl221");
loadModel(Modelica);
You can fool OMEdit into using MSL 2.2 by settings the same env.var:
Code:
OPENMODELICALIBRARY=/opt/openmodelica/lib/omlibrary/msl221 open -a /Applications/MacPorts/OMEdit.app
But OMEdit doesn't handle Modelica2 annotations, and crashes (because it fails at sanitizing returned data).
- sjoelund.se
- 1700 Posts
Re: World3 Model in OM and first steps
OMEdit has never handled MSL 2.2, so older versions of OM would not help. I'd suggest using OMShell instead of OMEdit.
- sjoelund.se
- 1700 Posts
Re: World3 Model in OM and first steps
Hi: I am also interested in this model. I have tried a few installs of OpenModelica and had bad luck. The closest I got was an XP x64 install where OMEdit complains about SystemDynamics.mo not being coded in "UTF8" (or something) and throws errors, and apparently stops loading the .mo file. This is an older thread, so maybe OM 1.8 lost the ability to read this library/file? I'm hoping someone can help me get going with this - I really need to get some results soon. If I try a Windows 7 install of OM 1.8, then opening this file, I get a crash.
Thank You!!!!
Patricia
Re: World3 Model in OM and first steps
Note that files that are not encoded in UTF-8 are not valid Modelica files. But OM provides workarounds.
See http://build.openmodelica.org/Documenta … Model.html
- sjoelund.se
- 1700 Posts
Re: World3 Model in OM and first steps
Thank you! I'll take a look. I am not sure where the problem lies, that's just an error I remember seeing in OMEdit when I tried to load. With Windows 7 OMEdit simply crashed...
Is it best to use the latest OpenModelica version? Best to use WinXP x32?
Re: World3 Model in OM and first steps
Hello,
I also have a problem to get started with the World3 model in OMEdit 1.9.0.
- I downloaded it from https://api.github.com/repos/modelica-3 … ball/v2.0.
- Then I renamed the package.mo into SystemDynamics.mo.
- I opened the SystemDynamics.mo and stored it in the UTF8 format with OMEdit.
The tree structure appears in a window "Modelica Files". However, I can neither plot the flow-charts (only a circle everywhere) nor can I simulate ("Interfaces.RealSignal missing" or "Cannot instantiate SystemDynamics.WorldDynamics due to restriction PACKAGE".
The same issues occur when I follow the steps in the shell described in this block. I use Windows 7.
Could somebody give me a hint how to open the package and simulate a scenario?
Would be great!
.
Re: World3 Model in OM and first steps
Sure. You have a few choices:
* Use OMShell instead of OMEdit (OMEdit does not support MSL 2.2)
* Convert SystemDynamics to MSL 3.x
* Try an unofficial version of SystemDynamics already converted to MSL 3: http://blog.wolfram.com/data/uploads/20 … cs-2.1.zip
- sjoelund.se
- 1700 Posts
Re: World3 Model in OM and first steps
Hi Folks,
I'm attempting to learn OpenModelica with SystemDynamics.mo 's World3 model. This is the SystemDynamics.mo that is said to be ready for MSL3, http://blog.wolfram.com/data/uploads/20 … cs-2.1.zip
I have opened it with OMEdit in OM 1.9.1+dev (r21495) .
While I can manually instantiate the world3 model via the 'simulate' pull-down menu, when I attempt to simulate, I get an error message stating that instantiation failed due to PACKAGE:
[:0:0-0:0] Error: Cannot instantiate SystemDynamics.WorldDynamics.World3 due to class specialization PACKAGE.
This is on a BioLinux7|Ubuntu|Debian system.
Clicking on Scenario 9 (&1,2,3...) opens a model with a flow chart. I'm not sure how to produce output graphs, though. I've simulated scenario 9, and gotten some output, but no graphs. (Still learning here).
Is MSL3 = Modelica Scripting Language 3?
Curiously,
Brian
Re: World3 Model in OM and first steps
MSL3 = Modelica Standard Library 3.x
https://test.openmodelica.org/libraries … rsive.html contains a list of classes that are ready to be simulated. To get graphs, click on the signals to select the signals you want to plot. Probably the most interesting variables are the state variables: https://test.openmodelica.org/libraries … ario_9.err
- sjoelund.se
- 1700 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » World3 Model in OM and first steps