diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..038d250455c6e8feab29cbf1f9f2217392b419be Binary files /dev/null and b/.DS_Store differ diff --git a/exercises/Debugging.pdf b/exercises/Debugging.pdf new file mode 100644 index 0000000000000000000000000000000000000000..752dabed240ed73ffe10672b408577a46bc4fb4d Binary files /dev/null and b/exercises/Debugging.pdf differ diff --git a/exercises/DynamicOptimization.mo b/exercises/DynamicOptimization.mo new file mode 100644 index 0000000000000000000000000000000000000000..83b4a7b29dc559a3e135d5ad13dfeb9be618475b --- /dev/null +++ b/exercises/DynamicOptimization.mo @@ -0,0 +1,289 @@ +package DynamicOptimization " + Dynamic Optimization with OpenModelica + 11th International Modelica Conference 2015 + + V. Ruge, W. Braun and B. Bachmann +" + package ObjectFunction + model MinimizeFinal + Modelica.Blocks.Interfaces.RealInput u annotation(Placement(visible = true, transformation(origin = {-120, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-120, -6.66661}, extent = {{-20, -13.3334}, {20, 26.6666}}, rotation = 0))); + parameter Real gain(start = 1); + protected + Real signal = gain * u annotation(isMayer = true); + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {-50, 43.6364}, extent = {{-50, 16.3636}, {150, -63.6364}}, lineColor = {0, 0, 0}, textString = "minimize signal"), Text(origin = {-50, 3.6364}, extent = {{-50, 16.3636}, {150, -63.6364}}, lineColor = {0, 0, 0}, textString = "at the end time point"), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})}), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {-50, 43.6364}, extent = {{-50, 16.3636}, {150, -63.6364}}, lineColor = {0, 0, 0}, textString = "minimize signal"), Text(origin = {-50, 3.63638}, extent = {{-50, 16.3636}, {150, -63.6364}}, lineColor = {0, 0, 0}, textString = "at the end time point"), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})})); + end MinimizeFinal; + + model MaximizeFinal + Modelica.Blocks.Interfaces.RealInput u annotation(Placement(visible = true, transformation(origin = {-120, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-120, -6.66661}, extent = {{-20, -13.3334}, {20, 26.6666}}, rotation = 0))); + parameter Real gain(start = 1); + protected + Real signal = -gain * u annotation(isMayer = true); + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {-50, 43.6364}, extent = {{-50, 16.3636}, {150, -63.6364}}, textString = "maximize signal"), Text(origin = {-50, 3.6364}, extent = {{-50, 16.3636}, {150, -63.6364}}, textString = "at the end time point"), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})}), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {-50, 43.6364}, extent = {{-50, 16.3636}, {150, -63.6364}}, textString = "maximize signal"), Text(origin = {-50, 3.63638}, extent = {{-50, 16.3636}, {150, -63.6364}}, textString = "at the end time point"), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})})); + end MaximizeFinal; + + model Maximize + Modelica.Blocks.Interfaces.RealInput u annotation(Placement(visible = true, transformation(origin = {-120, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-120, -6.6666}, extent = {{-20, -13.3334}, {20, 26.6666}}, rotation = 0))); + parameter Real gain(start = 1); + protected + Real signal = -gain * u annotation(isLagrange = true); + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {-50, 3.6364}, extent = {{-50, 16.3636}, {150, -63.6364}}, textString = "over the time"), Text(origin = {-50, 43.6364}, extent = {{-50, 16.3636}, {150, -63.6364}}, textString = "maximize signal"), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})}), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {-50, 43.6364}, extent = {{-50, 16.3636}, {150, -63.6364}}, textString = "maximize signal"), Text(origin = {-50, 3.6364}, extent = {{-50, 16.3636}, {150, -63.6364}}, textString = "over the time"), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})})); + end Maximize; + + model Minimize + Modelica.Blocks.Interfaces.RealInput u annotation(Placement(visible = true, transformation(origin = {-120, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-120, -6.66661}, extent = {{-20, -13.3334}, {20, 26.6666}}, rotation = 0))); + parameter Real gain(start = 1); + protected + Real signal = gain * u annotation(isLagrange = true); + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {-50, 3.6364}, extent = {{-50, 16.3636}, {150, -63.6364}}, textString = "over the time"), Text(origin = {-50, 43.6364}, extent = {{-50, 16.3636}, {150, -63.6364}}, textString = "minimize signal"), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})}), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {-50, 43.6364}, extent = {{-50, 16.3636}, {150, -63.6364}}, textString = "minimize signal"), Text(origin = {-50, 3.63641}, extent = {{-50, 16.3636}, {150, -63.6364}}, textString = "over the time"), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})})); + end Minimize; + + model MinimizeDifference + parameter Real gain(start = 1); + Modelica.Blocks.Interfaces.RealInput u annotation(Placement(visible = true, transformation(origin = {-120, 80}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-120, -20}, extent = {{-20, -80}, {20, -40}}, rotation = 0))); + Modelica.Blocks.Interfaces.RealInput u1 annotation(Placement(visible = true, transformation(origin = {-120, -80}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-120, 80}, extent = {{-20, -20}, {20, 20}}, rotation = 0))); + protected + Real signal = gain * (u - u1) ^ 2 annotation(isLagrange = true); + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {-50, 43.6364}, extent = {{-50, 16.3636}, {150, -63.6364}}, textString = "minimize difference"), Text(origin = {-50, 3.6364}, extent = {{-50, 16.3636}, {150, -63.6364}}, textString = "over the time"), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})}), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {-50, 43.6364}, extent = {{-50, 16.3636}, {150, -63.6364}}, textString = "minimize difference"), Text(origin = {-50, 3.63642}, extent = {{-50, 16.3636}, {150, -63.6364}}, textString = "over the time"), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})})); + end MinimizeDifference; + + model MinimizeDifferenceFinal + parameter Real gain(start = 1); + Modelica.Blocks.Interfaces.RealInput u annotation(Placement(visible = true, transformation(origin = {-117, 81}, extent = {{-17, -17}, {17, 17}}, rotation = 0), iconTransformation(origin = {-120, -20}, extent = {{-20, -80}, {20, -40}}, rotation = 0))); + Modelica.Blocks.Interfaces.RealInput u1 annotation(Placement(visible = true, transformation(origin = {-118, -60}, extent = {{-17, -17}, {17, 17}}, rotation = 0), iconTransformation(origin = {-120, 80}, extent = {{-20, -20}, {20, 20}}, rotation = 0))); + protected + Real signal = gain * (u - u1) ^ 2 annotation(isMayer = true); + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {-50, 3.6364}, extent = {{-50, 16.3636}, {150, -63.6364}}, textString = "at the end time"), Text(origin = {-50, 43.6364}, extent = {{-50, 16.3636}, {150, -63.6364}}, textString = "minimize difference"), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})}), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {-50, 43.6364}, extent = {{-50, 16.3636}, {150, -63.6364}}, textString = "minimize difference"), Text(origin = {-50, 3.63641}, extent = {{-50, 16.3636}, {150, -63.6364}}, textString = "at the end time"), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})})); + end MinimizeDifferenceFinal; + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2}))); + end ObjectFunction; + + package Constraints + model Band + parameter Real MaxValue(start = 1e120); + parameter Real MinValue(start = -1e120); + parameter Real gain(start = 1); + Modelica.Blocks.Interfaces.RealInput u annotation(Placement(visible = true, transformation(origin = {-120, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-120, 5.71421}, extent = {{-20, -25.7142}, {20, 14.2858}}, rotation = 0))); + protected + Real con(min = MinValue, max = MaxValue) = gain * u annotation(isConstraint = true); + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {0, 0}, extent = {{-100, 40}, {100, -40}}, textString = "u_min <= u(t) <= u_max"), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})}), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {0, 0}, extent = {{-100, 40}, {100, -40}}, textString = "u_min <= u(t) <= u_max"), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})})); + end Band; + + model BandFinal + parameter Real MaxValue(start = 1e120); + parameter Real MinValue(start = -1e120); + parameter Real gain(start = 1); + Modelica.Blocks.Interfaces.RealInput u annotation(Placement(visible = true, transformation(origin = {-120, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-120, 5.71421}, extent = {{-20, -25.7142}, {20, 14.2858}}, rotation = 0))); + protected + Real con(min = MinValue, max = MaxValue) = gain * u annotation(isFinalConstraint = true); + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {0, 0}, extent = {{-100, 40}, {100, -40}}, textString = "u_min <= u(stopTime) <= u_max"), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})}), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {0, 0}, extent = {{-100, 40}, {100, -40}}, textString = "u_min <= u(stopTime) <= u_max"), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})})); + end BandFinal; + + model GreaterEqual + parameter Real gain(start = 1, min = 0); + Modelica.Blocks.Interfaces.RealInput u annotation(Placement(visible = true, transformation(origin = {-120, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-120, 5.71421}, extent = {{-20, -25.7142}, {20, 14.2858}}, rotation = 0))); + Modelica.Blocks.Interfaces.RealInput u1 annotation(Placement(visible = true, transformation(origin = {120, -1.77636e-15}, extent = {{-20, -20}, {20, 20}}, rotation = 180), iconTransformation(origin = {120, 0}, extent = {{20, -20}, {-20, 20}}, rotation = 0))); + protected + Real con(max = 0) = gain * (u - u1) annotation(isConstraint = true); + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {0, 0}, extent = {{-100, 40}, {100, -40}}, textString = " <= "), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})}), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {0, 0}, extent = {{-100, 40}, {100, -40}}, textString = " <= "), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})})); + end GreaterEqual; + + model LessEqual + parameter Real gain(start = 1, min = 0); + Modelica.Blocks.Interfaces.RealInput u1 annotation(Placement(visible = true, transformation(origin = {120, -1.77636e-15}, extent = {{-20, -20}, {20, 20}}, rotation = 180), iconTransformation(origin = {120, 0}, extent = {{20, -20}, {-20, 20}}, rotation = 0))); + Modelica.Blocks.Interfaces.RealInput u annotation(Placement(visible = true, transformation(origin = {-120, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-120, 5.71421}, extent = {{-20, -25.7142}, {20, 14.2858}}, rotation = 0))); + protected + Real con(min = 0) = gain * (u - u1) annotation(isConstraint = true); + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {0, 0}, extent = {{-100, 40}, {100, -40}}, textString = " >= "), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})}), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {0, 0}, extent = {{-100, 40}, {100, -40}}, textString = " >= "), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})})); + end LessEqual; + + model Equal + parameter Real gain(start = 1, min = 0); + Modelica.Blocks.Interfaces.RealInput u1 annotation(Placement(visible = true, transformation(origin = {120, -1.77636e-15}, extent = {{-20, -20}, {20, 20}}, rotation = 180), iconTransformation(origin = {120, 0}, extent = {{20, -20}, {-20, 20}}, rotation = 0))); + Modelica.Blocks.Interfaces.RealInput u annotation(Placement(visible = true, transformation(origin = {-120, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-120, 5.7142}, extent = {{-20, -25.7142}, {20, 14.2858}}, rotation = 0))); + protected + Real con(min = 0, max = 0) = gain * (u - u1) annotation(isConstraint = true); + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {0, 0}, extent = {{-100, 40}, {100, -40}}, textString = " == "), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})}), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {0, 0}, extent = {{-100, 40}, {100, -40}}, textString = " == "), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})})); + end Equal; + + model GreaterEqualFinal + parameter Real gain(start = 1, min = 0); + Modelica.Blocks.Interfaces.RealInput u1 annotation(Placement(visible = true, transformation(origin = {120, -1.77636e-15}, extent = {{-20, -20}, {20, 20}}, rotation = 180), iconTransformation(origin = {120, 0}, extent = {{20, -20}, {-20, 20}}, rotation = 0))); + Modelica.Blocks.Interfaces.RealInput u annotation(Placement(visible = true, transformation(origin = {-120, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-120, 5.71421}, extent = {{-20, -25.7142}, {20, 14.2858}}, rotation = 0))); + protected + Real con(max = 0) = gain * (u - u1) annotation(isFinalConstraint = true); + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {0, 0}, extent = {{-100, 40}, {100, -40}}, textString = " <= "), Text(origin = {0, -50}, extent = {{-100, 10}, {100, -10}}, textString = "at stop time"), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})}), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {0, 0}, extent = {{-100, 40}, {100, -40}}, textString = " <= "), Text(origin = {0, -50}, extent = {{-100, 10}, {100, -10}}, textString = "at stop time"), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})})); + end GreaterEqualFinal; + + model LessEqualFinal + parameter Real gain(start = 1, min = 0); + Modelica.Blocks.Interfaces.RealInput u1 annotation(Placement(visible = true, transformation(origin = {120, -1.77636e-15}, extent = {{-20, -20}, {20, 20}}, rotation = 180), iconTransformation(origin = {120, 0}, extent = {{20, -20}, {-20, 20}}, rotation = 0))); + Modelica.Blocks.Interfaces.RealInput u annotation(Placement(visible = true, transformation(origin = {-120, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-120, 5.7142}, extent = {{-20, -25.7142}, {20, 14.2858}}, rotation = 0))); + protected + Real con(min = 0) = gain * (u - u1) annotation(isFinalConstraint = true); + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {0, 0}, extent = {{-100, 40}, {100, -40}}, textString = " >= "), Text(origin = {0, -50}, extent = {{-100, 10}, {100, -10}}, textString = "at stop time"), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})}), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {0, 0}, extent = {{-100, 40}, {100, -40}}, textString = " >= "), Text(origin = {0, -50}, extent = {{-100, 10}, {100, -10}}, textString = "at stop time"), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})})); + end LessEqualFinal; + + model EqualFinal + parameter Real gain(start = 1, min = 0); + Modelica.Blocks.Interfaces.RealInput u1 annotation(Placement(visible = true, transformation(origin = {120, -1.77636e-15}, extent = {{-20, -20}, {20, 20}}, rotation = 180), iconTransformation(origin = {120, -1.77636e-15}, extent = {{-20, -20}, {20, 20}}, rotation = 180))); + Modelica.Blocks.Interfaces.RealInput u annotation(Placement(visible = true, transformation(origin = {-120, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-120, 5.71421}, extent = {{-20, -25.7142}, {20, 14.2858}}, rotation = 0))); + protected + Real con(min = 0, max = 0) = gain * (u - u1) annotation(isFinalConstraint = true); + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {0, 0}, extent = {{-100, 40}, {100, -40}}, textString = " == "), Text(origin = {0, -50}, extent = {{-100, 10}, {100, -10}}, textString = "at stop time"), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})}), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {0, 0}, extent = {{-100, 40}, {100, -40}}, textString = " == "), Text(origin = {0, -50}, extent = {{-100, 10}, {100, -10}}, textString = "at stop time"), Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 255})})); + end EqualFinal; + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2}))); + end Constraints; + + package Examples "Lotka Volterra fishing problem: + optimal fishing strategy + see: http://mintoc.de/index.php/Lotka_Volterra_fishing_problem + " + package LotkaVolterraFishingProblem + model baseModel + Real x1(start = 0.5, fixed = true) "biomasses of prey"; + Real x2(start = 0.7, fixed = true) "biomasses of predator"; + Modelica.Blocks.Interfaces.RealInput u(min = 0, max = 1, start = 1) annotation(Placement(visible = true, transformation(origin = {-120, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-120, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0))); + equation + der(x1) = x1 - x1 * x2 - 0.4 * x1 * u; + der(x2) = (-x2) + x1 * x2 - 0.2 * x2 * u; + annotation(experiment(StopTime = 12, Tolerance = 1e-8), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics)); + end baseModel; + + model opt1 + DynamicOptimization.ObjectFunction.Minimize minimize1 annotation(Placement(visible = true, transformation(origin = {60, 80}, extent = {{-20, -20}, {20, 20}}, rotation = 0))); + DynamicOptimization.Examples.LotkaVolterraFishingProblem.baseModel BaseModel annotation(Placement(visible = true, transformation(origin = {70, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + Modelica.Blocks.Interfaces.RealInput u(min = 0, max = 1, start = 1) annotation(Placement(visible = true, transformation(origin = {-50, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-120, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0))); + Modelica.Blocks.Sources.RealExpression realexpression1(y = (BaseModel.x1 - 1) ^ 2 + (BaseModel.x2 - 1) ^ 2) annotation(Placement(visible = true, transformation(origin = {-40, 80}, extent = {{-20, -20}, {20, 20}}, rotation = 0))); + equation + connect(realexpression1.y, minimize1.u) annotation(Line(points = {{-18, 80}, {36, 80}}, color = {0, 0, 127})); + connect(u, BaseModel.u) annotation(Line(points = {{-50, 30}, {-50, 30}, {58, 30}}, color = {0, 0, 127})); + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics), experiment(StopTime = 12, Tolerance = 1e-8)); + end opt1; + + model opt2 + Modelica.Blocks.Interfaces.RealInput u(min = 0, max = 1, start = 1) annotation(Placement(visible = true, transformation(origin = {-50, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-84, -4}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + DynamicOptimization.ObjectFunction.MinimizeFinal minimizefinal1 annotation(Placement(visible = true, transformation(origin = {60, 80}, extent = {{-20, -20}, {20, 20}}, rotation = 0))); + DynamicOptimization.Examples.LotkaVolterraFishingProblem.baseModel BaseModel annotation(Placement(visible = true, transformation(origin = {70, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + Modelica.Blocks.Sources.RealExpression realexpression1(y = (BaseModel.x1 - 5) ^ 2 + (BaseModel.x2 - 3) ^ 2) annotation(Placement(visible = true, transformation(origin = {-42, 80}, extent = {{-20, -20}, {20, 20}}, rotation = 0))); + equation + connect(realexpression1.y, minimizefinal1.u) annotation(Line(points = {{-20, 80}, {36, 80}}, color = {0, 0, 127})); + connect(u, BaseModel.u) annotation(Line(points = {{-50, 30}, {58, 30}}, color = {0, 0, 127})); + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics), experiment(StopTime = 12, Tolerance = 1e-8)); + end opt2; + + model opt3 + Modelica.Blocks.Interfaces.RealInput u(min = 0, max = 1, start = 1) annotation(Placement(visible = true, transformation(origin = {-50, -10}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-84, -4}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + DynamicOptimization.Examples.LotkaVolterraFishingProblem.baseModel BaseModel annotation(Placement(visible = true, transformation(origin = {72, -10}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + Modelica.Blocks.Sources.RealExpression realexpression2(y = 0) annotation(Placement(visible = true, transformation(origin = {40, 20}, extent = {{-20, -20}, {20, 20}}, rotation = 0))); + Modelica.Blocks.Sources.RealExpression realexpression1(y = (BaseModel.x1 - 5) ^ 2 + (BaseModel.x2 - 3) ^ 2) annotation(Placement(visible = true, transformation(origin = {-40, 80}, extent = {{-20, -20}, {20, 20}}, rotation = 0))); + DynamicOptimization.Constraints.EqualFinal equalfinal1 annotation(Placement(visible = true, transformation(origin = {60, 80}, extent = {{-20, -20}, {20, 20}}, rotation = 0))); + equation + connect(realexpression1.y, equalfinal1.u) annotation(Line(points = {{-18, 80}, {36, 80}}, color = {0, 0, 127})); + connect(realexpression2.y, equalfinal1.u1) annotation(Line(points = {{62, 20}, {100, 20}, {100, 80}, {84, 80}}, color = {0, 0, 127})); + connect(u, BaseModel.u) annotation(Line(points = {{-50, -10}, {-48, -10}, {60, -10}}, color = {0, 0, 127})); + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics), experiment(StopTime = 12, Tolerance = 1e-8)); + end opt3; + + model opt4 + Real pop(min = 0, max = 2.5) = BaseModel.x1 + BaseModel.x2; + Modelica.Blocks.Interfaces.RealInput u(min = 0, max = 1, start = 1) annotation(Placement(visible = true, transformation(origin = {-70, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-84, -4}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + DynamicOptimization.Examples.LotkaVolterraFishingProblem.baseModel BaseModel annotation(Placement(visible = true, transformation(origin = {70, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + equation + connect(u, BaseModel.u) annotation(Line(points = {{-70, 30}, {-52, 30}, {58, 30}}, color = {0, 0, 127})); + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics), experiment(StopTime = 12, Tolerance = 1e-8)); + end opt4; + + model opt4_1 + Real pop = BaseModel.x1 + BaseModel.x2; + Modelica.Blocks.Interfaces.RealInput u(min = 0, max = 1, start = 1) annotation(Placement(visible = true, transformation(origin = {-70, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-84, -4}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + DynamicOptimization.Examples.LotkaVolterraFishingProblem.baseModel BaseModel annotation(Placement(visible = true, transformation(origin = {70, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + Modelica.Blocks.Sources.RealExpression realexpression1(y = pop) annotation(Placement(visible = true, transformation(origin = {-60, 80}, extent = {{-20, -20}, {20, 20}}, rotation = 0))); + DynamicOptimization.Constraints.Band band1(MaxValue = 2.5, MinValue = 0.0) annotation(Placement(visible = true, transformation(origin = {60, 80}, extent = {{-20, -20}, {20, 20}}, rotation = 0))); + equation + connect(realexpression1.y, band1.u) annotation(Line(points = {{-38, 80}, {36, 80}}, color = {0, 0, 127})); + connect(u, BaseModel.u) annotation(Line(points = {{-70, 30}, {58, 30}}, color = {0, 0, 127})); + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics), experiment(StopTime = 12, Tolerance = 1e-8)); + end opt4_1; + + model opt5 + Modelica.Blocks.Interfaces.RealInput u(min = -2, max = 2, start = -1) annotation(Placement(visible = true, transformation(origin = {-50, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-84, -4}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + DynamicOptimization.Examples.LotkaVolterraFishingProblem.baseModel BaseModel annotation(Placement(visible = true, transformation(origin = {70, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + Modelica.Blocks.Sources.RealExpression realexpression1(y = (u ^ 2 - 1) ^ 2) annotation(Placement(visible = true, transformation(origin = {-60, 80}, extent = {{-20, -20}, {20, 20}}, rotation = 0))); + DynamicOptimization.ObjectFunction.Minimize minimize1 annotation(Placement(visible = true, transformation(origin = {40, 80}, extent = {{-20, -20}, {20, 20}}, rotation = 0))); + equation + connect(realexpression1.y, minimize1.u) annotation(Line(points = {{-38, 80}, {16, 80}}, color = {0, 0, 127})); + connect(u, BaseModel.u) annotation(Line(points = {{-50, 30}, {-42, 30}, {58, 30}}, color = {0, 0, 127})); + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics), experiment(StopTime = 12, Tolerance = 1e-8)); + end opt5; + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2}))); + end LotkaVolterraFishingProblem; + + package LeeRamirezBioreactor " see: Dynamic optimization of chemical and biochemical processes using restricted second-order information 2001, + Eva Balsa-Canto, Julio R. Banga, Antonio A. Alonso Vassilios S. Vassiliadis + " + model base_model + input Real u1(min = 0, max = 1, start = 1); + input Real u2(min = 0, max = 1, start = 1); + Real x1(min = -1, max = 10, start = 1, fixed = true); + Real x2(min = -1, max = 10, start = 0.1, fixed = true); + Real x3(min = 10, max = 50, start = 40, fixed = true); + Real x4(min = -1, max = 10, start = 0, fixed = true); + Real x5(min = -1, max = 10, start = 0, fixed = true); + Real x6(min = -1, max = 10, start = 1, fixed = true); + Real x7(min = -1, max = 10, start = 0, fixed = true); + Real g1, g2, g3; + Real t1, t2, t3; + parameter Real c1 = 100; + parameter Real c2 = 0.51; + parameter Real c3 = 4.0; + equation + t1 = 14.35 + x3 + x3 ^ 2 / 111.5; + t2 = 0.22 + x5; + t3 = x6 + 0.22 ./ t2 * x7; + g1 = x3 / t1 * t3; + g2 = 0.233 * x3 / t1 * (0.0005 + x5) / (0.022 + x5); + g3 = 0.09 * x5 / (0.034 + x5); + der(x1) = u1 + u2; + der(x2) = g1 * x2 - (u1 + u2) * x2 / x1; + der(x3) = u1 / x1 * c1 - (u1 + u2) * x3 / x1 - g1 * x2 / c2; + der(x4) = g2 * x2 - (u1 + u2) * x4 / x1; + der(x5) = u2 * c3 / x1 - (u1 + u2) * x5 / x1; + der(x6) = -g3 * x6; + der(x7) = g3 * (1 - x7); + end base_model; + + model opt + DynamicOptimization.ObjectFunction.Minimize cost(u = -u2); + DynamicOptimization.ObjectFunction.MinimizeFinal costFinal(u = x4 * x1); + extends DynamicOptimization.Examples.LeeRamirezBioreactor.base_model; + annotation(experiment(StopTime = 10, Tolerance = 1e-8), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2}))); + end opt; + + model opt2 + DynamicOptimization.ObjectFunction.Minimize cost(u = -u2); + DynamicOptimization.ObjectFunction.MinimizeFinal costFinal(u = x4 * x1); + extends DynamicOptimization.Examples.LeeRamirezBioreactor.base_model; + annotation(experiment(StopTime = 10, Tolerance = 1e-8), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2}))); + end opt2; + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2}))); + end LeeRamirezBioreactor; + + package comparison + model test " + see: Optimal contrl of odes and daes, Matthias Gerdts, p.291 + " + Real cost = (-2 * x) + 3 * u annotation(isLagrange = true); + Real x(start = 5, fixed = true); + input Real u(min = 0, max = 2); + /*true solution*/ + Real x1 = 7 * exp(time) + (if time <= 2 - log(5 / 2) then -2 else -5 * exp(time - 2)); + Real u1 = if time <= 2 - log(5 / 2) then 2 else 0; + equation + der(x) = x + u; + annotation(experiment(StopTime = 2, Tolerance = 1e-8)); + end test; + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2}))); + end comparison; + end Examples; + annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), uses(Modelica(version = "3.2.1"))); +end DynamicOptimization; \ No newline at end of file diff --git a/exercises/Exercises-ModelicaTutorial.onb b/exercises/Exercises-ModelicaTutorial.onb new file mode 100644 index 0000000000000000000000000000000000000000..4cc472dcfb28b8f4d4eef94918240b26fc02360c --- /dev/null +++ b/exercises/Exercises-ModelicaTutorial.onb @@ -0,0 +1,442 @@ +<!DOCTYPE OMNotebook> +<Notebook> + <GroupCell closed="false"> + <GroupCell closed="false"> + <TextCell style="Title"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:10px; margin-bottom:10px; margin-left:10px; margin-right:10px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:38pt; font-weight:600; color:#000000;">Exercises to Introductory Modelica Tutorial</span></p></td></tr></table></body></html></Text> + </TextCell> + <TextCell style="Section"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times'; font-size:18pt; font-weight:600; color:#000000;">Short Introduction to Graphical Modeling</span></p></td></tr></table></body></html></Text> + </TextCell> + <TextCell style="Text"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times New Roman'; font-size:12pt; color:#000000;">Install OpenModelica and start OpenModelica OMNotebook. Also and start the OpenModelica Connection Graphical Connection Editor called OMedit..</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times New Roman'; font-size:12pt; color:#000000;">Do the RL-Circuit exercise in the course slides.</span></p></td></tr></table></body></html></Text> + </TextCell> + <GroupCell closed="false"> + <TextCell style="Section"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times'; font-size:18pt; font-weight:600; color:#000000;">Simple Textual Modeling Exercises</span></p></td></tr></table></body></html></Text> + <Rule name="CellTags">c:6</Rule> + </TextCell> + <TextCell style="Subsection"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times'; font-size:14pt; font-weight:600; color:#000000;">HelloWorld</span></p></td></tr></table></body></html></Text> + <Rule name="CellTags">c:6</Rule> + </TextCell> + <TextCell style="Text"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times New Roman'; font-size:12pt; color:#000000;">Simulate and plot the following example with one differential equation and one initial condition. Start by dlicking in the cell and pushing shift-enter.</span></p></td></tr></table></body></html></Text> + </TextCell> + <GraphCell style="Graph" closed="false"> + <Input>model HelloWorld "A simple equation" + parameter Real a = -1; + Real x(start=1); +equation + der(x)= a*x; +end HelloWorld;</Input> + <Output>{HelloWorld}</Output> + </GraphCell> + <TextCell style="Text"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times New Roman'; font-size:12pt; color:#000000;">Push shift-tab for command completion, fill in the name HelloWorld, and simulate it!</span></p></td></tr></table></body></html></Text> + </TextCell> + <GraphCell style="Graph" closed="false"> + <Input>simulate(HelloWorld, startTime=0, stopTime=1, numberOfIntervals=500, tolerance=1e-10)</Input> + <Output>[done]</Output> + </GraphCell> + <TextCell style="Text"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times New Roman'; font-size:12pt; color:#000000;">Push shift-tab for command completion, fill in a variable name (x), and plot it!</span></p></td></tr></table></body></html></Text> + </TextCell> + <GraphCell style="Graph" closed="false"> + <Input>plo</Input> + <Output>true</Output> + </GraphCell> + <TextCell style="Subsection"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times'; font-size:14pt; font-weight:600; color:#000000;">Try DrModelica with VanDerPol</span></p></td></tr></table></body></html></Text> + </TextCell> + <TextCell style="Text"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times New Roman'; font-size:12pt; color:#000000;">Locate the VanDerPol model in DrModelica (link from Section 2.1), run it, change it slightly, and re-run it.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times New Roman'; font-size:12pt; color:#000000;">Change the endTime to 10, then simulate and plot.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times New Roman'; font-size:12pt; color:#000000;">Change the lambda parameter to 10, then simulate for 50 seconds and plot. Why is the plot looking like this?</span></p></td></tr></table></body></html></Text> + </TextCell> + <TextCell style="Subsection"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times'; font-size:14pt; font-weight:600; color:#000000;">DAE Example</span></p></td></tr></table></body></html></Text> + </TextCell> + <TextCell style="Text"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times New Roman'; font-size:12pt; color:#000000;">Simulate and plot following example which includes an algebraic equation with no derivatives.</span></p></td></tr></table></body></html></Text> + </TextCell> + <GraphCell style="Graph" closed="false"> + <Input>class DAEexample + Real x(start=0.9, fixed=true); + Real y(start=0); +equation + der(y)+(1+0.5*sin(y))*der(x) = sin(time); + x - y = exp(-0.9*x)*cos(y); +end DAEexample;</Input> + <Output>{DAEexample}</Output> + </GraphCell> + <TextCell style="Text"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times New Roman'; font-size:12pt; color:#000000;">Simulate the example</span></p></td></tr></table></body></html></Text> + </TextCell> + <GraphCell style="Graph" closed="false"> + <Input>simulate(DAEexample, stopTime = 1)</Input> + <Output>[done]</Output> + </GraphCell> + <TextCell style="Text"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times New Roman'; font-size:12pt; color:#000000;">Plot the results. Notice that while the start value of x is fixed, the start value of y is not fixed. Non-fixed start values are treated by the simulator as &quot;guess&quot; values. During initializiation this guess value will be tried as a starting value, but the simulator can change them in order to produce a set of consistent initial condition.If a non-linear system of equations needs to be solved during initialization, such guess values will be used by the simulator as a starting point (guess value) for root-finding algorithms such as Newton's method.. </span></p></td></tr></table></body></html></Text> + </TextCell> + <GraphCell style="Graph" closed="false"> + <Input>plot({x,y})</Input> + <Output>true</Output> + </GraphCell> + <TextCell style="Subsection"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times'; font-size:14pt; font-weight:600; color:#000000;">A Simple Systems of Equations</span></p></td></tr></table></body></html></Text> + <Rule name="CellTags">c:6</Rule> + </TextCell> + <TextCell style="Text"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times New Roman'; font-size:12pt; color:#000000;">Develop a Modelica model that solves the equation system below with initial conditions. Hint: initial conditions are often specified using the </span><span style=" font-family:'Times New Roman'; font-size:12pt; font-weight:600; color:#000000;">start</span><span style=" font-family:'Times New Roman'; font-size:12pt; color:#000000;"> attribute.</span></p></td></tr></table></body></html></Text> + </TextCell> + <TextCell style="Text"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src="file:////tmp/OpenModelica/1.png" width="116" height="74" /></p> +<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Times New Roman'; font-size:12pt; color:#000000;"><br /></p></td></tr></table></body></html></Text> + <Rule name="TextAlignment">Center</Rule> + <Rule name="TextJustification">0</Rule> + <Image name="file:////tmp/OpenModelica/1.png">AAAAAYlQTkcNChoKAAAADUlIRFIAAAB0AAAASggDAAAAXTSAyAAAAwBQTFRFAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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0QC0UxmYJLQWV71F8ICbglPObF76gMPYiVQlkPBJsFx7Wwgxe6VD++rfZu6IZu6BxUs039VYsmwu8uHdpr0ti8uoywHBSqVpvuo51N7KcyUJi2LQwKeaOcjWnirIuWw9ygzDibjjEr9rO3AJuHEWdjPZK1OgMGhSdVCVFKyG4WQQ2K1Wln04WOAGaF8ZGZUPr/4Hxd7d3QDd3QJWgqUM22s1qUKBTVS2tc1N8GHYiNaO7rh8aWNw49I73JT3BobWGcP78xKBU5oQid9CoL44AezuKwbykeqpnz8xzKP11YNkhxuJz5EWVwQzd0Q/8A9Ba/wjxS6DUSb5uJd8aOPS7zKwQzAj0hvdnxgICKIxcPtDz2uCm95bHH9X6ldCaDfuWcRwblR/v+3CsVg5p0n0e653oL9AeFnB/JB3ifcAAAAABJRU5ErkJggg==</Image> + </TextCell> + <GraphCell style="Graph" closed="false"> + <Input>model ...</Input> + <Output></Output> + </GraphCell> + <TextCell style="Subsection"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times'; font-size:14pt; font-weight:600; color:#000000;">Functions</span></p></td></tr></table></body></html></Text> + </TextCell> + <TextCell style="Text"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times New Roman'; font-size:12pt; color:#000000;">a) Write a function, sum2, which calculates the sum of Real numbers, for a vector of arbitrary size.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Times New Roman'; font-size:12pt; color:#000000;"><br /></p></td></tr></table></body></html></Text> + </TextCell> + <GraphCell style="Graph" closed="false"> + <Input>function sum2 +... +end sum2;</Input> + <Output>{sum2}</Output> + </GraphCell> + <TextCell style="Text"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times New Roman'; font-size:12pt; color:#000000;">b) Write a function, average, which calculates the average of Real numbers, in a vector of arbitrary size. The function average should make use of a function call to sum2</span></p></td></tr></table></body></html></Text> + </TextCell> + <GraphCell style="Graph" closed="false"> + <Input>function average +... +end average;</Input> + <Output>{average}</Output> + </GraphCell> + <TextCell style="Text"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times New Roman'; font-size:12pt; color:#000000;">Test the functions</span></p></td></tr></table></body></html></Text> + </TextCell> + <GraphCell style="Graph" closed="false"> + <Input>average({1,2,3})</Input> + <Output>2.0</Output> + </GraphCell> + <TextCell style="Subsection"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times'; font-size:14pt; font-weight:600; color:#000000;">Hybrid Modeling with BouncingBall</span></p></td></tr></table></body></html></Text> + </TextCell> + <TextCell style="Text"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times New Roman'; font-size:12pt; color:#000000;">Locate the BouncingBall model in one of the hybrid modeling sections of DrModelica (the when-Equations link in Section 2.9), run it, change it slightly, and re-run it. </span></p></td></tr></table></body></html></Text> + </TextCell> + </GroupCell> + <GroupCell closed="false"> + <TextCell style="Section"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times'; font-size:18pt; font-weight:600; color:#000000;">Simple Graphical Design Using the Graphical Connection Editor</span></p></td></tr></table></body></html></Text> + <Rule name="CellTags">c:3</Rule> + </TextCell> + <TextCell style="Subsection"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times'; font-size:14pt; font-weight:600; color:#000000;">DC Motor</span></p></td></tr></table></body></html></Text> + <Rule name="FontWeight">Bold</Rule> + </TextCell> + <TextCell style="Text"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times New Roman'; font-size:12pt; color:#000000;">Make a simple DC-motor using the Modelica standard library that has the following structure: </span></p></td></tr></table></body></html></Text> + </TextCell> + <TextCell style="Text"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src="file:////tmp/OpenModelica/2.png" width="440" height="214" /></p></td></tr></table></body></html></Text> + <Rule name="TextAlignment">Left</Rule> + <Rule name="TextJustification">0</Rule> + <Rule name="CellTags">b:1.2</Rule> + <Image name="file:////tmp/OpenModelica/2.png">AAAAAYlQTkcNChoKAAAADUlIRFIAAAG4AAAA1ggDAAAAlJ1nHwAAAwBQTFRFAAAAb3FvdXZ1f4F/AAD/i42LkpOSn6GfpaKlr7Cvt7i3w8TDyMnI1tfW3N3c5ufm6+vr8vLy+Pj4+/v7////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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q705xeuZ4xwpghnqtPI4msUCCeLNTLhZLFGJpws1siEk8UamXCyWCMXh9uhqmf8WlziTBHOFOFMEc4U4UwRzhThTBHOFOFMEc4U4UwRzhThTBHOFOFM8cJGU4QzRThTvEGNKcKZ4qjSFOFMEc4U4UwRzhThTBHOFOFMEc6UGMDspSw7wBluinCmCGdqUThu3eLgbDdFOFOEM0U4U8vDcVgSAme+KcKZIpwpwpkinCnCmSKcKcKZIpwpwpkinCnCmSKcKcKZIpwpwpkinCnCmSKcKcKZIpwpwpkinCnCmSKcKcKZIpwpwpkinCnCmSKcKcKZ+g+L5CZcWlIVVQAAAABJRU5ErkJggg==</Image> + </TextCell> + <GraphCell style="Graph" closed="false"> + <Input>model ...</Input> + <Output>[1:7]: error: unexpected token: .</Output> + </GraphCell> + <TextCell style="Text"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;"><br /></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;"><br /></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;"><br /></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;"><br /></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;"><br /></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times New Roman'; font-size:12pt; color:#000000;">You can simulate and plot the model directly from the graphical editor. Simulate for 15s and plot the variables for the outgoing rotational speed on the inertia axis and the voltage on the voltage source (denoted u in the figure) in the same plot. </span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Times New Roman'; font-size:12pt; color:#000000;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times New Roman'; font-size:12pt; color:#000000;">Option: You can also save the model, load it and simulate it using OMShell or OMNotebook. You can also go to the graphical editor text view and copy/paste the model into a cell in OMNotebook.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Times New Roman'; font-size:12pt; color:#000000;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times New Roman'; font-size:12pt; color:#000000;">Hint: if you use the plot command in OMNotebook and you have difficulty finding the names of the variables to plot, you can flatten the model by calling instantiateModel, which exposes all variable names.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Times New Roman'; font-size:12pt; color:#000000;"><br /></p></td></tr></table></body></html></Text> + </TextCell> + <TextCell style="Subsection"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times'; font-size:14pt; font-weight:600; color:#000000;">Spring and Inertia (Extra)</span></p></td></tr></table></body></html></Text> + </TextCell> + <TextCell style="Text"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times New Roman'; font-size:12pt; color:#000000;">Add a torsional spring to the outgoing shaft and another inertia element. Simulate again and see the results. Adjust some parameters (right-click on corresponding model component icon) to make a rather stiff spring.<br /></span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src="file:////tmp/OpenModelica/3.png" width="475" height="216" /></p></td></tr></table></body></html></Text> + <Image name="file:////tmp/OpenModelica/3.png">AAAAAYlQTkcNChoKAAAADUlIRFIAAAHbAAAA2AgDAAAAlEe5HAAAAwBQTFRFAAAABgYGFBQUISEhIyMjKysrPTw9RkVGW1lbZmRma21rdnR2fXt9AAD/kI6QnZqdn5yfpaOlsK2wtbK1vbq9wb7BxsPG////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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FYX3OqCW11wqwtudcGtLrjVBbe64FYX3OqCW11wqwtudcGtLrjVBbe64FYX3OqCW1223Ql9f3KH4FaXklvZ3xnpANzqgltdSvfBmH0uuNUFt7rgVhfc6oJbXVJuXzluPzo4Au8F6IJbXXCrS84tTe3zod7qgltdcKvLplsa20dDvdUFt7rgVhfc6oJbXXCrC251wa0uuNUFt7rgVhfc6oJbXXCrC251wa0uuNUFt7rgVhfc6oJbXXCri+/WfKG8Na+Gp2BWs9vmzP8vgEuPB87DxHNj7Z0m42Iz1+fxwVBvH0Po1jM6zBqXqbcYnsG63uJWh0R7i1sREvfJZp4f5pbWSvVWwwPAlC641QW3uuBWF9zqgltdcKsLbnXBrS641QW3uuBWF9zqgltd/gOiNB2WuVNLLQAAAABJRU5ErkJggg==</Image> + </TextCell> + <GraphCell style="Graph" closed="false"> + <Input>model ...</Input> + <Output>[1:7]: error: unexpected token: .</Output> + </GraphCell> + <TextCell style="Subsection"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times'; font-size:14pt; font-weight:600; color:#000000;">Adding controller (extra)</span></p></td></tr></table></body></html></Text> + </TextCell> + <TextCell style="Text"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Times New Roman'; font-size:12pt; color:#000000;">Add a PI controller to the system and try to control the rotational speed of the outgoing shaft. Verify the result using a step signal for input. Tune the PI controller by changing its parameters. Right-click on the PI Controller Icon to change parameters. </span></p></td></tr></table></body></html></Text> + </TextCell> + <TextCell style="Text"> + <Text><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src="file:////tmp/OpenModelica/4.png" width="730" height="214" /></p></td></tr></table></body></html></Text> + <Image name="file:////tmp/OpenModelica/4.png">AAAAAYlQTkcNChoKAAAADUlIRFIAAALaAAAA1ggDAAAA2G3VUwAAAwBQTFRFAAAADQ0NFBQUIyMjKysrRkVGR0ZHZmRma21rcXBxAAD/kI6QpaOlq6irtbK1uba5xMHExsPG6+vr////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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TUCh2gQUqk1AodoEFKpNQKHaBBSqTUCh2gQUqk1AodoEFKpNQKHaBBSqTUCh2gQUqk1AodoEFKpNQLGkttutg1sfCASG1Hb7lfjety8/GQo7avsKuNXhh+vuqfPjj3t/LcllmFJ78dcP4F5mt43ob68luQxTaq8KU20D2FFbaE21LWBI7eUk0YlF51bhHdUGw5LaxBRUm4BCtQkoVJuAQrUJKFSbgEK1CShUm4BCtQkoVJuAQrUJKFSbgEK1CShUm4BCtQkor1ObkNfyKrUJeRNUm4BCtQkoVJuAQrUJKFSbgPI/V/saR+fbAHAAAAAASUVORK5CYII=</Image> + </TextCell> + <GraphCell style="Graph" closed="false"> + <Input>model ...</Input> + <Output>[1:7]: error: unexpected token: .</Output> + </GraphCell> + </GroupCell> + </GroupCell> + </GroupCell> +</Notebook> diff --git a/exercises/Exercises-ModelicaTutorial.pdf b/exercises/Exercises-ModelicaTutorial.pdf new file mode 100644 index 0000000000000000000000000000000000000000..e65c209ade8c76bdaaf857e0025d0a5d8cc400ad Binary files /dev/null and b/exercises/Exercises-ModelicaTutorial.pdf differ diff --git a/exercises/LotkaVolterra.mo b/exercises/LotkaVolterra.mo new file mode 100644 index 0000000000000000000000000000000000000000..cd202f990a65aa0322b656129558df817fc0adf7 --- /dev/null +++ b/exercises/LotkaVolterra.mo @@ -0,0 +1,16 @@ +model LotkaVolterra "This is the typical equation-oriented model" + parameter Real alpha=0.1 "Reproduction rate of prey"; + parameter Real beta=0.02 "Mortality rate of predator per prey"; + parameter Real gamma=0.4 "Mortality rate of predator"; + parameter Real delta=0.02 "Reproduction rate of predator per prey"; + parameter Real prey_pop_init=10 "Initial prey population"; + parameter Real pred_pop_init=10 "Initial predator population"; + Real prey_pop(start=prey_pop_init) "Prey population"; + Real pred_pop(start=pred_pop_init) "Predator population"; +initial equation + prey_pop = prey_pop_init; + pred_pop = pred_pop_init; +equation + der(prey_pop) = prey_pop*(alpha-beta*pred_pop); + der(pred_pop) = pred_pop*(delta*prey_pop-gamma); +end LotkaVolterra ; \ No newline at end of file diff --git a/exercises/OMSens Example_Exercise_ Lotka-Volterra.pdf b/exercises/OMSens Example_Exercise_ Lotka-Volterra.pdf new file mode 100644 index 0000000000000000000000000000000000000000..674165edeb5bfacaf6a3eaf50bd86e9156f774f9 Binary files /dev/null and b/exercises/OMSens Example_Exercise_ Lotka-Volterra.pdf differ diff --git a/exercises/OpenModelicaUsersGuide-latest.pdf b/exercises/OpenModelicaUsersGuide-latest.pdf new file mode 100644 index 0000000000000000000000000000000000000000..0140ac8217bb22ed3a66a46957f0980c90c71895 Binary files /dev/null and b/exercises/OpenModelicaUsersGuide-latest.pdf differ diff --git a/exercises/Resources LInks.pdf b/exercises/Resources LInks.pdf new file mode 100644 index 0000000000000000000000000000000000000000..0033ff5b550800d7aca93a2c45bb8364bb3d5573 Binary files /dev/null and b/exercises/Resources LInks.pdf differ