build_cmake/OMCompiler/Compiler/generated-mo/Template/CodegenFMU1.mo
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | encapsulated package CodegenFMU1 | ||
| 2 | " | ||
| 3 | file: CodegenFMU1.mo | ||
| 4 | package: CodegenFMU1 | ||
| 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 | |||
| 63 | output Tpl.Text out_txt; | ||
| 64 | algorithm | ||
| 65 | out_txt := | ||
| 66 | match(in_txt, in_mArg) | ||
| 67 | local | ||
| 68 | Tpl.Text txt; | ||
| 69 | |||
| 70 | case ( txt, | ||
| 71 | false ) | ||
| 72 | then txt; | ||
| 73 | |||
| 74 | case ( txt, | ||
| 75 | _ ) | ||
| 76 | algorithm | ||
| 77 | ✗ | txt := CodegenFMUCommon.Implementation(txt); | |
| 78 | then txt; | ||
| 79 | end match; | ||
| 80 | end fun_50; | ||
| 81 | |||
| 82 | public function fmiModelDescription | ||
| 83 | input Tpl.Text in_txt; | ||
| 84 | input SimCode.SimCode in_a_simCode; | ||
| 85 | input String in_a_guid; | ||
| 86 | input String in_a_FMUType; | ||
| 87 | |||
| 88 | output Tpl.Text out_txt; | ||
| 89 | algorithm | ||
| 90 | out_txt := | ||
| 91 | match(in_txt, in_a_simCode, in_a_guid, in_a_FMUType) | ||
| 92 | local | ||
| 93 | Tpl.Text txt; | ||
| 94 | String a_guid; | ||
| 95 | String a_FMUType; | ||
| 96 | Option<SimCode.SimulationSettings> i_simulationSettingsOpt; | ||
| 97 | SimCode.SimCode i_simCode; | ||
| 98 | Boolean ret_0; | ||
| 99 | |||
| 100 | case ( txt, | ||
| 101 | (i_simCode as SimCode.SIMCODE(simulationSettingsOpt = i_simulationSettingsOpt)), | ||
| 102 | a_guid, | ||
| 103 | a_FMUType ) | ||
| 104 | algorithm | ||
| 105 | 2 | txt := Tpl.writeTok(txt, Tpl.ST_LINE("<fmiModelDescription\n")); | |
| 106 | 2 | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 107 | 2 | txt := fmiModelDescriptionAttributes(txt, i_simCode, a_guid); | |
| 108 | 2 | txt := Tpl.writeTok(txt, Tpl.ST_LINE(">\n")); | |
| 109 | 2 | txt := CodegenFMUCommon.fmiTypeDefinitions(txt, i_simCode, "1.0"); | |
| 110 | 2 | txt := Tpl.softNewLine(txt); | |
| 111 | 2 | txt := CodegenFMUCommon.DefaultExperiment(txt, i_simulationSettingsOpt, "1.0"); | |
| 112 | 2 | txt := Tpl.softNewLine(txt); | |
| 113 | 2 | txt := CodegenFMUCommon.fmiModelVariables(txt, i_simCode, "1.0"); | |
| 114 | 2 | txt := Tpl.softNewLine(txt); | |
| 115 | 2 | ret_0 := FMI.isFMICSType(a_FMUType); | |
| 116 | 2 | txt := fun_50(txt, ret_0); | |
| 117 | 2 | txt := Tpl.softNewLine(txt); | |
| 118 | 2 | txt := Tpl.popBlock(txt); | |
| 119 | 2 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("</fmiModelDescription>")); | |
| 120 | then txt; | ||
| 121 | |||
| 122 | case ( txt, | ||
| 123 | _, | ||
| 124 | _, | ||
| 125 | _ ) | ||
| 126 | then txt; | ||
| 127 | end match; | ||
| 128 | end fmiModelDescription; | ||
| 129 | |||
| 130 | protected function fun_52 | ||
| 131 | input Tpl.Text in_txt; | ||
| 132 | input Boolean in_mArg; | ||
| 133 | input list<SimCodeVar.SimVar> in_a_listStates; | ||
| 134 | input Integer in_a_vi_numStateVars; | ||
| 135 | |||
| 136 | output Tpl.Text out_txt; | ||
| 137 | algorithm | ||
| 138 | out_txt := | ||
| 139 | match(in_txt, in_mArg, in_a_listStates, in_a_vi_numStateVars) | ||
| 140 | local | ||
| 141 | Tpl.Text txt; | ||
| 142 | list<SimCodeVar.SimVar> a_listStates; | ||
| 143 | Integer a_vi_numStateVars; | ||
| 144 | |||
| 145 | case ( txt, | ||
| 146 | false, | ||
| 147 | _, | ||
| 148 | a_vi_numStateVars ) | ||
| 149 | algorithm | ||
| 150 | 1 | txt := Tpl.writeStr(txt, intString(a_vi_numStateVars)); | |
| 151 | then txt; | ||
| 152 | |||
| 153 | case ( txt, | ||
| 154 | _, | ||
| 155 | a_listStates, | ||
| 156 | _ ) | ||
| 157 | algorithm | ||
| 158 | 1 | txt := CodegenFMUCommon.statesnumwithDummy(txt, a_listStates); | |
| 159 | then txt; | ||
| 160 | end match; | ||
| 161 | end fun_52; | ||
| 162 | |||
| 163 | public function fmiModelDescriptionAttributes | ||
| 164 | input Tpl.Text in_txt; | ||
| 165 | input SimCode.SimCode in_a_simCode; | ||
| 166 | input String in_a_guid; | ||
| 167 | |||
| 168 | output Tpl.Text out_txt; | ||
| 169 | algorithm | ||
| 170 | out_txt := | ||
| 171 | match(in_txt, in_a_simCode, in_a_guid) | ||
| 172 | local | ||
| 173 | Tpl.Text txt; | ||
| 174 | String a_guid; | ||
| 175 | list<SimCodeVar.SimVar> i_listStates; | ||
| 176 | Integer i_vi_numStateVars; | ||
| 177 | String i_modelInfo_description; | ||
| 178 | SimCode.SimCode i_simCode; | ||
| 179 | Absyn.Path i_modelInfo_name; | ||
| 180 | String ret_15; | ||
| 181 | String ret_14; | ||
| 182 | String ret_13; | ||
| 183 | String ret_12; | ||
| 184 | Tpl.Text l_numberOfEventIndicators; | ||
| 185 | Boolean ret_10; | ||
| 186 | Tpl.Text l_numberOfContinuousStates; | ||
| 187 | Tpl.Text l_variableNamingConvention; | ||
| 188 | Util.DateTime ret_7; | ||
| 189 | Tpl.Text l_generationDateAndTime; | ||
| 190 | String ret_5; | ||
| 191 | Tpl.Text l_generationTool; | ||
| 192 | Tpl.Text l_description; | ||
| 193 | Tpl.Text l_modelIdentifier; | ||
| 194 | Tpl.Text l_modelName; | ||
| 195 | Tpl.Text l_fmiVersion; | ||
| 196 | |||
| 197 | case ( txt, | ||
| 198 | (i_simCode as SimCode.SIMCODE(modelInfo = SimCode.MODELINFO(varInfo = SimCode.VARINFO(numStateVars = i_vi_numStateVars), vars = SimCodeVar.SIMVARS(stateVars = i_listStates), name = i_modelInfo_name, description = i_modelInfo_description))), | ||
| 199 | a_guid ) | ||
| 200 | algorithm | ||
| 201 | 2 | l_fmiVersion := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("1.0")); | |
| 202 | 2 | l_modelName := CodegenUtil.dotPath(Tpl.emptyTxt, i_modelInfo_name); | |
| 203 | 2 | l_modelIdentifier := CodegenUtilSimulation.modelNamePrefix(Tpl.emptyTxt, i_simCode); | |
| 204 | 2 | l_description := Tpl.writeStr(Tpl.emptyTxt, i_modelInfo_description); | |
| 205 | 2 | l_generationTool := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("OpenModelica Compiler ")); | |
| 206 | 2 | ret_5 := Settings.getVersionNr(); | |
| 207 | 2 | l_generationTool := Tpl.writeStr(l_generationTool, ret_5); | |
| 208 | 2 | ret_7 := Util.getCurrentDateTime(); | |
| 209 | 2 | l_generationDateAndTime := CodegenFMUCommon.xsdateTime(Tpl.emptyTxt, ret_7); | |
| 210 | 2 | l_variableNamingConvention := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("structured")); | |
| 211 | 2 | ret_10 := intEq(i_vi_numStateVars, 1); | |
| 212 | 2 | l_numberOfContinuousStates := fun_52(Tpl.emptyTxt, ret_10, i_listStates, i_vi_numStateVars); | |
| 213 | 2 | l_numberOfEventIndicators := CodegenFMUCommon.getNumberOfEventIndicators(Tpl.emptyTxt, i_simCode); | |
| 214 | 2 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("fmiVersion=\"")); | |
| 215 | 2 | txt := Tpl.writeText(txt, l_fmiVersion); | |
| 216 | 2 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 217 | "\"\n", | ||
| 218 | "modelName=\"" | ||
| 219 | }, false)); | ||
| 220 | 2 | ret_12 := Util.escapeModelicaStringToXmlString(Tpl.textString(l_modelName)); | |
| 221 | 2 | txt := Tpl.writeStr(txt, ret_12); | |
| 222 | 2 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 223 | "\"\n", | ||
| 224 | "modelIdentifier=\"" | ||
| 225 | }, false)); | ||
| 226 | 2 | ret_13 := Util.escapeModelicaStringToXmlString(Tpl.textString(l_modelIdentifier)); | |
| 227 | 2 | txt := Tpl.writeStr(txt, ret_13); | |
| 228 | 2 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 229 | "\"\n", | ||
| 230 | "guid=\"{" | ||
| 231 | }, false)); | ||
| 232 | 2 | txt := Tpl.writeStr(txt, a_guid); | |
| 233 | 2 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 234 | "}\"\n", | ||
| 235 | "description=\"" | ||
| 236 | }, false)); | ||
| 237 | 2 | ret_14 := Util.escapeModelicaStringToXmlString(Tpl.textString(l_description)); | |
| 238 | 2 | txt := Tpl.writeStr(txt, ret_14); | |
| 239 | 2 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 240 | "\"\n", | ||
| 241 | "generationTool=\"" | ||
| 242 | }, false)); | ||
| 243 | 2 | ret_15 := Util.escapeModelicaStringToXmlString(Tpl.textString(l_generationTool)); | |
| 244 | 2 | txt := Tpl.writeStr(txt, ret_15); | |
| 245 | 2 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 246 | "\"\n", | ||
| 247 | "generationDateAndTime=\"" | ||
| 248 | }, false)); | ||
| 249 | 2 | txt := Tpl.writeText(txt, l_generationDateAndTime); | |
| 250 | 2 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 251 | "\"\n", | ||
| 252 | "variableNamingConvention=\"" | ||
| 253 | }, false)); | ||
| 254 | 2 | txt := Tpl.writeText(txt, l_variableNamingConvention); | |
| 255 | 2 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 256 | "\"\n", | ||
| 257 | "numberOfContinuousStates=\"" | ||
| 258 | }, false)); | ||
| 259 | 2 | txt := Tpl.writeText(txt, l_numberOfContinuousStates); | |
| 260 | 2 | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 261 | "\"\n", | ||
| 262 | "numberOfEventIndicators=\"" | ||
| 263 | }, false)); | ||
| 264 | 2 | txt := Tpl.writeText(txt, l_numberOfEventIndicators); | |
| 265 | 2 | txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"")); | |
| 266 | then txt; | ||
| 267 | |||
| 268 | case ( txt, | ||
| 269 | _, | ||
| 270 | _ ) | ||
| 271 | then txt; | ||
| 272 | end match; | ||
| 273 | end fmiModelDescriptionAttributes; | ||
| 274 | |||
| 275 | annotation(__OpenModelica_Interface="codegen_fmu"); | ||
| 276 | end CodegenFMU1; | ||
| 277 |