Changeset 29797a1 in OpenModelica
- Timestamp:
- 2021-04-08T11:44:41+02:00 (3 years ago)
- Children:
- defe92d3
- Parents:
- 7d6513e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
OMCompiler/Compiler/SimCode/SimCodeUtil.mo
r7d6513e r29797a1 867 867 (_, _, equations, _, ouniqueEqIndex, clockedVars, oeqSccMapping, oeqBackendSimCodeMapping, oBackendMapping) := 868 868 createEquationsForSystem(stateeqnsmark, zceqnsmarks, syst, inShared, comps, ouniqueEqIndex, {}, 869 sccOffset, oeqSccMapping, oeqBackendSimCodeMapping, oBackendMapping, true);869 sccOffset, oeqSccMapping, oeqBackendSimCodeMapping, oBackendMapping, OutputSystems.Both, true); 870 870 sccOffset := listLength(comps) + sccOffset; 871 871 //otempvars := listAppend(clockedVars, otempvars); … … 1438 1438 // ============================================================================= 1439 1439 1440 protected type OutputSystems = enumeration(States, NonStates, Both); 1440 1441 1441 1442 protected type CreateEquationsForSystemsFold = … … 1450 1451 SimCode.BackendMapping /*backendSimCodeMapping*/, 1451 1452 Integer /*sccOffset*/>; 1452 protected type CreateEquationsForSystemsArg = tuple<BackendDAE.Shared, list<BackendDAE.ZeroCrossing>, Boolean>;1453 protected type CreateEquationsForSystemsArg = tuple<BackendDAE.Shared, list<BackendDAE.ZeroCrossing>, OutputSystems, Boolean>; 1453 1454 1454 1455 protected function createEquationsForSystems "Some kind of comments would be very helpful!" … … 1477 1478 algorithm 1478 1479 try 1479 arg := (shared, inAllZeroCrossings, createAlgebraicEquations);1480 arg := (shared, inAllZeroCrossings, OutputSystems.States, createAlgebraicEquations); 1480 1481 foldArg := (iuniqueEqIndex, {}, {}, {}, {}, itempvars, {}, {}, iBackendMapping, iSccOffset); 1482 foldArg := List.fold1(inSysts, createEquationsForSystems1, arg, foldArg); 1483 arg := (shared, inAllZeroCrossings, OutputSystems.NonStates, createAlgebraicEquations); 1481 1484 foldArg := List.fold1(inSysts, createEquationsForSystems1, arg, foldArg); 1482 1485 (ouniqueEqIndex, oodeEquations, oalgebraicEquations, oallEquations, oequationsForZeroCrossings, otempvars, … … 1495 1498 input CreateEquationsForSystemsFold inFold; 1496 1499 output CreateEquationsForSystemsFold outFold; 1497 algorithm 1500 protected 1501 BackendDAE.StrongComponents compsStates, compsNonStates, comps; 1502 list<BackendDAE.ZeroCrossing> zeroCrossings; 1503 BackendDAE.Shared shared; 1504 Boolean createAlgebraicEquations; 1505 OutputSystems outputSystemsKind; 1506 algorithm 1507 (shared, zeroCrossings, outputSystemsKind, createAlgebraicEquations) := inArg; 1498 1508 outFold := match inSyst.matching 1499 1509 local 1500 1510 list<SimCode.SimEqSystem> odeEquations1, algebraicEquations1, allEquations1; 1501 BackendDAE.StrongComponents comps;1502 1511 BackendDAE.EqSystem syst; 1503 1512 list<list<SimCode.SimEqSystem>> odeEquations, algebraicEquations; … … 1511 1520 list<tuple<Integer,Integer>> eqSccMapping, eqBackendSimCodeMapping; 1512 1521 SimCode.BackendMapping backendMapping; 1513 list<BackendDAE.ZeroCrossing> zeroCrossings;1514 BackendDAE.Shared shared;1515 Boolean createAlgebraicEquations;1516 1522 case BackendDAE.MATCHING(ass1=ass1, comps=comps) 1517 1523 equation … … 1520 1526 end if; 1521 1527 1522 (shared, zeroCrossings, createAlgebraicEquations) = inArg;1523 1528 (uniqueEqIndex, odeEquations, algebraicEquations, allEquations, equationsForZeroCrossings, tempvars, 1524 1529 eqSccMapping, eqBackendSimCodeMapping, backendMapping, sccOffset) = inFold; … … 1536 1541 createEquationsForSystem( 1537 1542 stateeqnsmark, zceqnsmarks, syst, shared, comps, uniqueEqIndex, tempvars, 1538 sccOffset, eqSccMapping, eqBackendSimCodeMapping, backendMapping, createAlgebraicEquations);1543 sccOffset, eqSccMapping, eqBackendSimCodeMapping, backendMapping, outputSystemsKind, createAlgebraicEquations); 1539 1544 GC.free(stateeqnsmark); 1540 1545 GC.free(zceqnsmarks); … … 1565 1570 protected type CreateEquationsForSystemArg = 1566 1571 tuple<array<Integer> /*stateeqnsmark*/, array<Integer> /*zceqnsmark*/, 1567 BackendDAE.EqSystem /*syst*/, BackendDAE.Shared /*shared*/, Boolean>;1572 BackendDAE.EqSystem /*syst*/, BackendDAE.Shared /*shared*/, OutputSystems, Boolean>; 1568 1573 1569 1574 protected function createEquationsForSystem … … 1579 1584 input list<tuple<Integer,Integer>> ieqBackendSimCodeMapping; 1580 1585 input SimCode.BackendMapping iBackendMapping; 1586 input OutputSystems outputSystemsKind; 1581 1587 input Boolean createAlgebraicEquations; 1582 1588 output list<SimCode.SimEqSystem> outOdeEquations; … … 1594 1600 list<list<SimCode.SimEqSystem>> odeEquations, algebraicEquations, allEquations, equationsforZeroCrossings; 1595 1601 algorithm 1596 arg := (stateeqnsmark, zceqnsmark, syst, shared, createAlgebraicEquations);1602 arg := (stateeqnsmark, zceqnsmark, syst, shared, outputSystemsKind, createAlgebraicEquations); 1597 1603 foldArg := (iuniqueEqIndex, {}, {}, {}, {}, itempvars, ieqSccMapping, ieqBackendSimCodeMapping, iBackendMapping, iSccIndex); 1598 1604 foldArg := List.fold2(comps, createEquationsForSystem1, arg, partitionKindToClockIndex(syst.partitionKind), foldArg); … … 1649 1655 list<BackendDAE.Var> varlst; 1650 1656 list<BackendDAE.Equation> eqnlst; 1657 OutputSystems outputSystemsKind; 1651 1658 Boolean createAlgebraicEquations, bdynamic, skip; 1652 Boolean debug = false;1653 algorithm 1654 (stateeqnsmark, zceqnsmark, syst, shared, createAlgebraicEquations) := inArg;1659 constant Boolean debug = false; 1660 algorithm 1661 (stateeqnsmark, zceqnsmark, syst, shared, outputSystemsKind, createAlgebraicEquations) := inArg; 1655 1662 (uniqueEqIndex, odeEquations, algebraicEquations, allEquations, equationsforZeroCrossings, 1656 1663 tempvars, eqSccMapping, eqBackendSimCodeMapping, backendMapping, sccIndex) := inFold; 1657 (varlst, varIdx,eqnlst,eqsIdx) := BackendDAEUtil.getStrongComponentVarsAndEquations(comp, syst.orderedVars, syst.orderedEqs);1664 (varlst, varIdx, eqnlst, eqsIdx) := BackendDAEUtil.getStrongComponentVarsAndEquations(comp, syst.orderedVars, syst.orderedEqs); 1658 1665 bdynamic := BackendDAEUtil.blockIsDynamic(eqsIdx, stateeqnsmark); 1666 1667 if outputSystemsKind==OutputSystems.Both or (if outputSystemsKind==OutputSystems.States then bdynamic else not bdynamic) then 1668 outFold := inFold; 1669 return; 1670 end if; 1659 1671 1660 1672 skip := false;
Note: See TracChangeset
for help on using the changeset viewer.