Skip to content

Commit 4d65de3

Browse files
author
vruge
committed
added tests for complex function
update tests
1 parent 769f154 commit 4d65de3

File tree

9 files changed

+590
-189
lines changed

9 files changed

+590
-189
lines changed

openmodelica/cruntime/xmlFiles/testxmlInfoAllEqnsCorrectOrder.mos

Lines changed: 163 additions & 163 deletions
Large diffs are not rendered by default.

openmodelica/debugDumps/lateInline.mos

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,6 +2244,97 @@ buildModel(testOptdaedump); getErrorString();
22442244
// ========================================
22452245
//
22462246
//
2247+
// post-optimization module simplifyComplexFunction:
2248+
//
2249+
//
2250+
// unspecified partition
2251+
// ========================================
2252+
//
2253+
// Variables (3)
2254+
// ========================================
2255+
// 1: y:VARIABLE() .testOptdaedump, .Real type: Real []
2256+
// 2: x:VARIABLE() .testOptdaedump, .Real type: Real []
2257+
// 3: $cse1:VARIABLE() type: Real []
2258+
//
2259+
//
2260+
// Equations (3, 3)
2261+
// ========================================
2262+
// 1/1 (1): x = time ^ 3.0 + $cse1 [binding]
2263+
// 2/2 (1): y = $cse1 + x [binding]
2264+
// 3/3 (1): $cse1 = exp(time ^ 3.0) [binding]
2265+
//
2266+
//
2267+
// Simple Equations (0, 0)
2268+
// ========================================
2269+
//
2270+
//
2271+
// State Sets
2272+
// ========================================
2273+
//
2274+
//
2275+
// Matching
2276+
// ========================================
2277+
// 3 variables and equations
2278+
// var 1 is solved in eqn 2
2279+
// var 2 is solved in eqn 1
2280+
// var 3 is solved in eqn 3
2281+
//
2282+
//
2283+
// StrongComponents
2284+
// ========================================
2285+
// {3:3}
2286+
// {1:2}
2287+
// {2:1}
2288+
//
2289+
//
2290+
//
2291+
// BackendDAEType: simulation
2292+
//
2293+
//
2294+
// Known Variables (constants) (0)
2295+
// ========================================
2296+
//
2297+
//
2298+
// External Objects (0)
2299+
// ========================================
2300+
//
2301+
//
2302+
// Classes of External Objects (0)
2303+
// ========================================
2304+
//
2305+
//
2306+
// Alias Variables (0)
2307+
// ========================================
2308+
//
2309+
//
2310+
// Simple Shared Equations (0, 0)
2311+
// ========================================
2312+
//
2313+
//
2314+
// Initial Equations (0, 0)
2315+
// ========================================
2316+
//
2317+
//
2318+
// Zero Crossings (0)
2319+
// ========================================
2320+
//
2321+
//
2322+
// Relations (0)
2323+
// ========================================
2324+
//
2325+
//
2326+
// Time Events (0)
2327+
// ========================================
2328+
//
2329+
//
2330+
// When Clauses (0)
2331+
// ========================================
2332+
//
2333+
//
2334+
// Constraints (0)
2335+
// ========================================
2336+
//
2337+
//
22472338
// post-optimization module symEuler:
22482339
//
22492340
//

openmodelica/debugDumps/optdaedump.mos

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3021,6 +3021,127 @@ buildModel(testOptdaedump); getErrorString();
30213021
// ========================================
30223022
//
30233023
//
3024+
// post-optimization module simplifyComplexFunction:
3025+
//
3026+
//
3027+
// unspecified partition
3028+
// ========================================
3029+
//
3030+
// Variables (9)
3031+
// ========================================
3032+
// 1: iC:VARIABLE() .testOptdaedump, .Real type: Real []
3033+
// 2: iL:STATE(1)() .testOptdaedump, .Real type: Real []
3034+
// 3: i2:VARIABLE() .testOptdaedump, .Real type: Real []
3035+
// 4: i1:VARIABLE() .testOptdaedump, .Real type: Real []
3036+
// 5: i0:VARIABLE() .testOptdaedump, .Real type: Real []
3037+
// 6: uC:DUMMY_STATE() .testOptdaedump, .Real type: Real []
3038+
// 7: uL:VARIABLE() .testOptdaedump, .Real type: Real []
3039+
// 8: u1:VARIABLE() .testOptdaedump, .Real type: Real []
3040+
// 9: $DER.uC:DUMMY_DER(fixed = false ) .testOptdaedump, .Real type: Real []
3041+
//
3042+
//
3043+
// Equations (9, 9)
3044+
// ========================================
3045+
// 1/1 (1): $DER.uC = -sin(time) [dynamic]
3046+
// 2/2 (1): u1 = R1 * i1 [dynamic]
3047+
// 3/3 (1): u1 = uC - uL [dynamic]
3048+
// 4/4 (1): uL = R2 * i2 [dynamic]
3049+
// 5/5 (1): uL = L * der(iL) [dynamic]
3050+
// 6/6 (1): iC = C * $DER.uC [dynamic]
3051+
// 7/7 (1): i0 = i1 + iC [dynamic]
3052+
// 8/8 (1): i1 = i2 + iL [dynamic]
3053+
// 9/9 (1): uC = cos(time) [dynamic]
3054+
//
3055+
//
3056+
// Simple Equations (0, 0)
3057+
// ========================================
3058+
//
3059+
//
3060+
// State Sets
3061+
// ========================================
3062+
//
3063+
//
3064+
// Matching
3065+
// ========================================
3066+
// 9 variables and equations
3067+
// var 1 is solved in eqn 6
3068+
// var 2 is solved in eqn 5
3069+
// var 3 is solved in eqn 8
3070+
// var 4 is solved in eqn 2
3071+
// var 5 is solved in eqn 7
3072+
// var 6 is solved in eqn 9
3073+
// var 7 is solved in eqn 4
3074+
// var 8 is solved in eqn 3
3075+
// var 9 is solved in eqn 1
3076+
//
3077+
//
3078+
// StrongComponents
3079+
// ========================================
3080+
// {9:6}
3081+
// {2, 8, 4, 3:8, 7, 3, 4} Size: 4 Jacobian Linear
3082+
// {5:2}
3083+
// {1:9}
3084+
// {6:1}
3085+
// {7:5}
3086+
//
3087+
//
3088+
//
3089+
// BackendDAEType: simulation
3090+
//
3091+
//
3092+
// Known Variables (constants) (5)
3093+
// ========================================
3094+
// 1: C:PARAM() = 3.0 .testOptdaedump, .Real type: Real []
3095+
// 2: L:PARAM() = 0.5 .testOptdaedump, .Real type: Real []
3096+
// 3: R2:PARAM() = 2.0 .testOptdaedump, .Real type: Real []
3097+
// 4: R1:PARAM() = 1.0 .testOptdaedump, .Real type: Real []
3098+
// 5: v0:VARIABLE() = 0.0 .testOptdaedump, .Real type: Real []
3099+
//
3100+
//
3101+
// External Objects (0)
3102+
// ========================================
3103+
//
3104+
//
3105+
// Classes of External Objects (0)
3106+
// ========================================
3107+
//
3108+
//
3109+
// Alias Variables (4)
3110+
// ========================================
3111+
// 1: u0:VARIABLE() = uC .testOptdaedump, .Real type: Real []
3112+
// 2: u2:VARIABLE() = uL .testOptdaedump, .Real type: Real []
3113+
// 3: v1:VARIABLE() = uC .testOptdaedump, .Real type: Real []
3114+
// 4: v2:VARIABLE() = uL .testOptdaedump, .Real type: Real []
3115+
//
3116+
//
3117+
// Simple Shared Equations (0, 0)
3118+
// ========================================
3119+
//
3120+
//
3121+
// Initial Equations (0, 0)
3122+
// ========================================
3123+
//
3124+
//
3125+
// Zero Crossings (0)
3126+
// ========================================
3127+
//
3128+
//
3129+
// Relations (0)
3130+
// ========================================
3131+
//
3132+
//
3133+
// Time Events (0)
3134+
// ========================================
3135+
//
3136+
//
3137+
// When Clauses (0)
3138+
// ========================================
3139+
//
3140+
//
3141+
// Constraints (0)
3142+
// ========================================
3143+
//
3144+
//
30243145
// post-optimization module symEuler:
30253146
//
30263147
//

simulation/modelica/events/EventTests2.mos

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,47 +23,47 @@ simulate(testEvents2, numberOfIntervals=19, simflags="-lv=LOG_EVENTS"); getError
2323
// resultFile = "testEvents2_res.mat",
2424
// simulationOptions = "startTime = -1.0, stopTime = 1.0, numberOfIntervals = 20, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'testEvents2', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-lv=LOG_EVENTS'",
2525
// messages = "LOG_EVENTS | info | status of relations at time=-1
26-
// | | | | | [1] (pre: false) false = time >= 0.2
27-
// | | | | | [2] (pre: false) false = time > 0.1
28-
// | | | | | [3] (pre: true) true = time <= -0.1
29-
// | | | | | [4] (pre: true) true = time < -0.2
26+
// | | | | | [1] (pre: true) true = time < -0.2
27+
// | | | | | [2] (pre: true) true = time <= -0.1
28+
// | | | | | [3] (pre: false) false = time > 0.1
29+
// | | | | | [4] (pre: false) false = time >= 0.2
3030
// LOG_EVENTS | info | status of zero crossings at time=-1
31-
// | | | | | [1] (pre: 0) -1 = time >= 0.2
32-
// | | | | | [2] (pre: 0) -1 = time > 0.1
33-
// | | | | | [3] (pre: 0) 1 = time <= -0.1
34-
// | | | | | [4] (pre: 0) 1 = time < -0.2
31+
// | | | | | [1] (pre: 0) 1 = time < -0.2
32+
// | | | | | [2] (pre: 0) 1 = time <= -0.1
33+
// | | | | | [3] (pre: 0) -1 = time > 0.1
34+
// | | | | | [4] (pre: 0) -1 = time >= 0.2
3535
// LOG_EVENTS | info | state event at time=-0.19999999988
36-
// | | | | | [4] time < -0.2
36+
// | | | | | [1] time < -0.2
3737
// LOG_EVENTS | info | state event at time=-0.0999999998894
38-
// | | | | | [3] time <= -0.1
38+
// | | | | | [2] time <= -0.1
3939
// LOG_EVENTS | info | state event at time=0.100000000111
40-
// | | | | | [2] time > 0.1
40+
// | | | | | [3] time > 0.1
4141
// LOG_EVENTS | info | state event at time=0.20000000012
42-
// | | | | | [1] time >= 0.2
42+
// | | | | | [4] time >= 0.2
4343
// "
4444
// end SimulationResult;
4545
// ""
4646
// record SimulationResult
4747
// resultFile = "testEvents2_res.mat",
4848
// simulationOptions = "startTime = -1.0, stopTime = 1.0, numberOfIntervals = 19, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'testEvents2', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-lv=LOG_EVENTS'",
4949
// messages = "LOG_EVENTS | info | status of relations at time=-1
50-
// | | | | | [1] (pre: false) false = time >= 0.2
51-
// | | | | | [2] (pre: false) false = time > 0.1
52-
// | | | | | [3] (pre: true) true = time <= -0.1
53-
// | | | | | [4] (pre: true) true = time < -0.2
50+
// | | | | | [1] (pre: true) true = time < -0.2
51+
// | | | | | [2] (pre: true) true = time <= -0.1
52+
// | | | | | [3] (pre: false) false = time > 0.1
53+
// | | | | | [4] (pre: false) false = time >= 0.2
5454
// LOG_EVENTS | info | status of zero crossings at time=-1
55-
// | | | | | [1] (pre: 0) -1 = time >= 0.2
56-
// | | | | | [2] (pre: 0) -1 = time > 0.1
57-
// | | | | | [3] (pre: 0) 1 = time <= -0.1
58-
// | | | | | [4] (pre: 0) 1 = time < -0.2
55+
// | | | | | [1] (pre: 0) 1 = time < -0.2
56+
// | | | | | [2] (pre: 0) 1 = time <= -0.1
57+
// | | | | | [3] (pre: 0) -1 = time > 0.1
58+
// | | | | | [4] (pre: 0) -1 = time >= 0.2
5959
// LOG_EVENTS | info | state event at time=-0.19999999988
60-
// | | | | | [4] time < -0.2
60+
// | | | | | [1] time < -0.2
6161
// LOG_EVENTS | info | state event at time=-0.0999999998894
62-
// | | | | | [3] time <= -0.1
62+
// | | | | | [2] time <= -0.1
6363
// LOG_EVENTS | info | state event at time=0.100000000111
64-
// | | | | | [2] time > 0.1
64+
// | | | | | [3] time > 0.1
6565
// LOG_EVENTS | info | state event at time=0.20000000012
66-
// | | | | | [1] time >= 0.2
66+
// | | | | | [4] time >= 0.2
6767
// "
6868
// end SimulationResult;
6969
// ""

simulation/modelica/initialization/autoFixed.mos

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ res := readSimulationResult("initializationTests.autoFixed.test6_res.mat", {time
117117
// messages = ""
118118
// end SimulationResult;
119119
// "Warning: Assuming fixed start value for the following 1 variables:
120-
// b:VARIABLE(start = 2.0 ) "comment b".initializationTests.autoFixed.test4, .Real type: Real []
120+
// a:DISCRETE(start = 1.0 fixed = false ) "comment a".initializationTests.autoFixed.test4, .Real type: Real []
121121
// "
122122
// record SimulationResult
123123
// resultFile = "initializationTests.autoFixed.test5_res.mat",

simulation/modelica/others/Bug3023.mos

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ val(z,1.0);
3131
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'foo', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
3232
// messages = ""
3333
// end SimulationResult;
34-
// ""
34+
// "Warning: There are iteration variables with default zero start attribute. Use +d=initialization for more information.
35+
// "
3536
// 0.0
3637
// -0.3333333333333333
3738
// -0.6666666666666666
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
model problem1
2+
function f
3+
input Real x;
4+
input Real y;
5+
output Real a;
6+
output Real b;
7+
algorithm
8+
a := x + y;
9+
b := x - y;
10+
end f;
11+
12+
Real x, y(start =0);
13+
equation
14+
(x, y) = f(time, 2 * y + sqrt(time));
15+
end problem1;
16+
17+
model problem2
18+
function f
19+
input Real x;
20+
input Real y;
21+
output Real a;
22+
output Real b;
23+
algorithm
24+
a := x + y;
25+
b := x - y;
26+
end f;
27+
28+
Real z = -y;
29+
Real x, y;
30+
equation
31+
(x, y) = f(time, 1 + sqrt(time));
32+
end problem2;
33+

0 commit comments

Comments
 (0)