Skip to content
Snippets Groups Projects
Commit c689b06d authored by Tiziano Munaro's avatar Tiziano Munaro
Browse files

Rename and refactor the co-simulation models

parent 1e335fa8
No related branches found
No related tags found
1 merge request!36[4031] Add inverted pendulum co-simulation example
Showing with 67 additions and 174 deletions
af3_faq.html 851f9881df0a7d2093c05bd73aa4e0e404e592db GREEN
example_co-simulation.html 1c68463b840b76646b218b1549291a24d22165b3 RED
example_co-simulation.html 564528153380823004891f8f3f4032550eb1a8a8 RED
furtherResources.MainPage.html 1d38b2ed28f00c8abed17a5c3aca6316341163f1 GREEN
getting_started.html d2cec69b06162d9b63687b4b8e9cadedabe168a7 GREEN
managing_projects.html f112b5b7db98bd373b870c343ba708e7b9c90aee GREEN
......
......@@ -12,19 +12,22 @@
<div class="box">
<button onclick="topFunction()" id="upBtn" title="Go to top">Top</button>
<h1>FMI-based Co-Simulation with OpenModelica and Overture</h1>
<h1>
FMI-based Co-Simulation</br>
with AutoFOCUS3, OpenModelica and Overture
</h1>
The following example illustrates the co-simulation capabilities of AutoFOCUS 3 and shows how this feature can be leveraged for tool-interoperability.
To highlight the potential of the Functional Mock-up Interface (FMI) standard, the following example considers a controlled inverted pendulum.
On the one hand, both the pendulum's dynamics and the PID controller are modeled using OpenModelica - a tool dedicated to the development of continuous systems.
The input and environment models, on the other hand, have been developed in AutoFOCUS 3 and Overture respectively - both representing models with a discrete notion of time.
<h2>Setup</h2>
<h3>AutoFOCUS 3</h3>
<ol>
<li>Download the following AutoFOCUS 3 model: <a href="./gettingStarted/dat/af3_pulse-generator.af3_23">Input Model</a></li>
<li>Download the following AutoFOCUS 3 model: <a href="./gettingStarted/dat/af3_input.af3_23">Input Model</a></li>
<li>Import the project: <b>'File &rarr; Import AF3-Project'</b></li>
</ol>
......@@ -32,7 +35,8 @@
<ol>
<li><a href="http://overturetool.org/download/">Download</a>, unzip and launch Overture</li>
<li>Download the following Overture project: <a href="./gettingStarted/dat/overture_noise-generator.zip">Environment Model</a></li>
<li>Install the FMI exporter for Overture following these instructions: <a href="https://into-cps-association.github.io/constituent-model-development/overture/fmi-support.html">FMI support for Overture</a></li>
<li>Download the following Overture project: <a href="./gettingStarted/dat/overture_environment.zip">Environment Model</a></li>
<li>Unzip the archive.</li>
<li>Import the project: <b>'File &rarr; Import... &rarr; General &rarr; Existing Projects into Workspace'</b></li>
</ol>
......@@ -41,8 +45,7 @@
<ol>
<li><a href="https://openmodelica.org/">Download</a></td> and install OpenModelica</li>
<li>Install the FMI exporter for Overture following these instructions: <a href="https://into-cps-association.github.io/constituent-model-development/overture/fmi-support.html">FMI support for Overture</a></li>
<li>Download the following OpenModelica model: <a href="./gettingStarted/dat/openmodelica_inverted-pendulum.mo">System &amp; Controller Models</a></li>
<li>Download the following OpenModelica model: <a href="./gettingStarted/dat/openmodelica_system.mo">System &amp; Controller Model</a></li>
<li>Import the project: <b>'File &rarr; Open Model/Library Files(s)'</b></li>
</ol>
......@@ -87,10 +90,26 @@
<ol>
<li><b>'[Name of the OMSimulator Model] &rarr; [Name of the root component] &rarr; System &rarr; angle'</b></li>
<li><b>'[Name of the OMSimulator Model] &rarr; [Name of the root component] &rarr; System &rarr; setpoint'</b></li>
<li><b>'[Name of the OMSimulator Model] &rarr; [Name of the root component] &rarr; System &rarr; acceleration'</b></li>
<li><b>'[Name of the OMSimulator Model] &rarr; [Name of the root component] &rarr; System &rarr; disturbance'</b></li>
</ol>
</li>
</ol>
<p>With everything working correctly the following plots should be visible:</p>
<center>
<img src="./gettingStarted/img/inverted-pendulum_setpoint-and-angle.png" alt="Setpoint and actual angle" style="width: 75%;" />
<p>The setpoint and the pendulums angle.</p>
<img src="./gettingStarted/img/inverted-pendulum_acceleration.png" alt="Acceleration" style="width: 75%;" />
<p>The acceleration to stabilize the pendulum.</p>
<img src="./gettingStarted/img/inverted-pendulum_disturbance.png" alt="Disturbance" style="width: 75%;" />
<p>The disturbance applied to the pendulum.</p>
</center>
</div>
<script src="../layout/jsscript/topBtn.js"></script>
......
model tutorial_system
model openmodelica_system
Modelica.Blocks.Continuous.StateSpace plant(A = [0, 1; 9, 0], B = [0, 0; 9 / 10, 1], C = [1, 0], D = [0, 0], initType = Modelica.Blocks.Types.Init.InitialState, x_start = {0, 0}, y_start = {0}) annotation(
Placement(visible = true, transformation(origin = {30, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Continuous.LimPID controller(Td = 0.5, Ti = 0.5,controllerType = Modelica.Blocks.Types.SimpleController.PID, homotopyType = Modelica.Blocks.Types.LimiterHomotopy.Linear, initType = Modelica.Blocks.Types.InitPID.SteadyState, k = 50, limitsAtInit = true, wd = 1, withFeedForward = false, wp = 1, xd_start = 0, xi_start = 0, yMax = Modelica.Constants.inf, y_start = 0) annotation(
......@@ -26,4 +26,4 @@ equation
Line(points = {{-110, 20}, {0, 20}, {0, 0}, {18, 0}, {18, 0}}, color = {0, 0, 127}));
annotation(
uses(Modelica(version = "3.2.3")));
end tutorial_system;
end openmodelica_system;
File added
File deleted
org.fortiss.af3.rcp.help/html/gettingStarted/img/inverted-pendulum_acceleration.png

22.4 KiB

org.fortiss.af3.rcp.help/html/gettingStarted/img/inverted-pendulum_disturbance.png

18.8 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment