To generate a Modelica model directly from the modeling tool 


  1. Right-click the Block Data::ConnectedTanks 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
  1. Launch OMEdit. Go to File > Open Model/Library File(s). Select the generated Modelica file located in the directory it has been saved in. It should be called ConnectedTanksModel.mo.



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



  3. 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



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



  5. Once the Simulate button is pressed, a pop-up window ConnectedTanksModel 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.



  6. To see the input and output of the ConntectedTanksModel, variables from the Variable Browser must be chosen. Selecting ConnectedTanksModel > _ConnectedTanks > fluidReservoir1 > fluidLevel will display the first tank’s changing fluid level on the plotting window. Selecting ConnectedTanksModel > _ConnectedTanks > fluidReservoir2 > fluidLevel will display the second tank’s changing fluid level on the plotting window.