Skip to content

Commit

Permalink
Fixed bug with start value for arrays in DAELow
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@2551 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed Sep 28, 2006
1 parent f487f5e commit cb5d518
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 6 additions & 5 deletions Compiler/DAELow.mo
Expand Up @@ -3261,10 +3261,11 @@ algorithm
Option<DAE.VariableAttributes> dae_var_attr;
Option<Absyn.Comment> comment;
DAE.Flow flow_;
DAE.StartValue start;
list<Var> xs;
DAE.Type var_type;
case ({},_) then ();
case (((v as VAR(varName = cr,varKind = kind,varDirection = dir,varType = var_type,bindExp = SOME(e),index = indx,origVarName = old_name,className = paths,values = dae_var_attr,comment = comment,flow_ = flow_)) :: xs),varno)
case (((v as VAR(varName = cr,varKind = kind,varDirection = dir,varType = var_type,bindExp = SOME(e),index = indx,origVarName = old_name,className = paths,values = dae_var_attr,comment = comment,flow_ = flow_,startValue=start)) :: xs),varno)
equation
varnostr = intString(varno);
print(varnostr);
Expand Down Expand Up @@ -3293,11 +3294,12 @@ algorithm
print(" indx = ");
print(indx_str);
varno_1 = varno + 1;
print(" start:");print(Dump.getOptionStr(start,Exp.printExpStr));
print("\n");
dumpVars2(xs, varno_1) "DAE.dump_variable_attributes(dae_var_attr) &" ;
then
();
case (((v as VAR(varName = cr,varKind = kind,varDirection = dir,varType = var_type,bindExp = NONE,index = indx,origVarName = old_name,className = paths,values = dae_var_attr,comment = comment,flow_ = flow_)) :: xs),varno)
case (((v as VAR(varName = cr,varKind = kind,varDirection = dir,varType = var_type,bindExp = NONE,index = indx,origVarName = old_name,className = paths,values = dae_var_attr,comment = comment,flow_ = flow_,startValue=start)) :: xs),varno)
equation
varnostr = intString(varno);
print(varnostr);
Expand All @@ -3322,9 +3324,8 @@ algorithm

print(" indx = ");
print(indx_str);
print("\n") " DAE.dump_variable_attributes(dae_var_attr) &
print \" \" & print comment_str &
print \",\\n\" &" ;
print(" start:");print(Dump.getOptionStr(start,Exp.printExpStr));
print("\n") ;
varno_1 = varno + 1;
dumpVars2(xs, varno_1);
then
Expand Down
6 changes: 5 additions & 1 deletion Compiler/Inst.mo
Expand Up @@ -8325,8 +8325,12 @@ protected function instStartBindingExp "function: instStartBindingExp
input Types.Type etype;
input list<Integer> index_list;
output DAE.StartValue result;
protected Types.Type eltType;
algorithm
result := instBinding(mod, etype, index_list, "start");
eltType := Types.arrayElementType(etype); // When instantiating arrays, the array type is passed
// But binding is performed on the element type.
// Also removed index, since indexing is already performed on the modifier.
result := instBinding(mod, eltType, {}, "start");
end instStartBindingExp;

protected function instDaeVariableAttributes "function: instDaeVariableAttributes
Expand Down

0 comments on commit cb5d518

Please sign in to comment.