Skip to content

Commit

Permalink
- move equalityConstraint equations to removed equations
Browse files Browse the repository at this point in the history
- move Modelica.Magnetic.FluxTubes.Examples.SaturatedInductor.mos and
       Modelica.Electrical.QuasiStationary.SinglePhase.Examples.Rectifier to working test

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13699 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Oct 29, 2012
1 parent b4ccec2 commit 9db75f9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions Compiler/BackEnd/BackendDAECreate.mo
Expand Up @@ -271,6 +271,14 @@ algorithm
(eqns,reqns,ieqns) = lowerAlgorithm(DAE.INITIALALGORITHM(DAE.ALGORITHM_STMTS({DAE.STMT_TUPLE_ASSIGN(DAE.T_UNKNOWN_DEFAULT,explst,e2,source)}),source),functionTree,inEqnsLst,inREqnsLst,inIEqnsLst);
then
(inVars,inKnVars,inExVars,eqns,reqns,ieqns,inConstraintLst,inClassAttributeLst,inWhenClauseLst,inExtObjClasses,iAliaseqns);

// equalityConstraint equations, moved to removed equations
case (DAE.ARRAY_EQUATION(exp = DAE.ARRAY(ty=_),array=DAE.CALL(path=path)),_,_,_,_,_,_,_,_,_,_,_,_)
equation
true = stringEq(Absyn.pathLastIdent(path),"equalityConstraint");
eqns = lowerEqn(inElement,functionTree,inREqnsLst);
then
(inVars,inKnVars,inExVars,inEqnsLst,eqns,inIEqnsLst,inConstraintLst,inClassAttributeLst,inWhenClauseLst,inExtObjClasses,iAliaseqns);

// scalar equations
case (DAE.EQUATION(exp = _),_,_,_,_,_,_,_,_,_,_,_,_)
Expand Down Expand Up @@ -719,12 +727,9 @@ protected function lowerVarkind
output BackendDAE.VarKind outVarKind;
algorithm
(outVarKind) := matchcontinue (inVarKind,inType,inComponentRef,inVarDirection,inConnectorType,daeAttr)
// Or states have StateSelect.always
// variable -> state if have stateSelect=StateSelect.always
case (DAE.VARIABLE(),_,_,_,_,SOME(DAE.VAR_ATTR_REAL(stateSelectOption = SOME(DAE.ALWAYS()))))
then (BackendDAE.STATE());
// Or states have StateSelect.prefer
case (DAE.VARIABLE(),_,_,_,_,SOME(DAE.VAR_ATTR_REAL(stateSelectOption = SOME(DAE.PREFER()))))
then (BackendDAE.STATE());

case (DAE.VARIABLE(),DAE.T_BOOL(varLst = _),_,_,_,_)
equation
Expand Down
4 changes: 2 additions & 2 deletions Compiler/Template/CodegenC.tpl
Expand Up @@ -8368,7 +8368,7 @@ template ScalarVariableType(String unit, String displayUnit, Option<DAE.Exp> min
case T_BOOL(__) then '<Boolean <%ScalarVariableTypeStartAttribute(initialValue, type_)%> <%ScalarVariableTypeFixedAttribute(isFixed)%> <%ScalarVariableTypeUnitAttribute(unit)%> <%ScalarVariableTypeDisplayUnitAttribute(displayUnit)%> />'
case T_STRING(__) then '<String <%ScalarVariableTypeStartAttribute(initialValue, type_)%> <%ScalarVariableTypeFixedAttribute(isFixed)%> <%ScalarVariableTypeUnitAttribute(unit)%> <%ScalarVariableTypeDisplayUnitAttribute(displayUnit)%> />'
case T_ENUMERATION(__) then '<Integer <%ScalarVariableTypeStartAttribute(initialValue, type_)%> <%ScalarVariableTypeFixedAttribute(isFixed)%> <%ScalarVariableTypeUnitAttribute(unit)%> <%ScalarVariableTypeDisplayUnitAttribute(displayUnit)%> />'
else error(sourceInfo(), 'ScalarVariableType: UNKOWN_TYPE')
else error(sourceInfo(), 'ScalarVariableType: <%unparseType(type_)%>')
end ScalarVariableType;

template ScalarVariableTypeStartAttribute(Option<DAE.Exp> initialValue, DAE.Type type_)
Expand All @@ -8383,7 +8383,7 @@ match initialValue
case T_REAL(__) then 'useStart="false" start="0.0"'
case T_BOOL(__) then 'useStart="false" start="false"'
case T_STRING(__) then 'useStart="false" start=""'
else error(sourceInfo(), 'ScalarVariableTypeStartAttribute: UNKOWN_TYPE')
else error(sourceInfo(), 'ScalarVariableTypeStartAttribute: <%unparseType(type_)%>')
end ScalarVariableTypeStartAttribute;

template ScalarVariableTypeFixedAttribute(Boolean isFixed)
Expand Down

0 comments on commit 9db75f9

Please sign in to comment.