-
Notifications
You must be signed in to change notification settings - Fork 298
/
CevalScriptBackend.mo
8574 lines (7739 loc) · 325 KB
/
CevalScriptBackend.mo
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-2014, Open Source Modelica Consortium (OSMC),
* c/o Linköpings universitet, Department of Computer and Information Science,
* SE-58183 Linköping, Sweden.
*
* All rights reserved.
*
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3 LICENSE OR
* THIS OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2.
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES
* RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3,
* ACCORDING TO RECIPIENTS CHOICE.
*
* The OpenModelica software and the Open Source Modelica
* Consortium (OSMC) Public License (OSMC-PL) are obtained
* from OSMC, either from the above address,
* from the URLs: http://www.ida.liu.se/projects/OpenModelica or
* http://www.openmodelica.org, and in the OpenModelica distribution.
* GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html.
*
* This program is distributed WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
* IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL.
*
* See the full OSMC Public License conditions for more details.
*
*/
encapsulated package CevalScriptBackend
"
This module handles constant propagation of expressions for scripting
functions. This module contains the parts not needed for the
bootstrapping.
"
// public imports
import Absyn;
import AbsynUtil;
import AbsynJLDumpTpl;
import BackendDAE;
import Ceval;
import DAE;
import FCore;
import GlobalScript;
import Interactive;
import InteractiveUtil;
import Values;
import SimCode;
import UnitAbsyn;
// protected imports
protected
import AbsynToJulia;
import AbsynToSCode;
import Autoconf;
import BackendDAECreate;
import BackendDAEOptimize;
import BackendDAEUtil;
import BackendDump;
import BackendEquation;
import BackendVariable;
import Binding;
import BlockCallRewrite;
import CevalScript;
import CheckModel;
import ClassInf;
import ClockIndexes;
import CodegenFMU;
import ComponentReference;
import Config;
import DAEDump;
import DAEQuery;
import DAEUtil;
import Debug;
import DiffAlgorithm;
import Dump;
import Error;
import ErrorExt;
import ErrorTypes;
import ExecStat;
import Expression;
import ExpressionDump;
import FBuiltin;
import FGraph;
import FGraphDump;
import Figaro;
import FindZeroCrossings;
import FInst;
import Flags;
import FlagsUtil;
import FMI;
import FMIExt;
import GC;
import Graph;
import HashSetString;
import InnerOuter;
import Inst;
import LexerModelicaDiff;
import List;
import Lookup;
import NFFlatModel;
import NFFlatten;
import NFInst;
import NFSCodeEnv;
import NFSCodeFlatten;
import NFSCodeLookup;
import OpenTURNS;
import PackageManagement;
import Parser;
import Print;
import Refactor;
import RewriteRules;
import SCode;
import SCodeDump;
import SCodeUtil;
import Settings;
import SimCodeMain;
import SimpleModelicaParser;
import SimulationResults;
import StaticScript;
import StringUtil;
import SymbolicJacobian;
import SymbolTable;
import System;
import TaskGraphResults;
import Tpl;
import Types;
import Uncertainties;
import UnitAbsynBuilder;
import UnitParserExt;
import Util;
import ValuesUtil;
import XMLDump;
protected constant DAE.Type simulationResultType_rtest = DAE.T_COMPLEX(ClassInf.RECORD(Absyn.IDENT("SimulationResult")),{
DAE.TYPES_VAR("resultFile",DAE.dummyAttrVar,DAE.T_STRING_DEFAULT,DAE.UNBOUND(),false,NONE()),
DAE.TYPES_VAR("simulationOptions",DAE.dummyAttrVar,DAE.T_STRING_DEFAULT,DAE.UNBOUND(),false,NONE()),
DAE.TYPES_VAR("messages",DAE.dummyAttrVar,DAE.T_STRING_DEFAULT,DAE.UNBOUND(),false,NONE())
},NONE());
protected constant DAE.Type simulationResultType_full = DAE.T_COMPLEX(ClassInf.RECORD(Absyn.IDENT("SimulationResult")),{
DAE.TYPES_VAR("resultFile",DAE.dummyAttrVar,DAE.T_STRING_DEFAULT,DAE.UNBOUND(),false,NONE()),
DAE.TYPES_VAR("simulationOptions",DAE.dummyAttrVar,DAE.T_STRING_DEFAULT,DAE.UNBOUND(),false,NONE()),
DAE.TYPES_VAR("messages",DAE.dummyAttrVar,DAE.T_STRING_DEFAULT,DAE.UNBOUND(),false,NONE()),
DAE.TYPES_VAR("timeFrontend",DAE.dummyAttrVar,DAE.T_REAL_DEFAULT,DAE.UNBOUND(),false,NONE()),
DAE.TYPES_VAR("timeBackend",DAE.dummyAttrVar,DAE.T_REAL_DEFAULT,DAE.UNBOUND(),false,NONE()),
DAE.TYPES_VAR("timeSimCode",DAE.dummyAttrVar,DAE.T_REAL_DEFAULT,DAE.UNBOUND(),false,NONE()),
DAE.TYPES_VAR("timeTemplates",DAE.dummyAttrVar,DAE.T_REAL_DEFAULT,DAE.UNBOUND(),false,NONE()),
DAE.TYPES_VAR("timeCompile",DAE.dummyAttrVar,DAE.T_REAL_DEFAULT,DAE.UNBOUND(),false,NONE()),
DAE.TYPES_VAR("timeSimulation",DAE.dummyAttrVar,DAE.T_REAL_DEFAULT,DAE.UNBOUND(),false,NONE()),
DAE.TYPES_VAR("timeTotal",DAE.dummyAttrVar,DAE.T_REAL_DEFAULT,DAE.UNBOUND(),false,NONE())
},NONE());
protected constant DAE.Type simulationResultType_drModelica = DAE.T_COMPLEX(ClassInf.RECORD(Absyn.IDENT("SimulationResult")),{
DAE.TYPES_VAR("messages",DAE.dummyAttrVar,DAE.T_STRING_DEFAULT,DAE.UNBOUND(),false,NONE()),
DAE.TYPES_VAR("flatteningTime",DAE.dummyAttrVar,DAE.T_REAL_DEFAULT,DAE.UNBOUND(),false,NONE()),
DAE.TYPES_VAR("simulationTime",DAE.dummyAttrVar,DAE.T_REAL_DEFAULT,DAE.UNBOUND(),false,NONE())
},NONE());
//these are in reversed order than above
protected constant list<tuple<String,Values.Value>> zeroAdditionalSimulationResultValues =
{ ("timeTotal", Values.REAL(0.0)),
("timeSimulation", Values.REAL(0.0)),
("timeCompile", Values.REAL(0.0)),
("timeTemplates", Values.REAL(0.0)),
("timeSimCode", Values.REAL(0.0)),
("timeBackend", Values.REAL(0.0)),
("timeFrontend", Values.REAL(0.0))
};
protected constant DAE.Exp defaultStartTime = DAE.RCONST(0.0) "default startTime";
protected constant DAE.Exp defaultStopTime = DAE.RCONST(1.0) "default stopTime";
protected constant DAE.Exp defaultNumberOfIntervals = DAE.ICONST(500) "default numberOfIntervals";
protected constant DAE.Exp defaultStepSize = DAE.RCONST(0.002) "default stepSize";
protected constant DAE.Exp defaultTolerance = DAE.RCONST(1e-6) "default tolerance";
protected constant DAE.Exp defaultMethod = DAE.SCONST("dassl") "default method";
protected constant DAE.Exp defaultFileNamePrefix = DAE.SCONST("") "default fileNamePrefix";
protected constant DAE.Exp defaultOptions = DAE.SCONST("") "default options";
protected constant DAE.Exp defaultOutputFormat = DAE.SCONST("mat") "default outputFormat";
protected constant DAE.Exp defaultVariableFilter = DAE.SCONST(".*") "default variableFilter; does whole string matching, i.e. it becomes ^.*$ in the runtime";
protected constant DAE.Exp defaultCflags = DAE.SCONST("") "default compiler flags";
protected constant DAE.Exp defaultSimflags = DAE.SCONST("") "default simulation flags";
protected constant GlobalScript.SimulationOptions defaultSimulationOptions =
GlobalScript.SIMULATION_OPTIONS(
defaultStartTime,
defaultStopTime,
defaultNumberOfIntervals,
defaultStepSize,
defaultTolerance,
defaultMethod,
defaultFileNamePrefix,
defaultOptions,
defaultOutputFormat,
defaultVariableFilter,
defaultCflags,
defaultSimflags
) "default simulation options";
protected constant list<String> simulationOptionsNames =
{
"startTime",
"stopTime",
"numberOfIntervals",
"tolerance",
"method",
"fileNamePrefix",
"options",
"outputFormat",
"variableFilter",
"cflags",
"simflags"
} "names of simulation options";
public function getSimulationResultType
output DAE.Type t;
algorithm
t := if Testsuite.isRunning() then simulationResultType_rtest else simulationResultType_full;
end getSimulationResultType;
public function getDrModelicaSimulationResultType
output DAE.Type t;
algorithm
t := if Testsuite.isRunning() then simulationResultType_rtest else simulationResultType_drModelica;
end getDrModelicaSimulationResultType;
public function createSimulationResult
input String resultFile;
input String options;
input String message;
input list<tuple<String,Values.Value>> inAddResultValues "additional values in reversed order; expected values see in CevalScript.simulationResultType_full";
output Values.Value res;
protected
list<tuple<String,Values.Value>> resultValues;
list<Values.Value> vals;
list<String> fields;
Boolean isTestType,notest;
algorithm
resultValues := listReverse(inAddResultValues);
//TODO: maybe we should test if the fields are the ones in simulationResultType_full
notest := not Testsuite.isRunning();
fields := if notest then List.map(resultValues, Util.tuple21) else {};
vals := if notest then List.map(resultValues, Util.tuple22) else {};
res := Values.RECORD(Absyn.IDENT("SimulationResult"),
Values.STRING(resultFile)::Values.STRING(options)::Values.STRING(message)::vals,
"resultFile"::"simulationOptions"::"messages"::fields,-1);
end createSimulationResult;
public function createDrModelicaSimulationResult
input String resultFile;
input String options;
input String message;
input list<tuple<String,Values.Value>> inAddResultValues "additional values in reversed order; expected values see in CevalScript.simulationResultType_full";
output Values.Value res;
protected
list<tuple<String,Values.Value>> resultValues;
list<Values.Value> vals;
list<String> fields;
Boolean isTestType,notest;
algorithm
resultValues := listReverse(inAddResultValues);
//TODO: maybe we should test if the fields are the ones in simulationResultType_full
notest := not Testsuite.isRunning();
fields := if notest then List.map(resultValues, Util.tuple21) else {};
vals := if notest then List.map(resultValues, Util.tuple22) else {};
res := Values.RECORD(Absyn.IDENT("SimulationResult"),Values.STRING(message)::
vals, "messages"::fields,-1);
end createDrModelicaSimulationResult;
public function createSimulationResultFailure
input String message;
input String options;
output Values.Value res;
protected
list<Values.Value> vals;
list<String> fields;
algorithm
res := createSimulationResult("", options, message, zeroAdditionalSimulationResultValues);
end createSimulationResultFailure;
public function createDrModelicaSimulationResultFailure
input String message;
input String options;
output Values.Value res;
protected
list<Values.Value> vals;
list<String> fields;
algorithm
res := createDrModelicaSimulationResult("", options, message, {});
end createDrModelicaSimulationResultFailure;
protected function buildCurrentSimulationResultExp
output DAE.Exp outExp;
protected
DAE.ComponentRef cref;
algorithm
cref := ComponentReference.makeCrefIdent("currentSimulationResult",DAE.T_UNKNOWN_DEFAULT,{});
outExp := Expression.makeCrefExp(cref,DAE.T_UNKNOWN_DEFAULT);
end buildCurrentSimulationResultExp;
protected function cevalCurrentSimulationResultExp
input FCore.Cache inCache;
input FCore.Graph env;
input String inputFilename;
input Absyn.Msg msg;
output FCore.Cache outCache;
output String filename;
algorithm
(outCache,filename) := match (inCache,env,inputFilename,msg)
local FCore.Cache cache;
case (cache,_,"<default>",_)
equation
(cache,Values.STRING(filename)) = Ceval.ceval(cache,env,buildCurrentSimulationResultExp(),true,msg,0);
then (cache,filename);
else (inCache,inputFilename);
end match;
end cevalCurrentSimulationResultExp;
public function convertSimulationOptionsToSimCode "converts SimulationOptions to SimCode.SimulationSettings"
input GlobalScript.SimulationOptions opts;
output SimCode.SimulationSettings settings;
algorithm
settings := match(opts)
local
Real startTime,stopTime,stepSize,tolerance;
Integer nIntervals;
String method,format,varFilter,cflags,options;
case(GlobalScript.SIMULATION_OPTIONS(
DAE.RCONST(startTime),
DAE.RCONST(stopTime),
DAE.ICONST(nIntervals),
DAE.RCONST(stepSize),
DAE.RCONST(tolerance),
DAE.SCONST(method),
_, /* fileNamePrefix*/
_, /* options */
DAE.SCONST(format),
DAE.SCONST(varFilter),
DAE.SCONST(cflags),
_)) equation
options = "";
then SimCode.SIMULATION_SETTINGS(startTime,stopTime,nIntervals,stepSize,tolerance,method,options,format,varFilter,cflags);
end match;
end convertSimulationOptionsToSimCode;
public function buildSimulationOptions
"@author: adrpo
builds a SimulationOptions record from the given input"
input DAE.Exp startTime "start time, default 0.0";
input DAE.Exp stopTime "stop time, default 1.0";
input DAE.Exp numberOfIntervals "number of intervals, default 500";
input DAE.Exp stepSize "stepSize, default (stopTime-startTime)/numberOfIntervals";
input DAE.Exp tolerance "tolerance, default 1e-6";
input DAE.Exp method "method, default 'dassl'";
input DAE.Exp fileNamePrefix "file name prefix, default ''";
input DAE.Exp options "options, default ''";
input DAE.Exp outputFormat "output format, default 'plt'";
input DAE.Exp variableFilter;
input DAE.Exp cflags;
input DAE.Exp simflags;
output GlobalScript.SimulationOptions outSimulationOptions;
algorithm
outSimulationOptions :=
GlobalScript.SIMULATION_OPTIONS(
startTime,
stopTime,
numberOfIntervals,
stepSize,
tolerance,
method,
fileNamePrefix,
options,
outputFormat,
variableFilter,
cflags,
simflags
);
end buildSimulationOptions;
public function getSimulationOption
"@author: adrpo
get the value from simulation option"
input GlobalScript.SimulationOptions inSimOpt;
input String optionName;
output DAE.Exp outOptionValue;
algorithm
outOptionValue := match(inSimOpt, optionName)
local
DAE.Exp e;
String name, msg;
case (GlobalScript.SIMULATION_OPTIONS(startTime = e), "startTime") then e;
case (GlobalScript.SIMULATION_OPTIONS(stopTime = e), "stopTime") then e;
case (GlobalScript.SIMULATION_OPTIONS(numberOfIntervals = e), "numberOfIntervals") then e;
case (GlobalScript.SIMULATION_OPTIONS(stepSize = e), "stepSize") then e;
case (GlobalScript.SIMULATION_OPTIONS(tolerance = e), "tolerance") then e;
case (GlobalScript.SIMULATION_OPTIONS(method = e), "method") then e;
case (GlobalScript.SIMULATION_OPTIONS(fileNamePrefix = e), "fileNamePrefix") then e;
case (GlobalScript.SIMULATION_OPTIONS(options = e), "options") then e;
case (GlobalScript.SIMULATION_OPTIONS(outputFormat = e), "outputFormat") then e;
case (GlobalScript.SIMULATION_OPTIONS(variableFilter = e), "variableFilter") then e;
case (GlobalScript.SIMULATION_OPTIONS(cflags = e), "cflags") then e;
case (GlobalScript.SIMULATION_OPTIONS(simflags = e), "simflags") then e;
case (_, name)
equation
msg = "Unknown simulation option: " + name;
Error.addCompilerWarning(msg);
then
fail();
end match;
end getSimulationOption;
public function buildSimulationOptionsFromModelExperimentAnnotation
"@author: adrpo
retrieve annotation(experiment(....)) values and build a SimulationOptions object to return"
input Absyn.Path inModelPath;
input String inFileNamePrefix;
input Option<GlobalScript.SimulationOptions> defaultOption;
output GlobalScript.SimulationOptions outSimOpt;
algorithm
outSimOpt := matchcontinue (inModelPath, inFileNamePrefix, defaultOption)
local
GlobalScript.SimulationOptions defaults, simOpt;
String experimentAnnotationStr;
list<Absyn.NamedArg> named;
// search inside annotation(experiment(...))
case (_, _, _)
equation
defaults = Util.getOptionOrDefault(defaultOption, setFileNamePrefixInSimulationOptions(defaultSimulationOptions, inFileNamePrefix));
experimentAnnotationStr =
Interactive.getNamedAnnotation(
inModelPath,
SymbolTable.getAbsyn(),
Absyn.IDENT("experiment"),
SOME("{}"),
Interactive.getExperimentAnnotationString);
// parse the string we get back, either {} or {StopTime=5, Tolerance = 0.10};
// jump to next case if the annotation is empty
false = stringEq(experimentAnnotationStr, "{}");
// get rid of '{' and '}'
experimentAnnotationStr = System.stringReplace(experimentAnnotationStr, "{", "");
experimentAnnotationStr = System.stringReplace(experimentAnnotationStr, "}", "");
GlobalScript.ISTMTS({GlobalScript.IEXP(exp = Absyn.CALL(functionArgs = Absyn.FUNCTIONARGS(_, named)))}, _)
= Parser.parsestringexp("experiment(" + experimentAnnotationStr + ");\n", "<experiment>");
simOpt = populateSimulationOptions(defaults, named);
then
simOpt;
// if we fail, just use the defaults
else
equation
defaults = setFileNamePrefixInSimulationOptions(defaultSimulationOptions, inFileNamePrefix);
then defaults;
end matchcontinue;
end buildSimulationOptionsFromModelExperimentAnnotation;
protected function setFileNamePrefixInSimulationOptions
input GlobalScript.SimulationOptions inSimOpt;
input String inFileNamePrefix;
output GlobalScript.SimulationOptions outSimOpt;
protected
DAE.Exp startTime, stopTime, numberOfIntervals, stepSize, tolerance, method, fileNamePrefix, options, outputFormat, variableFilter, cflags, simflags;
Boolean UseOtimica;
algorithm
UseOtimica := Config.acceptOptimicaGrammar() or Flags.getConfigBool(Flags.GENERATE_DYN_OPTIMIZATION_PROBLEM);
GlobalScript.SIMULATION_OPTIONS(startTime, stopTime, numberOfIntervals, stepSize, tolerance, method, _, options, outputFormat, variableFilter, cflags, simflags) := inSimOpt;
if UseOtimica then
method := DAE.SCONST("optimization");
elseif Flags.getConfigBool(Flags.DAE_MODE) then
method := DAE.SCONST("ida");
end if;
numberOfIntervals := if UseOtimica then DAE.ICONST(50) else numberOfIntervals;
outSimOpt := GlobalScript.SIMULATION_OPTIONS(startTime, stopTime, numberOfIntervals, stepSize, tolerance, method, DAE.SCONST(inFileNamePrefix), options, outputFormat, variableFilter, cflags, simflags);
end setFileNamePrefixInSimulationOptions;
protected function getConst
"@author: adrpo
Tranform a literal Absyn.Exp to DAE.Exp with the given DAE.Type"
input Absyn.Exp inAbsynExp;
input DAE.Type inExpType;
output DAE.Exp outExp;
algorithm
outExp := matchcontinue(inAbsynExp, inExpType)
local
Integer i;
Real r;
Absyn.Exp exp;
String str;
case (Absyn.UNARY(Absyn.UMINUS(),exp), _)
equation
DAE.ICONST(i) = getConst(exp, inExpType);
i = intNeg(i);
then
DAE.ICONST(i);
case (Absyn.UNARY(Absyn.UMINUS(),exp), _)
equation
DAE.RCONST(r) = getConst(exp, inExpType);
r = realNeg(r);
then
DAE.RCONST(r);
case (Absyn.INTEGER(i), DAE.T_INTEGER()) then DAE.ICONST(i);
case (Absyn.REAL(str), DAE.T_REAL()) equation r = System.stringReal(str); then DAE.RCONST(r);
case (Absyn.INTEGER(i), DAE.T_REAL()) equation r = intReal(i); then DAE.RCONST(r);
else
equation
str = "CevalScript.getConst: experiment annotation contains unsupported expression: " + Dump.printExpStr(inAbsynExp) + " of type " + Types.unparseType(inExpType) + "\n";
Error.addCompilerError(str);
then
fail();
end matchcontinue;
end getConst;
protected function populateSimulationOptions
"@auhtor: adrpo
populate simulation options"
input GlobalScript.SimulationOptions inSimOpt;
input list<Absyn.NamedArg> inExperimentSettings;
output GlobalScript.SimulationOptions outSimOpt;
algorithm
outSimOpt := matchcontinue(inSimOpt, inExperimentSettings)
local
Absyn.Exp exp;
list<Absyn.NamedArg> rest;
GlobalScript.SimulationOptions simOpt;
DAE.Exp startTime;
DAE.Exp stopTime;
DAE.Exp numberOfIntervals;
DAE.Exp stepSize;
DAE.Exp tolerance;
DAE.Exp method;
DAE.Exp fileNamePrefix;
DAE.Exp options;
DAE.Exp outputFormat;
DAE.Exp variableFilter, cflags, simflags;
Real rStepSize, rStopTime, rStartTime;
Integer iNumberOfIntervals;
String name,msg;
case (_, {}) then inSimOpt;
case (GlobalScript.SIMULATION_OPTIONS(startTime, stopTime, numberOfIntervals, stepSize, tolerance, method, fileNamePrefix, options, outputFormat, variableFilter, cflags, simflags),
Absyn.NAMEDARG(argName = "Tolerance", argValue = exp)::rest)
equation
tolerance = getConst(exp, DAE.T_REAL_DEFAULT);
simOpt = populateSimulationOptions(
GlobalScript.SIMULATION_OPTIONS(startTime,stopTime,numberOfIntervals,stepSize,tolerance,method,
fileNamePrefix,options,outputFormat,variableFilter,cflags,simflags),
rest);
then
simOpt;
case (GlobalScript.SIMULATION_OPTIONS(startTime, stopTime, numberOfIntervals, stepSize, tolerance, method, fileNamePrefix, options, outputFormat, variableFilter, cflags, simflags),
Absyn.NAMEDARG(argName = "StartTime", argValue = exp)::rest)
equation
startTime = getConst(exp, DAE.T_REAL_DEFAULT);
simOpt = populateSimulationOptions(
GlobalScript.SIMULATION_OPTIONS(startTime,stopTime,numberOfIntervals,stepSize,tolerance,method,
fileNamePrefix,options,outputFormat,variableFilter,cflags,simflags),
rest);
then
simOpt;
case (GlobalScript.SIMULATION_OPTIONS(startTime, stopTime, numberOfIntervals, stepSize, tolerance, method, fileNamePrefix, options, outputFormat, variableFilter, cflags, simflags),
Absyn.NAMEDARG(argName = "StopTime", argValue = exp)::rest)
equation
stopTime = getConst(exp, DAE.T_REAL_DEFAULT);
simOpt = populateSimulationOptions(
GlobalScript.SIMULATION_OPTIONS(startTime,stopTime,numberOfIntervals,stepSize,tolerance,method,
fileNamePrefix,options,outputFormat,variableFilter,cflags,simflags),
rest);
then
simOpt;
case (GlobalScript.SIMULATION_OPTIONS(startTime, stopTime, numberOfIntervals, stepSize, tolerance, method, fileNamePrefix, options, outputFormat, variableFilter, cflags, simflags),
Absyn.NAMEDARG(argName = "NumberOfIntervals", argValue = exp)::rest)
equation
numberOfIntervals = getConst(exp, DAE.T_INTEGER_DEFAULT);
simOpt = populateSimulationOptions(
GlobalScript.SIMULATION_OPTIONS(startTime,stopTime,numberOfIntervals,stepSize,tolerance,method,
fileNamePrefix,options,outputFormat,variableFilter,cflags,simflags),
rest);
then
simOpt;
case (GlobalScript.SIMULATION_OPTIONS(startTime, stopTime, numberOfIntervals, stepSize, tolerance, method, fileNamePrefix, options, outputFormat, variableFilter, cflags, simflags),
Absyn.NAMEDARG(argName = "Interval", argValue = exp)::rest)
equation
DAE.RCONST(rStepSize) = getConst(exp, DAE.T_REAL_DEFAULT);
// a bit different for Interval, handle it LAST!!!!
GlobalScript.SIMULATION_OPTIONS(startTime,stopTime,numberOfIntervals,stepSize,tolerance,method,
fileNamePrefix,options,outputFormat,variableFilter,cflags,simflags) =
populateSimulationOptions(inSimOpt, rest);
DAE.RCONST(rStartTime) = startTime;
DAE.RCONST(rStopTime) = stopTime;
iNumberOfIntervals = realInt(realDiv(realSub(rStopTime, rStartTime), rStepSize));
numberOfIntervals = DAE.ICONST(iNumberOfIntervals);
stepSize = DAE.RCONST(rStepSize);
simOpt = GlobalScript.SIMULATION_OPTIONS(startTime,stopTime,numberOfIntervals,stepSize,tolerance,method,
fileNamePrefix,options,outputFormat,variableFilter,cflags,simflags);
then
simOpt;
case (_,Absyn.NAMEDARG(argName = name, argValue = exp)::rest)
equation
msg = "Ignoring unknown experiment annotation option: " + name + " = " + Dump.printExpStr(exp);
Error.addCompilerWarning(msg);
simOpt = populateSimulationOptions(inSimOpt, rest);
then
simOpt;
end matchcontinue;
end populateSimulationOptions;
protected function simOptionsAsString
"@author: adrpo
Gets the simulation options as string"
input list<Values.Value> vals;
output String str;
algorithm
str := matchcontinue vals
local
list<String> simOptsValues;
list<Values.Value> lst;
case _::lst
equation
// build a list with the values
simOptsValues = List.map(lst, ValuesUtil.valString);
// trim " from strings!
simOptsValues = List.map2(simOptsValues, System.stringReplace, "\"", "\'");
str = Util.buildMapStr(simulationOptionsNames, simOptsValues, " = ", ", ");
then
str;
// on failure
case (_::lst)
equation
// build a list with the values
simOptsValues = List.map(lst, ValuesUtil.valString);
// trim " from strings!
simOptsValues = List.map2(simOptsValues, System.stringReplace, "\"", "\'");
str = stringDelimitList(simOptsValues, ", ");
then
str;
end matchcontinue;
end simOptionsAsString;
public function cevalInteractiveFunctions3
"defined in the interactive environment."
input FCore.Cache inCache;
input FCore.Graph inEnv;
input String inFunctionName;
input list<Values.Value> inVals;
input Absyn.Msg msg;
output FCore.Cache outCache;
output Values.Value outValue;
protected
import LexerModelicaDiff.{Token,TokenId,tokenContent,scanString,reportErrors,filterModelicaDiff,modelicaDiffTokenEq,modelicaDiffTokenWhitespace};
import DiffAlgorithm.{Diff,diff,printActual,printDiffTerminalColor,printDiffXml};
algorithm
(outCache,outValue) := matchcontinue (inCache,inEnv,inFunctionName,inVals,msg)
local
String omdev,simflags,s1,s2,s3,s4,s5,str,str1,str2,str3,str4,token,varid,cmd,executable,executable1,encoding,method_str,
outputFormat_str,initfilename,pd,executableSuffixedExe,sim_call,result_file,filename_1,filename,
call,str_1,mp,pathstr,name,cname,errMsg,errorStr,
title,xLabel,yLabel,filename2,varNameStr,xml_filename,xml_contents,visvar_str,pwd,omhome,omlib,omcpath,os,
platform,usercflags,senddata,res,workdir,gcc,confcmd,touch_file,uname,filenameprefix,compileDir,libDir,exeDir,configDir,from,to,
gridStr, logXStr, logYStr, x1Str, x2Str, y1Str, y2Str, curveWidthStr, curveStyleStr, legendPosition, footer, autoScaleStr,scriptFile,logFile, simflags2, outputFile,
systemPath, gccVersion, gd, strlinearizeTime, suffix,cname, modeldescriptionfilename, tmpDir, tmpFile;
list<DAE.Exp> simOptions;
list<Values.Value> vals;
Absyn.Path path,classpath,className,baseClassPath;
SCode.Program scodeP,sp;
FCore.Graph env;
Absyn.Program p,ip,pnew;
list<Absyn.Program> newps;
GlobalScript.SimulationOptions simOpt;
Real startTime,stopTime,tolerance,reltol,reltolDiffMinMax,rangeDelta;
DAE.Exp startTimeExp,stopTimeExp,toleranceExp,intervalExp;
DAE.Type tp, ty;
list<DAE.Type> tys;
Absyn.Class absynClass, absynClass2;
Absyn.ClassDef cdef;
Absyn.Exp aexp;
DAE.DAElist dae;
BackendDAE.BackendDAE daelow,optdae;
BackendDAE.Variables vars;
BackendDAE.EquationArray eqnarr;
array<list<Integer>> m,mt;
Option<list<tuple<Integer, Integer, BackendDAE.Equation>>> jac;
Values.Value ret_val,simValue,value,v,cvar,cvar2,v1,v2,v3;
Absyn.ComponentRef cr,cr_1;
Integer size,resI,i,i1,i2,i3,n,curveStyle,numberOfIntervals, status, access;
Option<Integer> fmiContext, fmiInstance, fmiModelVariablesInstance; /* void* implementation: DO NOT UNBOX THE POINTER AS THAT MIGHT CHANGE IT. Just treat this as an opaque type. */
Integer fmiLogLevel, direction;
list<Integer> is;
list<FMI.TypeDefinitions> fmiTypeDefinitionsList;
list<FMI.ModelVariables> fmiModelVariablesList;
FMI.ExperimentAnnotation fmiExperimentAnnotation;
FMI.Info fmiInfo;
list<String> vars_1,args,strings,strs,strs1,strs2,visvars,postOptModStrings,postOptModStringsOrg,mps,files,dirs,modifiernamelst;
Real timeTotal,timeSimulation,timeStamp,val,x1,x2,y1,y2,r,r1,r2,linearizeTime,curveWidth,offset,offset1,offset2,scaleFactor,scaleFactor1,scaleFactor2;
GlobalScript.Statements istmts;
list<GlobalScript.Statements> istmtss;
Boolean have_corba, bval, anyCode, b, b1, b2, b3, b4, b5, externalWindow, logX, logY, autoScale, forceOMPlot, gcc_res, omcfound, rm_res, touch_res, uname_res, ifcpp, ifmsvc,sort, builtin, showProtected, inputConnectors, outputConnectors, sanityCheckFailed, keepRedeclares;
FCore.Cache cache;
Absyn.ComponentRef crefCName;
list<tuple<String,Values.Value>> resultValues;
list<Real> realVals;
list<tuple<String,list<String>>> deps,depstransitive,depstransposed,depstransposedtransitive,depsmerged,depschanged;
Absyn.CodeNode codeNode;
list<Values.Value> cvars,vals2;
list<Absyn.Path> paths;
list<Absyn.NamedArg> nargs;
list<Absyn.Class> classes;
list<Absyn.ElementArg> eltargs,annlst;
Absyn.Within within_;
BackendDAE.EqSystem syst;
BackendDAE.Shared shared;
GlobalScript.SimulationOptions defaulSimOpt;
SimCode.SimulationSettings simSettings;
Boolean dumpExtractionSteps, requireExactVersion;
list<tuple<Absyn.Path,String,list<String>,Boolean>> uses;
Config.LanguageStandard oldLanguageStd;
SCode.Element cl;
list<SCode.Element> cls, elts;
list<String> names, namesPublic, namesProtected, namesChanged, fileNames;
HashSetString.HashSet hashSetString;
list<Boolean> blst;
list<ErrorTypes.TotalMessage> messages;
UnitAbsyn.Unit u1,u2;
Real stoptime,starttime,tol,stepsize,interval;
String stoptime_str,stepsize_str,starttime_str,tol_str,num_intervalls_str,description,prefix,method,annotationname,modifiername,modifiervalue;
list<String> interfaceType;
list<tuple<String,list<String>>> interfaceTypeAssoc;
list<tuple<String,String>> relocatableFunctionsTuple;
SCode.Encapsulated encflag;
SCode.Restriction restr;
list<list<Values.Value>> valsLst;
list<Token> tokens1, tokens2, errorTokens;
list<SimpleModelicaParser.ParseTree> parseTree1, parseTree2;
list<tuple<Diff, list<Token>>> diffs;
list<tuple<Diff, list<SimpleModelicaParser.ParseTree>>> treeDiffs;
SourceInfo info;
SymbolTable forkedSymbolTable;
case (cache,_,"runScriptParallel",{Values.ARRAY(valueLst=vals),Values.INTEGER(i),Values.BOOL(true)},_)
equation
strs = List.map(vals,ValuesUtil.extractValueString);
/* One of the few times we can allow to directly manipulate the symbol table
* Each thread will get a copy of the symbol table and the results will not
* be stored in the parent.
*/
forkedSymbolTable = SymbolTable.get();
blst = System.launchParallelTasks(i, List.map1(strs, Util.makeTuple, forkedSymbolTable), Interactive.evaluateFork);
v = ValuesUtil.makeArray(List.map(blst, ValuesUtil.makeBoolean));
SymbolTable.update(forkedSymbolTable);
then (cache,v);
case (cache,_,"runScriptParallel",{Values.ARRAY(valueLst=vals),Values.INTEGER(i),Values.BOOL(false)},_)
equation
strs = List.map(vals,ValuesUtil.extractValueString);
strs = List.map1r(strs, stringAppend, stringAppend(Settings.getInstallationDirectoryPath(),"/bin/omc "));
is = System.systemCallParallel(strs,i);
v = ValuesUtil.makeArray(List.map(List.map1(is,intEq,0), ValuesUtil.makeBoolean));
then (cache,v);
case (cache,_,"runScriptParallel",{Values.ARRAY(valueLst=vals),_,_},_)
equation
v = ValuesUtil.makeArray(List.fill(Values.BOOL(false), listLength(vals)));
then (cache,v);
case (cache,_,"setClassComment",{Values.CODE(Absyn.C_TYPENAME(path)),Values.STRING(str)},_)
equation
(p,b) = Interactive.setClassComment(path, str, SymbolTable.getAbsyn());
SymbolTable.setAbsyn(p);
then
(cache,Values.BOOL(b));
case (cache, _, "isShortDefinition", {Values.CODE(Absyn.C_TYPENAME(path))}, _)
equation
b = isShortDefinition(path, SymbolTable.getAbsyn());
then
(cache,Values.BOOL(b));
case (cache,_,"getUsedClassNames",{Values.CODE(Absyn.C_TYPENAME(path))},_)
equation
sp = SymbolTable.getSCode();
(sp, _) = NFSCodeFlatten.flattenClassInProgram(path, sp);
sp = SCodeUtil.removeBuiltinsFromTopScope(sp);
paths = Interactive.getSCodeClassNamesRecursive(sp);
// paths = bcallret2(sort, List.sort, paths, AbsynUtil.pathGe, paths);
vals = List.map(paths,ValuesUtil.makeCodeTypeName);
then (cache,ValuesUtil.makeArray(vals));
case (cache,_,"getUsedClassNames",_,_)
then (cache,ValuesUtil.makeArray({}));
case (cache,_,"getClassComment",{Values.CODE(Absyn.C_TYPENAME(path))},_)
equation
Absyn.CLASS(_,_,_,_,_,cdef,_) = Interactive.getPathedClassInProgram(path, SymbolTable.getAbsyn());
str = System.unescapedString(getClassComment(cdef));
then
(cache,Values.STRING(str));
case (cache,_,"getClassComment",{Values.CODE(Absyn.C_TYPENAME(_))},_)
then
(cache,Values.STRING(""));
case (cache,_,"getPackages",{Values.CODE(Absyn.C_TYPENAME(Absyn.IDENT("AllLoadedClasses")))},_)
equation
paths = Interactive.getTopPackages(SymbolTable.getAbsyn());
vals = List.map(paths,ValuesUtil.makeCodeTypeName);
then
(cache,ValuesUtil.makeArray(vals));
case (cache,_,"getPackages",{Values.CODE(Absyn.C_TYPENAME(path))},_)
equation
paths = Interactive.getPackagesInPath(path, SymbolTable.getAbsyn());
vals = List.map(paths,ValuesUtil.makeCodeTypeName);
then
(cache,ValuesUtil.makeArray(vals));
case (cache,_,"convertUnits",{Values.STRING(str1),Values.STRING(str2)},_)
equation
Error.clearMessages() "Clear messages";
UnitParserExt.initSIUnits();
(u1,scaleFactor1,offset1) = UnitAbsynBuilder.str2unitWithScaleFactor(str1,NONE());
(u2,scaleFactor2,offset2) = UnitAbsynBuilder.str2unitWithScaleFactor(str2,NONE());
b = valueEq(u1,u2);
/* How to calculate the final scale factor and offset:
F = C*1.8 + 32
C = (F - 32)/1.8 = F/1.8 - 32/1.8
*/
scaleFactor = realDiv(scaleFactor2, scaleFactor1);
offset = realDiv(realSub(offset2, offset1), scaleFactor1);
then
(cache,Values.TUPLE({Values.BOOL(b),Values.REAL(scaleFactor),Values.REAL(offset)}));
case (cache,_,"convertUnits",{Values.STRING(_),Values.STRING(_)},_)
then
(cache,Values.TUPLE({Values.BOOL(false),Values.REAL(1.0),Values.REAL(0.0)}));
case (cache,_,"getDerivedUnits",{Values.STRING(str1)},_)
equation
Error.clearMessages() "Clear messages";
UnitParserExt.initSIUnits();
u1 = UnitAbsynBuilder.str2unit(str1, NONE());
strs = UnitAbsynBuilder.getDerivedUnits(u1, str1);
v = ValuesUtil.makeArray(List.map(strs, ValuesUtil.makeString));
then (cache,v);
case (cache,_,"getDerivedUnits",{Values.STRING(_)},_)
then
(cache,ValuesUtil.makeArray({}));
case (cache,_,"getClassInformation",{Values.CODE(Absyn.C_TYPENAME(className))},_)
equation
v = getClassInformation(className, SymbolTable.getAbsyn());
then (cache,v);
case (cache,_,"getClassInformation",_,_)
then (cache,Values.TUPLE({Values.STRING(""),Values.STRING(""),Values.BOOL(false),Values.BOOL(false),Values.BOOL(false),Values.STRING(""),
Values.BOOL(false),Values.INTEGER(0),Values.INTEGER(0),Values.INTEGER(0),Values.INTEGER(0),Values.ARRAY({},{0}),
Values.BOOL(false),Values.BOOL(false),Values.STRING(""),Values.STRING(""),Values.BOOL(false),Values.STRING("")}));
case (cache,_,"getTransitions",{Values.CODE(Absyn.C_TYPENAME(className))},_)
equation
cr_1 = AbsynUtil.pathToCref(className);
false = Interactive.existClass(cr_1, SymbolTable.getAbsyn());
str = AbsynUtil.pathString(className);
Error.addMessage(Error.LOOKUP_ERROR, {str,"<TOP>"});
then (cache, Values.ARRAY({},{}));
case (cache,_,"getTransitions",{Values.CODE(Absyn.C_TYPENAME(className))},_)
equation
v = getTransitions(className, SymbolTable.getAbsyn());
then (cache, v);
case (cache,_,"getTransitions",_,_)
then (cache, Values.ARRAY({},{}));
case (cache,_,"addTransition",{Values.CODE(Absyn.C_TYPENAME(classpath)), Values.STRING(_), Values.STRING(_), Values.STRING(_),
Values.BOOL(_), Values.BOOL(_), Values.BOOL(_), Values.INTEGER(_), Values.CODE(Absyn.C_EXPRESSION(_))}, _)
equation
cr_1 = AbsynUtil.pathToCref(classpath);
false = Interactive.existClass(cr_1, SymbolTable.getAbsyn());
str = AbsynUtil.pathString(classpath);
Error.addMessage(Error.LOOKUP_ERROR, {str,"<TOP>"});
then
(cache,Values.BOOL(false));
case (cache,_,"addTransition",{Values.CODE(Absyn.C_TYPENAME(classpath)), Values.STRING(_), Values.STRING(_), Values.STRING(_),
Values.BOOL(_), Values.BOOL(_), Values.BOOL(_), Values.INTEGER(_),
Values.CODE(Absyn.C_MODIFICATION(Absyn.CLASSMOD(eqMod=Absyn.NOMOD())))},_)
equation
cr_1 = AbsynUtil.pathToCref(classpath);
false = Interactive.existClass(cr_1, SymbolTable.getAbsyn());
str = AbsynUtil.pathString(classpath);
Error.addMessage(Error.LOOKUP_ERROR, {str,"<TOP>"});
then
(cache,Values.BOOL(false));
case (cache,_,"addTransition",{Values.CODE(Absyn.C_TYPENAME(classpath)), Values.STRING(str1), Values.STRING(str2), Values.STRING(str3),
Values.BOOL(b), Values.BOOL(b1), Values.BOOL(b2), Values.INTEGER(i), Values.CODE(Absyn.C_EXPRESSION(aexp))},_)
equation
(bval, p) = Interactive.addTransition(AbsynUtil.pathToCref(classpath), str1, str2, str3, b, b1, b2, i, Absyn.NAMEDARG("annotate",aexp)::{}, SymbolTable.getAbsyn());
SymbolTable.setAbsyn(p);
then
(cache,Values.BOOL(bval));
case (cache,_,"addTransition",{Values.CODE(Absyn.C_TYPENAME(classpath)), Values.STRING(str1), Values.STRING(str2), Values.STRING(str3),
Values.BOOL(b), Values.BOOL(b1), Values.BOOL(b2), Values.INTEGER(i),
Values.CODE(Absyn.C_MODIFICATION(Absyn.CLASSMOD(elementArgLst=eltargs,eqMod=Absyn.NOMOD())))},_)
equation
(bval, p) = Interactive.addTransitionWithAnnotation(AbsynUtil.pathToCref(classpath), str1, str2, str3, b, b1, b2, i, Absyn.ANNOTATION(eltargs), SymbolTable.getAbsyn());
SymbolTable.setAbsyn(p);
then
(cache,Values.BOOL(bval));
case (cache,_,"addTransition",{_,_,_,_,_,_,_,_,_},_)
then
(cache,Values.BOOL(false));
case (cache,_,"deleteTransition",{Values.CODE(Absyn.C_TYPENAME(classpath)), Values.STRING(_), Values.STRING(_), Values.STRING(_),
Values.BOOL(_), Values.BOOL(_), Values.BOOL(_), Values.INTEGER(_)},_)
equation
cr_1 = AbsynUtil.pathToCref(classpath);
false = Interactive.existClass(cr_1, SymbolTable.getAbsyn());
str = AbsynUtil.pathString(classpath);
Error.addMessage(Error.LOOKUP_ERROR, {str,"<TOP>"});
then
(cache,Values.BOOL(false));
case (cache,_,"deleteTransition",{Values.CODE(Absyn.C_TYPENAME(classpath)), Values.STRING(str1), Values.STRING(str2), Values.STRING(str3),
Values.BOOL(b), Values.BOOL(b1), Values.BOOL(b2), Values.INTEGER(i)},_)
equation
(bval, p) = Interactive.deleteTransition(AbsynUtil.pathToCref(classpath), str1, str2, str3, b, b1, b2, i, SymbolTable.getAbsyn());
SymbolTable.setAbsyn(p);
then
(cache,Values.BOOL(bval));
case (cache,_,"deleteTransition",{_,_,_,_,_,_,_,_},_)
then
(cache,Values.BOOL(false));
case (cache,_,"updateTransition",{Values.CODE(Absyn.C_TYPENAME(classpath)), Values.STRING(_), Values.STRING(_), Values.STRING(_),
Values.BOOL(_), Values.BOOL(_), Values.BOOL(_), Values.INTEGER(_), Values.STRING(_),
Values.BOOL(_), Values.BOOL(_), Values.BOOL(_), Values.INTEGER(_), Values.CODE(Absyn.C_EXPRESSION(_))},_)
equation
cr_1 = AbsynUtil.pathToCref(classpath);
false = Interactive.existClass(cr_1, SymbolTable.getAbsyn());
str = AbsynUtil.pathString(classpath);
Error.addMessage(Error.LOOKUP_ERROR, {str,"<TOP>"});
then
(cache,Values.BOOL(false));
case (cache,_,"updateTransition",{Values.CODE(Absyn.C_TYPENAME(classpath)), Values.STRING(_), Values.STRING(_), Values.STRING(_),
Values.BOOL(_), Values.BOOL(_), Values.BOOL(_), Values.INTEGER(_), Values.STRING(_),
Values.BOOL(_), Values.BOOL(_), Values.BOOL(_), Values.INTEGER(_),
Values.CODE(Absyn.C_MODIFICATION(Absyn.CLASSMOD(eqMod=Absyn.NOMOD())))},_)
equation
cr_1 = AbsynUtil.pathToCref(classpath);
false = Interactive.existClass(cr_1, SymbolTable.getAbsyn());
str = AbsynUtil.pathString(classpath);
Error.addMessage(Error.LOOKUP_ERROR, {str,"<TOP>"});
then
(cache,Values.BOOL(false));
case (cache,_,"updateTransition",{Values.CODE(Absyn.C_TYPENAME(classpath)), Values.STRING(str1), Values.STRING(str2), Values.STRING(str3),
Values.BOOL(b), Values.BOOL(b1), Values.BOOL(b2), Values.INTEGER(i), Values.STRING(str4),
Values.BOOL(b3), Values.BOOL(b4), Values.BOOL(b5), Values.INTEGER(i1), Values.CODE(Absyn.C_EXPRESSION(aexp))},_)
equation
(bval, p) = Interactive.deleteTransition(AbsynUtil.pathToCref(classpath), str1, str2, str3, b, b1, b2, i, SymbolTable.getAbsyn());
(bval, p) = Interactive.addTransition(AbsynUtil.pathToCref(classpath), str1, str2, str4, b3, b4, b5, i1, Absyn.NAMEDARG("annotate",aexp)::{}, p);
SymbolTable.setAbsyn(p);
then
(cache,Values.BOOL(bval));
case (cache,_,"updateTransition",{Values.CODE(Absyn.C_TYPENAME(classpath)), Values.STRING(str1), Values.STRING(str2), Values.STRING(str3),