Title here
Summary here
Our first program will print the classic “hello world” message. Here’s the full source code.
model HelloWorld
annotation (experiment(StopTime=1));
equation
when initial() then
Modelica.Utilities.Streams.print("hello world");
end when;
end HelloWorld;
To run the program, compile the .mo
file using a Modelica tool like OpenModelica and then simulate it.
$ omc HelloWorld.mo
$ omsimulator --suppressPath=HelloWorld HelloWorld.mo
Once built, we can simulate the compiled Modelica model and see the output.
$ omc --simulate HelloWorld.mo
hello world
Now that we can run and build basic Modelica programs, let’s learn more about the language.