build_cmake/OMCompiler/Compiler/generated-mo/Template/CodegenCppInit.mo
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | encapsulated package CodegenCppInit | ||
| 2 | " | ||
| 3 | file: CodegenCppInit.mo | ||
| 4 | package: CodegenCppInit | ||
| 5 | description: Generated by Susan. | ||
| 6 | " | ||
| 7 | |||
| 8 | public import Tpl; | ||
| 9 | |||
| 10 | public import SimCodeVar; | ||
| 11 | public import HashTableCrefSimVar; | ||
| 12 | public import SimCode; | ||
| 13 | public import SimCodeFunction; | ||
| 14 | public import SimCodeCodegenUtil; | ||
| 15 | public import SimCodeFunctionUtil; | ||
| 16 | public import BackendDAE; | ||
| 17 | public import System; | ||
| 18 | public import Autoconf; | ||
| 19 | protected import Absyn; | ||
| 20 | protected import AbsynUtil; | ||
| 21 | public import MMath; | ||
| 22 | public import DAE; | ||
| 23 | public import ClassInf; | ||
| 24 | public import ClassInfUtil; | ||
| 25 | protected import SCode; | ||
| 26 | protected import SCodeDump; | ||
| 27 | public import StringUtil; | ||
| 28 | public import Util; | ||
| 29 | public import List; | ||
| 30 | public import ComponentReferenceBasics; | ||
| 31 | public import ComponentReference; | ||
| 32 | public import Expression; | ||
| 33 | protected import ExpressionDump; | ||
| 34 | public import ExpressionBasics; | ||
| 35 | public import Config; | ||
| 36 | public import Testsuite; | ||
| 37 | public import Flags; | ||
| 38 | public import FlagsUtil; | ||
| 39 | public import Settings; | ||
| 40 | public import Patternm; | ||
| 41 | public import Error; | ||
| 42 | public import Values; | ||
| 43 | public import ValuesUtil; | ||
| 44 | public import DAEDump; | ||
| 45 | public import Algorithm; | ||
| 46 | protected import ElementSource; | ||
| 47 | public import DAEUtil; | ||
| 48 | public import TypesDump; | ||
| 49 | public import Types; | ||
| 50 | public import HashTableCrIListArray; | ||
| 51 | public import BackendVariable; | ||
| 52 | public import HpcOmSimCode; | ||
| 53 | public import HpcOmCodegenUtil; | ||
| 54 | public import FMI; | ||
| 55 | public import CodegenUtil; | ||
| 56 | protected import CodegenCppCommon; | ||
| 57 | protected import CodegenFMUCommon; | ||
| 58 | protected import CodegenFMU2; | ||
| 59 | protected import CodegenFMU1; | ||
| 60 | |||
| 61 | protected function fun_52 | ||
| 62 | input Tpl.Text in_txt; | ||
| 63 | input Boolean in_a_generateFMUModelDescription; | ||
| 64 | |||
| 65 | output Tpl.Text out_txt; | ||
| 66 | algorithm | ||
| 67 | out_txt := | ||
| 68 | match(in_txt, in_a_generateFMUModelDescription) | ||
| 69 | local | ||
| 70 | Tpl.Text txt; | ||
| 71 | |||
| 72 | case ( txt, | ||
| 73 | false ) | ||
| 74 | algorithm | ||
| 75 | 49 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("ModelDescription")); | |
| 76 | then txt; | ||
| 77 | |||
| 78 | case ( txt, | ||
| 79 | _ ) | ||
| 80 | algorithm | ||
| 81 | 1 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("fmiModelDescription")); | |
| 82 | then txt; | ||
| 83 | end match; | ||
| 84 | end fun_52; | ||
| 85 | |||
| 86 | protected function fun_53 | ||
| 87 | input Tpl.Text in_txt; | ||
| 88 | input Boolean in_a_generateFMUModelDescription; | ||
| 89 | input String in_a_FMUGuid; | ||
| 90 | input String in_a_FMUType; | ||
| 91 | input String in_a_FMUVersion; | ||
| 92 | input SimCode.SimCode in_a_simCode; | ||
| 93 | input Absyn.Path in_a_modelInfo_name; | ||
| 94 | |||
| 95 | output Tpl.Text out_txt; | ||
| 96 | algorithm | ||
| 97 | out_txt := | ||
| 98 | match(in_txt, in_a_generateFMUModelDescription, in_a_FMUGuid, in_a_FMUType, in_a_FMUVersion, in_a_simCode, in_a_modelInfo_name) | ||
| 99 | local | ||
| 100 | Tpl.Text txt; | ||
| 101 | String a_FMUGuid; | ||
| 102 | String a_FMUType; | ||
| 103 | String a_FMUVersion; | ||
| 104 | SimCode.SimCode a_simCode; | ||
| 105 | Absyn.Path a_modelInfo_name; | ||
| 106 | |||
| 107 | case ( txt, | ||
| 108 | false, | ||
| 109 | _, | ||
| 110 | _, | ||
| 111 | _, | ||
| 112 | _, | ||
| 113 | a_modelInfo_name ) | ||
| 114 | algorithm | ||
| 115 | 49 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelName=\"")); | |
| 116 | 49 | txt := CodegenUtil.dotPath(txt, a_modelInfo_name); | |
| 117 | 49 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"")); | |
| 118 | then txt; | ||
| 119 | |||
| 120 | case ( txt, | ||
| 121 | _, | ||
| 122 | a_FMUGuid, | ||
| 123 | a_FMUType, | ||
| 124 | a_FMUVersion, | ||
| 125 | a_simCode, | ||
| 126 | _ ) | ||
| 127 | algorithm | ||
| 128 | 1 | txt := fmiDescriptionAttributes(txt, a_simCode, a_FMUVersion, a_FMUType, a_FMUGuid); | |
| 129 | then txt; | ||
| 130 | end match; | ||
| 131 | end fun_53; | ||
| 132 | |||
| 133 | protected function fun_54 | ||
| 134 | input Tpl.Text in_txt; | ||
| 135 | input Boolean in_a_generateFMUModelDescription; | ||
| 136 | input String in_a_FMUVersion; | ||
| 137 | input SimCode.SimCode in_a_simCode; | ||
| 138 | |||
| 139 | output Tpl.Text out_txt; | ||
| 140 | algorithm | ||
| 141 | out_txt := | ||
| 142 | match(in_txt, in_a_generateFMUModelDescription, in_a_FMUVersion, in_a_simCode) | ||
| 143 | local | ||
| 144 | Tpl.Text txt; | ||
| 145 | String a_FMUVersion; | ||
| 146 | SimCode.SimCode a_simCode; | ||
| 147 | |||
| 148 | case ( txt, | ||
| 149 | false, | ||
| 150 | _, | ||
| 151 | _ ) | ||
| 152 | then txt; | ||
| 153 | |||
| 154 | case ( txt, | ||
| 155 | _, | ||
| 156 | a_FMUVersion, | ||
| 157 | a_simCode ) | ||
| 158 | algorithm | ||
| 159 | 1 | txt := CodegenFMUCommon.fmiTypeDefinitions(txt, a_simCode, a_FMUVersion); | |
| 160 | then txt; | ||
| 161 | end match; | ||
| 162 | end fun_54; | ||
| 163 | |||
| 164 | protected function fun_55 | ||
| 165 | input Tpl.Text in_txt; | ||
| 166 | input Boolean in_a_generateFMUModelDescription; | ||
| 167 | input String in_a_FMUVersion; | ||
| 168 | input Option<SimCode.SimulationSettings> in_a_simulationSettingsOpt; | ||
| 169 | |||
| 170 | output Tpl.Text out_txt; | ||
| 171 | algorithm | ||
| 172 | out_txt := | ||
| 173 | match(in_txt, in_a_generateFMUModelDescription, in_a_FMUVersion, in_a_simulationSettingsOpt) | ||
| 174 | local | ||
| 175 | Tpl.Text txt; | ||
| 176 | String a_FMUVersion; | ||
| 177 | Option<SimCode.SimulationSettings> a_simulationSettingsOpt; | ||
| 178 | |||
| 179 | case ( txt, | ||
| 180 | false, | ||
| 181 | _, | ||
| 182 | _ ) | ||
| 183 | then txt; | ||
| 184 | |||
| 185 | case ( txt, | ||
| 186 | _, | ||
| 187 | a_FMUVersion, | ||
| 188 | a_simulationSettingsOpt ) | ||
| 189 | algorithm | ||
| 190 | 1 | txt := CodegenFMUCommon.DefaultExperiment(txt, a_simulationSettingsOpt, a_FMUVersion); | |
| 191 | then txt; | ||
| 192 | end match; | ||
| 193 | end fun_55; | ||
| 194 | |||
| 195 | public function modelInitXMLFile | ||
| 196 | input Tpl.Text in_txt; | ||
| 197 | input SimCode.SimCode in_a_simCode; | ||
| 198 | input String in_a_numRealVars; | ||
| 199 | input String in_a_numIntVars; | ||
| 200 | input String in_a_numBoolVars; | ||
| 201 | input String in_a_numStringVars; | ||
| 202 | input String in_a_FMUVersion; | ||
| 203 | input String in_a_FMUType; | ||
| 204 | input String in_a_FMUGuid; | ||
| 205 | input Boolean in_a_generateFMUModelDescription; | ||
| 206 | input String in_a_generatorComments; | ||
| 207 | input Tpl.Text in_a_complexStartExpressions; | ||
| 208 | input Tpl.Text in_a_stateDerVectorName; | ||
| 209 | |||
| 210 | output Tpl.Text out_txt; | ||
| 211 | output Tpl.Text out_a_complexStartExpressions; | ||
| 212 | output Tpl.Text out_a_stateDerVectorName; | ||
| 213 | algorithm | ||
| 214 | (out_txt, out_a_complexStartExpressions, out_a_stateDerVectorName) := | ||
| 215 | match(in_txt, in_a_simCode, in_a_numRealVars, in_a_numIntVars, in_a_numBoolVars, in_a_numStringVars, in_a_FMUVersion, in_a_FMUType, in_a_FMUGuid, in_a_generateFMUModelDescription, in_a_generatorComments, in_a_complexStartExpressions, in_a_stateDerVectorName) | ||
| 216 | local | ||
| 217 | Tpl.Text txt; | ||
| 218 | String a_numRealVars; | ||
| 219 | String a_numIntVars; | ||
| 220 | String a_numBoolVars; | ||
| 221 | String a_numStringVars; | ||
| 222 | String a_FMUVersion; | ||
| 223 | String a_FMUType; | ||
| 224 | String a_FMUGuid; | ||
| 225 | Boolean a_generateFMUModelDescription; | ||
| 226 | String a_generatorComments; | ||
| 227 | Tpl.Text a_complexStartExpressions; | ||
| 228 | Tpl.Text a_stateDerVectorName; | ||
| 229 | Option<SimCode.SimulationSettings> i_simulationSettingsOpt; | ||
| 230 | Absyn.Path i_modelInfo_name; | ||
| 231 | HashTableCrIListArray.HashTable i_varToArrayIndexMapping; | ||
| 232 | SimCode.ModelInfo i_modelInfo; | ||
| 233 | SimCode.SimCode i_simCode; | ||
| 234 | Tpl.Text l_fmiDefaultExperiment; | ||
| 235 | Tpl.Text l_fmiTypeDefinitions; | ||
| 236 | Tpl.Text l_fmiDescriptionAttributes; | ||
| 237 | Tpl.Text l_descriptionTag; | ||
| 238 | Tpl.Text txt_4; | ||
| 239 | Tpl.Text txt_3; | ||
| 240 | Tpl.Text txt_2; | ||
| 241 | Tpl.Text txt_1; | ||
| 242 | Tpl.Text l_variables; | ||
| 243 | |||
| 244 | case ( txt, | ||
| 245 | (i_simCode as SimCode.SIMCODE(modelInfo = (i_modelInfo as SimCode.MODELINFO(name = i_modelInfo_name)), varToArrayIndexMapping = i_varToArrayIndexMapping, simulationSettingsOpt = i_simulationSettingsOpt)), | ||
| 246 | a_numRealVars, | ||
| 247 | a_numIntVars, | ||
| 248 | a_numBoolVars, | ||
| 249 | a_numStringVars, | ||
| 250 | a_FMUVersion, | ||
| 251 | a_FMUType, | ||
| 252 | a_FMUGuid, | ||
| 253 | a_generateFMUModelDescription, | ||
| 254 | a_generatorComments, | ||
| 255 | a_complexStartExpressions, | ||
| 256 | a_stateDerVectorName ) | ||
| 257 | algorithm | ||
| 258 | 50 | txt_1 := Tpl.writeStr(Tpl.emptyTxt, a_numRealVars); | |
| 259 | 50 | txt_1 := Tpl.writeTok(txt_1, Tpl.ST_STRING(" - 1")); | |
| 260 | 50 | txt_2 := Tpl.writeStr(Tpl.emptyTxt, a_numIntVars); | |
| 261 | 50 | txt_2 := Tpl.writeTok(txt_2, Tpl.ST_STRING(" - 1")); | |
| 262 | 50 | txt_3 := Tpl.writeStr(Tpl.emptyTxt, a_numBoolVars); | |
| 263 | 50 | txt_3 := Tpl.writeTok(txt_3, Tpl.ST_STRING(" - 1")); | |
| 264 | 50 | txt_4 := Tpl.writeStr(Tpl.emptyTxt, a_numStringVars); | |
| 265 | 50 | txt_4 := Tpl.writeTok(txt_4, Tpl.ST_STRING(" - 1")); | |
| 266 | 50 | (l_variables, a_complexStartExpressions, a_stateDerVectorName) := modelVariablesXML(Tpl.emptyTxt, i_simCode, i_modelInfo, i_varToArrayIndexMapping, Tpl.textString(txt_1), Tpl.textString(txt_2), Tpl.textString(txt_3), Tpl.textString(txt_4), a_generateFMUModelDescription, a_complexStartExpressions, a_stateDerVectorName); | |
| 267 | 50 | l_descriptionTag := fun_52(Tpl.emptyTxt, a_generateFMUModelDescription); | |
| 268 | 50 | l_fmiDescriptionAttributes := fun_53(Tpl.emptyTxt, a_generateFMUModelDescription, a_FMUGuid, a_FMUType, a_FMUVersion, i_simCode, i_modelInfo_name); | |
| 269 | 50 | l_fmiTypeDefinitions := fun_54(Tpl.emptyTxt, a_generateFMUModelDescription, a_FMUVersion, i_simCode); | |
| 270 | 50 | l_fmiDefaultExperiment := fun_55(Tpl.emptyTxt, a_generateFMUModelDescription, a_FMUVersion, i_simulationSettingsOpt); | |
| 271 | 50 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 272 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", | ||
| 273 | "<!--Generated with the modifications: " | ||
| 274 | }, false)); | ||
| 275 | 50 | txt := Tpl.writeStr(txt, a_generatorComments); | |
| 276 | 50 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 277 | " -->\n", | ||
| 278 | "<!--Take care about array indices, they are stored in column major layout.-->\n", | ||
| 279 | "<" | ||
| 280 | }, false)); | ||
| 281 | 50 | txt := Tpl.writeText(txt, l_descriptionTag); | |
| 282 | 50 | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" ")); | |
| 283 | 50 | txt := Tpl.writeText(txt, l_fmiDescriptionAttributes); | |
| 284 | 50 | txt := Tpl.writeTok(txt, Tpl.ST_LINE(">\n")); | |
| 285 | 50 | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 286 | 50 | txt := Tpl.writeText(txt, l_fmiTypeDefinitions); | |
| 287 | 50 | txt := Tpl.softNewLine(txt); | |
| 288 | 50 | txt := Tpl.writeText(txt, l_fmiDefaultExperiment); | |
| 289 | 50 | txt := Tpl.softNewLine(txt); | |
| 290 | 50 | txt := Tpl.writeTok(txt, Tpl.ST_LINE("<ModelVariables>\n")); | |
| 291 | 50 | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 292 | 50 | txt := Tpl.writeText(txt, l_variables); | |
| 293 | 50 | txt := Tpl.softNewLine(txt); | |
| 294 | 50 | txt := Tpl.popBlock(txt); | |
| 295 | 50 | txt := Tpl.writeTok(txt, Tpl.ST_LINE("</ModelVariables>\n")); | |
| 296 | 50 | txt := Tpl.popBlock(txt); | |
| 297 | 50 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("</")); | |
| 298 | 50 | txt := Tpl.writeText(txt, l_descriptionTag); | |
| 299 | 50 | txt := Tpl.writeTok(txt, Tpl.ST_STRING(">")); | |
| 300 | 50 | then (txt, a_complexStartExpressions, a_stateDerVectorName); | |
| 301 | |||
| 302 | case ( txt, | ||
| 303 | _, | ||
| 304 | _, | ||
| 305 | _, | ||
| 306 | _, | ||
| 307 | _, | ||
| 308 | _, | ||
| 309 | _, | ||
| 310 | _, | ||
| 311 | _, | ||
| 312 | _, | ||
| 313 | a_complexStartExpressions, | ||
| 314 | a_stateDerVectorName ) | ||
| 315 | then (txt, a_complexStartExpressions, a_stateDerVectorName); | ||
| 316 | end match; | ||
| 317 | end modelInitXMLFile; | ||
| 318 | |||
| 319 | protected function fun_57 | ||
| 320 | input Tpl.Text in_txt; | ||
| 321 | input Boolean in_mArg; | ||
| 322 | input SimCode.SimCode in_a_simCode; | ||
| 323 | input String in_a_FMUGuid; | ||
| 324 | |||
| 325 | output Tpl.Text out_txt; | ||
| 326 | algorithm | ||
| 327 | out_txt := | ||
| 328 | match(in_txt, in_mArg, in_a_simCode, in_a_FMUGuid) | ||
| 329 | local | ||
| 330 | Tpl.Text txt; | ||
| 331 | SimCode.SimCode a_simCode; | ||
| 332 | String a_FMUGuid; | ||
| 333 | |||
| 334 | case ( txt, | ||
| 335 | false, | ||
| 336 | a_simCode, | ||
| 337 | a_FMUGuid ) | ||
| 338 | algorithm | ||
| 339 | 1 | txt := fmiModelDescriptionAttributes(txt, a_simCode, a_FMUGuid); | |
| 340 | then txt; | ||
| 341 | |||
| 342 | case ( txt, | ||
| 343 | _, | ||
| 344 | a_simCode, | ||
| 345 | a_FMUGuid ) | ||
| 346 | algorithm | ||
| 347 | ✗ | txt := CodegenFMU2.fmiModelDescriptionAttributes(txt, a_simCode, a_FMUGuid); | |
| 348 | then txt; | ||
| 349 | end match; | ||
| 350 | end fun_57; | ||
| 351 | |||
| 352 | public function fmiDescriptionAttributes | ||
| 353 | input Tpl.Text txt; | ||
| 354 | input SimCode.SimCode a_simCode; | ||
| 355 | input String a_FMUVersion; | ||
| 356 | input String a_FMUType; | ||
| 357 | input String a_FMUGuid; | ||
| 358 | |||
| 359 | output Tpl.Text out_txt; | ||
| 360 | protected | ||
| 361 | Boolean ret_0; | ||
| 362 | algorithm | ||
| 363 | 1 | ret_0 := FMI.isFMIVersion20(a_FMUVersion); | |
| 364 | 1 | out_txt := fun_57(txt, ret_0, a_simCode, a_FMUGuid); | |
| 365 | end fmiDescriptionAttributes; | ||
| 366 | |||
| 367 | public function fmiModelDescriptionAttributes | ||
| 368 | input Tpl.Text in_txt; | ||
| 369 | input SimCode.SimCode in_a_simCode; | ||
| 370 | input String in_a_guid; | ||
| 371 | |||
| 372 | output Tpl.Text out_txt; | ||
| 373 | algorithm | ||
| 374 | out_txt := | ||
| 375 | match(in_txt, in_a_simCode, in_a_guid) | ||
| 376 | local | ||
| 377 | Tpl.Text txt; | ||
| 378 | String a_guid; | ||
| 379 | SimCode.SimCode i_simCode; | ||
| 380 | Integer i_vi_numStateVars; | ||
| 381 | String i_fileNamePrefix; | ||
| 382 | Absyn.Path i_modelInfo_name; | ||
| 383 | Tpl.Text l_numberOfEventIndicators; | ||
| 384 | Tpl.Text l_numberOfContinuousStates; | ||
| 385 | Tpl.Text l_variableNamingConvention; | ||
| 386 | Util.DateTime ret_12; | ||
| 387 | Tpl.Text l_generationDateAndTime; | ||
| 388 | String ret_10; | ||
| 389 | Tpl.Text l_generationTool; | ||
| 390 | Tpl.Text l_version; | ||
| 391 | Tpl.Text l_author; | ||
| 392 | Tpl.Text l_description; | ||
| 393 | String ret_5; | ||
| 394 | Tpl.Text l_modelIdentifier; | ||
| 395 | String ret_3; | ||
| 396 | Tpl.Text txt_2; | ||
| 397 | Tpl.Text l_modelName; | ||
| 398 | Tpl.Text l_fmiVersion; | ||
| 399 | |||
| 400 | case ( txt, | ||
| 401 | (i_simCode as SimCode.SIMCODE(modelInfo = SimCode.MODELINFO(varInfo = SimCode.VARINFO(numStateVars = i_vi_numStateVars), vars = SimCodeVar.SIMVARS(stateVars = _), name = i_modelInfo_name), fileNamePrefix = i_fileNamePrefix)), | ||
| 402 | a_guid ) | ||
| 403 | algorithm | ||
| 404 | 1 | l_fmiVersion := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("1.0")); | |
| 405 | 1 | txt_2 := CodegenUtil.dotPath(Tpl.emptyTxt, i_modelInfo_name); | |
| 406 | 1 | ret_3 := System.stringReplace(Tpl.textString(txt_2), "$", "_D_"); | |
| 407 | 1 | l_modelName := Tpl.writeStr(Tpl.emptyTxt, ret_3); | |
| 408 | 1 | ret_5 := System.stringReplace(i_fileNamePrefix, ".", "_"); | |
| 409 | 1 | l_modelIdentifier := Tpl.writeStr(Tpl.emptyTxt, ret_5); | |
| 410 | l_description := Tpl.emptyTxt; | ||
| 411 | l_author := Tpl.emptyTxt; | ||
| 412 | l_version := Tpl.emptyTxt; | ||
| 413 | 1 | l_generationTool := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("OpenModelica Compiler ")); | |
| 414 | 1 | ret_10 := Settings.getVersionNr(); | |
| 415 | 1 | l_generationTool := Tpl.writeStr(l_generationTool, ret_10); | |
| 416 | 1 | ret_12 := Util.getCurrentDateTime(); | |
| 417 | 1 | l_generationDateAndTime := CodegenFMUCommon.xsdateTime(Tpl.emptyTxt, ret_12); | |
| 418 | 1 | l_variableNamingConvention := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("structured")); | |
| 419 | 1 | l_numberOfContinuousStates := Tpl.writeStr(Tpl.emptyTxt, intString(i_vi_numStateVars)); | |
| 420 | 1 | l_numberOfEventIndicators := CodegenFMUCommon.getNumberOfEventIndicators(Tpl.emptyTxt, i_simCode); | |
| 421 | 1 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("fmiVersion=\"")); | |
| 422 | 1 | txt := Tpl.writeText(txt, l_fmiVersion); | |
| 423 | 1 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 424 | "\"\n", | ||
| 425 | "modelName=\"" | ||
| 426 | }, false)); | ||
| 427 | 1 | txt := Tpl.writeText(txt, l_modelName); | |
| 428 | 1 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 429 | "\"\n", | ||
| 430 | "modelIdentifier=\"" | ||
| 431 | }, false)); | ||
| 432 | 1 | txt := Tpl.writeText(txt, l_modelIdentifier); | |
| 433 | 1 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 434 | "\"\n", | ||
| 435 | "guid=\"{" | ||
| 436 | }, false)); | ||
| 437 | 1 | txt := Tpl.writeStr(txt, a_guid); | |
| 438 | 1 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 439 | "}\"\n", | ||
| 440 | "generationTool=\"" | ||
| 441 | }, false)); | ||
| 442 | 1 | txt := Tpl.writeText(txt, l_generationTool); | |
| 443 | 1 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 444 | "\"\n", | ||
| 445 | "generationDateAndTime=\"" | ||
| 446 | }, false)); | ||
| 447 | 1 | txt := Tpl.writeText(txt, l_generationDateAndTime); | |
| 448 | 1 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 449 | "\"\n", | ||
| 450 | "variableNamingConvention=\"" | ||
| 451 | }, false)); | ||
| 452 | 1 | txt := Tpl.writeText(txt, l_variableNamingConvention); | |
| 453 | 1 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 454 | "\"\n", | ||
| 455 | "numberOfContinuousStates=\"" | ||
| 456 | }, false)); | ||
| 457 | 1 | txt := Tpl.writeText(txt, l_numberOfContinuousStates); | |
| 458 | 1 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 459 | "\"\n", | ||
| 460 | "numberOfEventIndicators=\"" | ||
| 461 | }, false)); | ||
| 462 | 1 | txt := Tpl.writeText(txt, l_numberOfEventIndicators); | |
| 463 | 1 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"")); | |
| 464 | then txt; | ||
| 465 | |||
| 466 | case ( txt, | ||
| 467 | _, | ||
| 468 | _ ) | ||
| 469 | then txt; | ||
| 470 | end match; | ||
| 471 | end fmiModelDescriptionAttributes; | ||
| 472 | |||
| 473 | protected function lm_60 | ||
| 474 | input output Tpl.Text txt; | ||
| 475 | input list<SimCodeVar.SimVar> items; | ||
| 476 | input output Tpl.Text a_stateDerVectorName; | ||
| 477 | input output Tpl.Text a_complexStartExpressions; | ||
| 478 | input Boolean a_generateFMUModelDescription; | ||
| 479 | input String a_indexForUndefinedReferencesReal; | ||
| 480 | input HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 481 | input SimCode.SimCode a_simCode; | ||
| 482 | algorithm | ||
| 483 |
2/2✓ Branch 0 taken 176 times.
✓ Branch 1 taken 50 times.
|
226 | for lstElt_60 in items loop |
| 484 | (txt, a_stateDerVectorName, a_complexStartExpressions) := match lstElt_60 | ||
| 485 | local | ||
| 486 | SimCodeVar.SimVar i_var; | ||
| 487 | |||
| 488 | case i_var | ||
| 489 | algorithm | ||
| 490 | 176 | (txt, a_complexStartExpressions, a_stateDerVectorName) := scalarVariableXML(txt, a_simCode, i_var, a_varToArrayIndexMapping, a_indexForUndefinedReferencesReal, a_generateFMUModelDescription, a_complexStartExpressions, a_stateDerVectorName); | |
| 491 | 176 | txt := Tpl.nextIter(txt); | |
| 492 | then (txt, a_stateDerVectorName, a_complexStartExpressions); | ||
| 493 | end match; | ||
| 494 | end for; | ||
| 495 | end lm_60; | ||
| 496 | |||
| 497 | protected function lm_61 | ||
| 498 | input output Tpl.Text txt; | ||
| 499 | input list<SimCodeVar.SimVar> items; | ||
| 500 | input output Tpl.Text a_stateDerVectorName; | ||
| 501 | input output Tpl.Text a_complexStartExpressions; | ||
| 502 | input Boolean a_generateFMUModelDescription; | ||
| 503 | input String a_indexForUndefinedReferencesReal; | ||
| 504 | input HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 505 | input SimCode.SimCode a_simCode; | ||
| 506 | algorithm | ||
| 507 |
2/2✓ Branch 0 taken 176 times.
✓ Branch 1 taken 50 times.
|
226 | for lstElt_61 in items loop |
| 508 | (txt, a_stateDerVectorName, a_complexStartExpressions) := match lstElt_61 | ||
| 509 | local | ||
| 510 | SimCodeVar.SimVar i_var; | ||
| 511 | |||
| 512 | case i_var | ||
| 513 | algorithm | ||
| 514 | 176 | (txt, a_complexStartExpressions, a_stateDerVectorName) := scalarVariableXML(txt, a_simCode, i_var, a_varToArrayIndexMapping, a_indexForUndefinedReferencesReal, a_generateFMUModelDescription, a_complexStartExpressions, a_stateDerVectorName); | |
| 515 | 176 | txt := Tpl.nextIter(txt); | |
| 516 | then (txt, a_stateDerVectorName, a_complexStartExpressions); | ||
| 517 | end match; | ||
| 518 | end for; | ||
| 519 | end lm_61; | ||
| 520 | |||
| 521 | protected function lm_62 | ||
| 522 | input output Tpl.Text txt; | ||
| 523 | input list<SimCodeVar.SimVar> items; | ||
| 524 | input output Tpl.Text a_stateDerVectorName; | ||
| 525 | input output Tpl.Text a_complexStartExpressions; | ||
| 526 | input Boolean a_generateFMUModelDescription; | ||
| 527 | input String a_indexForUndefinedReferencesReal; | ||
| 528 | input HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 529 | input SimCode.SimCode a_simCode; | ||
| 530 | algorithm | ||
| 531 |
2/2✓ Branch 0 taken 3998 times.
✓ Branch 1 taken 50 times.
|
4048 | for lstElt_62 in items loop |
| 532 | (txt, a_stateDerVectorName, a_complexStartExpressions) := match lstElt_62 | ||
| 533 | local | ||
| 534 | SimCodeVar.SimVar i_var; | ||
| 535 | |||
| 536 | case i_var | ||
| 537 | algorithm | ||
| 538 | 3998 | (txt, a_complexStartExpressions, a_stateDerVectorName) := scalarVariableXML(txt, a_simCode, i_var, a_varToArrayIndexMapping, a_indexForUndefinedReferencesReal, a_generateFMUModelDescription, a_complexStartExpressions, a_stateDerVectorName); | |
| 539 | 3998 | txt := Tpl.nextIter(txt); | |
| 540 | then (txt, a_stateDerVectorName, a_complexStartExpressions); | ||
| 541 | end match; | ||
| 542 | end for; | ||
| 543 | end lm_62; | ||
| 544 | |||
| 545 | protected function lm_63 | ||
| 546 | input output Tpl.Text txt; | ||
| 547 | input list<SimCodeVar.SimVar> items; | ||
| 548 | input output Tpl.Text a_stateDerVectorName; | ||
| 549 | input output Tpl.Text a_complexStartExpressions; | ||
| 550 | input Boolean a_generateFMUModelDescription; | ||
| 551 | input String a_indexForUndefinedReferencesReal; | ||
| 552 | input HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 553 | input SimCode.SimCode a_simCode; | ||
| 554 | algorithm | ||
| 555 |
2/2✓ Branch 0 taken 303 times.
✓ Branch 1 taken 50 times.
|
353 | for lstElt_63 in items loop |
| 556 | (txt, a_stateDerVectorName, a_complexStartExpressions) := match lstElt_63 | ||
| 557 | local | ||
| 558 | SimCodeVar.SimVar i_var; | ||
| 559 | |||
| 560 | case i_var | ||
| 561 | algorithm | ||
| 562 | 303 | (txt, a_complexStartExpressions, a_stateDerVectorName) := scalarVariableXML(txt, a_simCode, i_var, a_varToArrayIndexMapping, a_indexForUndefinedReferencesReal, a_generateFMUModelDescription, a_complexStartExpressions, a_stateDerVectorName); | |
| 563 | 303 | txt := Tpl.nextIter(txt); | |
| 564 | then (txt, a_stateDerVectorName, a_complexStartExpressions); | ||
| 565 | end match; | ||
| 566 | end for; | ||
| 567 | end lm_63; | ||
| 568 | |||
| 569 | protected function lm_64 | ||
| 570 | input output Tpl.Text txt; | ||
| 571 | input list<SimCodeVar.SimVar> items; | ||
| 572 | input output Tpl.Text a_stateDerVectorName; | ||
| 573 | input output Tpl.Text a_complexStartExpressions; | ||
| 574 | input Boolean a_generateFMUModelDescription; | ||
| 575 | input String a_indexForUndefinedReferencesReal; | ||
| 576 | input HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 577 | input SimCode.SimCode a_simCode; | ||
| 578 | algorithm | ||
| 579 |
2/2✓ Branch 0 taken 1834 times.
✓ Branch 1 taken 50 times.
|
1884 | for lstElt_64 in items loop |
| 580 | (txt, a_stateDerVectorName, a_complexStartExpressions) := match lstElt_64 | ||
| 581 | local | ||
| 582 | SimCodeVar.SimVar i_var; | ||
| 583 | |||
| 584 | case i_var | ||
| 585 | algorithm | ||
| 586 | 1834 | (txt, a_complexStartExpressions, a_stateDerVectorName) := scalarVariableXML(txt, a_simCode, i_var, a_varToArrayIndexMapping, a_indexForUndefinedReferencesReal, a_generateFMUModelDescription, a_complexStartExpressions, a_stateDerVectorName); | |
| 587 | 1834 | txt := Tpl.nextIter(txt); | |
| 588 | then (txt, a_stateDerVectorName, a_complexStartExpressions); | ||
| 589 | end match; | ||
| 590 | end for; | ||
| 591 | end lm_64; | ||
| 592 | |||
| 593 | protected function lm_65 | ||
| 594 | input output Tpl.Text txt; | ||
| 595 | input list<SimCodeVar.SimVar> items; | ||
| 596 | input output Tpl.Text a_stateDerVectorName; | ||
| 597 | input output Tpl.Text a_complexStartExpressions; | ||
| 598 | input Boolean a_generateFMUModelDescription; | ||
| 599 | input String a_indexForUndefinedReferencesReal; | ||
| 600 | input HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 601 | input SimCode.SimCode a_simCode; | ||
| 602 | algorithm | ||
| 603 |
2/2✓ Branch 0 taken 3318 times.
✓ Branch 1 taken 50 times.
|
3368 | for lstElt_65 in items loop |
| 604 | (txt, a_stateDerVectorName, a_complexStartExpressions) := match lstElt_65 | ||
| 605 | local | ||
| 606 | SimCodeVar.SimVar i_var; | ||
| 607 | |||
| 608 | case i_var | ||
| 609 | algorithm | ||
| 610 | 3318 | (txt, a_complexStartExpressions, a_stateDerVectorName) := scalarVariableXML(txt, a_simCode, i_var, a_varToArrayIndexMapping, a_indexForUndefinedReferencesReal, a_generateFMUModelDescription, a_complexStartExpressions, a_stateDerVectorName); | |
| 611 | 3318 | txt := Tpl.nextIter(txt); | |
| 612 | then (txt, a_stateDerVectorName, a_complexStartExpressions); | ||
| 613 | end match; | ||
| 614 | end for; | ||
| 615 | end lm_65; | ||
| 616 | |||
| 617 | protected function lm_66 | ||
| 618 | input output Tpl.Text txt; | ||
| 619 | input list<SimCodeVar.SimVar> items; | ||
| 620 | input output Tpl.Text a_stateDerVectorName; | ||
| 621 | input output Tpl.Text a_complexStartExpressions; | ||
| 622 | input Boolean a_generateFMUModelDescription; | ||
| 623 | input String a_indexForUndefinedReferencesInt; | ||
| 624 | input HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 625 | input SimCode.SimCode a_simCode; | ||
| 626 | algorithm | ||
| 627 |
2/2✓ Branch 0 taken 274 times.
✓ Branch 1 taken 50 times.
|
324 | for lstElt_66 in items loop |
| 628 | (txt, a_stateDerVectorName, a_complexStartExpressions) := match lstElt_66 | ||
| 629 | local | ||
| 630 | SimCodeVar.SimVar i_var; | ||
| 631 | |||
| 632 | case i_var | ||
| 633 | algorithm | ||
| 634 | 274 | (txt, a_complexStartExpressions, a_stateDerVectorName) := scalarVariableXML(txt, a_simCode, i_var, a_varToArrayIndexMapping, a_indexForUndefinedReferencesInt, a_generateFMUModelDescription, a_complexStartExpressions, a_stateDerVectorName); | |
| 635 | 274 | txt := Tpl.nextIter(txt); | |
| 636 | then (txt, a_stateDerVectorName, a_complexStartExpressions); | ||
| 637 | end match; | ||
| 638 | end for; | ||
| 639 | end lm_66; | ||
| 640 | |||
| 641 | protected function lm_67 | ||
| 642 | input output Tpl.Text txt; | ||
| 643 | input list<SimCodeVar.SimVar> items; | ||
| 644 | input output Tpl.Text a_stateDerVectorName; | ||
| 645 | input output Tpl.Text a_complexStartExpressions; | ||
| 646 | input Boolean a_generateFMUModelDescription; | ||
| 647 | input String a_indexForUndefinedReferencesInt; | ||
| 648 | input HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 649 | input SimCode.SimCode a_simCode; | ||
| 650 | algorithm | ||
| 651 |
2/2✓ Branch 0 taken 377 times.
✓ Branch 1 taken 50 times.
|
427 | for lstElt_67 in items loop |
| 652 | (txt, a_stateDerVectorName, a_complexStartExpressions) := match lstElt_67 | ||
| 653 | local | ||
| 654 | SimCodeVar.SimVar i_var; | ||
| 655 | |||
| 656 | case i_var | ||
| 657 | algorithm | ||
| 658 | 377 | (txt, a_complexStartExpressions, a_stateDerVectorName) := scalarVariableXML(txt, a_simCode, i_var, a_varToArrayIndexMapping, a_indexForUndefinedReferencesInt, a_generateFMUModelDescription, a_complexStartExpressions, a_stateDerVectorName); | |
| 659 | 377 | txt := Tpl.nextIter(txt); | |
| 660 | then (txt, a_stateDerVectorName, a_complexStartExpressions); | ||
| 661 | end match; | ||
| 662 | end for; | ||
| 663 | end lm_67; | ||
| 664 | |||
| 665 | protected function lm_68 | ||
| 666 | input output Tpl.Text txt; | ||
| 667 | input list<SimCodeVar.SimVar> items; | ||
| 668 | input output Tpl.Text a_stateDerVectorName; | ||
| 669 | input output Tpl.Text a_complexStartExpressions; | ||
| 670 | input Boolean a_generateFMUModelDescription; | ||
| 671 | input String a_indexForUndefinedReferencesInt; | ||
| 672 | input HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 673 | input SimCode.SimCode a_simCode; | ||
| 674 | algorithm | ||
| 675 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 50 times.
|
306 | for lstElt_68 in items loop |
| 676 | (txt, a_stateDerVectorName, a_complexStartExpressions) := match lstElt_68 | ||
| 677 | local | ||
| 678 | SimCodeVar.SimVar i_var; | ||
| 679 | |||
| 680 | case i_var | ||
| 681 | algorithm | ||
| 682 | 256 | (txt, a_complexStartExpressions, a_stateDerVectorName) := scalarVariableXML(txt, a_simCode, i_var, a_varToArrayIndexMapping, a_indexForUndefinedReferencesInt, a_generateFMUModelDescription, a_complexStartExpressions, a_stateDerVectorName); | |
| 683 | 256 | txt := Tpl.nextIter(txt); | |
| 684 | then (txt, a_stateDerVectorName, a_complexStartExpressions); | ||
| 685 | end match; | ||
| 686 | end for; | ||
| 687 | end lm_68; | ||
| 688 | |||
| 689 | protected function lm_69 | ||
| 690 | input output Tpl.Text txt; | ||
| 691 | input list<SimCodeVar.SimVar> items; | ||
| 692 | input output Tpl.Text a_stateDerVectorName; | ||
| 693 | input output Tpl.Text a_complexStartExpressions; | ||
| 694 | input Boolean a_generateFMUModelDescription; | ||
| 695 | input String a_indexForUndefinedReferencesBool; | ||
| 696 | input HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 697 | input SimCode.SimCode a_simCode; | ||
| 698 | algorithm | ||
| 699 |
2/2✓ Branch 0 taken 308 times.
✓ Branch 1 taken 50 times.
|
358 | for lstElt_69 in items loop |
| 700 | (txt, a_stateDerVectorName, a_complexStartExpressions) := match lstElt_69 | ||
| 701 | local | ||
| 702 | SimCodeVar.SimVar i_var; | ||
| 703 | |||
| 704 | case i_var | ||
| 705 | algorithm | ||
| 706 | 308 | (txt, a_complexStartExpressions, a_stateDerVectorName) := scalarVariableXML(txt, a_simCode, i_var, a_varToArrayIndexMapping, a_indexForUndefinedReferencesBool, a_generateFMUModelDescription, a_complexStartExpressions, a_stateDerVectorName); | |
| 707 | 308 | txt := Tpl.nextIter(txt); | |
| 708 | then (txt, a_stateDerVectorName, a_complexStartExpressions); | ||
| 709 | end match; | ||
| 710 | end for; | ||
| 711 | end lm_69; | ||
| 712 | |||
| 713 | protected function lm_70 | ||
| 714 | input output Tpl.Text txt; | ||
| 715 | input list<SimCodeVar.SimVar> items; | ||
| 716 | input output Tpl.Text a_stateDerVectorName; | ||
| 717 | input output Tpl.Text a_complexStartExpressions; | ||
| 718 | input Boolean a_generateFMUModelDescription; | ||
| 719 | input String a_indexForUndefinedReferencesBool; | ||
| 720 | input HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 721 | input SimCode.SimCode a_simCode; | ||
| 722 | algorithm | ||
| 723 |
2/2✓ Branch 0 taken 396 times.
✓ Branch 1 taken 50 times.
|
446 | for lstElt_70 in items loop |
| 724 | (txt, a_stateDerVectorName, a_complexStartExpressions) := match lstElt_70 | ||
| 725 | local | ||
| 726 | SimCodeVar.SimVar i_var; | ||
| 727 | |||
| 728 | case i_var | ||
| 729 | algorithm | ||
| 730 | 396 | (txt, a_complexStartExpressions, a_stateDerVectorName) := scalarVariableXML(txt, a_simCode, i_var, a_varToArrayIndexMapping, a_indexForUndefinedReferencesBool, a_generateFMUModelDescription, a_complexStartExpressions, a_stateDerVectorName); | |
| 731 | 396 | txt := Tpl.nextIter(txt); | |
| 732 | then (txt, a_stateDerVectorName, a_complexStartExpressions); | ||
| 733 | end match; | ||
| 734 | end for; | ||
| 735 | end lm_70; | ||
| 736 | |||
| 737 | protected function lm_71 | ||
| 738 | input output Tpl.Text txt; | ||
| 739 | input list<SimCodeVar.SimVar> items; | ||
| 740 | input output Tpl.Text a_stateDerVectorName; | ||
| 741 | input output Tpl.Text a_complexStartExpressions; | ||
| 742 | input Boolean a_generateFMUModelDescription; | ||
| 743 | input String a_indexForUndefinedReferencesBool; | ||
| 744 | input HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 745 | input SimCode.SimCode a_simCode; | ||
| 746 | algorithm | ||
| 747 |
2/2✓ Branch 0 taken 255 times.
✓ Branch 1 taken 50 times.
|
305 | for lstElt_71 in items loop |
| 748 | (txt, a_stateDerVectorName, a_complexStartExpressions) := match lstElt_71 | ||
| 749 | local | ||
| 750 | SimCodeVar.SimVar i_var; | ||
| 751 | |||
| 752 | case i_var | ||
| 753 | algorithm | ||
| 754 | 255 | (txt, a_complexStartExpressions, a_stateDerVectorName) := scalarVariableXML(txt, a_simCode, i_var, a_varToArrayIndexMapping, a_indexForUndefinedReferencesBool, a_generateFMUModelDescription, a_complexStartExpressions, a_stateDerVectorName); | |
| 755 | 255 | txt := Tpl.nextIter(txt); | |
| 756 | then (txt, a_stateDerVectorName, a_complexStartExpressions); | ||
| 757 | end match; | ||
| 758 | end for; | ||
| 759 | end lm_71; | ||
| 760 | |||
| 761 | protected function lm_72 | ||
| 762 | input output Tpl.Text txt; | ||
| 763 | input list<SimCodeVar.SimVar> items; | ||
| 764 | input output Tpl.Text a_stateDerVectorName; | ||
| 765 | input output Tpl.Text a_complexStartExpressions; | ||
| 766 | input Boolean a_generateFMUModelDescription; | ||
| 767 | input String a_indexForUndefinedReferencesString; | ||
| 768 | input HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 769 | input SimCode.SimCode a_simCode; | ||
| 770 | algorithm | ||
| 771 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 50 times.
|
53 | for lstElt_72 in items loop |
| 772 | (txt, a_stateDerVectorName, a_complexStartExpressions) := match lstElt_72 | ||
| 773 | local | ||
| 774 | SimCodeVar.SimVar i_var; | ||
| 775 | |||
| 776 | case i_var | ||
| 777 | algorithm | ||
| 778 | 3 | (txt, a_complexStartExpressions, a_stateDerVectorName) := scalarVariableXML(txt, a_simCode, i_var, a_varToArrayIndexMapping, a_indexForUndefinedReferencesString, a_generateFMUModelDescription, a_complexStartExpressions, a_stateDerVectorName); | |
| 779 | 3 | txt := Tpl.nextIter(txt); | |
| 780 | then (txt, a_stateDerVectorName, a_complexStartExpressions); | ||
| 781 | end match; | ||
| 782 | end for; | ||
| 783 | end lm_72; | ||
| 784 | |||
| 785 | protected function lm_73 | ||
| 786 | input output Tpl.Text txt; | ||
| 787 | input list<SimCodeVar.SimVar> items; | ||
| 788 | input output Tpl.Text a_stateDerVectorName; | ||
| 789 | input output Tpl.Text a_complexStartExpressions; | ||
| 790 | input Boolean a_generateFMUModelDescription; | ||
| 791 | input String a_indexForUndefinedReferencesString; | ||
| 792 | input HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 793 | input SimCode.SimCode a_simCode; | ||
| 794 | algorithm | ||
| 795 |
2/2✓ Branch 0 taken 54 times.
✓ Branch 1 taken 50 times.
|
104 | for lstElt_73 in items loop |
| 796 | (txt, a_stateDerVectorName, a_complexStartExpressions) := match lstElt_73 | ||
| 797 | local | ||
| 798 | SimCodeVar.SimVar i_var; | ||
| 799 | |||
| 800 | case i_var | ||
| 801 | algorithm | ||
| 802 | 54 | (txt, a_complexStartExpressions, a_stateDerVectorName) := scalarVariableXML(txt, a_simCode, i_var, a_varToArrayIndexMapping, a_indexForUndefinedReferencesString, a_generateFMUModelDescription, a_complexStartExpressions, a_stateDerVectorName); | |
| 803 | 54 | txt := Tpl.nextIter(txt); | |
| 804 | then (txt, a_stateDerVectorName, a_complexStartExpressions); | ||
| 805 | end match; | ||
| 806 | end for; | ||
| 807 | end lm_73; | ||
| 808 | |||
| 809 | protected function lm_74 | ||
| 810 | input output Tpl.Text txt; | ||
| 811 | input list<SimCodeVar.SimVar> items; | ||
| 812 | input output Tpl.Text a_stateDerVectorName; | ||
| 813 | input output Tpl.Text a_complexStartExpressions; | ||
| 814 | input Boolean a_generateFMUModelDescription; | ||
| 815 | input String a_indexForUndefinedReferencesString; | ||
| 816 | input HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 817 | input SimCode.SimCode a_simCode; | ||
| 818 | algorithm | ||
| 819 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 50 times.
|
50 | for lstElt_74 in items loop |
| 820 | (txt, a_stateDerVectorName, a_complexStartExpressions) := match lstElt_74 | ||
| 821 | local | ||
| 822 | SimCodeVar.SimVar i_var; | ||
| 823 | |||
| 824 | case i_var | ||
| 825 | algorithm | ||
| 826 | ✗ | (txt, a_complexStartExpressions, a_stateDerVectorName) := scalarVariableXML(txt, a_simCode, i_var, a_varToArrayIndexMapping, a_indexForUndefinedReferencesString, a_generateFMUModelDescription, a_complexStartExpressions, a_stateDerVectorName); | |
| 827 | ✗ | txt := Tpl.nextIter(txt); | |
| 828 | then (txt, a_stateDerVectorName, a_complexStartExpressions); | ||
| 829 | end match; | ||
| 830 | end for; | ||
| 831 | end lm_74; | ||
| 832 | |||
| 833 | protected function fun_75 | ||
| 834 | input Tpl.Text in_txt; | ||
| 835 | input SimCode.ModelInfo in_a_modelInfo; | ||
| 836 | input SimCode.SimCode in_a_simCode; | ||
| 837 | input HashTableCrIListArray.HashTable in_a_varToArrayIndexMapping; | ||
| 838 | input String in_a_indexForUndefinedReferencesReal; | ||
| 839 | input String in_a_indexForUndefinedReferencesInt; | ||
| 840 | input String in_a_indexForUndefinedReferencesBool; | ||
| 841 | input String in_a_indexForUndefinedReferencesString; | ||
| 842 | input Boolean in_a_generateFMUModelDescription; | ||
| 843 | input Tpl.Text in_a_complexStartExpressions; | ||
| 844 | input Tpl.Text in_a_stateDerVectorName; | ||
| 845 | |||
| 846 | output Tpl.Text out_txt; | ||
| 847 | output Tpl.Text out_a_complexStartExpressions; | ||
| 848 | output Tpl.Text out_a_stateDerVectorName; | ||
| 849 | algorithm | ||
| 850 | (out_txt, out_a_complexStartExpressions, out_a_stateDerVectorName) := | ||
| 851 | match(in_txt, in_a_modelInfo, in_a_simCode, in_a_varToArrayIndexMapping, in_a_indexForUndefinedReferencesReal, in_a_indexForUndefinedReferencesInt, in_a_indexForUndefinedReferencesBool, in_a_indexForUndefinedReferencesString, in_a_generateFMUModelDescription, in_a_complexStartExpressions, in_a_stateDerVectorName) | ||
| 852 | local | ||
| 853 | Tpl.Text txt; | ||
| 854 | SimCode.SimCode a_simCode; | ||
| 855 | HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 856 | String a_indexForUndefinedReferencesReal; | ||
| 857 | String a_indexForUndefinedReferencesInt; | ||
| 858 | String a_indexForUndefinedReferencesBool; | ||
| 859 | String a_indexForUndefinedReferencesString; | ||
| 860 | Boolean a_generateFMUModelDescription; | ||
| 861 | Tpl.Text a_complexStartExpressions; | ||
| 862 | Tpl.Text a_stateDerVectorName; | ||
| 863 | list<SimCodeVar.SimVar> i_vars_stringAliasVars; | ||
| 864 | list<SimCodeVar.SimVar> i_vars_stringParamVars; | ||
| 865 | list<SimCodeVar.SimVar> i_vars_stringAlgVars; | ||
| 866 | list<SimCodeVar.SimVar> i_vars_boolAliasVars; | ||
| 867 | list<SimCodeVar.SimVar> i_vars_boolParamVars; | ||
| 868 | list<SimCodeVar.SimVar> i_vars_boolAlgVars; | ||
| 869 | list<SimCodeVar.SimVar> i_vars_intAliasVars; | ||
| 870 | list<SimCodeVar.SimVar> i_vars_intParamVars; | ||
| 871 | list<SimCodeVar.SimVar> i_vars_intAlgVars; | ||
| 872 | list<SimCodeVar.SimVar> i_vars_aliasVars; | ||
| 873 | list<SimCodeVar.SimVar> i_vars_paramVars; | ||
| 874 | list<SimCodeVar.SimVar> i_vars_discreteAlgVars; | ||
| 875 | list<SimCodeVar.SimVar> i_vars_algVars; | ||
| 876 | list<SimCodeVar.SimVar> i_vars_derivativeVars; | ||
| 877 | list<SimCodeVar.SimVar> i_vars_stateVars; | ||
| 878 | |||
| 879 | case ( txt, | ||
| 880 | SimCode.MODELINFO(vars = SimCodeVar.SIMVARS(stateVars = i_vars_stateVars, derivativeVars = i_vars_derivativeVars, algVars = i_vars_algVars, discreteAlgVars = i_vars_discreteAlgVars, paramVars = i_vars_paramVars, aliasVars = i_vars_aliasVars, intAlgVars = i_vars_intAlgVars, intParamVars = i_vars_intParamVars, intAliasVars = i_vars_intAliasVars, boolAlgVars = i_vars_boolAlgVars, boolParamVars = i_vars_boolParamVars, boolAliasVars = i_vars_boolAliasVars, stringAlgVars = i_vars_stringAlgVars, stringParamVars = i_vars_stringParamVars, stringAliasVars = i_vars_stringAliasVars), varInfo = SimCode.VARINFO(numAlgVars = _, numDiscreteReal = _, numOptimizeConstraints = _)), | ||
| 881 | a_simCode, | ||
| 882 | a_varToArrayIndexMapping, | ||
| 883 | a_indexForUndefinedReferencesReal, | ||
| 884 | a_indexForUndefinedReferencesInt, | ||
| 885 | a_indexForUndefinedReferencesBool, | ||
| 886 | a_indexForUndefinedReferencesString, | ||
| 887 | a_generateFMUModelDescription, | ||
| 888 | a_complexStartExpressions, | ||
| 889 | a_stateDerVectorName ) | ||
| 890 | algorithm | ||
| 891 | 50 | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, SOME(Tpl.ST_STRING("")), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 892 | 50 | (txt, a_stateDerVectorName, a_complexStartExpressions) := lm_60(txt, i_vars_stateVars, a_stateDerVectorName, a_complexStartExpressions, a_generateFMUModelDescription, a_indexForUndefinedReferencesReal, a_varToArrayIndexMapping, a_simCode); | |
| 893 | 50 | txt := Tpl.popIter(txt); | |
| 894 | 50 | txt := Tpl.softNewLine(txt); | |
| 895 | 50 | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, SOME(Tpl.ST_STRING("")), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 896 | 50 | (txt, a_stateDerVectorName, a_complexStartExpressions) := lm_61(txt, i_vars_derivativeVars, a_stateDerVectorName, a_complexStartExpressions, a_generateFMUModelDescription, a_indexForUndefinedReferencesReal, a_varToArrayIndexMapping, a_simCode); | |
| 897 | 50 | txt := Tpl.popIter(txt); | |
| 898 | 50 | txt := Tpl.softNewLine(txt); | |
| 899 | 50 | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, SOME(Tpl.ST_STRING("")), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 900 | 50 | (txt, a_stateDerVectorName, a_complexStartExpressions) := lm_62(txt, i_vars_algVars, a_stateDerVectorName, a_complexStartExpressions, a_generateFMUModelDescription, a_indexForUndefinedReferencesReal, a_varToArrayIndexMapping, a_simCode); | |
| 901 | 50 | txt := Tpl.popIter(txt); | |
| 902 | 50 | txt := Tpl.softNewLine(txt); | |
| 903 | 50 | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, SOME(Tpl.ST_STRING("")), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 904 | 50 | (txt, a_stateDerVectorName, a_complexStartExpressions) := lm_63(txt, i_vars_discreteAlgVars, a_stateDerVectorName, a_complexStartExpressions, a_generateFMUModelDescription, a_indexForUndefinedReferencesReal, a_varToArrayIndexMapping, a_simCode); | |
| 905 | 50 | txt := Tpl.popIter(txt); | |
| 906 | 50 | txt := Tpl.softNewLine(txt); | |
| 907 | 50 | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, SOME(Tpl.ST_STRING("")), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 908 | 50 | (txt, a_stateDerVectorName, a_complexStartExpressions) := lm_64(txt, i_vars_paramVars, a_stateDerVectorName, a_complexStartExpressions, a_generateFMUModelDescription, a_indexForUndefinedReferencesReal, a_varToArrayIndexMapping, a_simCode); | |
| 909 | 50 | txt := Tpl.popIter(txt); | |
| 910 | 50 | txt := Tpl.softNewLine(txt); | |
| 911 | 50 | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, SOME(Tpl.ST_STRING("")), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 912 | 50 | (txt, a_stateDerVectorName, a_complexStartExpressions) := lm_65(txt, i_vars_aliasVars, a_stateDerVectorName, a_complexStartExpressions, a_generateFMUModelDescription, a_indexForUndefinedReferencesReal, a_varToArrayIndexMapping, a_simCode); | |
| 913 | 50 | txt := Tpl.popIter(txt); | |
| 914 | 50 | txt := Tpl.softNewLine(txt); | |
| 915 | 50 | txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE()); | |
| 916 | 50 | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, SOME(Tpl.ST_STRING("")), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 917 | 50 | (txt, a_stateDerVectorName, a_complexStartExpressions) := lm_66(txt, i_vars_intAlgVars, a_stateDerVectorName, a_complexStartExpressions, a_generateFMUModelDescription, a_indexForUndefinedReferencesInt, a_varToArrayIndexMapping, a_simCode); | |
| 918 | 50 | txt := Tpl.popIter(txt); | |
| 919 | 50 | txt := Tpl.softNewLine(txt); | |
| 920 | 50 | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, SOME(Tpl.ST_STRING("")), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 921 | 50 | (txt, a_stateDerVectorName, a_complexStartExpressions) := lm_67(txt, i_vars_intParamVars, a_stateDerVectorName, a_complexStartExpressions, a_generateFMUModelDescription, a_indexForUndefinedReferencesInt, a_varToArrayIndexMapping, a_simCode); | |
| 922 | 50 | txt := Tpl.popIter(txt); | |
| 923 | 50 | txt := Tpl.softNewLine(txt); | |
| 924 | 50 | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, SOME(Tpl.ST_STRING("")), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 925 | 50 | (txt, a_stateDerVectorName, a_complexStartExpressions) := lm_68(txt, i_vars_intAliasVars, a_stateDerVectorName, a_complexStartExpressions, a_generateFMUModelDescription, a_indexForUndefinedReferencesInt, a_varToArrayIndexMapping, a_simCode); | |
| 926 | 50 | txt := Tpl.popIter(txt); | |
| 927 | 50 | txt := Tpl.softNewLine(txt); | |
| 928 | 50 | txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE()); | |
| 929 | 50 | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, SOME(Tpl.ST_STRING("")), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 930 | 50 | (txt, a_stateDerVectorName, a_complexStartExpressions) := lm_69(txt, i_vars_boolAlgVars, a_stateDerVectorName, a_complexStartExpressions, a_generateFMUModelDescription, a_indexForUndefinedReferencesBool, a_varToArrayIndexMapping, a_simCode); | |
| 931 | 50 | txt := Tpl.popIter(txt); | |
| 932 | 50 | txt := Tpl.softNewLine(txt); | |
| 933 | 50 | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, SOME(Tpl.ST_STRING("")), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 934 | 50 | (txt, a_stateDerVectorName, a_complexStartExpressions) := lm_70(txt, i_vars_boolParamVars, a_stateDerVectorName, a_complexStartExpressions, a_generateFMUModelDescription, a_indexForUndefinedReferencesBool, a_varToArrayIndexMapping, a_simCode); | |
| 935 | 50 | txt := Tpl.popIter(txt); | |
| 936 | 50 | txt := Tpl.softNewLine(txt); | |
| 937 | 50 | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, SOME(Tpl.ST_STRING("")), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 938 | 50 | (txt, a_stateDerVectorName, a_complexStartExpressions) := lm_71(txt, i_vars_boolAliasVars, a_stateDerVectorName, a_complexStartExpressions, a_generateFMUModelDescription, a_indexForUndefinedReferencesBool, a_varToArrayIndexMapping, a_simCode); | |
| 939 | 50 | txt := Tpl.popIter(txt); | |
| 940 | 50 | txt := Tpl.softNewLine(txt); | |
| 941 | 50 | txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE()); | |
| 942 | 50 | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, SOME(Tpl.ST_STRING("")), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 943 | 50 | (txt, a_stateDerVectorName, a_complexStartExpressions) := lm_72(txt, i_vars_stringAlgVars, a_stateDerVectorName, a_complexStartExpressions, a_generateFMUModelDescription, a_indexForUndefinedReferencesString, a_varToArrayIndexMapping, a_simCode); | |
| 944 | 50 | txt := Tpl.popIter(txt); | |
| 945 | 50 | txt := Tpl.softNewLine(txt); | |
| 946 | 50 | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, SOME(Tpl.ST_STRING("")), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 947 | 50 | (txt, a_stateDerVectorName, a_complexStartExpressions) := lm_73(txt, i_vars_stringParamVars, a_stateDerVectorName, a_complexStartExpressions, a_generateFMUModelDescription, a_indexForUndefinedReferencesString, a_varToArrayIndexMapping, a_simCode); | |
| 948 | 50 | txt := Tpl.popIter(txt); | |
| 949 | 50 | txt := Tpl.softNewLine(txt); | |
| 950 | 50 | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, SOME(Tpl.ST_STRING("")), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 951 | 50 | (txt, a_stateDerVectorName, a_complexStartExpressions) := lm_74(txt, i_vars_stringAliasVars, a_stateDerVectorName, a_complexStartExpressions, a_generateFMUModelDescription, a_indexForUndefinedReferencesString, a_varToArrayIndexMapping, a_simCode); | |
| 952 | 50 | txt := Tpl.popIter(txt); | |
| 953 | 50 | then (txt, a_complexStartExpressions, a_stateDerVectorName); | |
| 954 | |||
| 955 | case ( txt, | ||
| 956 | _, | ||
| 957 | _, | ||
| 958 | _, | ||
| 959 | _, | ||
| 960 | _, | ||
| 961 | _, | ||
| 962 | _, | ||
| 963 | _, | ||
| 964 | a_complexStartExpressions, | ||
| 965 | a_stateDerVectorName ) | ||
| 966 | then (txt, a_complexStartExpressions, a_stateDerVectorName); | ||
| 967 | end match; | ||
| 968 | end fun_75; | ||
| 969 | |||
| 970 | public function modelVariablesXML | ||
| 971 | input Tpl.Text txt; | ||
| 972 | input SimCode.SimCode a_simCode; | ||
| 973 | input SimCode.ModelInfo a_modelInfo; | ||
| 974 | input HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 975 | input String a_indexForUndefinedReferencesReal; | ||
| 976 | input String a_indexForUndefinedReferencesInt; | ||
| 977 | input String a_indexForUndefinedReferencesBool; | ||
| 978 | input String a_indexForUndefinedReferencesString; | ||
| 979 | input Boolean a_generateFMUModelDescription; | ||
| 980 | input Tpl.Text a_complexStartExpressions; | ||
| 981 | input Tpl.Text a_stateDerVectorName; | ||
| 982 | |||
| 983 | output Tpl.Text out_txt; | ||
| 984 | output Tpl.Text out_a_complexStartExpressions; | ||
| 985 | output Tpl.Text out_a_stateDerVectorName; | ||
| 986 | algorithm | ||
| 987 | 50 | (out_txt, out_a_complexStartExpressions, out_a_stateDerVectorName) := fun_75(txt, a_modelInfo, a_simCode, a_varToArrayIndexMapping, a_indexForUndefinedReferencesReal, a_indexForUndefinedReferencesInt, a_indexForUndefinedReferencesBool, a_indexForUndefinedReferencesString, a_generateFMUModelDescription, a_complexStartExpressions, a_stateDerVectorName); | |
| 988 | end modelVariablesXML; | ||
| 989 | |||
| 990 | protected function fun_77 | ||
| 991 | input Tpl.Text in_txt; | ||
| 992 | input Boolean in_a_generateFMUModelDescription; | ||
| 993 | input SimCodeVar.SimVar in_a_simVar; | ||
| 994 | input Tpl.Text in_a_stateDerVectorName; | ||
| 995 | input Tpl.Text in_a_complexStartExpressions; | ||
| 996 | input DAE.Type in_a_type__; | ||
| 997 | input Boolean in_a_isFixed; | ||
| 998 | input Option<DAE.Exp> in_a_nominalValue; | ||
| 999 | input Option<DAE.Exp> in_a_initialValue; | ||
| 1000 | input Option<DAE.Exp> in_a_maxValue; | ||
| 1001 | input Option<DAE.Exp> in_a_minValue; | ||
| 1002 | input String in_a_displayUnit; | ||
| 1003 | input String in_a_unit; | ||
| 1004 | input SimCodeVar.AliasVariable in_a_aliasvar; | ||
| 1005 | input DAE.ComponentRef in_a_name; | ||
| 1006 | input SimCode.SimCode in_a_simCode; | ||
| 1007 | |||
| 1008 | output Tpl.Text out_txt; | ||
| 1009 | output Tpl.Text out_a_stateDerVectorName; | ||
| 1010 | output Tpl.Text out_a_complexStartExpressions; | ||
| 1011 | algorithm | ||
| 1012 | (out_txt, out_a_stateDerVectorName, out_a_complexStartExpressions) := | ||
| 1013 | match(in_txt, in_a_generateFMUModelDescription, in_a_simVar, in_a_stateDerVectorName, in_a_complexStartExpressions, in_a_type__, in_a_isFixed, in_a_nominalValue, in_a_initialValue, in_a_maxValue, in_a_minValue, in_a_displayUnit, in_a_unit, in_a_aliasvar, in_a_name, in_a_simCode) | ||
| 1014 | local | ||
| 1015 | Tpl.Text txt; | ||
| 1016 | SimCodeVar.SimVar a_simVar; | ||
| 1017 | Tpl.Text a_stateDerVectorName; | ||
| 1018 | Tpl.Text a_complexStartExpressions; | ||
| 1019 | DAE.Type a_type__; | ||
| 1020 | Boolean a_isFixed; | ||
| 1021 | Option<DAE.Exp> a_nominalValue; | ||
| 1022 | Option<DAE.Exp> a_initialValue; | ||
| 1023 | Option<DAE.Exp> a_maxValue; | ||
| 1024 | Option<DAE.Exp> a_minValue; | ||
| 1025 | String a_displayUnit; | ||
| 1026 | String a_unit; | ||
| 1027 | SimCodeVar.AliasVariable a_aliasvar; | ||
| 1028 | DAE.ComponentRef a_name; | ||
| 1029 | SimCode.SimCode a_simCode; | ||
| 1030 | |||
| 1031 | case ( txt, | ||
| 1032 | false, | ||
| 1033 | _, | ||
| 1034 | a_stateDerVectorName, | ||
| 1035 | a_complexStartExpressions, | ||
| 1036 | a_type__, | ||
| 1037 | a_isFixed, | ||
| 1038 | a_nominalValue, | ||
| 1039 | a_initialValue, | ||
| 1040 | a_maxValue, | ||
| 1041 | a_minValue, | ||
| 1042 | a_displayUnit, | ||
| 1043 | a_unit, | ||
| 1044 | a_aliasvar, | ||
| 1045 | a_name, | ||
| 1046 | a_simCode ) | ||
| 1047 | algorithm | ||
| 1048 | 4 | (txt, a_complexStartExpressions, a_stateDerVectorName) := ScalarVariableType(txt, a_simCode, a_name, a_aliasvar, a_unit, a_displayUnit, a_minValue, a_maxValue, a_initialValue, a_nominalValue, a_isFixed, a_type__, a_complexStartExpressions, a_stateDerVectorName); | |
| 1049 | 4 | then (txt, a_stateDerVectorName, a_complexStartExpressions); | |
| 1050 | |||
| 1051 | case ( txt, | ||
| 1052 | _, | ||
| 1053 | a_simVar, | ||
| 1054 | a_stateDerVectorName, | ||
| 1055 | a_complexStartExpressions, | ||
| 1056 | _, | ||
| 1057 | _, | ||
| 1058 | _, | ||
| 1059 | _, | ||
| 1060 | _, | ||
| 1061 | _, | ||
| 1062 | _, | ||
| 1063 | _, | ||
| 1064 | _, | ||
| 1065 | _, | ||
| 1066 | _ ) | ||
| 1067 | algorithm | ||
| 1068 | ✗ | txt := CodegenFMUCommon.ScalarVariableType(txt, a_simVar); | |
| 1069 | ✗ | then (txt, a_stateDerVectorName, a_complexStartExpressions); | |
| 1070 | end match; | ||
| 1071 | end fun_77; | ||
| 1072 | |||
| 1073 | protected function lm_78 | ||
| 1074 | input output Tpl.Text txt; | ||
| 1075 | input list<String> items; | ||
| 1076 | algorithm | ||
| 1077 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
|
8 | for lstElt_78 in items loop |
| 1078 | txt := match lstElt_78 | ||
| 1079 | local | ||
| 1080 | String i_dim; | ||
| 1081 | |||
| 1082 | case i_dim | ||
| 1083 | algorithm | ||
| 1084 | 4 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Dimension start=\"")); | |
| 1085 | 4 | txt := Tpl.writeStr(txt, i_dim); | |
| 1086 | 4 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"/>")); | |
| 1087 | 4 | txt := Tpl.nextIter(txt); | |
| 1088 | then txt; | ||
| 1089 | end match; | ||
| 1090 | end for; | ||
| 1091 | end lm_78; | ||
| 1092 | |||
| 1093 | protected function fun_79 | ||
| 1094 | input Tpl.Text in_txt; | ||
| 1095 | input Boolean in_a_generateFMUModelDescription; | ||
| 1096 | input Tpl.Text in_a_stateDerVectorName; | ||
| 1097 | input Tpl.Text in_a_complexStartExpressions; | ||
| 1098 | input DAE.Type in_a_type__; | ||
| 1099 | input Boolean in_a_isFixed; | ||
| 1100 | input Option<DAE.Exp> in_a_nominalValue; | ||
| 1101 | input Option<DAE.Exp> in_a_initialValue; | ||
| 1102 | input Option<DAE.Exp> in_a_maxValue; | ||
| 1103 | input Option<DAE.Exp> in_a_minValue; | ||
| 1104 | input String in_a_displayUnit; | ||
| 1105 | input String in_a_unit; | ||
| 1106 | input SimCodeVar.AliasVariable in_a_aliasvar; | ||
| 1107 | input DAE.ComponentRef in_a_name; | ||
| 1108 | input SimCode.SimCode in_a_simCode; | ||
| 1109 | |||
| 1110 | output Tpl.Text out_txt; | ||
| 1111 | output Tpl.Text out_a_stateDerVectorName; | ||
| 1112 | output Tpl.Text out_a_complexStartExpressions; | ||
| 1113 | algorithm | ||
| 1114 | (out_txt, out_a_stateDerVectorName, out_a_complexStartExpressions) := | ||
| 1115 | match(in_txt, in_a_generateFMUModelDescription, in_a_stateDerVectorName, in_a_complexStartExpressions, in_a_type__, in_a_isFixed, in_a_nominalValue, in_a_initialValue, in_a_maxValue, in_a_minValue, in_a_displayUnit, in_a_unit, in_a_aliasvar, in_a_name, in_a_simCode) | ||
| 1116 | local | ||
| 1117 | Tpl.Text txt; | ||
| 1118 | Tpl.Text a_stateDerVectorName; | ||
| 1119 | Tpl.Text a_complexStartExpressions; | ||
| 1120 | DAE.Type a_type__; | ||
| 1121 | Boolean a_isFixed; | ||
| 1122 | Option<DAE.Exp> a_nominalValue; | ||
| 1123 | Option<DAE.Exp> a_initialValue; | ||
| 1124 | Option<DAE.Exp> a_maxValue; | ||
| 1125 | Option<DAE.Exp> a_minValue; | ||
| 1126 | String a_displayUnit; | ||
| 1127 | String a_unit; | ||
| 1128 | SimCodeVar.AliasVariable a_aliasvar; | ||
| 1129 | DAE.ComponentRef a_name; | ||
| 1130 | SimCode.SimCode a_simCode; | ||
| 1131 | DAE.Type ret_0; | ||
| 1132 | |||
| 1133 | case ( txt, | ||
| 1134 | false, | ||
| 1135 | a_stateDerVectorName, | ||
| 1136 | a_complexStartExpressions, | ||
| 1137 | a_type__, | ||
| 1138 | a_isFixed, | ||
| 1139 | a_nominalValue, | ||
| 1140 | a_initialValue, | ||
| 1141 | a_maxValue, | ||
| 1142 | a_minValue, | ||
| 1143 | a_displayUnit, | ||
| 1144 | a_unit, | ||
| 1145 | a_aliasvar, | ||
| 1146 | a_name, | ||
| 1147 | a_simCode ) | ||
| 1148 | algorithm | ||
| 1149 | 34 | ret_0 := Types.arrayElementType(a_type__); | |
| 1150 | 34 | (txt, a_complexStartExpressions, a_stateDerVectorName) := ScalarVariableType(txt, a_simCode, a_name, a_aliasvar, a_unit, a_displayUnit, a_minValue, a_maxValue, a_initialValue, a_nominalValue, a_isFixed, ret_0, a_complexStartExpressions, a_stateDerVectorName); | |
| 1151 | 34 | then (txt, a_stateDerVectorName, a_complexStartExpressions); | |
| 1152 | |||
| 1153 | case ( txt, | ||
| 1154 | _, | ||
| 1155 | a_stateDerVectorName, | ||
| 1156 | a_complexStartExpressions, | ||
| 1157 | _, | ||
| 1158 | _, | ||
| 1159 | _, | ||
| 1160 | _, | ||
| 1161 | _, | ||
| 1162 | _, | ||
| 1163 | _, | ||
| 1164 | _, | ||
| 1165 | _, | ||
| 1166 | _, | ||
| 1167 | _ ) | ||
| 1168 | then (txt, a_stateDerVectorName, a_complexStartExpressions); | ||
| 1169 | end match; | ||
| 1170 | end fun_79; | ||
| 1171 | |||
| 1172 | protected function lm_80 | ||
| 1173 | input output Tpl.Text txt; | ||
| 1174 | input list<SimCodeVar.SimVar> items; | ||
| 1175 | input output Tpl.Text a_stateDerVectorName; | ||
| 1176 | input output Tpl.Text a_complexStartExpressionsForScalarsUnused; | ||
| 1177 | input Boolean a_generateFMUModelDescription; | ||
| 1178 | input String a_indexForUndefinedReferences; | ||
| 1179 | input HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 1180 | input SimCode.SimCode a_simCode; | ||
| 1181 | algorithm | ||
| 1182 |
2/2✓ Branch 0 taken 176 times.
✓ Branch 1 taken 34 times.
|
210 | for lstElt_80 in items loop |
| 1183 | (txt, a_stateDerVectorName, a_complexStartExpressionsForScalarsUnused) := match lstElt_80 | ||
| 1184 | local | ||
| 1185 | SimCodeVar.SimVar i_var; | ||
| 1186 | |||
| 1187 | case i_var | ||
| 1188 | algorithm | ||
| 1189 | 176 | (txt, a_complexStartExpressionsForScalarsUnused, a_stateDerVectorName) := scalarVariableXML(txt, a_simCode, i_var, a_varToArrayIndexMapping, a_indexForUndefinedReferences, a_generateFMUModelDescription, a_complexStartExpressionsForScalarsUnused, a_stateDerVectorName); | |
| 1190 | 176 | txt := Tpl.nextIter(txt); | |
| 1191 | then (txt, a_stateDerVectorName, a_complexStartExpressionsForScalarsUnused); | ||
| 1192 | end match; | ||
| 1193 | end for; | ||
| 1194 | end lm_80; | ||
| 1195 | |||
| 1196 | protected function fun_81 | ||
| 1197 | input Tpl.Text in_txt; | ||
| 1198 | input Boolean in_a_generateFMUModelDescription; | ||
| 1199 | input SimCodeVar.SimVar in_a_simVar; | ||
| 1200 | input Tpl.Text in_a_stateDerVectorName; | ||
| 1201 | input Tpl.Text in_a_complexStartExpressions; | ||
| 1202 | input DAE.Type in_a_type__; | ||
| 1203 | input Boolean in_a_isFixed; | ||
| 1204 | input Option<DAE.Exp> in_a_nominalValue; | ||
| 1205 | input Option<DAE.Exp> in_a_initialValue; | ||
| 1206 | input Option<DAE.Exp> in_a_maxValue; | ||
| 1207 | input Option<DAE.Exp> in_a_minValue; | ||
| 1208 | input String in_a_displayUnit; | ||
| 1209 | input String in_a_unit; | ||
| 1210 | input SimCodeVar.AliasVariable in_a_aliasvar; | ||
| 1211 | input DAE.ComponentRef in_a_name; | ||
| 1212 | input SimCode.SimCode in_a_simCode; | ||
| 1213 | |||
| 1214 | output Tpl.Text out_txt; | ||
| 1215 | output Tpl.Text out_a_stateDerVectorName; | ||
| 1216 | output Tpl.Text out_a_complexStartExpressions; | ||
| 1217 | algorithm | ||
| 1218 | (out_txt, out_a_stateDerVectorName, out_a_complexStartExpressions) := | ||
| 1219 | match(in_txt, in_a_generateFMUModelDescription, in_a_simVar, in_a_stateDerVectorName, in_a_complexStartExpressions, in_a_type__, in_a_isFixed, in_a_nominalValue, in_a_initialValue, in_a_maxValue, in_a_minValue, in_a_displayUnit, in_a_unit, in_a_aliasvar, in_a_name, in_a_simCode) | ||
| 1220 | local | ||
| 1221 | Tpl.Text txt; | ||
| 1222 | SimCodeVar.SimVar a_simVar; | ||
| 1223 | Tpl.Text a_stateDerVectorName; | ||
| 1224 | Tpl.Text a_complexStartExpressions; | ||
| 1225 | DAE.Type a_type__; | ||
| 1226 | Boolean a_isFixed; | ||
| 1227 | Option<DAE.Exp> a_nominalValue; | ||
| 1228 | Option<DAE.Exp> a_initialValue; | ||
| 1229 | Option<DAE.Exp> a_maxValue; | ||
| 1230 | Option<DAE.Exp> a_minValue; | ||
| 1231 | String a_displayUnit; | ||
| 1232 | String a_unit; | ||
| 1233 | SimCodeVar.AliasVariable a_aliasvar; | ||
| 1234 | DAE.ComponentRef a_name; | ||
| 1235 | SimCode.SimCode a_simCode; | ||
| 1236 | |||
| 1237 | case ( txt, | ||
| 1238 | false, | ||
| 1239 | _, | ||
| 1240 | a_stateDerVectorName, | ||
| 1241 | a_complexStartExpressions, | ||
| 1242 | a_type__, | ||
| 1243 | a_isFixed, | ||
| 1244 | a_nominalValue, | ||
| 1245 | a_initialValue, | ||
| 1246 | a_maxValue, | ||
| 1247 | a_minValue, | ||
| 1248 | a_displayUnit, | ||
| 1249 | a_unit, | ||
| 1250 | a_aliasvar, | ||
| 1251 | a_name, | ||
| 1252 | a_simCode ) | ||
| 1253 | algorithm | ||
| 1254 | 11858 | (txt, a_complexStartExpressions, a_stateDerVectorName) := ScalarVariableType(txt, a_simCode, a_name, a_aliasvar, a_unit, a_displayUnit, a_minValue, a_maxValue, a_initialValue, a_nominalValue, a_isFixed, a_type__, a_complexStartExpressions, a_stateDerVectorName); | |
| 1255 | 11858 | then (txt, a_stateDerVectorName, a_complexStartExpressions); | |
| 1256 | |||
| 1257 | case ( txt, | ||
| 1258 | _, | ||
| 1259 | a_simVar, | ||
| 1260 | a_stateDerVectorName, | ||
| 1261 | a_complexStartExpressions, | ||
| 1262 | _, | ||
| 1263 | _, | ||
| 1264 | _, | ||
| 1265 | _, | ||
| 1266 | _, | ||
| 1267 | _, | ||
| 1268 | _, | ||
| 1269 | _, | ||
| 1270 | _, | ||
| 1271 | _, | ||
| 1272 | _ ) | ||
| 1273 | algorithm | ||
| 1274 | 8 | txt := CodegenFMUCommon.ScalarVariableType(txt, a_simVar); | |
| 1275 | 8 | then (txt, a_stateDerVectorName, a_complexStartExpressions); | |
| 1276 | end match; | ||
| 1277 | end fun_81; | ||
| 1278 | |||
| 1279 | protected function fun_82 | ||
| 1280 | input Tpl.Text in_txt; | ||
| 1281 | input SimCodeVar.SimVar in_a_simVar; | ||
| 1282 | input SimCode.SimCode in_a_simCode; | ||
| 1283 | input HashTableCrIListArray.HashTable in_a_varToArrayIndexMapping; | ||
| 1284 | input String in_a_indexForUndefinedReferences; | ||
| 1285 | input Boolean in_a_generateFMUModelDescription; | ||
| 1286 | input Tpl.Text in_a_complexStartExpressions; | ||
| 1287 | input Tpl.Text in_a_stateDerVectorName; | ||
| 1288 | |||
| 1289 | output Tpl.Text out_txt; | ||
| 1290 | output Tpl.Text out_a_complexStartExpressions; | ||
| 1291 | output Tpl.Text out_a_stateDerVectorName; | ||
| 1292 | algorithm | ||
| 1293 | (out_txt, out_a_complexStartExpressions, out_a_stateDerVectorName) := | ||
| 1294 | match(in_txt, in_a_simVar, in_a_simCode, in_a_varToArrayIndexMapping, in_a_indexForUndefinedReferences, in_a_generateFMUModelDescription, in_a_complexStartExpressions, in_a_stateDerVectorName) | ||
| 1295 | local | ||
| 1296 | Tpl.Text txt; | ||
| 1297 | SimCode.SimCode a_simCode; | ||
| 1298 | HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 1299 | String a_indexForUndefinedReferences; | ||
| 1300 | Boolean a_generateFMUModelDescription; | ||
| 1301 | Tpl.Text a_complexStartExpressions; | ||
| 1302 | Tpl.Text a_stateDerVectorName; | ||
| 1303 | list<String> i_simVar_numArrayElement; | ||
| 1304 | SimCodeVar.SimVar i_simVar; | ||
| 1305 | DAE.Type i_type__; | ||
| 1306 | Boolean i_isFixed; | ||
| 1307 | Option<DAE.Exp> i_nominalValue; | ||
| 1308 | Option<DAE.Exp> i_initialValue; | ||
| 1309 | Option<DAE.Exp> i_maxValue; | ||
| 1310 | Option<DAE.Exp> i_minValue; | ||
| 1311 | String i_displayUnit; | ||
| 1312 | String i_unit; | ||
| 1313 | SimCodeVar.AliasVariable i_aliasvar; | ||
| 1314 | DAE.ComponentRef i_name; | ||
| 1315 | list<SimCodeVar.SimVar> ret_3; | ||
| 1316 | Tpl.Text l_complexStartExpressionsForScalarsUnused; | ||
| 1317 | Tpl.Text l_0__; | ||
| 1318 | Tpl.Text l_variableCode; | ||
| 1319 | |||
| 1320 | case ( txt, | ||
| 1321 | (i_simVar as SimCodeVar.SIMVAR(type_ = (i_type__ as DAE.T_ARRAY(ty = _)), arrayCref = SOME(_), name = i_name, aliasvar = i_aliasvar, unit = i_unit, displayUnit = i_displayUnit, minValue = i_minValue, maxValue = i_maxValue, initialValue = i_initialValue, nominalValue = i_nominalValue, isFixed = i_isFixed, numArrayElement = i_simVar_numArrayElement)), | ||
| 1322 | a_simCode, | ||
| 1323 | _, | ||
| 1324 | a_indexForUndefinedReferences, | ||
| 1325 | a_generateFMUModelDescription, | ||
| 1326 | a_complexStartExpressions, | ||
| 1327 | a_stateDerVectorName ) | ||
| 1328 | algorithm | ||
| 1329 | 4 | (l_variableCode, a_stateDerVectorName, a_complexStartExpressions) := fun_77(Tpl.emptyTxt, a_generateFMUModelDescription, i_simVar, a_stateDerVectorName, a_complexStartExpressions, i_type__, i_isFixed, i_nominalValue, i_initialValue, i_maxValue, i_minValue, i_displayUnit, i_unit, i_aliasvar, i_name, a_simCode); | |
| 1330 | 4 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("<ArrayVariable ")); | |
| 1331 | 4 | txt := scalarVariableAttributeXML(txt, i_simVar, a_simCode, a_indexForUndefinedReferences, a_generateFMUModelDescription); | |
| 1332 | 4 | txt := Tpl.writeTok(txt, Tpl.ST_LINE(">\n")); | |
| 1333 | 4 | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 1334 | 4 | txt := Tpl.writeText(txt, l_variableCode); | |
| 1335 | 4 | txt := Tpl.softNewLine(txt); | |
| 1336 | 4 | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 1337 | 4 | txt := lm_78(txt, i_simVar_numArrayElement); | |
| 1338 | 4 | txt := Tpl.popIter(txt); | |
| 1339 | 4 | txt := Tpl.softNewLine(txt); | |
| 1340 | 4 | txt := Tpl.popBlock(txt); | |
| 1341 | 4 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("</ArrayVariable>")); | |
| 1342 | 4 | then (txt, a_complexStartExpressions, a_stateDerVectorName); | |
| 1343 | |||
| 1344 | case ( txt, | ||
| 1345 | (i_simVar as SimCodeVar.SIMVAR(type_ = (i_type__ as DAE.T_ARRAY(ty = _)), name = i_name, aliasvar = i_aliasvar, unit = i_unit, displayUnit = i_displayUnit, minValue = i_minValue, maxValue = i_maxValue, initialValue = i_initialValue, nominalValue = i_nominalValue, isFixed = i_isFixed)), | ||
| 1346 | a_simCode, | ||
| 1347 | a_varToArrayIndexMapping, | ||
| 1348 | a_indexForUndefinedReferences, | ||
| 1349 | a_generateFMUModelDescription, | ||
| 1350 | a_complexStartExpressions, | ||
| 1351 | a_stateDerVectorName ) | ||
| 1352 | algorithm | ||
| 1353 | 34 | (l_0__, a_stateDerVectorName, a_complexStartExpressions) := fun_79(Tpl.emptyTxt, a_generateFMUModelDescription, a_stateDerVectorName, a_complexStartExpressions, i_type__, i_isFixed, i_nominalValue, i_initialValue, i_maxValue, i_minValue, i_displayUnit, i_unit, i_aliasvar, i_name, a_simCode); | |
| 1354 | 34 | l_complexStartExpressionsForScalarsUnused := Tpl.emptyTxt; | |
| 1355 | 34 | ret_3 := SimCodeCodegenUtil.getScalarElements(i_simVar); | |
| 1356 | 34 | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 1357 | 34 | (txt, a_stateDerVectorName, l_complexStartExpressionsForScalarsUnused) := lm_80(txt, ret_3, a_stateDerVectorName, l_complexStartExpressionsForScalarsUnused, a_generateFMUModelDescription, a_indexForUndefinedReferences, a_varToArrayIndexMapping, a_simCode); | |
| 1358 | 34 | txt := Tpl.popIter(txt); | |
| 1359 | 34 | then (txt, a_complexStartExpressions, a_stateDerVectorName); | |
| 1360 | |||
| 1361 | case ( txt, | ||
| 1362 | (i_simVar as SimCodeVar.SIMVAR(name = i_name, aliasvar = i_aliasvar, unit = i_unit, displayUnit = i_displayUnit, minValue = i_minValue, maxValue = i_maxValue, initialValue = i_initialValue, nominalValue = i_nominalValue, isFixed = i_isFixed, type_ = i_type__)), | ||
| 1363 | a_simCode, | ||
| 1364 | _, | ||
| 1365 | a_indexForUndefinedReferences, | ||
| 1366 | a_generateFMUModelDescription, | ||
| 1367 | a_complexStartExpressions, | ||
| 1368 | a_stateDerVectorName ) | ||
| 1369 | algorithm | ||
| 1370 | 11866 | (l_variableCode, a_stateDerVectorName, a_complexStartExpressions) := fun_81(Tpl.emptyTxt, a_generateFMUModelDescription, i_simVar, a_stateDerVectorName, a_complexStartExpressions, i_type__, i_isFixed, i_nominalValue, i_initialValue, i_maxValue, i_minValue, i_displayUnit, i_unit, i_aliasvar, i_name, a_simCode); | |
| 1371 | 11866 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("<ScalarVariable ")); | |
| 1372 | 11866 | txt := scalarVariableAttributeXML(txt, i_simVar, a_simCode, a_indexForUndefinedReferences, a_generateFMUModelDescription); | |
| 1373 | 11866 | txt := Tpl.writeTok(txt, Tpl.ST_LINE(">\n")); | |
| 1374 | 11866 | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 1375 | 11866 | txt := Tpl.writeText(txt, l_variableCode); | |
| 1376 | 11866 | txt := Tpl.softNewLine(txt); | |
| 1377 | 11866 | txt := Tpl.popBlock(txt); | |
| 1378 | 11866 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("</ScalarVariable>")); | |
| 1379 | 11866 | then (txt, a_complexStartExpressions, a_stateDerVectorName); | |
| 1380 | |||
| 1381 | case ( txt, | ||
| 1382 | _, | ||
| 1383 | _, | ||
| 1384 | _, | ||
| 1385 | _, | ||
| 1386 | _, | ||
| 1387 | a_complexStartExpressions, | ||
| 1388 | a_stateDerVectorName ) | ||
| 1389 | then (txt, a_complexStartExpressions, a_stateDerVectorName); | ||
| 1390 | end match; | ||
| 1391 | end fun_82; | ||
| 1392 | |||
| 1393 | public function scalarVariableXML | ||
| 1394 | input Tpl.Text txt; | ||
| 1395 | input SimCode.SimCode a_simCode; | ||
| 1396 | input SimCodeVar.SimVar a_simVar; | ||
| 1397 | input HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 1398 | input String a_indexForUndefinedReferences; | ||
| 1399 | input Boolean a_generateFMUModelDescription; | ||
| 1400 | input Tpl.Text a_complexStartExpressions; | ||
| 1401 | input Tpl.Text a_stateDerVectorName; | ||
| 1402 | |||
| 1403 | output Tpl.Text out_txt; | ||
| 1404 | output Tpl.Text out_a_complexStartExpressions; | ||
| 1405 | output Tpl.Text out_a_stateDerVectorName; | ||
| 1406 | algorithm | ||
| 1407 | 11904 | (out_txt, out_a_complexStartExpressions, out_a_stateDerVectorName) := fun_82(txt, a_simVar, a_simCode, a_varToArrayIndexMapping, a_indexForUndefinedReferences, a_generateFMUModelDescription, a_complexStartExpressions, a_stateDerVectorName); | |
| 1408 | end scalarVariableXML; | ||
| 1409 | |||
| 1410 | protected function fun_84 | ||
| 1411 | input Tpl.Text in_txt; | ||
| 1412 | input String in_a_comment; | ||
| 1413 | |||
| 1414 | output Tpl.Text out_txt; | ||
| 1415 | algorithm | ||
| 1416 | out_txt := | ||
| 1417 | match(in_txt, in_a_comment) | ||
| 1418 | local | ||
| 1419 | Tpl.Text txt; | ||
| 1420 | String i_comment; | ||
| 1421 | String ret_0; | ||
| 1422 | |||
| 1423 | case ( txt, | ||
| 1424 | "" ) | ||
| 1425 | then txt; | ||
| 1426 | |||
| 1427 | case ( txt, | ||
| 1428 | i_comment ) | ||
| 1429 | algorithm | ||
| 1430 | 9987 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("description=\"")); | |
| 1431 | 9987 | ret_0 := Util.escapeModelicaStringToXmlString(i_comment); | |
| 1432 | 9987 | txt := Tpl.writeStr(txt, ret_0); | |
| 1433 | 9987 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"")); | |
| 1434 | then txt; | ||
| 1435 | end match; | ||
| 1436 | end fun_84; | ||
| 1437 | |||
| 1438 | protected function fun_85 | ||
| 1439 | input Tpl.Text in_txt; | ||
| 1440 | input Option<Boolean> in_a_hideResult; | ||
| 1441 | |||
| 1442 | output Tpl.Text out_txt; | ||
| 1443 | algorithm | ||
| 1444 | out_txt := | ||
| 1445 | match(in_txt, in_a_hideResult) | ||
| 1446 | local | ||
| 1447 | Tpl.Text txt; | ||
| 1448 | Boolean i_bval; | ||
| 1449 | |||
| 1450 | case ( txt, | ||
| 1451 | SOME(i_bval) ) | ||
| 1452 | algorithm | ||
| 1453 | 694 | txt := Tpl.writeStr(txt, Tpl.booleanString(i_bval)); | |
| 1454 | then txt; | ||
| 1455 | |||
| 1456 | case ( txt, | ||
| 1457 | _ ) | ||
| 1458 | then txt; | ||
| 1459 | end match; | ||
| 1460 | end fun_85; | ||
| 1461 | |||
| 1462 | protected function fun_86 | ||
| 1463 | input Tpl.Text in_txt; | ||
| 1464 | input Boolean in_a_generateFMUModelDescription; | ||
| 1465 | input Boolean in_a_isValueChangeable; | ||
| 1466 | input Boolean in_a_isDiscrete; | ||
| 1467 | input Tpl.Text in_a_hr; | ||
| 1468 | input Boolean in_a_isProtected; | ||
| 1469 | |||
| 1470 | output Tpl.Text out_txt; | ||
| 1471 | algorithm | ||
| 1472 | out_txt := | ||
| 1473 | match(in_txt, in_a_generateFMUModelDescription, in_a_isValueChangeable, in_a_isDiscrete, in_a_hr, in_a_isProtected) | ||
| 1474 | local | ||
| 1475 | Tpl.Text txt; | ||
| 1476 | Boolean a_isValueChangeable; | ||
| 1477 | Boolean a_isDiscrete; | ||
| 1478 | Tpl.Text a_hr; | ||
| 1479 | Boolean a_isProtected; | ||
| 1480 | |||
| 1481 | case ( txt, | ||
| 1482 | false, | ||
| 1483 | a_isValueChangeable, | ||
| 1484 | a_isDiscrete, | ||
| 1485 | a_hr, | ||
| 1486 | a_isProtected ) | ||
| 1487 | algorithm | ||
| 1488 | 11862 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("isProtected=\"")); | |
| 1489 | 11862 | txt := Tpl.writeStr(txt, Tpl.booleanString(a_isProtected)); | |
| 1490 | 11862 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" hideResult=\"")); | |
| 1491 | 11862 | txt := Tpl.writeText(txt, a_hr); | |
| 1492 | 11862 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" isDiscrete=\"")); | |
| 1493 | 11862 | txt := Tpl.writeStr(txt, Tpl.booleanString(a_isDiscrete)); | |
| 1494 | 11862 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" isValueChangeable=\"")); | |
| 1495 | 11862 | txt := Tpl.writeStr(txt, Tpl.booleanString(a_isValueChangeable)); | |
| 1496 | 11862 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"")); | |
| 1497 | then txt; | ||
| 1498 | |||
| 1499 | case ( txt, | ||
| 1500 | _, | ||
| 1501 | _, | ||
| 1502 | _, | ||
| 1503 | _, | ||
| 1504 | _ ) | ||
| 1505 | then txt; | ||
| 1506 | end match; | ||
| 1507 | end fun_86; | ||
| 1508 | |||
| 1509 | protected function fun_87 | ||
| 1510 | input Tpl.Text in_txt; | ||
| 1511 | input SimCodeVar.SimVar in_a_simVar; | ||
| 1512 | input SimCode.SimCode in_a_simCode; | ||
| 1513 | input Boolean in_a_generateFMUModelDescription; | ||
| 1514 | |||
| 1515 | output Tpl.Text out_txt; | ||
| 1516 | algorithm | ||
| 1517 | out_txt := | ||
| 1518 | match(in_txt, in_a_simVar, in_a_simCode, in_a_generateFMUModelDescription) | ||
| 1519 | local | ||
| 1520 | Tpl.Text txt; | ||
| 1521 | SimCode.SimCode a_simCode; | ||
| 1522 | Boolean a_generateFMUModelDescription; | ||
| 1523 | DAE.ComponentRef i_name; | ||
| 1524 | Boolean i_isValueChangeable; | ||
| 1525 | Boolean i_isDiscrete; | ||
| 1526 | Boolean i_isProtected; | ||
| 1527 | Option<Boolean> i_hideResult; | ||
| 1528 | String i_comment; | ||
| 1529 | BackendDAE.VarKind i_varKind; | ||
| 1530 | Option<SimCodeVar.Causality> i_causality; | ||
| 1531 | SimCodeVar.AliasVariable i_aliasvar; | ||
| 1532 | SimCodeVar.SimVar i_simVar; | ||
| 1533 | String ret_10; | ||
| 1534 | String ret_9; | ||
| 1535 | Tpl.Text txt_8; | ||
| 1536 | Tpl.Text l_additionalAttributes; | ||
| 1537 | Tpl.Text l_hr; | ||
| 1538 | Tpl.Text l_description; | ||
| 1539 | Tpl.Text l_variability; | ||
| 1540 | Tpl.Text l_causalityAtt; | ||
| 1541 | Tpl.Text l_alias; | ||
| 1542 | String ret_1; | ||
| 1543 | Tpl.Text l_valueReference; | ||
| 1544 | |||
| 1545 | case ( txt, | ||
| 1546 | (i_simVar as SimCodeVar.SIMVAR(source = DAE.SOURCE(info = _), aliasvar = i_aliasvar, causality = i_causality, varKind = i_varKind, comment = i_comment, hideResult = i_hideResult, isProtected = i_isProtected, isDiscrete = i_isDiscrete, isValueChangeable = i_isValueChangeable, name = i_name)), | ||
| 1547 | a_simCode, | ||
| 1548 | a_generateFMUModelDescription ) | ||
| 1549 | algorithm | ||
| 1550 | 11870 | ret_1 := SimCodeCodegenUtil.getValueReference(i_simVar, a_simCode, true); | |
| 1551 | 11870 | l_valueReference := Tpl.writeStr(Tpl.emptyTxt, ret_1); | |
| 1552 | 11870 | l_alias := getAliasAttribute(Tpl.emptyTxt, i_aliasvar); | |
| 1553 | 11870 | l_causalityAtt := CodegenFMUCommon.getCausality(Tpl.emptyTxt, i_causality); | |
| 1554 | 11870 | l_variability := CodegenUtil.getVariablity(Tpl.emptyTxt, i_varKind); | |
| 1555 | 11870 | l_description := fun_84(Tpl.emptyTxt, i_comment); | |
| 1556 | 11870 | l_hr := fun_85(Tpl.emptyTxt, i_hideResult); | |
| 1557 | 11870 | l_additionalAttributes := fun_86(Tpl.emptyTxt, a_generateFMUModelDescription, i_isValueChangeable, i_isDiscrete, l_hr, i_isProtected); | |
| 1558 | 11870 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("name=\"")); | |
| 1559 | 11870 | txt_8 := CodegenUtil.crefStrNoUnderscore(Tpl.emptyTxt, i_name); | |
| 1560 | 11870 | ret_9 := Util.escapeModelicaStringToXmlString(Tpl.textString(txt_8)); | |
| 1561 | 11870 | ret_10 := System.stringReplace(ret_9, "$", "_D_"); | |
| 1562 | 11870 | txt := Tpl.writeStr(txt, ret_10); | |
| 1563 | 11870 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" valueReference=\"")); | |
| 1564 | 11870 | txt := Tpl.writeText(txt, l_valueReference); | |
| 1565 | 11870 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" ")); | |
| 1566 | 11870 | txt := Tpl.writeText(txt, l_description); | |
| 1567 | 11870 | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" variability=\"")); | |
| 1568 | 11870 | txt := Tpl.writeText(txt, l_variability); | |
| 1569 | 11870 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" causality=\"")); | |
| 1570 | 11870 | txt := Tpl.writeText(txt, l_causalityAtt); | |
| 1571 | 11870 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" alias=\"")); | |
| 1572 | 11870 | txt := Tpl.writeText(txt, l_alias); | |
| 1573 | 11870 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" ")); | |
| 1574 | 11870 | txt := Tpl.writeText(txt, l_additionalAttributes); | |
| 1575 | then txt; | ||
| 1576 | |||
| 1577 | case ( txt, | ||
| 1578 | _, | ||
| 1579 | _, | ||
| 1580 | _ ) | ||
| 1581 | then txt; | ||
| 1582 | end match; | ||
| 1583 | end fun_87; | ||
| 1584 | |||
| 1585 | public function scalarVariableAttributeXML | ||
| 1586 | input Tpl.Text txt; | ||
| 1587 | input SimCodeVar.SimVar a_simVar; | ||
| 1588 | input SimCode.SimCode a_simCode; | ||
| 1589 | input String a_indexForUndefinedReferences; | ||
| 1590 | input Boolean a_generateFMUModelDescription; | ||
| 1591 | |||
| 1592 | output Tpl.Text out_txt; | ||
| 1593 | algorithm | ||
| 1594 | 11870 | out_txt := fun_87(txt, a_simVar, a_simCode, a_generateFMUModelDescription); | |
| 1595 | end scalarVariableAttributeXML; | ||
| 1596 | |||
| 1597 | public function getAliasAttribute | ||
| 1598 | input Tpl.Text in_txt; | ||
| 1599 | input SimCodeVar.AliasVariable in_a_aliasvar; | ||
| 1600 | |||
| 1601 | output Tpl.Text out_txt; | ||
| 1602 | algorithm | ||
| 1603 | out_txt := | ||
| 1604 | match(in_txt, in_a_aliasvar) | ||
| 1605 | local | ||
| 1606 | Tpl.Text txt; | ||
| 1607 | |||
| 1608 | case ( txt, | ||
| 1609 | SimCodeVar.NOALIAS() ) | ||
| 1610 | algorithm | ||
| 1611 | 8041 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("noAlias")); | |
| 1612 | then txt; | ||
| 1613 | |||
| 1614 | case ( txt, | ||
| 1615 | SimCodeVar.ALIAS(varName = _) ) | ||
| 1616 | algorithm | ||
| 1617 | 3329 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("alias")); | |
| 1618 | then txt; | ||
| 1619 | |||
| 1620 | case ( txt, | ||
| 1621 | SimCodeVar.NEGATEDALIAS(varName = _) ) | ||
| 1622 | algorithm | ||
| 1623 | 500 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("negatedAlias")); | |
| 1624 | then txt; | ||
| 1625 | |||
| 1626 | case ( txt, | ||
| 1627 | _ ) | ||
| 1628 | algorithm | ||
| 1629 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("undefinedAliasType")); | |
| 1630 | then txt; | ||
| 1631 | end match; | ||
| 1632 | end getAliasAttribute; | ||
| 1633 | |||
| 1634 | protected function fun_90 | ||
| 1635 | input Tpl.Text in_txt; | ||
| 1636 | input DAE.Type in_mArg; | ||
| 1637 | input SimCode.SimCode in_a_simCode; | ||
| 1638 | input DAE.ComponentRef in_a_simVarCref; | ||
| 1639 | input SimCodeVar.AliasVariable in_a_simVarAlias; | ||
| 1640 | input String in_a_unit; | ||
| 1641 | input String in_a_displayUnit; | ||
| 1642 | input Option<DAE.Exp> in_a_minValue; | ||
| 1643 | input Option<DAE.Exp> in_a_maxValue; | ||
| 1644 | input Option<DAE.Exp> in_a_startValue; | ||
| 1645 | input Option<DAE.Exp> in_a_nominalValue; | ||
| 1646 | input Boolean in_a_isFixed; | ||
| 1647 | input DAE.Type in_a_type__; | ||
| 1648 | input Tpl.Text in_a_complexStartExpressions; | ||
| 1649 | input Tpl.Text in_a_stateDerVectorName; | ||
| 1650 | |||
| 1651 | output Tpl.Text out_txt; | ||
| 1652 | output Tpl.Text out_a_complexStartExpressions; | ||
| 1653 | output Tpl.Text out_a_stateDerVectorName; | ||
| 1654 | algorithm | ||
| 1655 | (out_txt, out_a_complexStartExpressions, out_a_stateDerVectorName) := | ||
| 1656 | match(in_txt, in_mArg, in_a_simCode, in_a_simVarCref, in_a_simVarAlias, in_a_unit, in_a_displayUnit, in_a_minValue, in_a_maxValue, in_a_startValue, in_a_nominalValue, in_a_isFixed, in_a_type__, in_a_complexStartExpressions, in_a_stateDerVectorName) | ||
| 1657 | local | ||
| 1658 | Tpl.Text txt; | ||
| 1659 | SimCode.SimCode a_simCode; | ||
| 1660 | DAE.ComponentRef a_simVarCref; | ||
| 1661 | SimCodeVar.AliasVariable a_simVarAlias; | ||
| 1662 | String a_unit; | ||
| 1663 | String a_displayUnit; | ||
| 1664 | Option<DAE.Exp> a_minValue; | ||
| 1665 | Option<DAE.Exp> a_maxValue; | ||
| 1666 | Option<DAE.Exp> a_startValue; | ||
| 1667 | Option<DAE.Exp> a_nominalValue; | ||
| 1668 | Boolean a_isFixed; | ||
| 1669 | DAE.Type a_type__; | ||
| 1670 | Tpl.Text a_complexStartExpressions; | ||
| 1671 | Tpl.Text a_stateDerVectorName; | ||
| 1672 | Absyn.Path i_ci_path; | ||
| 1673 | Tpl.Text txt_10; | ||
| 1674 | String ret_10; | ||
| 1675 | String ret_9; | ||
| 1676 | Tpl.Text txt_8; | ||
| 1677 | Boolean ret_7; | ||
| 1678 | Tpl.Text l_nom__; | ||
| 1679 | Tpl.Text l_disp__; | ||
| 1680 | Tpl.Text l_unit__; | ||
| 1681 | Tpl.Text l_max__; | ||
| 1682 | Tpl.Text l_min__; | ||
| 1683 | Tpl.Text l_fixed__; | ||
| 1684 | Tpl.Text l_start__; | ||
| 1685 | |||
| 1686 | case ( txt, | ||
| 1687 | DAE.T_INTEGER(varLst = _), | ||
| 1688 | a_simCode, | ||
| 1689 | a_simVarCref, | ||
| 1690 | a_simVarAlias, | ||
| 1691 | a_unit, | ||
| 1692 | a_displayUnit, | ||
| 1693 | a_minValue, | ||
| 1694 | a_maxValue, | ||
| 1695 | a_startValue, | ||
| 1696 | _, | ||
| 1697 | a_isFixed, | ||
| 1698 | _, | ||
| 1699 | a_complexStartExpressions, | ||
| 1700 | a_stateDerVectorName ) | ||
| 1701 | algorithm | ||
| 1702 | 503 | (l_start__, _, a_complexStartExpressions, a_stateDerVectorName) := ScalarVariableTypeStartAttribute(Tpl.emptyTxt, a_simCode, a_simVarCref, a_simVarAlias, a_startValue, Tpl.strTokText(Tpl.ST_STRING("Int")), a_complexStartExpressions, a_stateDerVectorName); | |
| 1703 | 503 | l_fixed__ := Tpl.pushBlock(Tpl.emptyTxt, Tpl.BT_INDENT(1)); | |
| 1704 | 503 | l_fixed__ := Tpl.writeTok(l_fixed__, Tpl.ST_STRING("fixed=\"")); | |
| 1705 | 503 | l_fixed__ := Tpl.writeStr(l_fixed__, Tpl.booleanString(a_isFixed)); | |
| 1706 | 503 | l_fixed__ := Tpl.writeTok(l_fixed__, Tpl.ST_STRING("\"")); | |
| 1707 | 503 | l_fixed__ := Tpl.popBlock(l_fixed__); | |
| 1708 | 503 | l_min__ := attributeOptionString(Tpl.emptyTxt, a_minValue, "min"); | |
| 1709 | 503 | l_max__ := attributeOptionString(Tpl.emptyTxt, a_maxValue, "max"); | |
| 1710 | 503 | l_unit__ := unitString(Tpl.emptyTxt, a_unit, "unit"); | |
| 1711 | 503 | l_disp__ := unitString(Tpl.emptyTxt, a_displayUnit, "displayUnit"); | |
| 1712 | 503 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Integer ")); | |
| 1713 | 503 | txt := Tpl.writeText(txt, l_start__); | |
| 1714 | 503 | txt := Tpl.writeText(txt, l_fixed__); | |
| 1715 | 503 | txt := Tpl.writeText(txt, l_min__); | |
| 1716 | 503 | txt := Tpl.writeText(txt, l_max__); | |
| 1717 | 503 | txt := Tpl.writeText(txt, l_unit__); | |
| 1718 | 503 | txt := Tpl.writeText(txt, l_disp__); | |
| 1719 | 503 | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" />")); | |
| 1720 | 503 | then (txt, a_complexStartExpressions, a_stateDerVectorName); | |
| 1721 | |||
| 1722 | case ( txt, | ||
| 1723 | DAE.T_REAL(varLst = _), | ||
| 1724 | a_simCode, | ||
| 1725 | a_simVarCref, | ||
| 1726 | a_simVarAlias, | ||
| 1727 | a_unit, | ||
| 1728 | a_displayUnit, | ||
| 1729 | a_minValue, | ||
| 1730 | a_maxValue, | ||
| 1731 | a_startValue, | ||
| 1732 | a_nominalValue, | ||
| 1733 | a_isFixed, | ||
| 1734 | _, | ||
| 1735 | a_complexStartExpressions, | ||
| 1736 | a_stateDerVectorName ) | ||
| 1737 | algorithm | ||
| 1738 | 9973 | (l_start__, _, a_complexStartExpressions, a_stateDerVectorName) := ScalarVariableTypeStartAttribute(Tpl.emptyTxt, a_simCode, a_simVarCref, a_simVarAlias, a_startValue, Tpl.strTokText(Tpl.ST_STRING("Real")), a_complexStartExpressions, a_stateDerVectorName); | |
| 1739 | 9973 | l_fixed__ := Tpl.pushBlock(Tpl.emptyTxt, Tpl.BT_INDENT(1)); | |
| 1740 | 9973 | l_fixed__ := Tpl.writeTok(l_fixed__, Tpl.ST_STRING("fixed=\"")); | |
| 1741 | 9973 | l_fixed__ := Tpl.writeStr(l_fixed__, Tpl.booleanString(a_isFixed)); | |
| 1742 | 9973 | l_fixed__ := Tpl.writeTok(l_fixed__, Tpl.ST_STRING("\"")); | |
| 1743 | 9973 | l_fixed__ := Tpl.popBlock(l_fixed__); | |
| 1744 | 9973 | l_nom__ := Tpl.pushBlock(Tpl.emptyTxt, Tpl.BT_INDENT(1)); | |
| 1745 | 9973 | l_nom__ := Tpl.writeTok(l_nom__, Tpl.ST_STRING("useNominal=\"")); | |
| 1746 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 9973 times.
✓ Branch 2 taken 1463 times.
✓ Branch 3 taken 8510 times.
|
9973 | ret_7 := isSome(a_nominalValue); |
| 1747 | 9973 | l_nom__ := Tpl.writeStr(l_nom__, Tpl.booleanString(ret_7)); | |
| 1748 | 9973 | l_nom__ := Tpl.writeTok(l_nom__, Tpl.ST_STRING("\"")); | |
| 1749 | 9973 | l_nom__ := attributeOptionString(l_nom__, a_nominalValue, "nominal"); | |
| 1750 | 9973 | l_nom__ := Tpl.popBlock(l_nom__); | |
| 1751 | 9973 | l_min__ := attributeOptionString(Tpl.emptyTxt, a_minValue, "min"); | |
| 1752 | 9973 | l_max__ := attributeOptionString(Tpl.emptyTxt, a_maxValue, "max"); | |
| 1753 | 9973 | l_unit__ := unitString(Tpl.emptyTxt, a_unit, "unit"); | |
| 1754 | 9973 | l_disp__ := unitString(Tpl.emptyTxt, a_displayUnit, "displayUnit"); | |
| 1755 | 9973 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Real ")); | |
| 1756 | 9973 | txt := Tpl.writeText(txt, l_start__); | |
| 1757 | 9973 | txt := Tpl.writeText(txt, l_fixed__); | |
| 1758 | 9973 | txt := Tpl.writeText(txt, l_nom__); | |
| 1759 | 9973 | txt := Tpl.writeText(txt, l_min__); | |
| 1760 | 9973 | txt := Tpl.writeText(txt, l_max__); | |
| 1761 | 9973 | txt := Tpl.writeText(txt, l_unit__); | |
| 1762 | 9973 | txt := Tpl.writeText(txt, l_disp__); | |
| 1763 | 9973 | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" />")); | |
| 1764 | 9973 | then (txt, a_complexStartExpressions, a_stateDerVectorName); | |
| 1765 | |||
| 1766 | case ( txt, | ||
| 1767 | DAE.T_BOOL(varLst = _), | ||
| 1768 | a_simCode, | ||
| 1769 | a_simVarCref, | ||
| 1770 | a_simVarAlias, | ||
| 1771 | a_unit, | ||
| 1772 | a_displayUnit, | ||
| 1773 | _, | ||
| 1774 | _, | ||
| 1775 | a_startValue, | ||
| 1776 | _, | ||
| 1777 | a_isFixed, | ||
| 1778 | _, | ||
| 1779 | a_complexStartExpressions, | ||
| 1780 | a_stateDerVectorName ) | ||
| 1781 | algorithm | ||
| 1782 | 959 | (l_start__, _, a_complexStartExpressions, a_stateDerVectorName) := ScalarVariableTypeStartAttribute(Tpl.emptyTxt, a_simCode, a_simVarCref, a_simVarAlias, a_startValue, Tpl.strTokText(Tpl.ST_STRING("Bool")), a_complexStartExpressions, a_stateDerVectorName); | |
| 1783 | 959 | l_fixed__ := Tpl.pushBlock(Tpl.emptyTxt, Tpl.BT_INDENT(1)); | |
| 1784 | 959 | l_fixed__ := Tpl.writeTok(l_fixed__, Tpl.ST_STRING("fixed=\"")); | |
| 1785 | 959 | l_fixed__ := Tpl.writeStr(l_fixed__, Tpl.booleanString(a_isFixed)); | |
| 1786 | 959 | l_fixed__ := Tpl.writeTok(l_fixed__, Tpl.ST_STRING("\"")); | |
| 1787 | 959 | l_fixed__ := Tpl.popBlock(l_fixed__); | |
| 1788 | 959 | l_unit__ := unitString(Tpl.emptyTxt, a_unit, "unit"); | |
| 1789 | 959 | l_disp__ := unitString(Tpl.emptyTxt, a_displayUnit, "displayUnit"); | |
| 1790 | 959 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Boolean ")); | |
| 1791 | 959 | txt := Tpl.writeText(txt, l_start__); | |
| 1792 | 959 | txt := Tpl.writeText(txt, l_fixed__); | |
| 1793 | 959 | txt := Tpl.writeText(txt, l_unit__); | |
| 1794 | 959 | txt := Tpl.writeText(txt, l_disp__); | |
| 1795 | 959 | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" />")); | |
| 1796 | 959 | then (txt, a_complexStartExpressions, a_stateDerVectorName); | |
| 1797 | |||
| 1798 | case ( txt, | ||
| 1799 | DAE.T_STRING(varLst = _), | ||
| 1800 | a_simCode, | ||
| 1801 | a_simVarCref, | ||
| 1802 | a_simVarAlias, | ||
| 1803 | a_unit, | ||
| 1804 | a_displayUnit, | ||
| 1805 | _, | ||
| 1806 | _, | ||
| 1807 | a_startValue, | ||
| 1808 | _, | ||
| 1809 | a_isFixed, | ||
| 1810 | _, | ||
| 1811 | a_complexStartExpressions, | ||
| 1812 | a_stateDerVectorName ) | ||
| 1813 | algorithm | ||
| 1814 | 57 | (l_start__, _, a_complexStartExpressions, a_stateDerVectorName) := ScalarVariableTypeStartAttribute(Tpl.emptyTxt, a_simCode, a_simVarCref, a_simVarAlias, a_startValue, Tpl.strTokText(Tpl.ST_STRING("String")), a_complexStartExpressions, a_stateDerVectorName); | |
| 1815 | 57 | l_fixed__ := Tpl.pushBlock(Tpl.emptyTxt, Tpl.BT_INDENT(1)); | |
| 1816 | 57 | l_fixed__ := Tpl.writeTok(l_fixed__, Tpl.ST_STRING("fixed=\"")); | |
| 1817 | 57 | l_fixed__ := Tpl.writeStr(l_fixed__, Tpl.booleanString(a_isFixed)); | |
| 1818 | 57 | l_fixed__ := Tpl.writeTok(l_fixed__, Tpl.ST_STRING("\"")); | |
| 1819 | 57 | l_fixed__ := Tpl.popBlock(l_fixed__); | |
| 1820 | 57 | l_unit__ := unitString(Tpl.emptyTxt, a_unit, "unit"); | |
| 1821 | 57 | l_disp__ := unitString(Tpl.emptyTxt, a_displayUnit, "displayUnit"); | |
| 1822 | 57 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("<String ")); | |
| 1823 | 57 | txt := Tpl.writeText(txt, l_start__); | |
| 1824 | 57 | txt := Tpl.writeText(txt, l_fixed__); | |
| 1825 | 57 | txt := Tpl.writeText(txt, l_unit__); | |
| 1826 | 57 | txt := Tpl.writeText(txt, l_disp__); | |
| 1827 | 57 | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" />")); | |
| 1828 | 57 | then (txt, a_complexStartExpressions, a_stateDerVectorName); | |
| 1829 | |||
| 1830 | case ( txt, | ||
| 1831 | DAE.T_ENUMERATION(index = _), | ||
| 1832 | a_simCode, | ||
| 1833 | a_simVarCref, | ||
| 1834 | a_simVarAlias, | ||
| 1835 | a_unit, | ||
| 1836 | a_displayUnit, | ||
| 1837 | _, | ||
| 1838 | _, | ||
| 1839 | a_startValue, | ||
| 1840 | _, | ||
| 1841 | a_isFixed, | ||
| 1842 | _, | ||
| 1843 | a_complexStartExpressions, | ||
| 1844 | a_stateDerVectorName ) | ||
| 1845 | algorithm | ||
| 1846 | 404 | (l_start__, _, a_complexStartExpressions, a_stateDerVectorName) := ScalarVariableTypeStartAttribute(Tpl.emptyTxt, a_simCode, a_simVarCref, a_simVarAlias, a_startValue, Tpl.strTokText(Tpl.ST_STRING("Int")), a_complexStartExpressions, a_stateDerVectorName); | |
| 1847 | 404 | l_fixed__ := Tpl.pushBlock(Tpl.emptyTxt, Tpl.BT_INDENT(1)); | |
| 1848 | 404 | l_fixed__ := Tpl.writeTok(l_fixed__, Tpl.ST_STRING("fixed=\"")); | |
| 1849 | 404 | l_fixed__ := Tpl.writeStr(l_fixed__, Tpl.booleanString(a_isFixed)); | |
| 1850 | 404 | l_fixed__ := Tpl.writeTok(l_fixed__, Tpl.ST_STRING("\"")); | |
| 1851 | 404 | l_fixed__ := Tpl.popBlock(l_fixed__); | |
| 1852 | 404 | l_unit__ := unitString(Tpl.emptyTxt, a_unit, "unit"); | |
| 1853 | 404 | l_disp__ := unitString(Tpl.emptyTxt, a_displayUnit, "displayUnit"); | |
| 1854 | 404 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Integer ")); | |
| 1855 | 404 | txt := Tpl.writeText(txt, l_start__); | |
| 1856 | 404 | txt := Tpl.writeText(txt, l_fixed__); | |
| 1857 | 404 | txt := Tpl.writeText(txt, l_unit__); | |
| 1858 | 404 | txt := Tpl.writeText(txt, l_disp__); | |
| 1859 | 404 | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" />")); | |
| 1860 | 404 | then (txt, a_complexStartExpressions, a_stateDerVectorName); | |
| 1861 | |||
| 1862 | case ( txt, | ||
| 1863 | DAE.T_COMPLEX(complexClassType = ClassInf.EXTERNAL_OBJ(path = i_ci_path)), | ||
| 1864 | _, | ||
| 1865 | _, | ||
| 1866 | _, | ||
| 1867 | _, | ||
| 1868 | _, | ||
| 1869 | _, | ||
| 1870 | _, | ||
| 1871 | _, | ||
| 1872 | _, | ||
| 1873 | _, | ||
| 1874 | _, | ||
| 1875 | a_complexStartExpressions, | ||
| 1876 | a_stateDerVectorName ) | ||
| 1877 | algorithm | ||
| 1878 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("<ExternalObject path=\"")); | |
| 1879 | ✗ | txt_8 := CodegenUtil.dotPath(Tpl.emptyTxt, i_ci_path); | |
| 1880 | ✗ | ret_9 := Util.escapeModelicaStringToXmlString(Tpl.textString(txt_8)); | |
| 1881 | ✗ | txt := Tpl.writeStr(txt, ret_9); | |
| 1882 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" />")); | |
| 1883 | ✗ | then (txt, a_complexStartExpressions, a_stateDerVectorName); | |
| 1884 | |||
| 1885 | case ( txt, | ||
| 1886 | _, | ||
| 1887 | _, | ||
| 1888 | _, | ||
| 1889 | _, | ||
| 1890 | _, | ||
| 1891 | _, | ||
| 1892 | _, | ||
| 1893 | _, | ||
| 1894 | _, | ||
| 1895 | _, | ||
| 1896 | _, | ||
| 1897 | a_type__, | ||
| 1898 | a_complexStartExpressions, | ||
| 1899 | a_stateDerVectorName ) | ||
| 1900 | algorithm | ||
| 1901 | ✗ | txt_10 := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("ScalarVariableType: ")); | |
| 1902 | ✗ | ret_10 := TypesDump.unparseType(a_type__); | |
| 1903 | ✗ | txt_10 := Tpl.writeStr(txt_10, ret_10); | |
| 1904 | ✗ | txt := CodegenUtil.error(txt, Tpl.sourceInfo("CodegenCppInit.tpl", 252, 16), Tpl.textString(txt_10)); | |
| 1905 | ✗ | then (txt, a_complexStartExpressions, a_stateDerVectorName); | |
| 1906 | end match; | ||
| 1907 | end fun_90; | ||
| 1908 | |||
| 1909 | public function ScalarVariableType | ||
| 1910 | input Tpl.Text txt; | ||
| 1911 | input SimCode.SimCode a_simCode; | ||
| 1912 | input DAE.ComponentRef a_simVarCref; | ||
| 1913 | input SimCodeVar.AliasVariable a_simVarAlias; | ||
| 1914 | input String a_unit; | ||
| 1915 | input String a_displayUnit; | ||
| 1916 | input Option<DAE.Exp> a_minValue; | ||
| 1917 | input Option<DAE.Exp> a_maxValue; | ||
| 1918 | input Option<DAE.Exp> a_startValue; | ||
| 1919 | input Option<DAE.Exp> a_nominalValue; | ||
| 1920 | input Boolean a_isFixed; | ||
| 1921 | input DAE.Type a_type__; | ||
| 1922 | input Tpl.Text a_complexStartExpressions; | ||
| 1923 | input Tpl.Text a_stateDerVectorName; | ||
| 1924 | |||
| 1925 | output Tpl.Text out_txt; | ||
| 1926 | output Tpl.Text out_a_complexStartExpressions; | ||
| 1927 | output Tpl.Text out_a_stateDerVectorName; | ||
| 1928 | protected | ||
| 1929 | DAE.Type ret_0; | ||
| 1930 | algorithm | ||
| 1931 | 11896 | ret_0 := Types.arrayElementType(a_type__); | |
| 1932 | 11896 | (out_txt, out_a_complexStartExpressions, out_a_stateDerVectorName) := fun_90(txt, ret_0, a_simCode, a_simVarCref, a_simVarAlias, a_unit, a_displayUnit, a_minValue, a_maxValue, a_startValue, a_nominalValue, a_isFixed, a_type__, a_complexStartExpressions, a_stateDerVectorName); | |
| 1933 | end ScalarVariableType; | ||
| 1934 | |||
| 1935 | protected function lm_92 | ||
| 1936 | input output Tpl.Text txt; | ||
| 1937 | input list<DAE.Exp> items; | ||
| 1938 | algorithm | ||
| 1939 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 7 times.
|
17 | for lstElt_92 in items loop |
| 1940 | txt := match lstElt_92 | ||
| 1941 | local | ||
| 1942 | DAE.Exp i_elem; | ||
| 1943 | |||
| 1944 | case i_elem | ||
| 1945 | algorithm | ||
| 1946 | 10 | txt := CodegenUtil.initValXml(txt, i_elem, """); | |
| 1947 | 10 | txt := Tpl.nextIter(txt); | |
| 1948 | then txt; | ||
| 1949 | end match; | ||
| 1950 | end for; | ||
| 1951 | end lm_92; | ||
| 1952 | |||
| 1953 | protected function fun_93 | ||
| 1954 | input Tpl.Text in_txt; | ||
| 1955 | input Boolean in_mArg; | ||
| 1956 | input list<DAE.Exp> in_a_array; | ||
| 1957 | input String in_a_attr__name; | ||
| 1958 | |||
| 1959 | output Tpl.Text out_txt; | ||
| 1960 | algorithm | ||
| 1961 | out_txt := | ||
| 1962 | match(in_txt, in_mArg, in_a_array, in_a_attr__name) | ||
| 1963 | local | ||
| 1964 | Tpl.Text txt; | ||
| 1965 | list<DAE.Exp> a_array; | ||
| 1966 | String a_attr__name; | ||
| 1967 | |||
| 1968 | case ( txt, | ||
| 1969 | false, | ||
| 1970 | _, | ||
| 1971 | _ ) | ||
| 1972 | then txt; | ||
| 1973 | |||
| 1974 | case ( txt, | ||
| 1975 | _, | ||
| 1976 | a_array, | ||
| 1977 | a_attr__name ) | ||
| 1978 | algorithm | ||
| 1979 | 7 | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1)); | |
| 1980 | 7 | txt := Tpl.writeStr(txt, a_attr__name); | |
| 1981 | 7 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("=\"")); | |
| 1982 | 7 | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(" ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 1983 | 7 | txt := lm_92(txt, a_array); | |
| 1984 | 7 | txt := Tpl.popIter(txt); | |
| 1985 | 7 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"")); | |
| 1986 | 7 | txt := Tpl.popBlock(txt); | |
| 1987 | then txt; | ||
| 1988 | end match; | ||
| 1989 | end fun_93; | ||
| 1990 | |||
| 1991 | protected function fun_94 | ||
| 1992 | input Tpl.Text in_txt; | ||
| 1993 | input Boolean in_mArg; | ||
| 1994 | input String in_a_attr__name; | ||
| 1995 | input DAE.Exp in_a_expr; | ||
| 1996 | |||
| 1997 | output Tpl.Text out_txt; | ||
| 1998 | algorithm | ||
| 1999 | out_txt := | ||
| 2000 | match(in_txt, in_mArg, in_a_attr__name, in_a_expr) | ||
| 2001 | local | ||
| 2002 | Tpl.Text txt; | ||
| 2003 | String a_attr__name; | ||
| 2004 | DAE.Exp a_expr; | ||
| 2005 | |||
| 2006 | case ( txt, | ||
| 2007 | false, | ||
| 2008 | _, | ||
| 2009 | _ ) | ||
| 2010 | then txt; | ||
| 2011 | |||
| 2012 | case ( txt, | ||
| 2013 | _, | ||
| 2014 | a_attr__name, | ||
| 2015 | a_expr ) | ||
| 2016 | algorithm | ||
| 2017 | ✗ | txt := attributeString(txt, a_expr, a_attr__name); | |
| 2018 | then txt; | ||
| 2019 | end match; | ||
| 2020 | end fun_94; | ||
| 2021 | |||
| 2022 | public function attributeString | ||
| 2023 | input Tpl.Text in_txt; | ||
| 2024 | input DAE.Exp in_a_exp; | ||
| 2025 | input String in_a_attr__name; | ||
| 2026 | |||
| 2027 | output Tpl.Text out_txt; | ||
| 2028 | algorithm | ||
| 2029 | out_txt := | ||
| 2030 | match(in_txt, in_a_exp, in_a_attr__name) | ||
| 2031 | local | ||
| 2032 | Tpl.Text txt; | ||
| 2033 | String a_attr__name; | ||
| 2034 | DAE.Exp i_expr; | ||
| 2035 | list<DAE.Exp> i_array; | ||
| 2036 | DAE.Exp i_exp; | ||
| 2037 | Boolean ret_1; | ||
| 2038 | Boolean ret_0; | ||
| 2039 | |||
| 2040 | case ( txt, | ||
| 2041 | (i_exp as DAE.ICONST(integer = _)), | ||
| 2042 | a_attr__name ) | ||
| 2043 | algorithm | ||
| 2044 | 697 | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1)); | |
| 2045 | 697 | txt := Tpl.writeStr(txt, a_attr__name); | |
| 2046 | 697 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("=\"")); | |
| 2047 | 697 | txt := CodegenUtil.initValXml(txt, i_exp, ""); | |
| 2048 | 697 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"")); | |
| 2049 | 697 | txt := Tpl.popBlock(txt); | |
| 2050 | then txt; | ||
| 2051 | |||
| 2052 | case ( txt, | ||
| 2053 | (i_exp as DAE.RCONST(real = _)), | ||
| 2054 | a_attr__name ) | ||
| 2055 | algorithm | ||
| 2056 | 8306 | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1)); | |
| 2057 | 8306 | txt := Tpl.writeStr(txt, a_attr__name); | |
| 2058 | 8306 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("=\"")); | |
| 2059 | 8306 | txt := CodegenUtil.initValXml(txt, i_exp, ""); | |
| 2060 | 8306 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"")); | |
| 2061 | 8306 | txt := Tpl.popBlock(txt); | |
| 2062 | then txt; | ||
| 2063 | |||
| 2064 | case ( txt, | ||
| 2065 | (i_exp as DAE.SCONST(string = _)), | ||
| 2066 | a_attr__name ) | ||
| 2067 | algorithm | ||
| 2068 | 49 | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1)); | |
| 2069 | 49 | txt := Tpl.writeStr(txt, a_attr__name); | |
| 2070 | 49 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("=\"")); | |
| 2071 | 49 | txt := CodegenUtil.initValXml(txt, i_exp, ""); | |
| 2072 | 49 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"")); | |
| 2073 | 49 | txt := Tpl.popBlock(txt); | |
| 2074 | then txt; | ||
| 2075 | |||
| 2076 | case ( txt, | ||
| 2077 | (i_exp as DAE.BCONST(bool = _)), | ||
| 2078 | a_attr__name ) | ||
| 2079 | algorithm | ||
| 2080 | 435 | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1)); | |
| 2081 | 435 | txt := Tpl.writeStr(txt, a_attr__name); | |
| 2082 | 435 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("=\"")); | |
| 2083 | 435 | txt := CodegenUtil.initValXml(txt, i_exp, ""); | |
| 2084 | 435 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"")); | |
| 2085 | 435 | txt := Tpl.popBlock(txt); | |
| 2086 | then txt; | ||
| 2087 | |||
| 2088 | case ( txt, | ||
| 2089 | (i_exp as DAE.ENUM_LITERAL(name = _)), | ||
| 2090 | a_attr__name ) | ||
| 2091 | algorithm | ||
| 2092 | 200 | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1)); | |
| 2093 | 200 | txt := Tpl.writeStr(txt, a_attr__name); | |
| 2094 | 200 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("=\"")); | |
| 2095 | 200 | txt := CodegenUtil.initValXml(txt, i_exp, ""); | |
| 2096 | 200 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"")); | |
| 2097 | 200 | txt := Tpl.popBlock(txt); | |
| 2098 | then txt; | ||
| 2099 | |||
| 2100 | case ( txt, | ||
| 2101 | (i_exp as DAE.ARRAY(array = i_array)), | ||
| 2102 | a_attr__name ) | ||
| 2103 | algorithm | ||
| 2104 | 7 | ret_0 := Expression.isSimpleLiteralValue(i_exp, true); | |
| 2105 | 7 | txt := fun_93(txt, ret_0, i_array, a_attr__name); | |
| 2106 | then txt; | ||
| 2107 | |||
| 2108 | case ( txt, | ||
| 2109 | DAE.REDUCTION(expr = i_expr), | ||
| 2110 | a_attr__name ) | ||
| 2111 | algorithm | ||
| 2112 | ✗ | ret_1 := Expression.isSimpleLiteralValue(i_expr, true); | |
| 2113 | ✗ | txt := fun_94(txt, ret_1, a_attr__name, i_expr); | |
| 2114 | then txt; | ||
| 2115 | |||
| 2116 | case ( txt, | ||
| 2117 | _, | ||
| 2118 | _ ) | ||
| 2119 | then txt; | ||
| 2120 | end match; | ||
| 2121 | end attributeString; | ||
| 2122 | |||
| 2123 | public function attributeOptionString | ||
| 2124 | input Tpl.Text in_txt; | ||
| 2125 | input Option<DAE.Exp> in_a_exp__opt; | ||
| 2126 | input String in_a_attr__name; | ||
| 2127 | |||
| 2128 | output Tpl.Text out_txt; | ||
| 2129 | algorithm | ||
| 2130 | out_txt := | ||
| 2131 | match(in_txt, in_a_exp__opt, in_a_attr__name) | ||
| 2132 | local | ||
| 2133 | Tpl.Text txt; | ||
| 2134 | String a_attr__name; | ||
| 2135 | DAE.Exp i_exp; | ||
| 2136 | |||
| 2137 | case ( txt, | ||
| 2138 | SOME(i_exp), | ||
| 2139 | a_attr__name ) | ||
| 2140 | algorithm | ||
| 2141 | 5377 | txt := attributeString(txt, i_exp, a_attr__name); | |
| 2142 | then txt; | ||
| 2143 | |||
| 2144 | case ( txt, | ||
| 2145 | _, | ||
| 2146 | _ ) | ||
| 2147 | then txt; | ||
| 2148 | end match; | ||
| 2149 | end attributeOptionString; | ||
| 2150 | |||
| 2151 | public function unitString | ||
| 2152 | input Tpl.Text in_txt; | ||
| 2153 | input String in_a_unit; | ||
| 2154 | input String in_a_attr__name; | ||
| 2155 | |||
| 2156 | output Tpl.Text out_txt; | ||
| 2157 | algorithm | ||
| 2158 | out_txt := | ||
| 2159 | match(in_txt, in_a_unit, in_a_attr__name) | ||
| 2160 | local | ||
| 2161 | Tpl.Text txt; | ||
| 2162 | String a_attr__name; | ||
| 2163 | String i_unit; | ||
| 2164 | String ret_0; | ||
| 2165 | |||
| 2166 | case ( txt, | ||
| 2167 | "", | ||
| 2168 | _ ) | ||
| 2169 | then txt; | ||
| 2170 | |||
| 2171 | case ( txt, | ||
| 2172 | i_unit, | ||
| 2173 | a_attr__name ) | ||
| 2174 | algorithm | ||
| 2175 | 8011 | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1)); | |
| 2176 | 8011 | txt := Tpl.writeStr(txt, a_attr__name); | |
| 2177 | 8011 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("=\"")); | |
| 2178 | 8011 | ret_0 := Util.escapeModelicaStringToXmlString(i_unit); | |
| 2179 | 8011 | txt := Tpl.writeStr(txt, ret_0); | |
| 2180 | 8011 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"")); | |
| 2181 | 8011 | txt := Tpl.popBlock(txt); | |
| 2182 | then txt; | ||
| 2183 | end match; | ||
| 2184 | end unitString; | ||
| 2185 | |||
| 2186 | protected function fun_98 | ||
| 2187 | input Tpl.Text in_txt; | ||
| 2188 | input SimCodeVar.AliasVariable in_a_simVarAlias; | ||
| 2189 | input Tpl.Text in_a_type; | ||
| 2190 | input Tpl.Text in_a_complexStartExpressions; | ||
| 2191 | input DAE.Exp in_a_exp; | ||
| 2192 | input Tpl.Text in_a_stateDerVectorName; | ||
| 2193 | input SimCode.SimCode in_a_simCode; | ||
| 2194 | input DAE.ComponentRef in_a_simVarCref; | ||
| 2195 | |||
| 2196 | output Tpl.Text out_txt; | ||
| 2197 | output Tpl.Text out_a_complexStartExpressions; | ||
| 2198 | output Tpl.Text out_a_stateDerVectorName; | ||
| 2199 | algorithm | ||
| 2200 | (out_txt, out_a_complexStartExpressions, out_a_stateDerVectorName) := | ||
| 2201 | match(in_txt, in_a_simVarAlias, in_a_type, in_a_complexStartExpressions, in_a_exp, in_a_stateDerVectorName, in_a_simCode, in_a_simVarCref) | ||
| 2202 | local | ||
| 2203 | Tpl.Text txt; | ||
| 2204 | Tpl.Text a_type; | ||
| 2205 | Tpl.Text a_complexStartExpressions; | ||
| 2206 | DAE.Exp a_exp; | ||
| 2207 | Tpl.Text a_stateDerVectorName; | ||
| 2208 | SimCode.SimCode a_simCode; | ||
| 2209 | DAE.ComponentRef a_simVarCref; | ||
| 2210 | Tpl.Text l_expression; | ||
| 2211 | Tpl.Text l_crefStr; | ||
| 2212 | Tpl.Text l_extraFuncsDecl; | ||
| 2213 | Tpl.Text l_extraFuncs; | ||
| 2214 | Tpl.Text l_varDecls; | ||
| 2215 | Tpl.Text l_complexPreExpression; | ||
| 2216 | |||
| 2217 | case ( txt, | ||
| 2218 | SimCodeVar.NOALIAS(), | ||
| 2219 | a_type, | ||
| 2220 | a_complexStartExpressions, | ||
| 2221 | a_exp, | ||
| 2222 | a_stateDerVectorName, | ||
| 2223 | a_simCode, | ||
| 2224 | a_simVarCref ) | ||
| 2225 | algorithm | ||
| 2226 | 183 | l_complexPreExpression := Tpl.emptyTxt; | |
| 2227 | 183 | l_varDecls := Tpl.emptyTxt; | |
| 2228 | 183 | l_extraFuncs := Tpl.emptyTxt; | |
| 2229 | 183 | l_extraFuncsDecl := Tpl.emptyTxt; | |
| 2230 | 183 | (l_crefStr, l_extraFuncs, l_extraFuncsDecl, _, l_varDecls, a_stateDerVectorName) := CodegenCppCommon.cref1(Tpl.emptyTxt, a_simVarCref, a_simCode, l_extraFuncs, l_extraFuncsDecl, Tpl.strTokText(Tpl.ST_STRING("")), SimCodeFunction.contextOther, l_varDecls, a_stateDerVectorName, false); | |
| 2231 | 183 | (l_expression, l_complexPreExpression, l_varDecls, l_extraFuncs, l_extraFuncsDecl, _, a_stateDerVectorName) := CodegenCppCommon.daeExp(Tpl.emptyTxt, a_exp, SimCodeFunction.contextOther, l_complexPreExpression, l_varDecls, a_simCode, l_extraFuncs, l_extraFuncsDecl, Tpl.strTokText(Tpl.ST_STRING("")), a_stateDerVectorName, false); | |
| 2232 | 183 | a_complexStartExpressions := Tpl.writeText(a_complexStartExpressions, l_varDecls); | |
| 2233 | 183 | a_complexStartExpressions := Tpl.writeText(a_complexStartExpressions, l_complexPreExpression); | |
| 2234 | 183 | a_complexStartExpressions := Tpl.writeTok(a_complexStartExpressions, Tpl.ST_STRING("SystemDefaultImplementation::set")); | |
| 2235 | 183 | a_complexStartExpressions := Tpl.writeText(a_complexStartExpressions, a_type); | |
| 2236 | 183 | a_complexStartExpressions := Tpl.writeTok(a_complexStartExpressions, Tpl.ST_STRING("StartValue(")); | |
| 2237 | 183 | a_complexStartExpressions := Tpl.writeText(a_complexStartExpressions, l_crefStr); | |
| 2238 | 183 | a_complexStartExpressions := Tpl.writeTok(a_complexStartExpressions, Tpl.ST_STRING(",")); | |
| 2239 | 183 | a_complexStartExpressions := Tpl.writeText(a_complexStartExpressions, l_expression); | |
| 2240 | 183 | a_complexStartExpressions := Tpl.writeTok(a_complexStartExpressions, Tpl.ST_STRING(");")); | |
| 2241 | 183 | a_complexStartExpressions := Tpl.writeTok(a_complexStartExpressions, Tpl.ST_NEW_LINE()); | |
| 2242 | 183 | then (txt, a_complexStartExpressions, a_stateDerVectorName); | |
| 2243 | |||
| 2244 | case ( txt, | ||
| 2245 | _, | ||
| 2246 | _, | ||
| 2247 | a_complexStartExpressions, | ||
| 2248 | _, | ||
| 2249 | a_stateDerVectorName, | ||
| 2250 | _, | ||
| 2251 | _ ) | ||
| 2252 | then (txt, a_complexStartExpressions, a_stateDerVectorName); | ||
| 2253 | end match; | ||
| 2254 | end fun_98; | ||
| 2255 | |||
| 2256 | protected function fun_99 | ||
| 2257 | input Tpl.Text in_txt; | ||
| 2258 | input String in_mArg; | ||
| 2259 | input Tpl.Text in_a_startString; | ||
| 2260 | input Tpl.Text in_a_type; | ||
| 2261 | input Tpl.Text in_a_complexStartExpressions; | ||
| 2262 | input DAE.Exp in_a_exp; | ||
| 2263 | input Tpl.Text in_a_stateDerVectorName; | ||
| 2264 | input SimCode.SimCode in_a_simCode; | ||
| 2265 | input DAE.ComponentRef in_a_simVarCref; | ||
| 2266 | input SimCodeVar.AliasVariable in_a_simVarAlias; | ||
| 2267 | |||
| 2268 | output Tpl.Text out_txt; | ||
| 2269 | output Tpl.Text out_a_complexStartExpressions; | ||
| 2270 | output Tpl.Text out_a_stateDerVectorName; | ||
| 2271 | algorithm | ||
| 2272 | (out_txt, out_a_complexStartExpressions, out_a_stateDerVectorName) := | ||
| 2273 | match(in_txt, in_mArg, in_a_startString, in_a_type, in_a_complexStartExpressions, in_a_exp, in_a_stateDerVectorName, in_a_simCode, in_a_simVarCref, in_a_simVarAlias) | ||
| 2274 | local | ||
| 2275 | Tpl.Text txt; | ||
| 2276 | Tpl.Text a_startString; | ||
| 2277 | Tpl.Text a_type; | ||
| 2278 | Tpl.Text a_complexStartExpressions; | ||
| 2279 | DAE.Exp a_exp; | ||
| 2280 | Tpl.Text a_stateDerVectorName; | ||
| 2281 | SimCode.SimCode a_simCode; | ||
| 2282 | DAE.ComponentRef a_simVarCref; | ||
| 2283 | SimCodeVar.AliasVariable a_simVarAlias; | ||
| 2284 | Tpl.Text l_unsued; | ||
| 2285 | |||
| 2286 | case ( txt, | ||
| 2287 | "", | ||
| 2288 | _, | ||
| 2289 | a_type, | ||
| 2290 | a_complexStartExpressions, | ||
| 2291 | a_exp, | ||
| 2292 | a_stateDerVectorName, | ||
| 2293 | a_simCode, | ||
| 2294 | a_simVarCref, | ||
| 2295 | a_simVarAlias ) | ||
| 2296 | algorithm | ||
| 2297 | 185 | (l_unsued, a_complexStartExpressions, a_stateDerVectorName) := fun_98(Tpl.emptyTxt, a_simVarAlias, a_type, a_complexStartExpressions, a_exp, a_stateDerVectorName, a_simCode, a_simVarCref); | |
| 2298 | 185 | then (txt, a_complexStartExpressions, a_stateDerVectorName); | |
| 2299 | |||
| 2300 | case ( txt, | ||
| 2301 | _, | ||
| 2302 | a_startString, | ||
| 2303 | _, | ||
| 2304 | a_complexStartExpressions, | ||
| 2305 | _, | ||
| 2306 | a_stateDerVectorName, | ||
| 2307 | _, | ||
| 2308 | _, | ||
| 2309 | _ ) | ||
| 2310 | algorithm | ||
| 2311 | 4334 | txt := Tpl.writeText(txt, a_startString); | |
| 2312 | then (txt, a_complexStartExpressions, a_stateDerVectorName); | ||
| 2313 | end match; | ||
| 2314 | end fun_99; | ||
| 2315 | |||
| 2316 | protected function fun_100 | ||
| 2317 | input Tpl.Text in_txt; | ||
| 2318 | input Option<DAE.Exp> in_a_startValue; | ||
| 2319 | input SimCode.SimCode in_a_simCode; | ||
| 2320 | input DAE.ComponentRef in_a_simVarCref; | ||
| 2321 | input SimCodeVar.AliasVariable in_a_simVarAlias; | ||
| 2322 | input Tpl.Text in_a_type; | ||
| 2323 | input Tpl.Text in_a_complexStartExpressions; | ||
| 2324 | input Tpl.Text in_a_stateDerVectorName; | ||
| 2325 | |||
| 2326 | output Tpl.Text out_txt; | ||
| 2327 | output Tpl.Text out_a_complexStartExpressions; | ||
| 2328 | output Tpl.Text out_a_stateDerVectorName; | ||
| 2329 | algorithm | ||
| 2330 | (out_txt, out_a_complexStartExpressions, out_a_stateDerVectorName) := | ||
| 2331 | match(in_txt, in_a_startValue, in_a_simCode, in_a_simVarCref, in_a_simVarAlias, in_a_type, in_a_complexStartExpressions, in_a_stateDerVectorName) | ||
| 2332 | local | ||
| 2333 | Tpl.Text txt; | ||
| 2334 | SimCode.SimCode a_simCode; | ||
| 2335 | DAE.ComponentRef a_simVarCref; | ||
| 2336 | SimCodeVar.AliasVariable a_simVarAlias; | ||
| 2337 | Tpl.Text a_type; | ||
| 2338 | Tpl.Text a_complexStartExpressions; | ||
| 2339 | Tpl.Text a_stateDerVectorName; | ||
| 2340 | DAE.Exp i_exp; | ||
| 2341 | String str_1; | ||
| 2342 | Tpl.Text l_startString; | ||
| 2343 | |||
| 2344 | case ( txt, | ||
| 2345 | SOME(i_exp), | ||
| 2346 | a_simCode, | ||
| 2347 | a_simVarCref, | ||
| 2348 | a_simVarAlias, | ||
| 2349 | a_type, | ||
| 2350 | a_complexStartExpressions, | ||
| 2351 | a_stateDerVectorName ) | ||
| 2352 | algorithm | ||
| 2353 | 4519 | l_startString := attributeString(Tpl.emptyTxt, i_exp, "start"); | |
| 2354 | 4519 | str_1 := Tpl.textString(l_startString); | |
| 2355 | 4519 | (txt, a_complexStartExpressions, a_stateDerVectorName) := fun_99(txt, str_1, l_startString, a_type, a_complexStartExpressions, i_exp, a_stateDerVectorName, a_simCode, a_simVarCref, a_simVarAlias); | |
| 2356 | then (txt, a_complexStartExpressions, a_stateDerVectorName); | ||
| 2357 | |||
| 2358 | case ( txt, | ||
| 2359 | NONE(), | ||
| 2360 | _, | ||
| 2361 | _, | ||
| 2362 | _, | ||
| 2363 | _, | ||
| 2364 | a_complexStartExpressions, | ||
| 2365 | a_stateDerVectorName ) | ||
| 2366 | 7377 | then (txt, a_complexStartExpressions, a_stateDerVectorName); | |
| 2367 | |||
| 2368 | case ( txt, | ||
| 2369 | _, | ||
| 2370 | _, | ||
| 2371 | _, | ||
| 2372 | _, | ||
| 2373 | _, | ||
| 2374 | a_complexStartExpressions, | ||
| 2375 | a_stateDerVectorName ) | ||
| 2376 | ✗ | then (txt, a_complexStartExpressions, a_stateDerVectorName); | |
| 2377 | end match; | ||
| 2378 | end fun_100; | ||
| 2379 | |||
| 2380 | public function ScalarVariableTypeStartAttribute | ||
| 2381 | input Tpl.Text txt; | ||
| 2382 | input SimCode.SimCode a_simCode; | ||
| 2383 | input DAE.ComponentRef a_simVarCref; | ||
| 2384 | input SimCodeVar.AliasVariable a_simVarAlias; | ||
| 2385 | input Option<DAE.Exp> a_startValue; | ||
| 2386 | input Tpl.Text a_type; | ||
| 2387 | input Tpl.Text a_complexStartExpressions; | ||
| 2388 | input Tpl.Text a_stateDerVectorName; | ||
| 2389 | |||
| 2390 | output Tpl.Text out_txt; | ||
| 2391 | output Tpl.Text out_a_type; | ||
| 2392 | output Tpl.Text out_a_complexStartExpressions; | ||
| 2393 | output Tpl.Text out_a_stateDerVectorName; | ||
| 2394 | algorithm | ||
| 2395 | 11896 | (out_txt, out_a_complexStartExpressions, out_a_stateDerVectorName) := fun_100(txt, a_startValue, a_simCode, a_simVarCref, a_simVarAlias, a_type, a_complexStartExpressions, a_stateDerVectorName); | |
| 2396 | out_a_type := a_type; | ||
| 2397 | end ScalarVariableTypeStartAttribute; | ||
| 2398 | |||
| 2399 | protected function lm_102 | ||
| 2400 | input output Tpl.Text txt; | ||
| 2401 | input list<String> items; | ||
| 2402 | algorithm | ||
| 2403 | ✗ | for lstElt_102 in items loop | |
| 2404 | txt := match lstElt_102 | ||
| 2405 | local | ||
| 2406 | String i_it; | ||
| 2407 | |||
| 2408 | case i_it | ||
| 2409 | algorithm | ||
| 2410 | ✗ | txt := Tpl.writeStr(txt, i_it); | |
| 2411 | then txt; | ||
| 2412 | end match; | ||
| 2413 | end for; | ||
| 2414 | end lm_102; | ||
| 2415 | |||
| 2416 | protected function lm_103 | ||
| 2417 | input output Tpl.Text txt; | ||
| 2418 | input list<SimCodeVar.SimVar> items; | ||
| 2419 | input String a_indexForUndefinedReferences; | ||
| 2420 | input HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 2421 | algorithm | ||
| 2422 | ✗ | for lstElt_103 in items loop | |
| 2423 | txt := match lstElt_103 | ||
| 2424 | local | ||
| 2425 | DAE.ComponentRef i_v_name; | ||
| 2426 | list<String> ret_0; | ||
| 2427 | |||
| 2428 | case SimCodeVar.SIMVAR(name = i_v_name) | ||
| 2429 | algorithm | ||
| 2430 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Var type=\"double\" index=\"")); | |
| 2431 | ✗ | ret_0 := SimCodeCodegenUtil.getVarIndexListByMapping(a_varToArrayIndexMapping, i_v_name, true, a_indexForUndefinedReferences); | |
| 2432 | ✗ | txt := lm_102(txt, ret_0); | |
| 2433 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" />")); | |
| 2434 | ✗ | txt := Tpl.nextIter(txt); | |
| 2435 | then txt; | ||
| 2436 | |||
| 2437 | case _ | ||
| 2438 | then txt; | ||
| 2439 | end match; | ||
| 2440 | end for; | ||
| 2441 | end lm_103; | ||
| 2442 | |||
| 2443 | protected function lm_104 | ||
| 2444 | input output Tpl.Text txt; | ||
| 2445 | input list<String> items; | ||
| 2446 | algorithm | ||
| 2447 | ✗ | for lstElt_104 in items loop | |
| 2448 | txt := match lstElt_104 | ||
| 2449 | local | ||
| 2450 | String i_it; | ||
| 2451 | |||
| 2452 | case i_it | ||
| 2453 | algorithm | ||
| 2454 | ✗ | txt := Tpl.writeStr(txt, i_it); | |
| 2455 | then txt; | ||
| 2456 | end match; | ||
| 2457 | end for; | ||
| 2458 | end lm_104; | ||
| 2459 | |||
| 2460 | protected function lm_105 | ||
| 2461 | input output Tpl.Text txt; | ||
| 2462 | input list<DAE.ComponentRef> items; | ||
| 2463 | input String a_indexForUndefinedReferences; | ||
| 2464 | input HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 2465 | algorithm | ||
| 2466 | ✗ | for lstElt_105 in items loop | |
| 2467 | txt := match lstElt_105 | ||
| 2468 | local | ||
| 2469 | DAE.ComponentRef i_name; | ||
| 2470 | list<String> ret_0; | ||
| 2471 | |||
| 2472 | case i_name | ||
| 2473 | algorithm | ||
| 2474 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Var type=\"double\" index=\"")); | |
| 2475 | ✗ | ret_0 := SimCodeCodegenUtil.getVarIndexListByMapping(a_varToArrayIndexMapping, i_name, true, a_indexForUndefinedReferences); | |
| 2476 | ✗ | txt := lm_104(txt, ret_0); | |
| 2477 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" />")); | |
| 2478 | ✗ | txt := Tpl.nextIter(txt); | |
| 2479 | then txt; | ||
| 2480 | end match; | ||
| 2481 | end for; | ||
| 2482 | end lm_105; | ||
| 2483 | |||
| 2484 | protected function fun_106 | ||
| 2485 | input Tpl.Text in_txt; | ||
| 2486 | input SimCode.SimEqSystem in_a_eqs; | ||
| 2487 | input HashTableCrIListArray.HashTable in_a_varToArrayIndexMapping; | ||
| 2488 | input String in_a_indexForUndefinedReferences; | ||
| 2489 | |||
| 2490 | output Tpl.Text out_txt; | ||
| 2491 | algorithm | ||
| 2492 | out_txt := | ||
| 2493 | match(in_txt, in_a_eqs, in_a_varToArrayIndexMapping, in_a_indexForUndefinedReferences) | ||
| 2494 | local | ||
| 2495 | Tpl.Text txt; | ||
| 2496 | HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 2497 | String a_indexForUndefinedReferences; | ||
| 2498 | list<DAE.ComponentRef> i_nls_crefs; | ||
| 2499 | Integer i_nls_index; | ||
| 2500 | list<SimCodeVar.SimVar> i_ls_vars; | ||
| 2501 | Integer i_ls_index; | ||
| 2502 | Integer ret_1; | ||
| 2503 | Integer ret_0; | ||
| 2504 | |||
| 2505 | case ( txt, | ||
| 2506 | SimCode.SES_LINEAR(lSystem = SimCode.LINEARSYSTEM(index = i_ls_index, vars = i_ls_vars)), | ||
| 2507 | a_varToArrayIndexMapping, | ||
| 2508 | a_indexForUndefinedReferences ) | ||
| 2509 | algorithm | ||
| 2510 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Linear eqIdx=\"")); | |
| 2511 | ✗ | txt := Tpl.writeStr(txt, intString(i_ls_index)); | |
| 2512 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" sparse=\"true\" size=\"")); | |
| 2513 | ✗ | ret_0 := listLength(i_ls_vars); | |
| 2514 | ✗ | txt := Tpl.writeStr(txt, intString(ret_0)); | |
| 2515 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 2516 | "\">\n", | ||
| 2517 | " <Vars>\n" | ||
| 2518 | }, true)); | ||
| 2519 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4)); | |
| 2520 | ✗ | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 2521 | ✗ | txt := lm_103(txt, i_ls_vars, a_indexForUndefinedReferences, a_varToArrayIndexMapping); | |
| 2522 | ✗ | txt := Tpl.popIter(txt); | |
| 2523 | ✗ | txt := Tpl.softNewLine(txt); | |
| 2524 | ✗ | txt := Tpl.popBlock(txt); | |
| 2525 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 2526 | " </Vars>\n", | ||
| 2527 | "</Linear>" | ||
| 2528 | }, false)); | ||
| 2529 | then txt; | ||
| 2530 | |||
| 2531 | case ( txt, | ||
| 2532 | SimCode.SES_NONLINEAR(nlSystem = SimCode.NONLINEARSYSTEM(index = i_nls_index, crefs = i_nls_crefs)), | ||
| 2533 | a_varToArrayIndexMapping, | ||
| 2534 | a_indexForUndefinedReferences ) | ||
| 2535 | algorithm | ||
| 2536 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("<NonLinear eqIdx=\"")); | |
| 2537 | ✗ | txt := Tpl.writeStr(txt, intString(i_nls_index)); | |
| 2538 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" size=\"")); | |
| 2539 | ✗ | ret_1 := listLength(i_nls_crefs); | |
| 2540 | ✗ | txt := Tpl.writeStr(txt, intString(ret_1)); | |
| 2541 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 2542 | "\">\n", | ||
| 2543 | " <Vars>\n" | ||
| 2544 | }, true)); | ||
| 2545 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4)); | |
| 2546 | ✗ | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 2547 | ✗ | txt := lm_105(txt, i_nls_crefs, a_indexForUndefinedReferences, a_varToArrayIndexMapping); | |
| 2548 | ✗ | txt := Tpl.popIter(txt); | |
| 2549 | ✗ | txt := Tpl.softNewLine(txt); | |
| 2550 | ✗ | txt := Tpl.popBlock(txt); | |
| 2551 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 2552 | " </Vars>\n", | ||
| 2553 | " <NominalVars>\n", | ||
| 2554 | " <!-- Maybe Expressions here -->\n", | ||
| 2555 | " </NominalVars>\n", | ||
| 2556 | "</NonLinear>" | ||
| 2557 | }, false)); | ||
| 2558 | then txt; | ||
| 2559 | |||
| 2560 | case ( txt, | ||
| 2561 | _, | ||
| 2562 | _, | ||
| 2563 | _ ) | ||
| 2564 | then txt; | ||
| 2565 | end match; | ||
| 2566 | end fun_106; | ||
| 2567 | |||
| 2568 | public function algLoopXML | ||
| 2569 | input Tpl.Text txt; | ||
| 2570 | input SimCode.SimEqSystem a_eqs; | ||
| 2571 | input SimCode.SimCode a_simCode; | ||
| 2572 | input HashTableCrIListArray.HashTable a_varToArrayIndexMapping; | ||
| 2573 | input String a_indexForUndefinedReferences; | ||
| 2574 | |||
| 2575 | output Tpl.Text out_txt; | ||
| 2576 | algorithm | ||
| 2577 | ✗ | out_txt := fun_106(txt, a_eqs, a_varToArrayIndexMapping, a_indexForUndefinedReferences); | |
| 2578 | end algLoopXML; | ||
| 2579 | |||
| 2580 | protected function lm_108 | ||
| 2581 | input output Tpl.Text txt; | ||
| 2582 | input list<SimCode.JacobianMatrix> items; | ||
| 2583 | algorithm | ||
| 2584 | ✗ | for lstElt_108 in items loop | |
| 2585 | txt := match lstElt_108 | ||
| 2586 | local | ||
| 2587 | Integer i_maxColor; | ||
| 2588 | list<list<Integer>> i_colorList; | ||
| 2589 | SimCode.SparsityPattern i_sparsepattern; | ||
| 2590 | String i_name; | ||
| 2591 | list<SimCodeVar.SimVar> i_vars; | ||
| 2592 | list<SimCode.JacobianColumn> i_mat; | ||
| 2593 | Integer i_jacIndex; | ||
| 2594 | |||
| 2595 | case SimCode.JAC_MATRIX(columns = i_mat, seedVars = i_vars, matrixName = i_name, sparsity = i_sparsepattern, coloredCols = i_colorList, maxColorCols = i_maxColor, jacobianIndex = i_jacIndex) | ||
| 2596 | algorithm | ||
| 2597 | ✗ | txt := jacobianMatrixXML(txt, i_jacIndex, i_mat, i_vars, i_name, i_sparsepattern, i_colorList, i_maxColor); | |
| 2598 | ✗ | txt := Tpl.nextIter(txt); | |
| 2599 | then txt; | ||
| 2600 | |||
| 2601 | case _ | ||
| 2602 | then txt; | ||
| 2603 | end match; | ||
| 2604 | end for; | ||
| 2605 | end lm_108; | ||
| 2606 | |||
| 2607 | public function jacobianMatricesXML | ||
| 2608 | input Tpl.Text txt; | ||
| 2609 | input list<SimCode.JacobianMatrix> a_JacobianMatrices; | ||
| 2610 | |||
| 2611 | output Tpl.Text out_txt; | ||
| 2612 | protected | ||
| 2613 | Tpl.Text l_jacMats; | ||
| 2614 | algorithm | ||
| 2615 | ✗ | l_jacMats := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, SOME(Tpl.ST_STRING("")), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 2616 | ✗ | l_jacMats := lm_108(l_jacMats, a_JacobianMatrices); | |
| 2617 | ✗ | l_jacMats := Tpl.popIter(l_jacMats); | |
| 2618 | ✗ | out_txt := Tpl.writeText(txt, l_jacMats); | |
| 2619 | end jacobianMatricesXML; | ||
| 2620 | |||
| 2621 | protected function lm_110 | ||
| 2622 | input output Tpl.Text txt; | ||
| 2623 | input list<SimCode.JacobianColumn> items; | ||
| 2624 | algorithm | ||
| 2625 | ✗ | for lstElt_110 in items loop | |
| 2626 | txt := match lstElt_110 | ||
| 2627 | local | ||
| 2628 | Integer i_nRows; | ||
| 2629 | |||
| 2630 | case SimCode.JAC_COLUMN(numberOfResultVars = i_nRows) | ||
| 2631 | algorithm | ||
| 2632 | ✗ | txt := Tpl.writeStr(txt, intString(i_nRows)); | |
| 2633 | ✗ | txt := Tpl.nextIter(txt); | |
| 2634 | then txt; | ||
| 2635 | |||
| 2636 | case _ | ||
| 2637 | then txt; | ||
| 2638 | end match; | ||
| 2639 | end for; | ||
| 2640 | end lm_110; | ||
| 2641 | |||
| 2642 | protected function fun_111 | ||
| 2643 | input Tpl.Text in_txt; | ||
| 2644 | input String in_mArg; | ||
| 2645 | input Integer in_a_i__index; | ||
| 2646 | input Integer in_a_index; | ||
| 2647 | |||
| 2648 | output Tpl.Text out_txt; | ||
| 2649 | algorithm | ||
| 2650 | out_txt := | ||
| 2651 | match(in_txt, in_mArg, in_a_i__index, in_a_index) | ||
| 2652 | local | ||
| 2653 | Tpl.Text txt; | ||
| 2654 | Integer a_i__index; | ||
| 2655 | Integer a_index; | ||
| 2656 | |||
| 2657 | case ( txt, | ||
| 2658 | "1", | ||
| 2659 | _, | ||
| 2660 | a_index ) | ||
| 2661 | algorithm | ||
| 2662 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Entry indexX=\"")); | |
| 2663 | ✗ | txt := Tpl.writeStr(txt, intString(a_index)); | |
| 2664 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" indexY=\"0\" valueIndex=\"0\"/>")); | |
| 2665 | then txt; | ||
| 2666 | |||
| 2667 | case ( txt, | ||
| 2668 | _, | ||
| 2669 | a_i__index, | ||
| 2670 | a_index ) | ||
| 2671 | algorithm | ||
| 2672 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Entry indexX=\"")); | |
| 2673 | ✗ | txt := Tpl.writeStr(txt, intString(a_index)); | |
| 2674 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" indexY=\"")); | |
| 2675 | ✗ | txt := Tpl.writeStr(txt, intString(a_i__index)); | |
| 2676 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" valueIndex=\"")); | |
| 2677 | ✗ | txt := Tpl.writeStr(txt, intString(a_i__index)); | |
| 2678 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"/>")); | |
| 2679 | then txt; | ||
| 2680 | end match; | ||
| 2681 | end fun_111; | ||
| 2682 | |||
| 2683 | protected function lm_112 | ||
| 2684 | input output Tpl.Text txt; | ||
| 2685 | input list<Integer> items; | ||
| 2686 | input Integer a_index; | ||
| 2687 | input Tpl.Text a_indexColumn; | ||
| 2688 | algorithm | ||
| 2689 | ✗ | for lstElt_112 in items loop | |
| 2690 | txt := match lstElt_112 | ||
| 2691 | local | ||
| 2692 | Integer i_i__index; | ||
| 2693 | String str_0; | ||
| 2694 | |||
| 2695 | case i_i__index | ||
| 2696 | algorithm | ||
| 2697 | ✗ | str_0 := Tpl.textString(a_indexColumn); | |
| 2698 | ✗ | txt := fun_111(txt, str_0, i_i__index, a_index); | |
| 2699 | ✗ | txt := Tpl.nextIter(txt); | |
| 2700 | then txt; | ||
| 2701 | end match; | ||
| 2702 | end for; | ||
| 2703 | end lm_112; | ||
| 2704 | |||
| 2705 | protected function lm_113 | ||
| 2706 | input output Tpl.Text txt; | ||
| 2707 | input SimCode.SparsityPattern items; | ||
| 2708 | input Tpl.Text a_indexColumn; | ||
| 2709 | algorithm | ||
| 2710 | ✗ | for lstElt_113 in items loop | |
| 2711 | txt := match lstElt_113 | ||
| 2712 | local | ||
| 2713 | Integer i_index; | ||
| 2714 | list<Integer> i_indexes; | ||
| 2715 | |||
| 2716 | case (i_index, i_indexes) | ||
| 2717 | algorithm | ||
| 2718 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_LINE("<Column>\n")); | |
| 2719 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(19)); | |
| 2720 | ✗ | txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 2721 | ✗ | txt := lm_112(txt, i_indexes, i_index, a_indexColumn); | |
| 2722 | ✗ | txt := Tpl.popIter(txt); | |
| 2723 | ✗ | txt := Tpl.softNewLine(txt); | |
| 2724 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("</Column>")); | |
| 2725 | ✗ | txt := Tpl.popBlock(txt); | |
| 2726 | ✗ | txt := Tpl.nextIter(txt); | |
| 2727 | then txt; | ||
| 2728 | end match; | ||
| 2729 | end for; | ||
| 2730 | end lm_113; | ||
| 2731 | |||
| 2732 | public function jacobianMatrixXML | ||
| 2733 | input Tpl.Text txt; | ||
| 2734 | input Integer a_indexJacobian; | ||
| 2735 | input list<SimCode.JacobianColumn> a_jacobianColumn; | ||
| 2736 | input list<SimCodeVar.SimVar> a_seedVars; | ||
| 2737 | input String a_matrixName; | ||
| 2738 | input SimCode.SparsityPattern a_sparsepattern; | ||
| 2739 | input list<list<Integer>> a_colorList; | ||
| 2740 | input Integer a_maxColor; | ||
| 2741 | |||
| 2742 | output Tpl.Text out_txt; | ||
| 2743 | protected | ||
| 2744 | Tpl.Text l_jacvals; | ||
| 2745 | Tpl.Text l_indexColumn; | ||
| 2746 | algorithm | ||
| 2747 | ✗ | l_indexColumn := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 2748 | ✗ | l_indexColumn := lm_110(l_indexColumn, a_jacobianColumn); | |
| 2749 | ✗ | l_indexColumn := Tpl.popIter(l_indexColumn); | |
| 2750 | ✗ | l_jacvals := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE())); | |
| 2751 | ✗ | l_jacvals := lm_113(l_jacvals, a_sparsepattern, l_indexColumn); | |
| 2752 | ✗ | l_jacvals := Tpl.popIter(l_jacvals); | |
| 2753 | ✗ | out_txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Matrix name=\"")); | |
| 2754 | ✗ | out_txt := Tpl.writeStr(out_txt, a_matrixName); | |
| 2755 | ✗ | out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING_LIST({ | |
| 2756 | "\">\n", | ||
| 2757 | " <Column>\n" | ||
| 2758 | }, true)); | ||
| 2759 | ✗ | out_txt := Tpl.pushBlock(out_txt, Tpl.BT_INDENT(4)); | |
| 2760 | ✗ | out_txt := Tpl.writeText(out_txt, l_jacvals); | |
| 2761 | ✗ | out_txt := Tpl.softNewLine(out_txt); | |
| 2762 | ✗ | out_txt := Tpl.popBlock(out_txt); | |
| 2763 | ✗ | out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING_LIST({ | |
| 2764 | " </Column>\n", | ||
| 2765 | "</Matrix>" | ||
| 2766 | }, false)); | ||
| 2767 | end jacobianMatrixXML; | ||
| 2768 | |||
| 2769 | annotation(__OpenModelica_Interface="codegen_cpp_common"); | ||
| 2770 | end CodegenCppInit; | ||
| 2771 |