- Index
- » Users
- » Dave
- » Profile
Posts
Posts
I am running the model:
Code:
model SMP
Real y(start=5);
Real y_dot(start=0);
Real omega_0=5.0;
Real delta=0.2;
equation
y_dot = der(y);
der(y_dot) + 2.0*delta*omega_0*der(y) + omega_0^2*y = 0;
end SMP;
The model runs and gives the results I expects, but I get the error:
Code:
"Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=initialization").
I am solving a second order ODE so I need to provide 2 initial conditions, which I believe I am doing with:
Code:
Real y(start=5);
Real y_dot(start=0);
Any reason why I am getting this error?
Never mind, I noticed that simulate(Model) should be simulate(HelloWorld), which I suppose is obvious.
Thanks for your help!
Thank you.
I understand the process, but I am getting the output:
Code:
true
""
true
""
record SimulationResult
resultFile = "",
simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Model', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
messages = "Simulation Failed. Model: Model does not exist! Please load it first before simulation.",
timeFrontend = 0.0,
timeBackend = 0.0,
timeSimCode = 0.0,
timeTemplates = 0.0,
timeCompile = 0.0,
timeSimulation = 0.0,
timeTotal = 0.0
end SimulationResult;
""
false
""
I'm interpreting this as Modelica is loaded successfully (First True) and the file Model.mo is loaded successfully (second True), but the simulation can't be run.
The content of my Model.mo file is:
Code:
model HelloWorld "A simple equation"
Real x(start=1);
parameter Real a = -1;
equation
der(x)= a*x;
end HelloWorld;
Is this correct?
Good day.
I am new to OM and would like to know what workflow to follow to build and execute models through scripting.
I use Ubuntu and my workflow in other languages is to code in Vim and then have another tab open in the terminal where I run the script. Is there a similar way in OM?
Lets say I want to run the model given in the tutorial:
Code:
model HelloWorld "A simple equation"
Real x(start=1);
parameter Real a = -1;
equation
der(x)= a*x;
end HelloWorld;
simulate(HelloWorld, stopTime = 2)
plot(x)
Can I put all this code in a file and run the script with some terminal command?
I have tried stuff like
Code:
omc file.oml
and
Code:
omshell file.oml
where the above code is stored in file.oml, to no avail.
Thank you in advance.
- Index
- » Users
- » Dave
- » Profile