Changeset e4faaeb in OpenModelica


Ignore:
Timestamp:
2020-05-04T14:12:55+02:00 (4 years ago)
Author:
vwaurich <volker.waurich@…>
Children:
0e9f9fe9
Parents:
b201452
Message:

remove bindings of external objects if they are alias vars

File:
1 edited

Legend:

Unmodified
Added
Removed
  • OMCompiler/Compiler/BackEnd/BackendDAECreate.mo

    rb201452 re4faaeb  
    227227  //remove alias from extVarArray
    228228  extVarsOut := BackendVariable.deleteVars(extAliasVars,extVars);
     229  extVarsOut := removeExtAliasBinding(extVarsOut,repl);
    229230
    230231  //replace in equations
     
    237238  oRemEqs := listReverse(oRemEqs);
    238239end getExternalObjectAlias;
     240
     241
     242protected function removeExtAliasBinding "Removes the binding of an external variable if the binding cref ist already detected as an alias variable.
     243author: Waurich TUD 2020-05"
     244  input BackendDAE.Variables extVarsIn;
     245  input BackendVarTransform.VariableReplacements repl;
     246  output BackendDAE.Variables extVarsOut;
     247protected
     248  list<BackendDAE.Var> varLst,extVarLst;
     249  DAE.ComponentRef cref;
     250algorithm
     251  varLst := BackendVariable.varList(extVarsIn);
     252  extVarLst := {};
     253  for var in varLst loop
     254    var := matchcontinue(var)
     255      case (BackendDAE.VAR(bindExp = SOME(DAE.CREF(componentRef=cref))))
     256        algorithm
     257          if BackendVarTransform.hasReplacement(repl,cref) then
     258            var.bindExp := NONE();
     259          end if;
     260      then var;
     261      else var;
     262    end matchcontinue;
     263  extVarLst := var::extVarLst;
     264  end for;
     265  extVarsOut := BackendVariable.listVar(extVarLst);
     266end removeExtAliasBinding;
    239267
    240268protected function getExternalObjectAlias3 "Gets the alias var and sim var for the given alias equation and adds a replacement rule
Note: See TracChangeset for help on using the changeset viewer.