Here is a quick test for a first Modelica model. Open it and point at three things: the kind of component, the particular copy of that component you are simulating, and the experiment that produced the plot. If you can point at three different names, the model is in good shape. If all three are the same block of text — parameters, equations, inputs, and a stop time all living in one class — the model may compile, may even simulate, and still be very hard to do anything else with.
That single-class first model is the most common place an OMEdit session goes sideways. Not because anyone made an error the compiler can see, but because three ideas that Modelica is designed to keep separate were written as one. OMEdit First Model Hour (for OpenModelica) is a one-hour path that starts from the other end: a tiny model already split into a class, an instance, and an experiment, run along the official OMEdit menu paths, ending in a plot of a variable you can name.
Get it here: OMEdit First Model Hour (for OpenModelica)
What goes wrong when a first model is one class?
Three problems, each of which shows up later than you would like.
You cannot reuse the component. If the first-order lag, its input, and its run settings are written as one model, there is no “lag” to instantiate a second time. Want two lags in series? You copy and paste the equations, rename the variables, and now have two definitions to keep in sync. Modelica gives you classes precisely so that you never do this.
You cannot change one instance without changing the definition. In a single-class model, the gain and time constant are the class’s own parameters. Change them for one experiment and you have changed them for every future use of that model. A separate instance — FirstOrderLag plant(k=1.0, T=2.0) — lets you set values for this use without touching the kind.
You cannot say which name produced the plot. A finished run with a cloud of variables and no obvious output is a strangely common end to a first hour. When the instance has a name and the output has a name, the thing to plot is plant.y, and you know exactly what you are looking at.
There is also a fourth, more ordinary problem: a first hour spent hunting menus. OMEdit is a capable environment with a lot of panes. A first session does not need most of them. It needs a documented path from “open file” to “plot,” walked once, in order.
Why separate the kind from the copy from the test?
Because engineering learned this lesson long before Modelica existed, and every time it was learned, things got faster.
In 1785, Thomas Jefferson, then the American minister in Paris, wrote home about the gunsmith Honoré Blanc, who could assemble musket locks from bins of parts made to a common pattern. Jefferson reported picking up pieces at random and seeing them fit. The insight was not a better lock. It was the separation of the pattern from any particular lock built to it — a class, and its instances.
In 1841, Joseph Whitworth proposed a uniform system of screw threads: one specification for thread angle and pitch at each diameter, which any shop could follow. A bolt from one workshop would fit a nut from another. The specification is the class; every bolt is an instance; and nobody has to redefine a thread to make one more bolt.
In 1901, the Wright brothers built a small wind tunnel and tested dozens of model wing surfaces in it, one after another, under the same conditions. The wing shape was one thing. The test rig and its settings were another. Keeping the experiment separate from the thing being tested is what let them compare results instead of collecting anecdotes.
Class, instance, experiment. A first Modelica model that keeps those three apart is following the same discipline — and gets the same payoff: you can build the next thing without rebuilding the last one.
What is in the kit?
The zip contains a 4-page guide, two original Modelica files, a run checklist, and a README.
**NorthshoreFirstHour.mo** is a small package with two members:
FirstOrderLag, the class: a gaink, a time constantT, an inputu, an outputy, and one equation,T * der(y) = k * u - y. It describes a kind of component, not a run.StepResponse, the runnable model: one instance ofFirstOrderLagnamedplant, withk = 1.0andT = 2.0, a constant inputu = 1.0, and an experiment annotation that starts at 0 and stops at 10 seconds.
**StepResponseStandalone.mo** is the same experiment as a single runnable class, for when you want one file and one plot in the first ten minutes. Having both is deliberate. The standalone file shows you what the experiment does. The package shows you how it should be organized. Reading them side by side makes the case for the split better than any paragraph can.
**Run-checklist.md** is the official OMEdit path as a tick list, used the first time through and again when you start a model of your own.
The guide covers class versus instance versus experiment, the first-hour path in OMEdit, what a finished first hour looks like, and what to do next.
Both models were compiled and simulated to completion with omc 1.27.2 (the compiler reports v1.27.2-cmake). For each model, initialization finished successfully and the simulation finished successfully, using the dassl solver and a ten-second stop time. The current official patch, 1.27.2, was the verification target. The files are original and self-contained: they do not import the Modelica Standard Library, and the kit does not ship a copy of it — a normal OpenModelica install already loads MSL as a system library in OMEdit. Simulation result files and generated C stayed out of the zip; they are build artifacts, not something you need.
The Northshore First Hour package is fictional. “Northshore” is a made-up label for a teaching package, and the parameters are illustrative rather than a measured plant.
What does the first hour look like in OMEdit?
The menu paths below follow the official OpenModelica 1.27 OMEdit user guide.
- Install OpenModelica 1.27.2, or your current official 1.27.x, and open OMEdit.
- File → Open Model/Library File(s), and open
NorthshoreFirstHour.mo. - In the Libraries Browser, open the package
NorthshoreFirstHour. - Open
FirstOrderLagand read it. That is the kind of component. - Open
StepResponse. The component namedplantis the instance. Note the names you will plot:plant.y, and the constant inputu. - Optionally, Simulation → Instantiate Model, to see the flattened instance —
plant.k,plant.T,plant.y— before you run. - Simulation → Simulation Setup (a model must be open). Set Stop Time to 10 seconds if it is not already.
- Simulation → Simulate, or the Simulate toolbar button.
- When the run finishes, the Plotting Perspective becomes active. In the Variables browser, tick
plant.yto plot it against time.
If you opened the standalone file instead, tick y. The experiment is identical: a unit step into a first-order lag, ten seconds, y starting at zero. With a gain of 1 and a time constant of 2 seconds, the textbook first-order response climbs toward 1 and covers about 63 percent of the way in the first two seconds — which makes the plot easy to sanity-check by eye, and is precisely why a first-order lag is a good first model. It is simple enough that you can predict the answer, so you can tell when the tool is giving it to you.
Why does “Instantiate Model” earn a place in a first hour?
Because it shows you, in plain text, what the instance actually is once the class has been applied. The flattened view lists names such as plant.k, plant.T, and plant.y — the dotted names that make the class/instance split concrete. A first-time user who has seen those dotted names will never again wonder why the plot variable is called plant.y rather than y. The step is optional, and it is the most clarifying optional step in the hour.
What does a finished first hour look like?
The guide is specific, and the specificity is the point. You can point at three names: the class, the instance, and the plotted variable. You have a ten-second run that finished. You know where Stop Time is set. That is the hour.
Then comes the part that turns an exercise into a habit:
- File → New → New Modelica Class, and write a tiny class you can define in a sentence.
- Write a second model that instantiates it and that you can simulate.
- Simulate, then plot the output you care about.
- Keep the class reusable. Put the experiment — inputs, stop time, the plot you want — in the model that instantiates it.
That last rule is worth taping to the monitor. A class that knows nothing about any particular experiment can be used in all of them.
Who is this for?
Practitioners opening OMEdit for a first model, and anyone restarting a model that grew into a single class nobody wants to split. Controls engineers trying Modelica for the first time will recognize the first-order lag immediately; people coming from block-diagram tools will appreciate seeing the equation-based version of something familiar. It is also a clean way to onboard a colleague: hand them the zip and the checklist, and in an hour they have the same mental model you do.
You install OpenModelica from official OpenModelica sources. The kit ships original Modelica files, a run checklist, and a guide. It does not include the OpenModelica application, OMEdit, omc, or the Modelica Standard Library.
OpenModelica is a trademark of the Open Source Modelica Consortium (OSMC). Modelica® is a registered trademark of the Modelica Association. This is an independent set of original Modelica files, a checklist, and a guide for people who use OpenModelica and OMEdit. It is not an official OpenModelica, OSMC, or Modelica Association product.
Three names and a plot
You are not paying for a tour of every OMEdit pane. You are paying for a first model already split into a class, an instance, and an experiment; a standalone file for when you want one plot in ten minutes; a checklist that follows the official menu paths; and a guide that names the three things a first model usually mixes. Both models have already been compiled and simulated to completion with omc 1.27.2, so your first hour is spent learning the structure, not debugging the example.
Get OMEdit First Model Hour (for OpenModelica): OMEdit First Model Hour (for OpenModelica)
It will be listed on our Tools for OpenModelica page (Tools for OpenModelica) alongside the rest of the tools in that line. You can browse every Organa Obscura tool on the Products page.
Leave a Reply