To generate a Modelica model directly from the modeling tool


  1. Right-click the Block TestCaseCircuit::Circuit and select Tools > Export to Modelica. Please see Generating a simulation file for more information. 
  2. Now make sure the OpenModelica Connection Editor (OMEdit) is installed:
    1. For Windows: https://openmodelica.org/download/download-windows
    2. For Mac: https://openmodelica.org/download/download-mac
  3. Launch OMEdit. Go to File > Open Model/Library File(s) and select the generated Modelica file located in the directory it has been saved in. It should be called CircuitModel.mo.



  4. A CircuitModel  model will show up in the Libraries window. Double-click it. A tab called CircuitModel should open up in the main OpenModelica window. Make sure it is in text view (by selecting the ‘note’ symbol under the CircuitModel tab, as shown in the image below).



  5. Check that the model works by going to Simulation > Check Model. A Check Model pop-up box will show up and report whether the model is ready for simulation. Press OK.



  6. To setup the simulation run for the model, go to Simulation Simulation Setup. Make sure the Start Time is 0 and the Stop Time is at 60 seconds (or any other reasonable amount of time; for this model, 60 seconds should be enough). Press the Simulate button.



  7. Once the Simulate button is pressed, a pop-up window CircuitModel Simulation Output will run until the simulation results are completed (indicated by a progress bar). OpenModelica will load up the Plotting Perspective (the Perspectives tab is in the bottom-right corner of the image below), where the main window displays an empty graph and a Variable Browser shows up on the right.



  8. To see the input and output of the CircuitModel, variables from the Variable Browser must be chosen. Selecting CircuitModel _Circuit > c, i, rc, ri, s > iThru, vDrop will display the current (iThru) and voltage (vDrop) variable across each of the circuit’s 5 components: the capacitor (c), the inductor (i), the voltage source (v), and the resistors (rc, ri).