Description
A note to my future self
What I am doing here is quite against my policy of doing the least necessary amount of quality work, but I am doing it as a partial fulfillment of my Master's degree secondary goal: to be proficient in model, simulation, and control using Julia. Otherwise, I would just use the ABCD matrix of the model and would call it a day.
To follow a TDD approach, I need a verified model of an inverted pendulum to compare the newly created model against it. To do so I need to:
The WSM model is a Modelica model, which means I need to
OMJulia relies on Open Modelica, so I have to figure out a way to
Here is a quick summary of the components used in the model
Modelica.Icons.Library
- This is a built-in icon library.PlanarMechanics.Parts.Body
- Represents the mass of the pendulum and the cart in planar mechanics.PlanarMechanics.Parts.Fixed
- Represents a fixed point in planar mechanics.PlanarMechanics.Parts.FixedTranslation
- Represents the length of the pendulum in planar mechanics.PlanarMechanics.PlanarWorld
- Represents the planar world in planar mechanics.PlanarMechanics.Joints.Revolute
- Represents a revolute joint in planar mechanics.PlanarMechanics.Joints.Prismatic
- Represents a prismatic joint in planar mechanics.Modelica.Mechanics.Rotational.Sensors.AngleSensor
- Represents an angle sensor in rotational mechanics.Modelica.Blocks.Math.MatrixGain
- Represents a matrix gain block for control.Modelica.Mechanics.Translational.Sensors.PositionSensor
- Represents a position sensor in translational mechanics.Modelica.Mechanics.Rotational.Sensors.SpeedSensor
- Represents a speed sensor in rotational mechanics.Modelica.Mechanics.Translational.Sensors.SpeedSensor
- Represents a speed sensor in translational mechanics.PlanarMechanics.Sources.WorldForce
- Represents a world force source in planar mechanics.
Other auxiliary components
-
Modelica.Blocks.Interfaces.RealOutput - Represents real output signals for various components.
-
Real - Represents real numbers for storing values.
-
Modelica.SIunits.Mass - Represents mass values in SI units.
-
Modelica.SIunits.Inertia - Represents inertia values in SI units.
-
Modelica.SIunits.Angle - Represents angle values in SI units.
-
Modelica.SIunits.Length - Represents length values in SI units.
-
Modelica.SIunits.Position - Represents position values in SI units.
-
Modelica.SIunits.Acceleration - Represents acceleration values in SI units.
-
Modelica.SIunits.AngularAcceleration - Represents angular acceleration values in SI units.
The PlanarMechanics.*
components are provided via https://github.com/dzimmer/PlanarMechanics which is missing for ModelingToolkitStandardLibarary
. So I have to add the following to MTKStdLib
- Add
PlanarMechanics/components/Fixed
to MTKStdLib #16 - Add
PlanarMechanics/components/Body (Mass)
to MTKStdLib #15 - Add
PlanarMechanics/components/FixedTranaslation
to MTKStdLib #17 - Add
PlanarMechanics/joints/Revolute
to MTKStdLib #18 - Add
PlanarMechanics/joints/Prismatic
to MTKStdLib #19 - Add
PlanarMechanics/sources/force
to MTKStdLib #20 - Add
Measure
demo #27 (as a validation for the component implementation, it isn't related to the pendulum model directly.)
Here is a PR that added the Mechnaical.Transitional
module for inspiration and pitfalls SciML/ModelingToolkitStandardLibrary.jl#85
only then I can start building the model using ModelingToolkit. oouf 😫