diff options
author | bnewbold <bnewbold@robocracy.org> | 2016-12-17 19:33:11 -0800 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2016-12-17 19:33:11 -0800 |
commit | 2e634496a6f362017d8f5f643d4ad30a3507dff9 (patch) | |
tree | f6500ad5f05082a062794f90e2afd1998bb33ec1 /modelica-parser-lalrpop/examples/modelica_models/breaking_pendulum.mo | |
parent | 9f82aceb9fbdb42f332d68f4a423123bd0788b2c (diff) | |
download | modelthing-2e634496a6f362017d8f5f643d4ad30a3507dff9.tar.gz modelthing-2e634496a6f362017d8f5f643d4ad30a3507dff9.zip |
update/expand parser examples
Diffstat (limited to 'modelica-parser-lalrpop/examples/modelica_models/breaking_pendulum.mo')
-rw-r--r-- | modelica-parser-lalrpop/examples/modelica_models/breaking_pendulum.mo | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/modelica-parser-lalrpop/examples/modelica_models/breaking_pendulum.mo b/modelica-parser-lalrpop/examples/modelica_models/breaking_pendulum.mo new file mode 100644 index 0000000..87b58d3 --- /dev/null +++ b/modelica-parser-lalrpop/examples/modelica_models/breaking_pendulum.mo @@ -0,0 +1,21 @@ +model BreakingPendulum3 + parameter Real m=1, g=9.81; + input Boolean Broken; + input Real u; + Real pos[2], vel[2]; + constant Real PI=3.141592653589793; + Real phi(start=PI/4), phid; + Real L=0.5, Ldot; +equation + pos = [L*sin(phi); -L*cos(phi)]; + vel = der(pos); + phid = der(phi); + Ldot = der(L); + 0 = if not Broken then [ + // Equations of pendulum + m*der(phid) + m*g*L*sin(phi) - u; + der(Ldot)] + else + // Equations of free flying mass + m*der(vel) = m*[0; -g]; +end BreakingPendulum3; |