@@ -71,9 +71,9 @@ type JacobianMatrix = tuple<list<JacobianColumn>, // col
7171
7272public constant list< DAE.Exp> listExpLength1 = {DAE.ICONST(0 )} "For CodegenC.tpl" ;
7373
74- // Root data structure containing information required for templates to
75- // generate simulation code for a Modelica model.
7674uniontype SimCode
75+ "Root data structure containing information required for templates to
76+ generate simulation code for a Modelica model."
7777 record SIMCODE
7878 ModelInfo modelInfo;
7979 list< DAE.Exp> literals "shared literals" ;
@@ -83,8 +83,8 @@ uniontype SimCode
8383 list< list< SimEqSystem>> odeEquations;
8484 list< list< SimEqSystem>> algebraicEquations;
8585 list< SimEqSystem> residualEquations;
86- Boolean useSymbolicInitialization; // true if a system to solve the initial problem symbolically is generated, otherwise false
87- Boolean useHomotopy; // true if homotopy(...) is used during initialization
86+ Boolean useSymbolicInitialization " true if a system to solve the initial problem symbolically is generated, otherwise false" ;
87+ Boolean useHomotopy " true if homotopy(...) is used during initialization" ;
8888 list< SimEqSystem> initialEquations;
8989 list< SimEqSystem> startValueEquations;
9090 list< SimEqSystem> parameterEquations;
@@ -112,17 +112,17 @@ uniontype SimCode
112112 end SIMCODE;
113113end SimCode;
114114
115- // Delayed expressions type
116115uniontype DelayedExpression
116+ "Delayed expressions type"
117117 record DELAYED_EXPRESSIONS
118118 list< tuple< Integer , tuple< DAE.Exp, DAE.Exp, DAE.Exp>>> delayedExps;
119119 Integer maxDelayedIndex;
120120 end DELAYED_EXPRESSIONS;
121121end DelayedExpression;
122122
123- // Root data structure containing information required for templates to
124- // generate C functions for Modelica/MetaModelica functions.
125123uniontype FunctionCode
124+ "Root data structure containing information required for templates to
125+ generate C functions for Modelica/MetaModelica functions."
126126 record FUNCTIONCODE
127127 String name;
128128 Option< Function> mainFunction "This function is special; the 'in'-function should be generated for it" ;
@@ -134,8 +134,7 @@ uniontype FunctionCode
134134 end FUNCTIONCODE;
135135end FunctionCode;
136136
137- // Container for metadata about a Modelica model.
138- uniontype ModelInfo
137+ uniontype ModelInfo "Container for metadata about a Modelica model."
139138 record MODELINFO
140139 Absyn.Path name;
141140 String directory;
@@ -161,8 +160,7 @@ uniontype FileInfo
161160 end FILEINFO;
162161end FileInfo;
163162
164- // Number of variables of various types in a Modelica model.
165- uniontype VarInfo
163+ uniontype VarInfo "Number of variables of various types in a Modelica model."
166164 record VARINFO
167165 Integer numZeroCrossings;
168166 Integer numTimeEvents;
@@ -184,7 +182,7 @@ uniontype VarInfo
184182 Integer numInVars;
185183 Integer numInitialEquations;
186184 Integer numInitialAlgorithms;
187- Integer numInitialResiduals; // numInitialEquations+ numInitialAlgorithms
185+ Integer numInitialResiduals " numInitialEquations + numInitialAlgorithms" ;
188186 Integer numExternalObjects;
189187 Integer numStringAlgVars;
190188 Integer numStringParamVars;
@@ -199,8 +197,7 @@ uniontype VarInfo
199197 end VARINFO;
200198end VarInfo;
201199
202- // Container for metadata about variables in a Modelica model.
203- uniontype SimVars
200+ uniontype SimVars "Container for metadata about variables in a Modelica model."
204201 record SIMVARS
205202 list< SimVar> stateVars;
206203 list< SimVar> derivativeVars;
@@ -230,8 +227,7 @@ end SimVars;
230227public constant SimVars emptySimVars = SIMVARS({}, {}, {}, {}, {}, {}, {}, {},
231228 {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {});
232229
233- // Information about a variable in a Modelica model.
234- uniontype SimVar
230+ uniontype SimVar "Information about a variable in a Modelica model."
235231 record SIMVAR
236232 DAE.ComponentRef name;
237233 BackendDAE.VarKind varKind;
@@ -274,10 +270,10 @@ uniontype Causality
274270 record INPUT end INPUT;
275271end Causality;
276272
277- // Represents a Modelica or MetaModelica function.
278273// TODO: I believe some of these fields can be removed. Check to see what is
279274// used in templates.
280- uniontype Function
275+ uniontype Function
276+ "Represents a Modelica or MetaModelica function."
281277 record FUNCTION
282278 Absyn.Path name;
283279 list< Variable> outVars;
@@ -314,7 +310,7 @@ uniontype Function
314310 list< Variable> inVars;
315311 list< Variable> outVars;
316312 list< Variable> biVars;
317- list< String > libs; // need this one for C#
313+ list< String > libs " need this one for C#" ;
318314 String language "C or Fortran" ;
319315 Absyn.Info info;
320316 Boolean dynamicLoad;
@@ -330,22 +326,22 @@ end Function;
330326
331327uniontype RecordDeclaration
332328 record RECORD_DECL_FULL
333- String name; // struct (record) name ? encoded
334- Absyn . Path defPath; // definition path
335- list< Variable > variables; // only name and type
329+ String name " struct (record) name ? encoded" ;
330+ Absyn.Path defPath " definition path" ;
331+ list< Variable> variables " only name and type" ;
336332 end RECORD_DECL_FULL;
337333 record RECORD_DECL_DEF
338- Absyn . Path path; // definition path .. encoded ?
334+ Absyn.Path path " definition path .. encoded?" ;
339335 list< String > fieldNames;
340336 end RECORD_DECL_DEF;
341337end RecordDeclaration;
342338
343- // Information about an argument to an external function.
344339uniontype SimExtArg
340+ "Information about an argument to an external function."
345341 record SIMEXTARG
346342 DAE.ComponentRef cref;
347343 Boolean isInput;
348- Integer outputIndex; // > 0 if output
344+ Integer outputIndex " > 0 if output" ;
349345 Boolean isArray;
350346 Boolean hasBinding "avoid double allocation" ;
351347 DAE.Type type_;
@@ -357,19 +353,19 @@ uniontype SimExtArg
357353 record SIMEXTARGSIZE
358354 DAE.ComponentRef cref;
359355 Boolean isInput;
360- Integer outputIndex; // > 0 if output
356+ Integer outputIndex " > 0 if output" ;
361357 DAE.Type type_;
362358 DAE.Exp exp ;
363359 end SIMEXTARGSIZE;
364360 record SIMNOEXTARG end SIMNOEXTARG;
365361end SimExtArg;
366362
367- /* a variable represents a name, a type and a possible default value */
368363uniontype Variable
364+ "a variable represents a name, a type and a possible default value"
369365 record VARIABLE
370366 DAE.ComponentRef name;
371367 DAE.Type ty;
372- Option < DAE . Exp > value; // Default value
368+ Option< DAE.Exp> value "default value" ;
373369 list< DAE.Exp> instDims;
374370 DAE.VarParallelism parallelism;
375371 end VARIABLE;
@@ -388,9 +384,8 @@ uniontype Statement
388384 end ALGORITHM;
389385end Statement;
390386
391- // Represents a single equation or a system of equations that must be solved
392- // together.
393387uniontype SimEqSystem
388+ "Represents a single equation or a system of equations that must be solved together."
394389 record SES_RESIDUAL
395390 Integer index;
396391 DAE.Exp exp ;
@@ -451,8 +446,8 @@ uniontype SimEqSystem
451446
452447 record SES_WHEN
453448 Integer index;
454- list< DAE . ComponentRef > conditions; // list of boolean variables as conditions
455- Boolean initialCall; // true, if top-level branch with initial()
449+ list< DAE.ComponentRef> conditions " list of boolean variables as conditions" ;
450+ Boolean initialCall " true, if top-level branch with initial()" ;
456451 DAE.ComponentRef left;
457452 DAE.Exp right;
458453 Option< SimEqSystem> elseWhen;
@@ -474,9 +469,9 @@ end StateSet;
474469
475470uniontype SimWhenClause
476471 record SIM_WHEN_CLAUSE
477- list< DAE . ComponentRef > conditionVars; // is no longer needed
478- list< DAE . ComponentRef > conditions; // list of boolean variables as conditions
479- Boolean initialCall; // true, if top-level branch with initial()
472+ list< DAE.ComponentRef> conditionVars " is no longer needed" ;
473+ list< DAE.ComponentRef> conditions " list of boolean variables as conditions" ;
474+ Boolean initialCall " true, if top-level branch with initial()" ;
480475 list< BackendDAE.WhenOperator> reinits;
481476 Option< BackendDAE.WhenEquation> whenEq;
482477 end SIM_WHEN_CLAUSE;
@@ -489,8 +484,8 @@ uniontype ExtObjInfo
489484 end EXTOBJINFO;
490485end ExtObjInfo;
491486
492- // Platform specific parameters used when generating makefiles.
493487uniontype MakefileParams
488+ "Platform specific parameters used when generating makefiles."
494489 record MAKEFILE_PARAMS
495490 String ccompiler;
496491 String cxxcompiler;
@@ -525,55 +520,54 @@ uniontype SimulationSettings
525520 end SIMULATION_SETTINGS;
526521end SimulationSettings;
527522
528- // Constants of this type defined below are used by templates to be able to
529- // generate different code depending on the context it is generated in.
530523uniontype Context
531- record SIMULATION
524+ "Constants of this type defined below are used by templates to be able to
525+ generate different code depending on the context it is generated in."
526+ record SIMULATION_CONTEXT
532527 Boolean genDiscrete;
533- end SIMULATION ;
528+ end SIMULATION_CONTEXT;
529+
534530 record FUNCTION_CONTEXT
535531 end FUNCTION_CONTEXT;
536532
537533 record ALGLOOP_CONTEXT
538534 Boolean genInitialisation;
539535 end ALGLOOP_CONTEXT;
540- record OTHER
541- end OTHER ;
536+
537+ record OTHER_CONTEXT
538+ end OTHER_CONTEXT;
539+
542540 record INLINE_CONTEXT
543541 end INLINE_CONTEXT;
542+
544543 record PARALLEL_FUNCTION_CONTEXT
545544 end PARALLEL_FUNCTION_CONTEXT;
545+
546546 record ZEROCROSSINGS_CONTEXT
547547 end ZEROCROSSINGS_CONTEXT;
548- record OPTIMIZATION
549- end OPTIMIZATION ;
548+
549+ record OPTIMIZATION_CONTEXT
550+ end OPTIMIZATION_CONTEXT;
550551end Context;
551552
552-
553- public constant Context contextSimulationNonDiscrete = SIMULATION (false );
554- public constant Context contextSimulationDiscrete = SIMULATION (true );
553+ public constant Context contextSimulationNonDiscrete = SIMULATION_CONTEXT(false );
554+ public constant Context contextSimulationDiscrete = SIMULATION_CONTEXT(true );
555555public constant Context contextInlineSolver = INLINE_CONTEXT();
556556public constant Context contextFunction = FUNCTION_CONTEXT();
557557public constant Context contextAlgloopInitialisation = ALGLOOP_CONTEXT(true );
558558public constant Context contextAlgloop = ALGLOOP_CONTEXT(false );
559- public constant Context contextOther = OTHER ();
559+ public constant Context contextOther = OTHER_CONTEXT ();
560560public constant Context contextParallelFunction = PARALLEL_FUNCTION_CONTEXT();
561561public constant Context contextZeroCross = ZEROCROSSINGS_CONTEXT();
562- public constant Context contextOptimization = OPTIMIZATION ();
563-
562+ public constant Context contextOptimization = OPTIMIZATION_CONTEXT();
564563
565564/****** HashTable ComponentRef -> SimCode.SimVar ******/
566565/* a workaround to enable "cross public import" */
567566
568-
569567/* HashTable instance specific code */
570-
571568public
572569type Key = DAE.ComponentRef;
573570type Value = SimVar;
574-
575-
576-
577571/* end of HashTable instance specific code */
578572
579573/* Generic hashtable code below!! */
@@ -599,7 +593,7 @@ end ValueArray;
599593
600594public uniontype HpcOmParInformation "informations for the taskgraph parallelization"
601595 record HPCOMPARINFORMATION
602- list< list< Integer >> eqsOfLevels; // The equations of the level <%listindex%>
596+ list< list< Integer >> eqsOfLevels " The equations of the level <%listindex%>" ;
603597 end HPCOMPARINFORMATION;
604598end HpcOmParInformation;
605599end SimCode;
0 commit comments