Debian Codegraph @

tests/inputs/SimpleODE.mo

raw
1 /*
2 based on
3 https://raw.githubusercontent.com/casella/ScalableTestSuite/master/ScalableTestSuite/Elementary/SimpleODE.mo
4
5 */
6
7 within ScalableTestSuite.Elementary;
8 package SimpleODE "Models with simple ODE systems"
9 package Models
10 model CascadedFirstOrder
11 "N cascaded first order systems, approximating a pure delay"
12 parameter Integer N = 10 "Order of the system";
13 parameter Modelica.Units.SI.Time T=1 "System delay";
14 final parameter Modelica.Units.SI.Time tau=T/N "Individual time constant";
15 Real x[N]( each start = 0, each fixed = true) "State array";
16 Real u = 1 "Cascaded system input";
17 equation
18 tau*der(x[1]) = u - x[1];
19 for i in 2:N loop
20 tau*der(x[i]) = x[i-1] - x[i];
21 end for;
22 annotation(
23 experiment(StopTime = 2,Tolerance = 1e-6),
24 Documentation(info = "<html><p>This model is meant to try out the tool
25 performance with ODE systems of possibly very large size, with high
26 sparsity degree.</p>
27 <p> The model is a cascaded connection of first order linear systems,
28 approximating a pure delay of <tt>T</tt> seconds as <tt>N</tt> approaches
29 infinity. It contains exactly <tt>N</tt> state variables and <tt>N</tt>
30 differential equations.</p></html>"));
31 end CascadedFirstOrder;
32 end Models;
33
34 package ScaledExperiments
35 model CascadedFirstOrder_N_100
36 extends Models.CascadedFirstOrder(N=100);
37 annotation(experiment(StopTime = 2, Tolerance = 1e-6),
38 __OpenModelica_simulationFlags(s = "ida"));
39 end CascadedFirstOrder_N_100;
40
41 // model CascadedFirstOrder_N_200
42 // extends Models.CascadedFirstOrder(N=200);
43 // annotation(experiment(StopTime = 2, Tolerance = 1e-6),
44 // __OpenModelica_simulationFlags(s = "ida"));
45 // end CascadedFirstOrder_N_200;
46
47 model CascadedFirstOrder_N_400
48 extends Models.CascadedFirstOrder(N=400);
49 annotation(experiment(StopTime = 2, Tolerance = 1e-6),
50 __OpenModelica_simulationFlags(s = "ida"));
51 end CascadedFirstOrder_N_400;
52
53 model CascadedFirstOrder_N_25600
54 extends Models.CascadedFirstOrder(N=25600);
55 annotation(experiment(StopTime = 2, Tolerance = 1e-6),
56 __OpenModelica_simulationFlags(s = "ida"));
57 end CascadedFirstOrder_N_25600;
58 end ScaledExperiments;
59 end SimpleODE;