|
File test2.mo, 535 bytes
(added by lukas.koenemann@…, 5 years ago) |
|
example for test
|
| Line | |
|---|
| 1 | package test2
|
|---|
| 2 | model base
|
|---|
| 3 | parameter Real a = 1;
|
|---|
| 4 | Real x;
|
|---|
| 5 | output Real y;
|
|---|
| 6 | initial equation
|
|---|
| 7 | y = 0;
|
|---|
| 8 | equation
|
|---|
| 9 | x = a*time;
|
|---|
| 10 | der(y) = x/2;
|
|---|
| 11 | end base;
|
|---|
| 12 |
|
|---|
| 13 | model C1
|
|---|
| 14 | extends base(a=2);
|
|---|
| 15 | parameter Real b = 4;
|
|---|
| 16 | Real m;
|
|---|
| 17 | equation
|
|---|
| 18 | m = 2*time/b;
|
|---|
| 19 | end C1;
|
|---|
| 20 |
|
|---|
| 21 | model C2
|
|---|
| 22 | extends base(a=6);
|
|---|
| 23 | parameter Real c = 10;
|
|---|
| 24 | Real n;
|
|---|
| 25 | equation
|
|---|
| 26 | n = 10*time+c;
|
|---|
| 27 | end C2;
|
|---|
| 28 |
|
|---|
| 29 | model main
|
|---|
| 30 | Real y_sum;
|
|---|
| 31 | C1 c1;
|
|---|
| 32 | C2 c2;
|
|---|
| 33 | base[2] B = {c1,c2};
|
|---|
| 34 | equation
|
|---|
| 35 | y_sum = sum(B.y);
|
|---|
| 36 | end main;
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 | end test2;
|
|---|
Download in other formats: