diff options
Diffstat (limited to 'modelica-parser-lalrpop/examples')
-rw-r--r-- | modelica-parser-lalrpop/examples/modelica_other/breaking_pendulum.mo | 29 | ||||
-rw-r--r-- | modelica-parser-lalrpop/examples/modelica_other/polynomial_evaluator.mo | 2 |
2 files changed, 30 insertions, 1 deletions
diff --git a/modelica-parser-lalrpop/examples/modelica_other/breaking_pendulum.mo b/modelica-parser-lalrpop/examples/modelica_other/breaking_pendulum.mo new file mode 100644 index 0000000..f719a04 --- /dev/null +++ b/modelica-parser-lalrpop/examples/modelica_other/breaking_pendulum.mo @@ -0,0 +1,29 @@ +record PendulumData + parameter Real m, g, L; +end PendulumData; + +partial model BasePendulum + PendulumData p; + input + Real u; + output Real pos[2], vel[2]; +end BasePendulum; + +block Pendulum + extends BasePendulum; + constant Real PI=3.141592653589793; + output + Real phi(start=PI/4), phid; +equation + phid = der(phi); + p.m*p.L*p.L*der(phid) + p.m*p.g*p.L*sin(phi) = u; + pos = [p.L*sin(phi); -p.L*cos(phi)]; + vel = der(pos); +end Pendulum; + +block BrokenPendulum + extends BasePendulum; +equation + vel = der(pos); + p.m*der(vel) = p.m*[0; -p.g]; +end BrokenPendulum; diff --git a/modelica-parser-lalrpop/examples/modelica_other/polynomial_evaluator.mo b/modelica-parser-lalrpop/examples/modelica_other/polynomial_evaluator.mo index f11d375..632fbc7 100644 --- a/modelica-parser-lalrpop/examples/modelica_other/polynomial_evaluator.mo +++ b/modelica-parser-lalrpop/examples/modelica_other/polynomial_evaluator.mo @@ -3,7 +3,7 @@ block PolynomialEvaluator input Real x; output Real y; protected - constant n = size(a, 1)-1; + constant Real n = size(a, 1)-1; Real xpowers[n+1]; equation xpowers[1] = 1; |