-
Notifications
You must be signed in to change notification settings - Fork 297
/
cse2.mos
97 lines (94 loc) · 3.12 KB
/
cse2.mos
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// name: cse2
// keywords: cse
// status: correct
loadString("
model Tearing3 \"Example from Book Continous System Simulation by F. Cellier page 277\"
Real u0;
Real u1;
Real u2;
Real uL;
Real uC;
Real i0;
Real i1;
Real i2(start=0,fixed=true);
Real iL;
Real iC;
parameter Real R1=1;
parameter Real R2=2;
parameter Real L=0.5;
parameter Real C=3;
equation
u0 = sin(time);
u1 = R1*i1;
u2 = R2*i2;
uL = L*der(iL);
iC = C*der(uC);
u0 = u1 + uL;
uC = u1 + u2;
uL = u2;
i0 = i1 + iC;
i1 = i2 + iL;
end Tearing3;
"); getErrorString();
setDebugFlags("dumpCSE"); getErrorString();
setTearingMethod("cellier"); getErrorString();
setCommandLineOptions("+tearingHeuristic=MC1 +cseCall +cseBinary"); getErrorString();
simulate(Tearing3); getErrorString();
// Result:
// true
// ""
// true
// ""
// true
// ""
// true
// ""
//
// ########### Updated Variable List ########### (17)
// ========================================
// 1: iC:VARIABLE() .Tearing3, .Real type: Real []
// 2: iL:DUMMY_STATE() .Tearing3, .Real type: Real []
// 3: i2:STATE(1)(start = 0.0 fixed = true ) .Tearing3, .Real type: Real []
// 4: i1:DUMMY_STATE() .Tearing3, .Real type: Real []
// 5: i0:VARIABLE() .Tearing3, .Real type: Real []
// 6: uC:DUMMY_STATE() .Tearing3, .Real type: Real []
// 7: uL:DUMMY_STATE() .Tearing3, .Real type: Real []
// 8: u1:DUMMY_STATE() .Tearing3, .Real type: Real []
// 9: u0:DUMMY_STATE() .Tearing3, .Real type: Real []
// 10: $DER.u0:DUMMY_DER(fixed = false ) .Tearing3, .Real type: Real []
// 11: $DER.u1:DUMMY_DER(fixed = false ) .Tearing3, .Real type: Real []
// 12: $DER.uL:DUMMY_DER(fixed = false ) .Tearing3, .Real type: Real []
// 13: $DER.uC:DUMMY_DER(fixed = false ) .Tearing3, .Real type: Real []
// 14: $DER.i1:DUMMY_DER(fixed = false ) .Tearing3, .Real type: Real []
// 15: $DER.iL:DUMMY_DER(fixed = false ) .Tearing3, .Real type: Real []
// 16: $cse12:VARIABLE() type: Real []
// 17: $cse3:VARIABLE() type: Real []
//
//
// ########### Updated Equation List ########### (17, 17)
// ========================================
// 1/1 (1): $DER.i1 = der(i2) + $DER.iL [dynamic]
// 2/2 (1): i0 = i1 + iC [dynamic]
// 3/3 (1): $DER.uC = $cse3 [dynamic]
// 4/4 (1): $DER.u0 = $cse3 [dynamic]
// 5/5 (1): iC = C * $DER.uC [dynamic]
// 6/6 (1): uL = L * $DER.iL [dynamic]
// 7/7 (1): $DER.uL = R2 * der(i2) [dynamic]
// 8/8 (1): $DER.u1 = R1 * $DER.i1 [dynamic]
// 9/9 (1): $DER.u0 = cos(time) [dynamic]
// 10/10 (1): u0 = sin(time) [dynamic]
// 11/11 (1): u1 = R1 * i1 [dynamic]
// 12/12 (1): uL = R2 * i2 [dynamic]
// 13/13 (1): u0 = $cse12 [dynamic]
// 14/14 (1): uC = $cse12 [dynamic]
// 15/15 (1): i1 = i2 + iL [dynamic]
// 16/16 (1): $cse12 = u1 + uL [binding]
// 17/17 (1): $cse3 = $DER.u1 + $DER.uL [binding]
//
// record SimulationResult
// resultFile = "Tearing3_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Tearing3', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = ""
// end SimulationResult;
// ""
// endResult