Changeset e3518437 in OpenModelica
- Timestamp:
- 2022-05-19T15:04:25+02:00 (2 years ago)
- Parents:
- d0dfb07d
- git-author:
- Per Östlund <perost86@…> (05/19/22 13:45:27)
- git-committer:
- Per Östlund <perost86@…> (05/19/22 15:04:25)
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
OMCompiler/Compiler/BackEnd/VisualXML.mo
r68cae5a re3518437 33 33 " file: VisualXML 34 34 package: VisualXML 35 description: This package gathers all einformation about visualization objects from the MultiBody lib and outputs them as an XML file.36 This can be used additionally tothe result file to visualize the system.35 description: This package gathers all information about visualization objects from the MultiBody lib and outputs them as an XML file. 36 This can be used together with the result file to visualize the system. 37 37 38 38 … … 65 65 //---------------------------- 66 66 67 public uniontype Visualization 67 public 68 uniontype Visualization 68 69 record SHAPE 69 70 DAE.ComponentRef ident; … … 81 82 DAE.Exp specularCoeff; 82 83 end SHAPE; 84 85 record VECTOR 86 DAE.ComponentRef ident; 87 array<list<DAE.Exp>> T; 88 array<DAE.Exp> r; 89 array<DAE.Exp> coordinates; 90 array<DAE.Exp> color; 91 DAE.Exp specularCoeff; 92 DAE.Exp quantity; 93 DAE.Exp headAtOrigin; 94 DAE.Exp twoHeadedArrow; 95 end VECTOR; 83 96 end Visualization; 84 97 … … 87 100 //------------------------- 88 101 89 public function visualizationInfoXML"dumps an xml containing information about visualization objects. 102 public 103 function visualizationInfoXML"dumps an xml containing information about visualization objects. 90 104 author:Waurich TUD 2015-04" 91 105 input BackendDAE.BackendDAE daeIn; … … 99 113 list<BackendDAE.Var> globalKnownVarLst, allVarLst, aliasVarLst; 100 114 list<Visualization> visuals; 101 list< DAE.ComponentRef> allVisuals;115 list<tuple<DAE.ComponentRef, String>> allVisuals; 102 116 algorithm 103 117 BackendDAE.DAE(eqs=eqs0, shared=shared) := daeIn; … … 120 134 //fill theses visualization objects with information 121 135 allVarLst := listAppend(globalKnownVarLst,listAppend(allVarLst,aliasVarLst)); 122 (visuals,_,_):= List.mapFold2(allVisuals, fillVisualizationObjects,allVarLst, program);136 visuals := List.mapFold2(allVisuals, fillVisualizationObjects,allVarLst, program); 123 137 //some expressions refer to other known parameters, get them 124 138 visuals := List.map2(visuals,replaceVisualBinding,globalKnownVars,program); … … 129 143 130 144 //update the variabels 131 (globalKnownVars,_):= BackendVariable.traverseBackendDAEVarsWithUpdate(globalKnownVars, setVisVarsPublic,"");132 (aliasVars,_):= BackendVariable.traverseBackendDAEVarsWithUpdate(aliasVars, setVisVarsPublic,"");145 globalKnownVars := BackendVariable.traverseBackendDAEVarsWithUpdate(globalKnownVars, setVisVarsPublic,""); 146 aliasVars := BackendVariable.traverseBackendDAEVarsWithUpdate(aliasVars, setVisVarsPublic,""); 133 147 daeOut := BackendDAE.DAE(eqs=eqs, shared=shared); 134 148 end visualizationInfoXML; 135 149 136 protected function replaceVisualBinding"Replace the cref binding for the given visualization shapeType with the constant expression of its alias. 137 author: vwaurich 2016-10" 138 input Visualization visIn; 150 protected 151 function replaceVisualBinding 152 "Replace the cref binding for the given visualization shapeType with the constant expression of its alias. 153 author: vwaurich 2016-10" 154 input output Visualization vis; 139 155 input BackendDAE.Variables varArray; 140 156 input Absyn.Program program; 141 output Visualization visOut; 142 algorithm 143 visOut := matchcontinue(visIn,varArray,program) 144 local 145 DAE.ComponentRef cr, ident; 146 DAE.Exp exp, length, width, height, extra, specularCoeff, shapeType; 147 Real rvalue; 157 algorithm 158 () := matchcontinue vis 159 local 160 DAE.ComponentRef cr; 148 161 String s; 149 array<DAE.Exp> color, r, lengthDir, widthDir, r_shape ; 150 array<list<DAE.Exp>> T; 151 case(SHAPE(ident=ident, shapeType=DAE.CREF(componentRef = cr), T=T, r=r, r_shape=r_shape, lengthDir=lengthDir, widthDir=widthDir, 152 length=length, width=width, height=height, extra=extra, color=color, specularCoeff=specularCoeff),_,_) 153 equation 154 DAE.SCONST(string=s) = getConstCrefBinding(cr,varArray); 155 s = getFullCADFilePath(s,program); 156 then (SHAPE(ident, DAE.SCONST(s), T, r, r_shape, lengthDir, widthDir, length, width, height, extra, color, specularCoeff)); 157 case(SHAPE(ident=ident, shapeType=DAE.SCONST(string=s), T=T, r=r, r_shape=r_shape, lengthDir=lengthDir, widthDir=widthDir, 158 length=length, width=width, height=height, extra=extra, color=color, specularCoeff=specularCoeff),_,_) 159 equation 160 s = getFullCADFilePath(s,program); 161 then (SHAPE(ident, DAE.SCONST(s), T, r, r_shape, lengthDir, widthDir, length, width, height, extra, color, specularCoeff)); 162 else 163 then visIn; 162 163 case SHAPE(shapeType = DAE.CREF(componentRef = cr)) 164 algorithm 165 vis.shapeType := getConstCrefBinding(cr, varArray); 166 then 167 (); 168 169 case SHAPE(shapeType = DAE.SCONST(string=s)) 170 algorithm 171 vis.shapeType := DAE.SCONST(getFullCADFilePath(s, program)); 172 then 173 (); 174 175 else (); 164 176 end matchcontinue; 165 177 end replaceVisualBinding; 166 178 167 protected function getConstCrefBinding"Get the const binding for the cref. It has to be somewhere in the vars. 168 author: vwaurich 2016-10" 179 function getConstCrefBinding 180 "Get the const binding for the cref. It has to be somewhere in the vars. 181 author: vwaurich 2016-10" 169 182 input DAE.ComponentRef cr; 170 183 input BackendDAE.Variables vars; … … 178 191 ({var},_) := BackendVariable.getVar(cr,vars); 179 192 e := BackendVariable.varBindExp(var); 180 eOut := matchcontinue(e) 181 case(_) 182 equation 183 true = Expression.isConst(e); 184 then e; 185 case(DAE.CREF(_)) 186 equation 187 then getConstCrefBinding(Expression.expCref(e),vars); 193 eOut := matchcontinue e 194 case _ guard Expression.isConst(e) then e; 195 case DAE.CREF(_) then getConstCrefBinding(Expression.expCref(e),vars); 188 196 /* 189 197 case(DAE.CALL(Absyn.FULLYQUALIFIED(Absyn.QUALIFIED("Modelica",Absyn.QUALIFIED("Utilities",Absyn.QUALIFIED("Files",Absyn.IDENT("fullPathName"))))),{DAE.SCONST(s)},_)) … … 201 209 end getConstCrefBinding; 202 210 203 public function setVisVarsPublic "Sets the VariableAttributes of protected visualization vars to public. 204 author: waurich TUD 08-2016" 211 function setVisVarsPublic 212 "Sets the VariableAttributes of protected visualization vars to public. 213 author: waurich TUD 08-2016" 205 214 input BackendDAE.Var inVar; 206 215 input String dummyArgIn; … … 213 222 end setVisVarsPublic; 214 223 215 protected function makeVarPublicHideResultFalse "Sets the VariableAttributes to public and hideResult to false 216 author: waurich TUD 08-2016" 224 function makeVarPublicHideResultFalse 225 "Sets the VariableAttributes to public and hideResult to false 226 author: waurich TUD 08-2016" 217 227 input BackendDAE.Var inVar; 218 228 output BackendDAE.Var outVar; 219 229 protected 220 230 Option<DAE.VariableAttributes> vals; 221 231 algorithm 222 232 vals := inVar.values; … … 226 236 end makeVarPublicHideResultFalse; 227 237 228 protected function setBindingForProtectedVars "searches for protected vars and sets the binding exp with their equation. 229 This is needed since protected, time-dependent variables are not stored in result files (in OMC and Dymola)" 238 function setBindingForProtectedVars 239 "searches for protected vars and sets the binding exp with their equation. 240 This is needed since protected, time-dependent variables are not stored in result files (in OMC and Dymola)" 230 241 input BackendDAE.EqSystem eqSysIn; 231 242 output BackendDAE.EqSystem eqSysOut; … … 236 247 algorithm 237 248 try 238 BackendDAE.EQSYSTEM(orderedEqs=eqs, orderedVars=vars, matching=BackendDAE.MATCHING(ass1=ass1)) := eqSysIn;239 BackendVariable.traverseBackendDAEVarsWithUpdate(vars, setBindingForProtectedVars1, (1, ass1, eqs));249 BackendDAE.EQSYSTEM(orderedEqs=eqs, orderedVars=vars, matching=BackendDAE.MATCHING(ass1=ass1)) := eqSysIn; 250 BackendVariable.traverseBackendDAEVarsWithUpdate(vars, setBindingForProtectedVars1, (1, ass1, eqs)); 240 251 else 241 252 end try; 253 242 254 eqSysOut := eqSysIn; 243 255 end setBindingForProtectedVars; 244 256 245 protected function setBindingForProtectedVars1 "checks if the var is protected and sets the binding (i.e. the solved equation)" 257 function setBindingForProtectedVars1 258 "checks if the var is protected and sets the binding (i.e. the solved equation)" 246 259 input BackendDAE.Var varIn; 247 260 input tuple<Integer,array<Integer>,BackendDAE.EquationArray> tplIn; … … 249 262 output tuple<Integer,array<Integer>,BackendDAE.EquationArray> tplOut; 250 263 algorithm 251 (varOut, tplOut) := matchcontinue(varIn,tplIn)264 (varOut, tplOut) := matchcontinue (varIn, tplIn) 252 265 local 253 266 Integer idx, eqIdx; … … 257 270 BackendDAE.Var var; 258 271 DAE.Exp exp1, exp2; 259 case(BackendDAE.VAR(bindExp=NONE(), values=SOME(_)),(idx,ass1,eqs)) 260 equation 261 true = (BackendVariable.isProtectedVar(varIn) and isVisualizationVar(varIn)); 262 eq = BackendEquation.get(eqs,arrayGet(ass1,idx)); 263 BackendDAE.EQUATION(exp=exp1, scalar=exp2) = eq; 264 (exp1,_) = ExpressionSolve.solve(exp1,exp2,BackendVariable.varExp(varIn)); 265 var = BackendVariable.setBindExp(varIn,SOME(exp1)); 266 var = makeVarPublicHideResultFalse(var); 267 then (var,(idx+1,ass1,eqs)); 268 case(_,(idx,ass1,eqs)) 272 273 case (BackendDAE.VAR(bindExp=NONE(), values=SOME(_)) , (idx, ass1, eqs)) 274 guard BackendVariable.isProtectedVar(varIn) and isVisualizationVar(varIn) 275 algorithm 276 eq := BackendEquation.get(eqs, arrayGet(ass1, idx)); 277 BackendDAE.EQUATION(exp=exp1, scalar=exp2) := eq; 278 (exp1,_) := ExpressionSolve.solve(exp1, exp2, BackendVariable.varExp(varIn)); 279 var := BackendVariable.setBindExp(varIn, SOME(exp1)); 280 var := makeVarPublicHideResultFalse(var); 281 then 282 (var, (idx+1, ass1, eqs)); 283 284 case (_, (idx, ass1, eqs)) 269 285 equation 270 286 if (BackendVariable.isProtectedVar(varIn) and isVisualizationVar(varIn)) then … … 273 289 var = varIn; 274 290 end if; 275 then (var, (idx+1,ass1,eqs));291 then (var, (idx+1, ass1, eqs)); 276 292 end matchcontinue; 277 293 end setBindingForProtectedVars1; 278 294 279 protected function fillVisualizationObjects"gets the identifier of a visualization object as an input and collects all information from allVars. 280 author:Waurich TUD 2015-04" 281 input DAE.ComponentRef crefIn; 295 function fillVisualizationObjects 296 "gets the identifier of a visualization object as an input and collects all information from allVars. 297 author:Waurich TUD 2015-04" 298 input tuple<DAE.ComponentRef, String> visVar; 282 299 input list<BackendDAE.Var> allVarsIn; 283 300 input Absyn.Program programIn; 284 301 output Visualization visOut; 285 output list<BackendDAE.Var> allVarsOut; 286 output Absyn.Program programOut; 287 algorithm 288 (visOut,allVarsOut,programOut) := matchcontinue(crefIn,allVarsIn,programIn) 289 local 290 String name; 291 list<String> nameChars,prefix; 292 Visualization vis; 293 list<BackendDAE.Var> allVars; 294 case(_,_,_) 295 algorithm 296 //nameChars := stringListStringChar(nameIn); 297 //(prefix,nameChars) := List.split(nameChars,6); 298 //name := stringCharListString(nameChars); 299 //name := Util.stringReplaceChar(name,"$","."); 300 //true := stringEqual(stringCharListString(prefix),"Shape$"); 301 //name := ComponentReference.printComponentRefStr(crefIn); 302 vis := SHAPE(crefIn,DAE.SCONST("DUMMY"),arrayCreate(3,{DAE.RCONST(-1),DAE.RCONST(-1),DAE.RCONST(-1)}), 303 arrayCreate(3,DAE.RCONST(-1)), arrayCreate(3,DAE.RCONST(-1)), arrayCreate(3,DAE.RCONST(-1)),arrayCreate(3,DAE.RCONST(-1)), 304 DAE.RCONST(-1),DAE.RCONST(-1),DAE.RCONST(-1),DAE.RCONST(-1), arrayCreate(3,DAE.RCONST(-1)), DAE.RCONST(-1)); 305 (_,vis) := List.fold2(allVarsIn,fillVisualizationObjects1,true,programIn,({},vis)); 306 then (vis,allVarsIn,programIn); 302 output list<BackendDAE.Var> allVarsOut = allVarsIn; 303 output Absyn.Program programOut = programIn; 304 protected 305 DAE.ComponentRef cref; 306 String name, vis_name; 307 list<String> nameChars,prefix; 308 Visualization vis; 309 list<BackendDAE.Var> allVars; 310 algorithm 311 try 312 //nameChars := stringListStringChar(nameIn); 313 //(prefix,nameChars) := List.split(nameChars,6); 314 //name := stringCharListString(nameChars); 315 //name := Util.stringReplaceChar(name,"$","."); 316 //true := stringEqual(stringCharListString(prefix),"Shape$"); 317 //name := ComponentReference.printComponentRefStr(crefIn); 318 (cref, vis_name) := visVar; 319 vis := newVisualizer(cref, vis_name); 320 (_, visOut) := List.fold2(allVarsIn,fillVisualizationObjects1,true,programIn,({},vis)); 307 321 else 308 algorithm309 322 print("fillVisualizationObjects failed! - not yet supported type"); 310 thenfail();311 end matchcontinue;323 fail(); 324 end try; 312 325 end fillVisualizationObjects; 313 326 314 protected function makeCrefQualFromString"generates a qualified cref from the '.' separated string. 315 author: Waurich TUD 2015-04" 327 function newVisualizer 328 input DAE.ComponentRef cref; 329 input String visualizerName; 330 output Visualization vis; 331 algorithm 332 vis := match visualizerName 333 case "Shape" 334 then SHAPE(cref, 335 DAE.SCONST("DUMMY"), 336 arrayCreate(3, {DAE.RCONST(-1),DAE.RCONST(-1),DAE.RCONST(-1)}), 337 arrayCreate(3, DAE.RCONST(-1)), 338 arrayCreate(3, DAE.RCONST(-1)), 339 arrayCreate(3, DAE.RCONST(-1)), 340 arrayCreate(3, DAE.RCONST(-1)), 341 DAE.RCONST(-1), 342 DAE.RCONST(-1), 343 DAE.RCONST(-1), 344 DAE.RCONST(-1), 345 arrayCreate(3, DAE.RCONST(-1)), 346 DAE.RCONST(-1)); 347 348 case "Vector" 349 then VECTOR(cref, 350 arrayCreate(3, {DAE.RCONST(-1), DAE.RCONST(-1), DAE.RCONST(-1)}), 351 arrayCreate(3, DAE.RCONST(-1)), 352 arrayCreate(3, DAE.RCONST(-1)), 353 arrayCreate(3, DAE.RCONST(-1)), 354 DAE.RCONST(-1), 355 DAE.RCONST(-1), 356 DAE.BCONST(false), 357 DAE.BCONST(false)); 358 359 else 360 algorithm 361 Error.addInternalError(getInstanceName() + " failed on " + 362 visualizerName + "\n", sourceInfo()); 363 then 364 fail(); 365 end match; 366 end newVisualizer; 367 368 function makeCrefQualFromString 369 "generates a qualified cref from the '.' separated string. 370 author: Waurich TUD 2015-04" 316 371 input String s; 317 372 output DAE.ComponentRef crefOut; … … 327 382 end makeCrefQualFromString; 328 383 329 protected function splitCrefAfter"checks if crefCut exists in the crefIn and outputs the appending crefs 330 author:Waurich TUD 2015-04" 384 function splitCrefAfter 385 "checks if crefCut exists in the crefIn and outputs the appending crefs 386 author:Waurich TUD 2015-04" 331 387 input DAE.ComponentRef crefIn; 332 388 input DAE.ComponentRef crefCut; … … 334 390 output Boolean wasCut; 335 391 algorithm 336 (crefOut, wasCut) := matchcontinue(crefIn,crefCut)392 (crefOut, wasCut) := matchcontinue(crefIn, crefCut) 337 393 local 338 394 DAE.ComponentRef crefCut1, crefIn1; 339 case(DAE.CREF_QUAL(componentRef=crefIn1),DAE.CREF_QUAL()) 340 equation 341 // the crefs are not equal, check the next cref in crefIn 342 true = not ComponentReference.crefFirstCrefEqual(crefIn,crefCut); 343 then splitCrefAfter(crefIn1,crefCut); 344 case(DAE.CREF_QUAL(componentRef=crefIn1),DAE.CREF_QUAL(componentRef=crefCut1)) 345 equation 346 // the crefs are equal, continue checking 347 true = ComponentReference.crefFirstCrefEqual(crefIn,crefCut); 348 then splitCrefAfter(crefIn1,crefCut1); 349 case(DAE.CREF_QUAL(componentRef=crefIn1),DAE.CREF_IDENT(_)) 350 equation 351 // the cref has to be cut after this step 352 true = ComponentReference.crefFirstCrefEqual(crefIn,crefCut); 353 then (crefIn1,true); 354 case(DAE.CREF_QUAL(componentRef=crefIn1),DAE.CREF_IDENT(_)) 355 equation 356 // there is no identical cref 357 true = not ComponentReference.crefFirstCrefEqual(crefIn,crefCut); 358 then (crefIn1,false); 359 else 360 then (crefCut,false); 395 396 case(DAE.CREF_QUAL(componentRef=crefIn1),DAE.CREF_QUAL()) 397 algorithm 398 // the crefs are not equal, check the next cref in crefIn 399 true := not ComponentReference.crefFirstCrefEqual(crefIn,crefCut); 400 then 401 splitCrefAfter(crefIn1,crefCut); 402 403 case(DAE.CREF_QUAL(componentRef=crefIn1),DAE.CREF_QUAL(componentRef=crefCut1)) 404 algorithm 405 // the crefs are equal, continue checking 406 true := ComponentReference.crefFirstCrefEqual(crefIn,crefCut); 407 then 408 splitCrefAfter(crefIn1,crefCut1); 409 410 case(DAE.CREF_QUAL(componentRef=crefIn1),DAE.CREF_IDENT(_)) 411 algorithm 412 // the cref has to be cut after this step 413 true := ComponentReference.crefFirstCrefEqual(crefIn,crefCut); 414 then 415 (crefIn1, true); 416 417 case(DAE.CREF_QUAL(componentRef=crefIn1),DAE.CREF_IDENT(_)) 418 algorithm 419 // there is no identical cref 420 true := not ComponentReference.crefFirstCrefEqual(crefIn,crefCut); 421 then 422 (crefIn1, false); 423 424 else (crefCut, false); 361 425 end matchcontinue; 362 426 end splitCrefAfter; 363 427 364 protected function fillVisualizationObjects1"checks if a variable belongs to a certain visualization var. if true, add information to the visualization object 365 author:Waurich TUD 2015-04" 428 function fillVisualizationObjects1 429 "checks if a variable belongs to a certain visualization var. if true, add information to the visualization object 430 author:Waurich TUD 2015-04" 366 431 input BackendDAE.Var varIn; //check this var 367 432 input Boolean storeProtectedCrefs; // if you want to store the protected crefs instead of the bidning expression … … 370 435 output tuple<list<BackendDAE.Var>,Visualization> tplOut; 371 436 algorithm 372 tplOut := matchcontinue(varIn, storeProtectedCrefs,tplIn)437 tplOut := matchcontinue(varIn, tplIn) 373 438 local 374 439 String compIdent; 375 440 list<BackendDAE.Var> vars; 376 441 DAE.ComponentRef cref,crefIdent,cref1,ident; 377 Visualization vis; 378 case(BackendDAE.VAR(varName=cref),_,(vars, vis as SHAPE(ident=ident))) 379 algorithm 380 //this var belongs to the visualization object 381 //crefIdent := makeCrefQualFromString(ident); // make a qualified cref out of the shape ident 382 (cref1,true) := splitCrefAfter(cref,ident); // check if this occures in the qualified var cref 383 vis := fillShapeObject(cref1,varIn,storeProtectedCrefs,program,vis); 384 then (vars, vis); 385 else 386 algorithm 387 (vars,vis) := tplIn; 388 then (varIn::vars, vis); 442 Visualization vis, filled_vis; 443 444 case (BackendDAE.VAR(varName=cref), (vars, vis as SHAPE(ident=ident))) 445 algorithm 446 //this var belongs to the visualization object 447 //crefIdent := makeCrefQualFromString(ident); // make a qualified cref out of the shape ident 448 (cref1,true) := splitCrefAfter(cref,ident); // check if this occures in the qualified var cref 449 filled_vis := fillShapeObject(cref1,varIn,storeProtectedCrefs,program,vis); 450 then 451 (vars, filled_vis); 452 453 case (BackendDAE.VAR(varName=cref), (vars, vis as VECTOR(ident=ident))) 454 algorithm 455 //this var belongs to the visualization object 456 //crefIdent := makeCrefQualFromString(ident); // make a qualified cref out of the shape ident 457 (cref1,true) := splitCrefAfter(cref,ident); // check if this occures in the qualified var cref 458 filled_vis := fillVectorObject(cref1,varIn,storeProtectedCrefs,program,vis); 459 then 460 (vars, filled_vis); 461 462 else 463 algorithm 464 (vars, vis) := tplIn; 465 then 466 (varIn::vars, vis); 467 389 468 end matchcontinue; 390 469 end fillVisualizationObjects1; 391 470 392 protected function getFullCADFilePath "Get the absolute path for the given modelica uri. 393 author: vwaurich TUD 2016-10" 471 function getFullCADFilePath 472 "Get the absolute path for the given modelica uri. 473 author: vwaurich TUD 2016-10" 394 474 input String sIn; 395 475 input Absyn.Program program; … … 405 485 end getFullCADFilePath; 406 486 407 protected function fillShapeObject"sets the visualization info in the visualization object 408 author:Waurich TUD 2015-04" 487 function fillShapeObject 488 "sets the visualization info in the visualization object 489 author:Waurich TUD 2015-04" 409 490 input DAE.ComponentRef cref; 410 491 input BackendDAE.Var var; 411 492 input Boolean storeProtectedCrefs; 412 493 input Absyn.Program program; 413 input Visualization visIn; 414 output Visualization visOut; 415 algorithm 416 visOut := matchcontinue(cref,var,storeProtectedCrefs,program,visIn) 494 input output Visualization vis; 495 algorithm 496 () := matchcontinue (cref, vis) 417 497 local 418 498 Option<DAE.Exp> bind; 419 DAE.ComponentRef ident; 420 DAE.Exp exp, length, width, height, extra, specularCoeff, shapeType; 421 Integer ivalue, pos, pos1; 422 Real rvalue; 423 array<DAE.Exp> color, r, lengthDir, widthDir, r_shape ; 499 DAE.Exp exp; 500 Integer pos, pos1; 424 501 list<DAE.Exp> T0; 425 array<list<DAE.Exp>> T; 426 427 case(DAE.CREF_IDENT(ident="shapeType"),BackendDAE.VAR(bindExp=SOME(exp)),_ ,_ , SHAPE(ident=ident, shapeType=shapeType, T=T, r=r, r_shape=r_shape, lengthDir=lengthDir, widthDir=widthDir, length=length, width=width, height=height, extra=extra, color=color, specularCoeff=specularCoeff)) 428 algorithm 429 then (SHAPE(ident, exp, T, r, r_shape, lengthDir, widthDir, length, width, height, extra, color, specularCoeff)); 430 431 case(DAE.CREF_QUAL(ident="R",componentRef=DAE.CREF_IDENT(ident="T", subscriptLst = {DAE.INDEX(DAE.ICONST(pos)),DAE.INDEX(DAE.ICONST(pos1))})),BackendDAE.VAR(bindExp=bind),_ ,_ , SHAPE(ident=ident, shapeType=shapeType, T=T, r=r, r_shape=r_shape, lengthDir=lengthDir, widthDir=widthDir, length=length, width=width, height=height, extra=extra, color=color, specularCoeff=specularCoeff)) 432 algorithm 433 if isSome(bind) then 434 exp := if not Expression.isConstValue(Util.getOption(bind)) and storeProtectedCrefs then BackendVariable.varExp(var) else Util.getOption(bind); 435 else exp := BackendVariable.varExp(var); 436 end if; 437 T0 := arrayGet(T,pos); 438 T0 := List.replaceAt(exp,pos1,T0); 439 T := arrayUpdate(T,pos,T0); 440 then (SHAPE(ident, shapeType, T, r, r_shape, lengthDir, widthDir, length, width, height, extra, color, specularCoeff)); 441 442 case(DAE.CREF_IDENT(ident="r", subscriptLst = {DAE.INDEX(DAE.ICONST(pos))}),BackendDAE.VAR(bindExp=bind), _ ,_ , SHAPE(ident=ident, shapeType=shapeType, T=T, r=r, r_shape=r_shape, lengthDir=lengthDir, widthDir=widthDir, length=length, width=width, height=height, extra=extra, color=color, specularCoeff=specularCoeff)) 443 algorithm 444 if isSome(bind) then 445 exp := if not Expression.isConstValue(Util.getOption(bind)) and storeProtectedCrefs then BackendVariable.varExp(var) else Util.getOption(bind); 446 else exp := BackendVariable.varExp(var); 447 end if; 448 r := arrayUpdate(r,pos,exp); 449 then (SHAPE(ident, shapeType, T, r, r_shape, lengthDir, widthDir, length, width, height, extra, color, specularCoeff)); 450 451 case(DAE.CREF_IDENT(ident="r_shape", subscriptLst = {DAE.INDEX(DAE.ICONST(pos))}),BackendDAE.VAR(bindExp=bind), _ ,_ , SHAPE(ident=ident, shapeType=shapeType, T=T, r=r, r_shape=r_shape, lengthDir=lengthDir, widthDir=widthDir, length=length, width=width, height=height, extra=extra, color=color, specularCoeff=specularCoeff)) 452 algorithm 453 if isSome(bind) then 454 exp := if not Expression.isConstValue(Util.getOption(bind)) and storeProtectedCrefs then BackendVariable.varExp(var) else Util.getOption(bind); 455 else exp := BackendVariable.varExp(var); 456 end if; 457 r_shape := arrayUpdate(r_shape,pos,exp); 458 then (SHAPE(ident, shapeType, T, r, r_shape, lengthDir, widthDir, length, width, height, extra, color, specularCoeff)); 459 460 case(DAE.CREF_IDENT(ident="lengthDirection", subscriptLst = {DAE.INDEX(DAE.ICONST(pos))}),BackendDAE.VAR(bindExp=bind), _ ,_ , SHAPE(ident=ident, shapeType=shapeType, T=T, r=r, r_shape=r_shape, lengthDir=lengthDir, widthDir=widthDir, length=length, width=width, height=height, extra=extra, color=color, specularCoeff=specularCoeff)) 461 algorithm 462 if isSome(bind) then 463 exp := if not Expression.isConstValue(Util.getOption(bind)) and storeProtectedCrefs then BackendVariable.varExp(var) else Util.getOption(bind); 464 else exp := BackendVariable.varExp(var); 465 end if; 466 lengthDir := arrayUpdate(lengthDir,pos,exp); 467 then (SHAPE(ident, shapeType, T, r, r_shape, lengthDir, widthDir, length, width, height, extra, color, specularCoeff)); 468 469 case(DAE.CREF_IDENT(ident="widthDirection", subscriptLst = {DAE.INDEX(DAE.ICONST(pos))}),BackendDAE.VAR(bindExp=bind), _ ,_ , SHAPE(ident=ident, shapeType=shapeType, T=T, r=r, r_shape=r_shape, lengthDir=lengthDir, widthDir=widthDir, length=length, width=width, height=height, extra=extra, color=color, specularCoeff=specularCoeff)) 470 algorithm 471 if isSome(bind) then 472 exp := if not Expression.isConstValue(Util.getOption(bind)) and storeProtectedCrefs then BackendVariable.varExp(var) else Util.getOption(bind); 473 else exp := BackendVariable.varExp(var); 474 end if; 475 widthDir := arrayUpdate(widthDir,pos,exp); 476 then (SHAPE(ident, shapeType, T, r, r_shape, lengthDir, widthDir, length, width, height, extra, color, specularCoeff)); 477 478 case(DAE.CREF_IDENT(ident="length"),BackendDAE.VAR(bindExp=bind), _ ,_ , SHAPE(ident=ident, shapeType=shapeType, T=T, r=r, r_shape=r_shape, lengthDir=lengthDir, widthDir=widthDir, length=length, width=width, height=height, extra=extra, color=color, specularCoeff=specularCoeff)) 479 algorithm 480 if isSome(bind) then 481 exp := if not Expression.isConstValue(Util.getOption(bind)) and storeProtectedCrefs then BackendVariable.varExp(var) else Util.getOption(bind); 482 else exp := BackendVariable.varExp(var); 483 end if; 484 then (SHAPE(ident, shapeType, T, r, r_shape, lengthDir, widthDir, exp, width, height, extra, color, specularCoeff)); 485 486 case(DAE.CREF_IDENT(ident="width"),BackendDAE.VAR(bindExp=bind), _ ,_ , SHAPE(ident=ident, shapeType=shapeType, T=T, r=r, r_shape=r_shape, lengthDir=lengthDir, widthDir=widthDir, length=length, width=width, height=height, extra=extra, color=color, specularCoeff=specularCoeff)) 487 algorithm 488 if isSome(bind) then 489 exp := if not Expression.isConstValue(Util.getOption(bind)) and storeProtectedCrefs then BackendVariable.varExp(var) else Util.getOption(bind); 490 else exp := BackendVariable.varExp(var); 491 end if; 492 then (SHAPE(ident, shapeType, T, r, r_shape, lengthDir, widthDir, length, exp, height, extra, color, specularCoeff)); 493 494 case(DAE.CREF_IDENT(ident="height"),BackendDAE.VAR(bindExp=bind), _ ,_ , SHAPE(ident=ident, shapeType=shapeType, T=T, r=r, r_shape=r_shape, lengthDir=lengthDir, widthDir=widthDir, length=length, width=width, height=height, extra=extra, color=color, specularCoeff=specularCoeff)) 495 algorithm 496 if isSome(bind) then 497 exp := if not Expression.isConstValue(Util.getOption(bind)) and storeProtectedCrefs then BackendVariable.varExp(var) else Util.getOption(bind); 498 else exp := BackendVariable.varExp(var); 499 end if; 500 then (SHAPE(ident, shapeType, T, r, r_shape, lengthDir, widthDir, length, width, exp, extra, color, specularCoeff)); 501 502 case(DAE.CREF_IDENT(ident="extra"),BackendDAE.VAR(bindExp=bind), _ ,_ , SHAPE(ident=ident, shapeType=shapeType, T=T, r=r, r_shape=r_shape, lengthDir=lengthDir, widthDir=widthDir, length=length, width=width, height=height, extra=extra, color=color, specularCoeff=specularCoeff)) 503 algorithm 504 if isSome(bind) then 505 exp := if not Expression.isConstValue(Util.getOption(bind)) and storeProtectedCrefs then BackendVariable.varExp(var) else Util.getOption(bind); 506 else exp := BackendVariable.varExp(var); 507 end if; 508 then (SHAPE(ident, shapeType, T, r, r_shape, lengthDir, widthDir, length, width, height, exp, color, specularCoeff)); 509 510 case(DAE.CREF_IDENT(ident="color", subscriptLst = {DAE.INDEX(DAE.ICONST(pos))}),BackendDAE.VAR(bindExp=bind), _ ,_ , SHAPE(ident=ident, shapeType=shapeType, T=T, r=r, r_shape=r_shape, lengthDir=lengthDir, widthDir=widthDir, length=length, width=width, height=height, extra=extra, color=color, specularCoeff=specularCoeff)) 511 algorithm 512 if isSome(bind) then 513 exp := if not Expression.isConstValue(Util.getOption(bind)) and storeProtectedCrefs then BackendVariable.varExp(var) else Util.getOption(bind); 514 else exp := BackendVariable.varExp(var); 515 end if; 516 color := arrayUpdate(color,pos,exp); 517 then (SHAPE(ident, shapeType, T, r, r_shape, lengthDir, widthDir, length, width, height, extra, color, specularCoeff)); 518 519 case(DAE.CREF_IDENT(ident="specularCoefficient"),BackendDAE.VAR(bindExp=bind), _ ,_ , SHAPE(ident=ident, shapeType=shapeType, T=T, r=r, r_shape=r_shape, lengthDir=lengthDir, widthDir=widthDir, length=length, width=width, height=height, extra=extra, color=color)) 520 algorithm 521 if isSome(bind) then 522 exp := if not Expression.isConstValue(Util.getOption(bind)) and storeProtectedCrefs then BackendVariable.varExp(var) else Util.getOption(bind); 523 else exp := BackendVariable.varExp(var); 524 end if; 525 then (SHAPE(ident, shapeType, T, r, r_shape, lengthDir, widthDir, length, width, height, extra, color, exp)); 526 527 else visIn; 502 503 case (DAE.CREF_IDENT(ident="shapeType"), SHAPE()) 504 algorithm 505 BackendDAE.VAR(bindExp = bind) := var; 506 507 if isSome(bind) then 508 vis.shapeType := Util.getOption(bind); 509 end if; 510 then 511 (); 512 513 case (DAE.CREF_QUAL(ident="R", componentRef=DAE.CREF_IDENT(ident="T", 514 subscriptLst = {DAE.INDEX(DAE.ICONST(pos)), DAE.INDEX(DAE.ICONST(pos1))})), SHAPE()) 515 algorithm 516 exp := getVariableBinding(var, storeProtectedCrefs); 517 T0 := arrayGet(vis.T, pos); 518 T0 := List.replaceAt(exp, pos1, T0); 519 arrayUpdate(vis.T, pos, T0); 520 then 521 (); 522 523 case (DAE.CREF_IDENT(ident="r", subscriptLst = {DAE.INDEX(DAE.ICONST(pos))}), SHAPE()) 524 algorithm 525 exp := getVariableBinding(var, storeProtectedCrefs); 526 arrayUpdate(vis.r, pos, exp); 527 then 528 (); 529 530 case (DAE.CREF_IDENT(ident="r_shape", subscriptLst = {DAE.INDEX(DAE.ICONST(pos))}), SHAPE()) 531 algorithm 532 exp := getVariableBinding(var, storeProtectedCrefs); 533 arrayUpdate(vis.r_shape, pos, exp); 534 then 535 (); 536 537 case (DAE.CREF_IDENT(ident="lengthDirection", subscriptLst = {DAE.INDEX(DAE.ICONST(pos))}), SHAPE()) 538 algorithm 539 exp := getVariableBinding(var, storeProtectedCrefs); 540 arrayUpdate(vis.lengthDir, pos, exp); 541 then 542 (); 543 544 case (DAE.CREF_IDENT(ident="widthDirection", subscriptLst = {DAE.INDEX(DAE.ICONST(pos))}), SHAPE()) 545 algorithm 546 exp := getVariableBinding(var, storeProtectedCrefs); 547 arrayUpdate(vis.widthDir, pos, exp); 548 then 549 (); 550 551 case (DAE.CREF_IDENT(ident="length"), SHAPE()) 552 algorithm 553 vis.length := getVariableBinding(var, storeProtectedCrefs); 554 then 555 (); 556 557 case (DAE.CREF_IDENT(ident="width"), SHAPE()) 558 algorithm 559 vis.width := getVariableBinding(var, storeProtectedCrefs); 560 then 561 (); 562 563 case (DAE.CREF_IDENT(ident="height"), SHAPE()) 564 algorithm 565 vis.height := getVariableBinding(var, storeProtectedCrefs); 566 then 567 (); 568 569 case (DAE.CREF_IDENT(ident="extra"), SHAPE()) 570 algorithm 571 vis.extra := getVariableBinding(var, storeProtectedCrefs); 572 then 573 (); 574 575 case (DAE.CREF_IDENT(ident="color", subscriptLst = {DAE.INDEX(DAE.ICONST(pos))}), SHAPE()) 576 algorithm 577 exp := getVariableBinding(var, storeProtectedCrefs); 578 arrayUpdate(vis.color, pos, exp); 579 then 580 (); 581 582 case (DAE.CREF_IDENT(ident="specularCoefficient"), SHAPE()) 583 algorithm 584 vis.specularCoeff := getVariableBinding(var, storeProtectedCrefs); 585 then 586 (); 587 588 else (); 528 589 end matchcontinue; 529 590 end fillShapeObject; 530 591 531 protected function printVisualization"printing function for debugging. 532 author:Waurich TUD 2015-04" 592 function fillVectorObject 593 "sets the visualization info in the visualization object 594 author:Waurich TUD 2015-04" 595 input DAE.ComponentRef cref; 596 input BackendDAE.Var var; 597 input Boolean storeProtectedCrefs; 598 input Absyn.Program program; 599 input output Visualization vis; 600 algorithm 601 () := matchcontinue (cref, vis) 602 local 603 Option<DAE.Exp> bind; 604 DAE.Exp exp; 605 Integer pos, pos1; 606 list<DAE.Exp> T0; 607 608 case (DAE.CREF_QUAL(ident="R", componentRef=DAE.CREF_IDENT(ident="T", 609 subscriptLst = {DAE.INDEX(DAE.ICONST(pos)), DAE.INDEX(DAE.ICONST(pos1))})), VECTOR()) 610 algorithm 611 exp := getVariableBinding(var, storeProtectedCrefs); 612 T0 := arrayGet(vis.T, pos); 613 T0 := List.replaceAt(exp, pos1, T0); 614 arrayUpdate(vis.T, pos, T0); 615 then 616 (); 617 618 case (DAE.CREF_IDENT(ident="r", subscriptLst = {DAE.INDEX(DAE.ICONST(pos))}), VECTOR()) 619 algorithm 620 exp := getVariableBinding(var, storeProtectedCrefs); 621 arrayUpdate(vis.r, pos, exp); 622 then 623 (); 624 625 case (DAE.CREF_IDENT(ident="coordinates", subscriptLst = {DAE.INDEX(DAE.ICONST(pos))}), VECTOR()) 626 algorithm 627 exp := getVariableBinding(var, storeProtectedCrefs); 628 arrayUpdate(vis.coordinates, pos, exp); 629 then 630 (); 631 632 case (DAE.CREF_IDENT(ident="color", subscriptLst = {DAE.INDEX(DAE.ICONST(pos))}), VECTOR()) 633 algorithm 634 exp := getVariableBinding(var, storeProtectedCrefs); 635 arrayUpdate(vis.color, pos, exp); 636 then 637 (); 638 639 case (DAE.CREF_IDENT(ident="specularCoefficient"), VECTOR()) 640 algorithm 641 vis.specularCoeff := getVariableBinding(var, storeProtectedCrefs); 642 then 643 (); 644 645 case (DAE.CREF_IDENT(ident="quantity"), VECTOR()) 646 algorithm 647 vis.quantity := getVariableBinding(var, storeProtectedCrefs); 648 then 649 (); 650 651 case (DAE.CREF_IDENT(ident="headAtOrigin"), VECTOR()) 652 algorithm 653 vis.headAtOrigin := getVariableBinding(var, storeProtectedCrefs); 654 then 655 (); 656 657 case (DAE.CREF_IDENT(ident="twoHeadedArrow"), VECTOR()) 658 algorithm 659 vis.twoHeadedArrow := getVariableBinding(var, storeProtectedCrefs); 660 then 661 (); 662 663 else (); 664 end matchcontinue; 665 end fillVectorObject; 666 667 function getVariableBinding 668 input BackendDAE.Var var; 669 input Boolean storeProtectedCrefs; 670 output DAE.Exp exp; 671 protected 672 Option<DAE.Exp> binding; 673 algorithm 674 BackendDAE.VAR(bindExp = binding) := var; 675 676 if isSome(binding) then 677 SOME(exp) := binding; 678 679 if not Expression.isConstValue(exp) and storeProtectedCrefs then 680 exp := BackendVariable.varExp(var); 681 end if; 682 else 683 exp := BackendVariable.varExp(var); 684 end if; 685 end getVariableBinding; 686 687 function printVisualization 688 "printing function for debugging. 689 author:Waurich TUD 2015-04" 533 690 input Visualization vis; 534 691 output String s; … … 550 707 end printVisualization; 551 708 552 protected function isVisualizationVar"the var inherits from an visualization object. Therefore, the paths are checked. 553 author:Waurich TUD 2015-04" 709 function isVisualizationVar 710 "the var inherits from an visualization object. Therefore, the paths are checked. 711 author:Waurich TUD 2015-04" 554 712 input BackendDAE.Var var; 555 713 output Boolean isVisVar; 556 714 algorithm 557 isVisVar := matchcontinue(var) 558 local 559 Boolean b; 560 DAE.ElementSource source; 561 String obj; 562 list<Absyn.Path> paths; 563 list<String> paths_lst; 564 case(BackendDAE.VAR(source=source)) 565 algorithm 566 paths := ElementSource.getElementSourceTypes(source); 567 //_ := list(AbsynUtil.pathString(p) for p in paths); 568 //print("paths_lst "+stringDelimitList(paths_lst, "; ")+"\n"); 569 (obj,_) := hasVisPath(paths,1); 570 then Util.stringNotEqual(obj,""); 571 else 572 then false; 715 isVisVar := matchcontinue var 716 local 717 Boolean b; 718 DAE.ElementSource source; 719 String obj; 720 list<Absyn.Path> paths; 721 list<String> paths_lst; 722 723 case BackendDAE.VAR(source=source) 724 algorithm 725 paths := ElementSource.getElementSourceTypes(source); 726 //_ := list(AbsynUtil.pathString(p) for p in paths); 727 //print("paths_lst "+stringDelimitList(paths_lst, "; ")+"\n"); 728 obj := hasVisPath(paths, 1); 729 then 730 Util.stringNotEqual(obj, ""); 731 732 else false; 573 733 end matchcontinue; 574 734 end isVisualizationVar; 575 735 576 577 protected function isVisualizationVarFold"the var inherits from an visualization object. Therefore, the paths are checked.578 author:Waurich TUD 2015-04"736 function isVisualizationVarFold 737 "the var inherits from an visualization object. Therefore, the paths are checked. 738 author:Waurich TUD 2015-04" 579 739 input BackendDAE.Var var; 580 input tuple<list<BackendDAE.Var>,list< DAE.ComponentRef>> tplIn;//visualizationVars, visualization Identifiers581 output tuple<list<BackendDAE.Var>,list< DAE.ComponentRef>> tplOut;740 input tuple<list<BackendDAE.Var>,list<tuple<DAE.ComponentRef, String>>> tplIn;//visualizationVars, visualization Identifiers 741 output tuple<list<BackendDAE.Var>,list<tuple<DAE.ComponentRef, String>>> tplOut; 582 742 algorithm 583 743 tplOut := matchcontinue(var,tplIn) … … 585 745 Integer idx; 586 746 DAE.ComponentRef varName, cref; 587 list< DAE.ComponentRef> crefs;747 list<tuple<DAE.ComponentRef, String>> crefs; 588 748 DAE.ElementSource source; 589 749 list<BackendDAE.Var> varLst; … … 591 751 list<Absyn.Path> paths; 592 752 593 case (BackendDAE.VAR(varName=varName, 753 case (BackendDAE.VAR(varName=varName, source=source), (varLst,crefs)) 594 754 algorithm 595 755 paths := ElementSource.getElementSourceTypes(source); 596 756 //print("Component " + ComponentReference.printComponentRefStr(varName) + ":\n"); 597 757 //print(List.toString(paths, AbsynUtil.pathStringDefault, "", " ", "\n ", "", false) + "\n"); 598 (obj, idx) := hasVisPath(paths,1);599 true := Util.stringNotEqual(obj, "");758 (obj, idx) := hasVisPath(paths, 1); 759 true := Util.stringNotEqual(obj, ""); 600 760 //print("ComponentRef "+ComponentReference.printComponentRefStr(varName)+" path: "+obj+ " idx: "+intString(idx)+"\n"); 601 cref := ComponentReference.firstNCrefs(varName, idx-1);602 crefs := List.unique( cref::crefs);761 cref := ComponentReference.firstNCrefs(varName, idx-1); 762 crefs := List.unique((cref, obj)::crefs); 603 763 then 604 764 (var::varLst, crefs); … … 608 768 end isVisualizationVarFold; 609 769 610 protected function hasVisPath"checks if the path is Modelica.Mechanics.MultiBody.Visualizers.Advanced.* and outputs * if true. outputs which path is the vis path 611 author:Waurich TUD 2015-04" 770 function hasVisPath 771 "checks if the path is Modelica.Mechanics.MultiBody.Visualizers.Advanced.* and 772 outputs * if true. outputs which path is the vis path 773 author:Waurich TUD 2015-04" 612 774 input list<Absyn.Path> pathsIn; 613 775 input Integer numIn; … … 615 777 output Integer numOut; 616 778 algorithm 617 (visPath, numOut) := matchcontinue(pathsIn,numIn)779 (visPath, numOut) := matchcontinue pathsIn 618 780 local 619 781 String name, shapeIdent; … … 622 784 Absyn.Path path; 623 785 list<Absyn.Path> rest; 624 case({},_) 625 then ("",-1); 626 case(Absyn.FULLYQUALIFIED(path=path)::rest,_) 627 algorithm 628 (name,num) := hasVisPath(path::rest,numIn); 629 then (name,num); 630 case(Absyn.QUALIFIED(name="Modelica",path=Absyn.QUALIFIED(name="Mechanics",path=Absyn.QUALIFIED(name="MultiBody",path=Absyn.QUALIFIED(name="Visualizers",path=Absyn.QUALIFIED(name="Advanced",path=Absyn.IDENT(name=name))))))::_,_) 631 algorithm 632 shapeIdent := substring(name, 1, 5); 633 true := stringEqual(shapeIdent,"Shape"); 634 then (name,numIn); 635 case(_::rest,_) 636 algorithm 637 (name,num) := hasVisPath(rest,numIn+1); 638 then (name,num); 786 787 case {} then ("", -1); 788 case Absyn.FULLYQUALIFIED(path=path)::rest then hasVisPath(path::rest, numIn); 789 790 case Absyn.QUALIFIED(name="Modelica", 791 path=Absyn.QUALIFIED(name="Mechanics", 792 path=Absyn.QUALIFIED(name="MultiBody", 793 path=Absyn.QUALIFIED(name="Visualizers", 794 path=Absyn.QUALIFIED(name="Advanced", 795 path=Absyn.IDENT(name=name))))))::_ 796 algorithm 797 true := listMember(name, {"Shape", "Vector"}); 798 then 799 (name, numIn); 800 801 case _::rest then hasVisPath(rest,numIn+1); 639 802 end matchcontinue; 640 803 end hasVisPath; 641 804 642 643 public function dumpVis"author: waurich TUD644 Dumps the graph into a *.xml-file."805 function dumpVis 806 "author: waurich TUD 807 Dumps the graph into a *.xml-file." 645 808 input array<Visualization> visIn; 646 809 input String iFileName; -
OMCompiler/Compiler/Template/VisualXMLTpl.tpl
r83be5f2b re3518437 47 47 <ident><%ComponentReference.printComponentRefStr(ident)%></ident> 48 48 <type><%svalue%></type> 49 <T><%TDump%></T> 50 <r><%rDump%></r> 51 <r_shape><%r_shapeDump%></r_shape> 52 <lengthDir><%lDirDump%></lengthDir> 53 <widthDir><%wDirDump%></widthDir> 49 <T> 50 <%TDump%> 51 </T> 52 <r> 53 <%rDump%> 54 </r> 55 <r_shape> 56 <%r_shapeDump%> 57 </r_shape> 58 <lengthDir> 59 <%lDirDump%> 60 </lengthDir> 61 <widthDir> 62 <%wDirDump%> 63 </widthDir> 54 64 <length><%dumpExp(length)%></length> 55 65 <width><%dumpExp(width)%></width> 56 66 <height><%dumpExp(height)%></height> 57 67 <extra><%dumpExp(extra)%></extra> 58 <color><%colorDump%></color> 68 <color> 69 <%colorDump%> 70 </color> 59 71 <specCoeff><%dumpExp(specularCoeff)%></specCoeff> 60 72 </shape> 61 73 >> 74 75 case vis as VECTOR() then 76 let TDump = arrayList(T) |> T0 => << 77 <%dumpVecExp(T0)%> 78 >> ; separator="\n" 79 let rDump = dumpVecExp(arrayList(r)) 80 let coordDump = dumpVecExp(arrayList(coordinates)) 81 let colorDump = dumpVecExp(arrayList(color)) 82 << 83 <vector> 84 <ident><%ComponentReference.printComponentRefStr(ident)%></ident> 85 <T> 86 <%TDump%> 87 </T> 88 <r> 89 <%rDump%> 90 </r> 91 <coordinates> 92 <%coordDump%> 93 </coordinates> 94 <color> 95 <%colorDump%> 96 </color> 97 <specCoeff><%dumpExp(specularCoeff)%></specCoeff> 98 <quantity><%dumpExp(quantity)%></quantity> 99 <headAtOrigin><%dumpExp(headAtOrigin)%></headAtOrigin> 100 <twoHeadedArrow><%dumpExp(twoHeadedArrow)%></twoHeadedArrow> 101 </vector> 102 >> 103 62 104 end match 63 105 end dumpVisualization; … … 75 117 case expIn as BCONST(__) then 76 118 << 77 119 <bexp><%ExpressionDump.printExpStr(expIn)%></bexp> 78 120 >> 79 121 case expIn as CREF(__) then 80 122 << 81 123 <cref><%ExpressionDump.printExpStr(expIn)%></cref> 82 124 >> 83 125 case expIn as BINARY(__) then … … 130 172 else 131 173 << 132 174 <exp><%ExpressionDump.printExpStr(expIn)%></exp> 133 175 >> 134 176 end match -
OMCompiler/Compiler/Template/VisualXMLTplTV.mo
r9405381f re3518437 160 160 DAE.Exp specularCoeff; 161 161 end SHAPE; 162 163 record VECTOR 164 DAE.ComponentRef ident; 165 array<list<DAE.Exp>> T; 166 array<DAE.Exp> r; 167 array<DAE.Exp> coordinates; 168 array<DAE.Exp> color; 169 DAE.Exp specularCoeff; 170 DAE.Exp quantity; 171 DAE.Exp headAtOrigin; 172 DAE.Exp twoHeadedArrow; 173 end VECTOR; 162 174 end Visualization; 163 175 end VisualXML; -
testsuite/Makefile
r4cb8721 re3518437 43 43 device.log \ 44 44 ffi.log \ 45 conversion.log 45 conversion.log \ 46 visualization.log \ 46 47 47 48 SIMULATIONLOGS = \ … … 645 646 $(MAKE) -C openmodelica/conversion -f Makefile test > $@ 646 647 @echo $@ done 648 visualization.log: omc-diff 649 $(MAKE) -C openmodelica/visualization -f Makefile test > $@ 650 @echo $@ done 647 651 648 652 failingtest: omc-diff
Note: See TracChangeset
for help on using the changeset viewer.