build_cmake/OMCompiler/Compiler/generated-mo/Template/CodegenFMU2.mo
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | encapsulated package CodegenFMU2 | ||
| 2 | " | ||
| 3 | file: CodegenFMU2.mo | ||
| 4 | package: CodegenFMU2 | ||
| 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 | public import CodegenUtilSimulation; | ||
| 57 | public import CodegenFMUCommon; | ||
| 58 | |||
| 59 | protected function fun_50 | ||
| 60 | input Tpl.Text in_txt; | ||
| 61 | input Boolean in_mArg; | ||
| 62 | input list<String> in_a_sourceFiles; | ||
| 63 | input SimCode.SimCode in_a_simCode; | ||
| 64 | |||
| 65 | output Tpl.Text out_txt; | ||
| 66 | algorithm | ||
| 67 | out_txt := | ||
| 68 | match(in_txt, in_mArg, in_a_sourceFiles, in_a_simCode) | ||
| 69 | local | ||
| 70 | Tpl.Text txt; | ||
| 71 | list<String> a_sourceFiles; | ||
| 72 | SimCode.SimCode a_simCode; | ||
| 73 | |||
| 74 | case ( txt, | ||
| 75 | false, | ||
| 76 | _, | ||
| 77 | _ ) | ||
| 78 | then txt; | ||
| 79 | |||
| 80 | case ( txt, | ||
| 81 | _, | ||
| 82 | a_sourceFiles, | ||
| 83 | a_simCode ) | ||
| 84 | algorithm | ||
| 85 | 66 | txt := CodegenFMUCommon.ModelExchange(txt, a_simCode, a_sourceFiles); | |
| 86 | then txt; | ||
| 87 | end match; | ||
| 88 | end fun_50; | ||
| 89 | |||
| 90 | protected function fun_51 | ||
| 91 | input Tpl.Text in_txt; | ||
| 92 | input Boolean in_mArg; | ||
| 93 | input list<String> in_a_sourceFiles; | ||
| 94 | input SimCode.SimCode in_a_simCode; | ||
| 95 | |||
| 96 | output Tpl.Text out_txt; | ||
| 97 | algorithm | ||
| 98 | out_txt := | ||
| 99 | match(in_txt, in_mArg, in_a_sourceFiles, in_a_simCode) | ||
| 100 | local | ||
| 101 | Tpl.Text txt; | ||
| 102 | list<String> a_sourceFiles; | ||
| 103 | SimCode.SimCode a_simCode; | ||
| 104 | |||
| 105 | case ( txt, | ||
| 106 | false, | ||
| 107 | _, | ||
| 108 | _ ) | ||
| 109 | then txt; | ||
| 110 | |||
| 111 | case ( txt, | ||
| 112 | _, | ||
| 113 | a_sourceFiles, | ||
| 114 | a_simCode ) | ||
| 115 | algorithm | ||
| 116 | 14 | txt := CoSimulation(txt, a_simCode, a_sourceFiles); | |
| 117 | then txt; | ||
| 118 | end match; | ||
| 119 | end fun_51; | ||
| 120 | |||
| 121 | protected function fun_52 | ||
| 122 | input Tpl.Text in_txt; | ||
| 123 | input Boolean in_mArg; | ||
| 124 | |||
| 125 | output Tpl.Text out_txt; | ||
| 126 | algorithm | ||
| 127 | out_txt := | ||
| 128 | match(in_txt, in_mArg) | ||
| 129 | local | ||
| 130 | Tpl.Text txt; | ||
| 131 | |||
| 132 | case ( txt, | ||
| 133 | false ) | ||
| 134 | algorithm | ||
| 135 | 61 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 136 | "<LogCategories>\n", | ||
| 137 | " <Category name=\"logEvents\" />\n", | ||
| 138 | " <Category name=\"logSingularLinearSystems\" />\n", | ||
| 139 | " <Category name=\"logNonlinearSystems\" />\n", | ||
| 140 | " <Category name=\"logDynamicStateSelection\" />\n", | ||
| 141 | " <Category name=\"logStatusWarning\" />\n", | ||
| 142 | " <Category name=\"logStatusDiscard\" />\n", | ||
| 143 | " <Category name=\"logStatusError\" />\n", | ||
| 144 | " <Category name=\"logStatusFatal\" />\n", | ||
| 145 | " <Category name=\"logStatusPending\" />\n", | ||
| 146 | " <Category name=\"logAll\" />\n", | ||
| 147 | " <Category name=\"logFmi2Call\" />\n", | ||
| 148 | "</LogCategories>" | ||
| 149 | }, false)); | ||
| 150 | then txt; | ||
| 151 | |||
| 152 | case ( txt, | ||
| 153 | _ ) | ||
| 154 | algorithm | ||
| 155 | 11 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 156 | "<LogCategories>\n", | ||
| 157 | " <Category name=\"logEvents\" description=\"logEvents\" />\n", | ||
| 158 | " <Category name=\"logSingularLinearSystems\" description=\"logSingularLinearSystems\" />\n", | ||
| 159 | " <Category name=\"logNonlinearSystems\" description=\"logNonlinearSystems\" />\n", | ||
| 160 | " <Category name=\"logDynamicStateSelection\" description=\"logDynamicStateSelection\" />\n", | ||
| 161 | " <Category name=\"logStatusWarning\" description=\"logStatusWarning\" />\n", | ||
| 162 | " <Category name=\"logStatusDiscard\" description=\"logStatusDiscard\" />\n", | ||
| 163 | " <Category name=\"logStatusError\" description=\"logStatusError\" />\n", | ||
| 164 | " <Category name=\"logStatusFatal\" description=\"logStatusFatal\" />\n", | ||
| 165 | " <Category name=\"logStatusPending\" description=\"logStatusPending\" />\n", | ||
| 166 | " <Category name=\"logAll\" description=\"logAll\" />\n", | ||
| 167 | " <Category name=\"logFmi2Call\" description=\"logFmi2Call\" />\n", | ||
| 168 | "</LogCategories>" | ||
| 169 | }, false)); | ||
| 170 | then txt; | ||
| 171 | end match; | ||
| 172 | end fun_52; | ||
| 173 | |||
| 174 | public function fmiModelDescription | ||
| 175 | input Tpl.Text in_txt; | ||
| 176 | input SimCode.SimCode in_a_simCode; | ||
| 177 | input String in_a_guid; | ||
| 178 | input String in_a_FMUType; | ||
| 179 | input list<String> in_a_sourceFiles; | ||
| 180 | |||
| 181 | output Tpl.Text out_txt; | ||
| 182 | algorithm | ||
| 183 | out_txt := | ||
| 184 | match(in_txt, in_a_simCode, in_a_guid, in_a_FMUType, in_a_sourceFiles) | ||
| 185 | local | ||
| 186 | Tpl.Text txt; | ||
| 187 | String a_guid; | ||
| 188 | String a_FMUType; | ||
| 189 | list<String> a_sourceFiles; | ||
| 190 | Option<SimCode.FmiModelStructure> i_modelStructure; | ||
| 191 | Option<SimCode.SimulationSettings> i_simulationSettingsOpt; | ||
| 192 | SimCode.SimCode i_simCode; | ||
| 193 | Boolean ret_2; | ||
| 194 | Boolean ret_1; | ||
| 195 | Boolean ret_0; | ||
| 196 | |||
| 197 | case ( txt, | ||
| 198 | (i_simCode as SimCode.SIMCODE(simulationSettingsOpt = i_simulationSettingsOpt, modelStructure = i_modelStructure)), | ||
| 199 | a_guid, | ||
| 200 | a_FMUType, | ||
| 201 | a_sourceFiles ) | ||
| 202 | algorithm | ||
| 203 | 72 | txt := Tpl.writeTok(txt, Tpl.ST_LINE("<fmiModelDescription\n")); | |
| 204 | 72 | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 205 | 72 | txt := fmiModelDescriptionAttributes(txt, i_simCode, a_guid); | |
| 206 | 72 | txt := Tpl.writeTok(txt, Tpl.ST_LINE(">\n")); | |
| 207 | 72 | ret_0 := FMI.isFMIMEType(a_FMUType); | |
| 208 | 72 | txt := fun_50(txt, ret_0, a_sourceFiles, i_simCode); | |
| 209 | 72 | txt := Tpl.softNewLine(txt); | |
| 210 | 72 | ret_1 := FMI.isFMICSType(a_FMUType); | |
| 211 | 72 | txt := fun_51(txt, ret_1, a_sourceFiles, i_simCode); | |
| 212 | 72 | txt := Tpl.softNewLine(txt); | |
| 213 | 72 | txt := CodegenFMUCommon.UnitDefinitions(txt, i_simCode); | |
| 214 | 72 | txt := Tpl.softNewLine(txt); | |
| 215 | 72 | txt := CodegenFMUCommon.fmiTypeDefinitions(txt, i_simCode, "2.0"); | |
| 216 | 72 | txt := Tpl.softNewLine(txt); | |
| 217 | 72 | ret_2 := Flags.isSet(Flags.FMU_EXPERIMENTAL); | |
| 218 | 72 | txt := fun_52(txt, ret_2); | |
| 219 | 72 | txt := Tpl.softNewLine(txt); | |
| 220 | 72 | txt := CodegenFMUCommon.DefaultExperiment(txt, i_simulationSettingsOpt, "2.0"); | |
| 221 | 72 | txt := Tpl.softNewLine(txt); | |
| 222 | 72 | txt := CodegenFMUCommon.fmiModelVariables(txt, i_simCode, "2.0"); | |
| 223 | 72 | txt := Tpl.softNewLine(txt); | |
| 224 | 72 | txt := CodegenFMUCommon.ModelStructure(txt, i_modelStructure); | |
| 225 | 72 | txt := Tpl.softNewLine(txt); | |
| 226 | 72 | txt := Tpl.popBlock(txt); | |
| 227 | 72 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("</fmiModelDescription>")); | |
| 228 | then txt; | ||
| 229 | |||
| 230 | case ( txt, | ||
| 231 | _, | ||
| 232 | _, | ||
| 233 | _, | ||
| 234 | _ ) | ||
| 235 | then txt; | ||
| 236 | end match; | ||
| 237 | end fmiModelDescription; | ||
| 238 | |||
| 239 | protected function fun_54 | ||
| 240 | input Tpl.Text in_txt; | ||
| 241 | input Boolean in_mArg; | ||
| 242 | input Tpl.Text in_a_author; | ||
| 243 | |||
| 244 | output Tpl.Text out_txt; | ||
| 245 | algorithm | ||
| 246 | out_txt := | ||
| 247 | match(in_txt, in_mArg, in_a_author) | ||
| 248 | local | ||
| 249 | Tpl.Text txt; | ||
| 250 | Tpl.Text a_author; | ||
| 251 | String ret_0; | ||
| 252 | |||
| 253 | case ( txt, | ||
| 254 | false, | ||
| 255 | a_author ) | ||
| 256 | algorithm | ||
| 257 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("author=\"")); | |
| 258 | ✗ | ret_0 := Util.escapeModelicaStringToXmlString(Tpl.textString(a_author)); | |
| 259 | ✗ | txt := Tpl.writeStr(txt, ret_0); | |
| 260 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"")); | |
| 261 | then txt; | ||
| 262 | |||
| 263 | case ( txt, | ||
| 264 | _, | ||
| 265 | _ ) | ||
| 266 | then txt; | ||
| 267 | end match; | ||
| 268 | end fun_54; | ||
| 269 | |||
| 270 | protected function fun_55 | ||
| 271 | input Tpl.Text in_txt; | ||
| 272 | input Boolean in_mArg; | ||
| 273 | input Tpl.Text in_a_copyright; | ||
| 274 | |||
| 275 | output Tpl.Text out_txt; | ||
| 276 | algorithm | ||
| 277 | out_txt := | ||
| 278 | match(in_txt, in_mArg, in_a_copyright) | ||
| 279 | local | ||
| 280 | Tpl.Text txt; | ||
| 281 | Tpl.Text a_copyright; | ||
| 282 | String ret_0; | ||
| 283 | |||
| 284 | case ( txt, | ||
| 285 | false, | ||
| 286 | a_copyright ) | ||
| 287 | algorithm | ||
| 288 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("copyright=\"")); | |
| 289 | ✗ | ret_0 := Util.escapeModelicaStringToXmlString(Tpl.textString(a_copyright)); | |
| 290 | ✗ | txt := Tpl.writeStr(txt, ret_0); | |
| 291 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"")); | |
| 292 | then txt; | ||
| 293 | |||
| 294 | case ( txt, | ||
| 295 | _, | ||
| 296 | _ ) | ||
| 297 | then txt; | ||
| 298 | end match; | ||
| 299 | end fun_55; | ||
| 300 | |||
| 301 | protected function fun_56 | ||
| 302 | input Tpl.Text in_txt; | ||
| 303 | input Boolean in_mArg; | ||
| 304 | input Tpl.Text in_a_license; | ||
| 305 | |||
| 306 | output Tpl.Text out_txt; | ||
| 307 | algorithm | ||
| 308 | out_txt := | ||
| 309 | match(in_txt, in_mArg, in_a_license) | ||
| 310 | local | ||
| 311 | Tpl.Text txt; | ||
| 312 | Tpl.Text a_license; | ||
| 313 | String ret_0; | ||
| 314 | |||
| 315 | case ( txt, | ||
| 316 | false, | ||
| 317 | a_license ) | ||
| 318 | algorithm | ||
| 319 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("license=\"")); | |
| 320 | ✗ | ret_0 := Util.escapeModelicaStringToXmlString(Tpl.textString(a_license)); | |
| 321 | ✗ | txt := Tpl.writeStr(txt, ret_0); | |
| 322 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"")); | |
| 323 | then txt; | ||
| 324 | |||
| 325 | case ( txt, | ||
| 326 | _, | ||
| 327 | _ ) | ||
| 328 | then txt; | ||
| 329 | end match; | ||
| 330 | end fun_56; | ||
| 331 | |||
| 332 | public function fmiModelDescriptionAttributes | ||
| 333 | input Tpl.Text in_txt; | ||
| 334 | input SimCode.SimCode in_a_simCode; | ||
| 335 | input String in_a_guid; | ||
| 336 | |||
| 337 | output Tpl.Text out_txt; | ||
| 338 | algorithm | ||
| 339 | out_txt := | ||
| 340 | match(in_txt, in_a_simCode, in_a_guid) | ||
| 341 | local | ||
| 342 | Tpl.Text txt; | ||
| 343 | String a_guid; | ||
| 344 | SimCode.SimCode i_simCode; | ||
| 345 | String i_modelInfo_license; | ||
| 346 | String i_modelInfo_copyright; | ||
| 347 | String i_modelInfo_version; | ||
| 348 | String i_modelInfo_author; | ||
| 349 | String i_modelInfo_description; | ||
| 350 | Absyn.Path i_modelInfo_name; | ||
| 351 | String ret_20; | ||
| 352 | String ret_19; | ||
| 353 | Boolean ret_18; | ||
| 354 | Boolean ret_17; | ||
| 355 | Boolean ret_16; | ||
| 356 | String ret_15; | ||
| 357 | String ret_14; | ||
| 358 | String ret_13; | ||
| 359 | Tpl.Text l_numberOfEventIndicators; | ||
| 360 | Tpl.Text l_variableNamingConvention; | ||
| 361 | Util.DateTime ret_10; | ||
| 362 | Tpl.Text l_generationDateAndTime; | ||
| 363 | String ret_8; | ||
| 364 | Tpl.Text l_generationTool; | ||
| 365 | Tpl.Text l_license; | ||
| 366 | Tpl.Text l_copyright; | ||
| 367 | Tpl.Text l_version; | ||
| 368 | Tpl.Text l_author; | ||
| 369 | Tpl.Text l_description; | ||
| 370 | Tpl.Text l_modelName; | ||
| 371 | Tpl.Text l_fmiVersion; | ||
| 372 | |||
| 373 | case ( txt, | ||
| 374 | (i_simCode as SimCode.SIMCODE(modelInfo = SimCode.MODELINFO(varInfo = SimCode.VARINFO(numZeroCrossings = _), vars = SimCodeVar.SIMVARS(stateVars = _), name = i_modelInfo_name, description = i_modelInfo_description, author = i_modelInfo_author, version = i_modelInfo_version, copyright = i_modelInfo_copyright, license = i_modelInfo_license))), | ||
| 375 | a_guid ) | ||
| 376 | algorithm | ||
| 377 | 72 | l_fmiVersion := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("2.0")); | |
| 378 | 72 | l_modelName := CodegenUtil.dotPath(Tpl.emptyTxt, i_modelInfo_name); | |
| 379 | 72 | l_description := Tpl.writeStr(Tpl.emptyTxt, i_modelInfo_description); | |
| 380 | 72 | l_author := Tpl.writeStr(Tpl.emptyTxt, i_modelInfo_author); | |
| 381 | 72 | l_version := Tpl.writeStr(Tpl.emptyTxt, i_modelInfo_version); | |
| 382 | 72 | l_copyright := Tpl.writeStr(Tpl.emptyTxt, i_modelInfo_copyright); | |
| 383 | 72 | l_license := Tpl.writeStr(Tpl.emptyTxt, i_modelInfo_license); | |
| 384 | 72 | l_generationTool := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("OpenModelica Compiler ")); | |
| 385 | 72 | ret_8 := Settings.getVersionNr(); | |
| 386 | 72 | l_generationTool := Tpl.writeStr(l_generationTool, ret_8); | |
| 387 | 72 | ret_10 := Util.getCurrentDateTime(); | |
| 388 | 72 | l_generationDateAndTime := CodegenFMUCommon.xsdateTime(Tpl.emptyTxt, ret_10); | |
| 389 | 72 | l_variableNamingConvention := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("structured")); | |
| 390 | 72 | l_numberOfEventIndicators := CodegenFMUCommon.getNumberOfEventIndicators(Tpl.emptyTxt, i_simCode); | |
| 391 | 72 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("fmiVersion=\"")); | |
| 392 | 72 | txt := Tpl.writeText(txt, l_fmiVersion); | |
| 393 | 72 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 394 | "\"\n", | ||
| 395 | "modelName=\"" | ||
| 396 | }, false)); | ||
| 397 | 72 | ret_13 := Util.escapeModelicaStringToXmlString(Tpl.textString(l_modelName)); | |
| 398 | 72 | txt := Tpl.writeStr(txt, ret_13); | |
| 399 | 72 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 400 | "\"\n", | ||
| 401 | "guid=\"{" | ||
| 402 | }, false)); | ||
| 403 | 72 | txt := Tpl.writeStr(txt, a_guid); | |
| 404 | 72 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 405 | "}\"\n", | ||
| 406 | "description=\"" | ||
| 407 | }, false)); | ||
| 408 | 72 | ret_14 := Util.escapeModelicaStringToXmlString(Tpl.textString(l_description)); | |
| 409 | 72 | txt := Tpl.writeStr(txt, ret_14); | |
| 410 | 72 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 411 | "\"\n", | ||
| 412 | "version=\"" | ||
| 413 | }, false)); | ||
| 414 | 72 | ret_15 := Util.escapeModelicaStringToXmlString(Tpl.textString(l_version)); | |
| 415 | 72 | txt := Tpl.writeStr(txt, ret_15); | |
| 416 | 72 | txt := Tpl.writeTok(txt, Tpl.ST_LINE("\"\n")); | |
| 417 |
2/4✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 72 times.
|
72 | ret_16 := stringEq(Tpl.textString(l_author), ""); |
| 418 | 72 | txt := fun_54(txt, ret_16, l_author); | |
| 419 | 72 | txt := Tpl.softNewLine(txt); | |
| 420 |
2/4✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 72 times.
|
72 | ret_17 := stringEq(Tpl.textString(l_copyright), ""); |
| 421 | 72 | txt := fun_55(txt, ret_17, l_copyright); | |
| 422 | 72 | txt := Tpl.softNewLine(txt); | |
| 423 |
2/4✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 72 times.
|
72 | ret_18 := stringEq(Tpl.textString(l_license), ""); |
| 424 | 72 | txt := fun_56(txt, ret_18, l_license); | |
| 425 | 72 | txt := Tpl.softNewLine(txt); | |
| 426 | 72 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("generationTool=\"")); | |
| 427 | 72 | ret_19 := Util.escapeModelicaStringToXmlString(Tpl.textString(l_generationTool)); | |
| 428 | 72 | txt := Tpl.writeStr(txt, ret_19); | |
| 429 | 72 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 430 | "\"\n", | ||
| 431 | "generationDateAndTime=\"" | ||
| 432 | }, false)); | ||
| 433 | 72 | ret_20 := Util.escapeModelicaStringToXmlString(Tpl.textString(l_generationDateAndTime)); | |
| 434 | 72 | txt := Tpl.writeStr(txt, ret_20); | |
| 435 | 72 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 436 | "\"\n", | ||
| 437 | "variableNamingConvention=\"" | ||
| 438 | }, false)); | ||
| 439 | 72 | txt := Tpl.writeText(txt, l_variableNamingConvention); | |
| 440 | 72 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 441 | "\"\n", | ||
| 442 | "numberOfEventIndicators=\"" | ||
| 443 | }, false)); | ||
| 444 | 72 | txt := Tpl.writeText(txt, l_numberOfEventIndicators); | |
| 445 | 72 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"")); | |
| 446 | then txt; | ||
| 447 | |||
| 448 | case ( txt, | ||
| 449 | _, | ||
| 450 | _ ) | ||
| 451 | then txt; | ||
| 452 | end match; | ||
| 453 | end fmiModelDescriptionAttributes; | ||
| 454 | |||
| 455 | protected function fun_58 | ||
| 456 | input Tpl.Text in_txt; | ||
| 457 | input Boolean in_mArg; | ||
| 458 | |||
| 459 | output Tpl.Text out_txt; | ||
| 460 | algorithm | ||
| 461 | out_txt := | ||
| 462 | match(in_txt, in_mArg) | ||
| 463 | local | ||
| 464 | Tpl.Text txt; | ||
| 465 | |||
| 466 | case ( txt, | ||
| 467 | false ) | ||
| 468 | algorithm | ||
| 469 | 11 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("providesDirectionalDerivative=\"false\"")); | |
| 470 | then txt; | ||
| 471 | |||
| 472 | case ( txt, | ||
| 473 | _ ) | ||
| 474 | algorithm | ||
| 475 | 3 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("providesDirectionalDerivative=\"true\"")); | |
| 476 | then txt; | ||
| 477 | end match; | ||
| 478 | end fun_58; | ||
| 479 | |||
| 480 | public function CoSimulation | ||
| 481 | input Tpl.Text in_txt; | ||
| 482 | input SimCode.SimCode in_a_simCode; | ||
| 483 | input list<String> in_a_sourceFiles; | ||
| 484 | |||
| 485 | output Tpl.Text out_txt; | ||
| 486 | algorithm | ||
| 487 | out_txt := | ||
| 488 | match(in_txt, in_a_simCode, in_a_sourceFiles) | ||
| 489 | local | ||
| 490 | Tpl.Text txt; | ||
| 491 | list<String> a_sourceFiles; | ||
| 492 | SimCode.SimCode i_simCode; | ||
| 493 | Boolean ret_2; | ||
| 494 | String ret_1; | ||
| 495 | Tpl.Text l_modelIdentifier; | ||
| 496 | |||
| 497 | case ( txt, | ||
| 498 | (i_simCode as SimCode.SIMCODE(modelInfo = _)), | ||
| 499 | a_sourceFiles ) | ||
| 500 | algorithm | ||
| 501 | 14 | l_modelIdentifier := CodegenUtilSimulation.modelNamePrefix(Tpl.emptyTxt, i_simCode); | |
| 502 | 14 | txt := Tpl.writeTok(txt, Tpl.ST_LINE("<CoSimulation\n")); | |
| 503 | 14 | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 504 | 14 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelIdentifier=\"")); | |
| 505 | 14 | ret_1 := Util.escapeModelicaStringToXmlString(Tpl.textString(l_modelIdentifier)); | |
| 506 | 14 | txt := Tpl.writeStr(txt, ret_1); | |
| 507 | 14 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 508 | "\"\n", | ||
| 509 | "needsExecutionTool=\"false\"\n", | ||
| 510 | "canHandleVariableCommunicationStepSize=\"true\"\n", | ||
| 511 | "canInterpolateInputs=\"true\"\n", | ||
| 512 | "maxOutputDerivativeOrder=\"1\"\n", | ||
| 513 | "canRunAsynchronuously=\"false\"\n", | ||
| 514 | "canBeInstantiatedOnlyOncePerProcess=\"false\"\n", | ||
| 515 | "canNotUseMemoryManagementFunctions=\"false\"\n", | ||
| 516 | "canGetAndSetFMUstate=\"true\"\n", | ||
| 517 | "canSerializeFMUstate=\"true\"\n" | ||
| 518 | }, true)); | ||
| 519 | 14 | ret_2 := Flags.isSet(Flags.FMU_EXPERIMENTAL); | |
| 520 | 14 | txt := fun_58(txt, ret_2); | |
| 521 | 14 | txt := Tpl.writeTok(txt, Tpl.ST_LINE(">\n")); | |
| 522 | 14 | txt := CodegenFMUCommon.SourceFiles(txt, a_sourceFiles); | |
| 523 | 14 | txt := Tpl.softNewLine(txt); | |
| 524 | 14 | txt := Tpl.popBlock(txt); | |
| 525 | 14 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("</CoSimulation>")); | |
| 526 | then txt; | ||
| 527 | |||
| 528 | case ( txt, | ||
| 529 | _, | ||
| 530 | _ ) | ||
| 531 | then txt; | ||
| 532 | end match; | ||
| 533 | end CoSimulation; | ||
| 534 | |||
| 535 | annotation(__OpenModelica_Interface="codegen_fmu"); | ||
| 536 | end CodegenFMU2; | ||
| 537 |