aboutsummaryrefslogtreecommitdiffstats
path: root/modelica-parser-lalrpop/examples/modelica_other
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2016-12-19 00:16:01 -0800
committerbnewbold <bnewbold@robocracy.org>2016-12-19 00:16:01 -0800
commit3d94fa2a883c5535210ec954543414e17e7ea455 (patch)
tree9cdf27c9d8b277c8fb72eb58c89b62a65ed92dbe /modelica-parser-lalrpop/examples/modelica_other
parent4451df9a9f33bcd81ab9b4ddd085c4b57d27bc29 (diff)
downloadmodelthing-3d94fa2a883c5535210ec954543414e17e7ea455.tar.gz
modelthing-3d94fa2a883c5535210ec954543414e17e7ea455.zip
parser: more models (not working)
Diffstat (limited to 'modelica-parser-lalrpop/examples/modelica_other')
-rw-r--r--modelica-parser-lalrpop/examples/modelica_other/breaking_pendulum.mo29
-rw-r--r--modelica-parser-lalrpop/examples/modelica_other/polynomial_evaluator.mo2
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;