Skip to content

Commit

Permalink
Fixes for bugs: #1273 #1156
Browse files Browse the repository at this point in the history
- OMC will now use the start value for a parameter during 
  instantiation if the parameter does not have a default value
  and report a warning about it. This is widely used in Modelica 3.1.

- DAE.mo
  + added BindingSource to DAE.Binding records DAE.EQBOUND and DAE.VALBOUND
    to know weather this binding came from a start value or default value.
- DAEUtil.mo
  + added functions to set the DAE.BindingSource in DAE.Binding and to print DAE.Binding
- Static.mo
  + Static.elabBuiltinDelay
    delay(x, variable, variable) generates only a warning now as is used inside
    Modelica.Electrical.Analog.Lines.TLine* (where a variable that is an expression of parameters is used)
  + Static.elabCref2
    if the parameter binding came from a start value, issue a warning.
- Inst.mo
  + send prefix and component name to Inst.makeBinding and Inst.elabArraydimType for better error messages
  + Inst.makeBinding will use the start value to generate a DAE.Binding as DAE.EQBOUND if the parameter
    does not have a default value.
- Main.mo
  + added commented out debug statements using System Timer
- Types.mo
  + improved the display of variables (now it displays where the binding came from start/default)
- All other .mo files
  + fixes due to changes in DAE.mo
- testsuite/*
  + fixes to the test models due to changes in the error/warning messages.
  + now run testsuite/libraries/msl31/* tests by default.



  



git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@6119 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Sep 14, 2010
1 parent 3294b10 commit caab1f9
Show file tree
Hide file tree
Showing 15 changed files with 275 additions and 110 deletions.
16 changes: 8 additions & 8 deletions Compiler/Builtin.mo
Expand Up @@ -277,7 +277,7 @@ protected constant tuple<DAE.TType, Option<Type_a>> derType=(
DAE.ATTR(false,false,SCode.RW,SCode.PARAM(),Absyn.BIDIR(),Absyn.UNSPECIFIED()),
false,
DAE.T_STRING_DEFAULT,
DAE.EQBOUND(DAE.SCONST("'p"),SOME(Values.STRING("'p")),DAE.C_CONST),
DAE.EQBOUND(DAE.SCONST("'p"),SOME(Values.STRING("'p")),DAE.C_CONST(),DAE.BINDING_FROM_DEFAULT_VALUE()),
NONE()
)
}
Expand All @@ -289,7 +289,7 @@ protected constant tuple<DAE.TType, Option<Type_a>> derType=(
DAE.ATTR(false,false,SCode.RW,SCode.PARAM(),Absyn.BIDIR(),Absyn.UNSPECIFIED()),
false,
DAE.T_STRING_DEFAULT,
DAE.EQBOUND(DAE.SCONST("'p/s"),SOME(Values.STRING("'p/s")),DAE.C_CONST),
DAE.EQBOUND(DAE.SCONST("'p/s"),SOME(Values.STRING("'p/s")),DAE.C_CONST(),DAE.BINDING_FROM_DEFAULT_VALUE()),
NONE()
)
}),NONE),DAE.NO_INLINE),NONE);
Expand All @@ -302,7 +302,7 @@ protected constant tuple<DAE.TType, Option<Type_a>> dimesionlessReal2Dimensionle
DAE.ATTR(false,false,SCode.RW,SCode.PARAM(),Absyn.BIDIR(),Absyn.UNSPECIFIED()),
false,
DAE.T_STRING_DEFAULT,
DAE.EQBOUND(DAE.SCONST("1"),SOME(Values.STRING("1")),DAE.C_CONST),
DAE.EQBOUND(DAE.SCONST("1"),SOME(Values.STRING("1")),DAE.C_CONST(),DAE.BINDING_FROM_DEFAULT_VALUE()),
NONE()
)
}
Expand All @@ -314,7 +314,7 @@ protected constant tuple<DAE.TType, Option<Type_a>> dimesionlessReal2Dimensionle
DAE.ATTR(false,false,SCode.RW,SCode.PARAM(),Absyn.BIDIR(),Absyn.UNSPECIFIED()),
false,
DAE.T_STRING_DEFAULT,
DAE.EQBOUND(DAE.SCONST("1"),SOME(Values.STRING("1")),DAE.C_CONST),
DAE.EQBOUND(DAE.SCONST("1"),SOME(Values.STRING("1")),DAE.C_CONST(),DAE.BINDING_FROM_DEFAULT_VALUE()),
NONE()
)
}),NONE),DAE.NO_INLINE),NONE);
Expand All @@ -327,7 +327,7 @@ protected constant tuple<DAE.TType, Option<Type_a>> sqrtint2real=(
DAE.ATTR(false,false,SCode.RW,SCode.PARAM(),Absyn.BIDIR(),Absyn.UNSPECIFIED()),
false,
DAE.T_STRING_DEFAULT,
DAE.EQBOUND(DAE.SCONST("'p"),SOME(Values.STRING("'p")),DAE.C_CONST),
DAE.EQBOUND(DAE.SCONST("'p"),SOME(Values.STRING("'p")),DAE.C_CONST(),DAE.BINDING_FROM_DEFAULT_VALUE()),
NONE()
)
}
Expand All @@ -339,7 +339,7 @@ protected constant tuple<DAE.TType, Option<Type_a>> sqrtint2real=(
DAE.ATTR(false,false,SCode.RW,SCode.PARAM(),Absyn.BIDIR(),Absyn.UNSPECIFIED()),
false,
DAE.T_STRING_DEFAULT,
DAE.EQBOUND(DAE.SCONST("'p(1/2)"),SOME(Values.STRING("'p(1/2)")),DAE.C_CONST),
DAE.EQBOUND(DAE.SCONST("'p(1/2)"),SOME(Values.STRING("'p(1/2)")),DAE.C_CONST(),DAE.BINDING_FROM_DEFAULT_VALUE()),
NONE()
)
}),NONE),DAE.NO_INLINE),NONE);
Expand All @@ -352,7 +352,7 @@ protected constant tuple<DAE.TType, Option<Type_a>> sqrtreal2real=(
DAE.ATTR(false,false,SCode.RW,SCode.PARAM(),Absyn.BIDIR(),Absyn.UNSPECIFIED()),
false,
DAE.T_STRING_DEFAULT,
DAE.EQBOUND(DAE.SCONST("'p"),SOME(Values.STRING("'p")),DAE.C_CONST),
DAE.EQBOUND(DAE.SCONST("'p"),SOME(Values.STRING("'p")),DAE.C_CONST(),DAE.BINDING_FROM_DEFAULT_VALUE()),
NONE()
)
}
Expand All @@ -364,7 +364,7 @@ protected constant tuple<DAE.TType, Option<Type_a>> sqrtreal2real=(
DAE.ATTR(false,false,SCode.RW,SCode.PARAM(),Absyn.BIDIR(),Absyn.UNSPECIFIED()),
false,
DAE.T_STRING_DEFAULT,
DAE.EQBOUND(DAE.SCONST("'p(1/2)"),SOME(Values.STRING("'p(1/2))")),DAE.C_CONST),
DAE.EQBOUND(DAE.SCONST("'p(1/2)"),SOME(Values.STRING("'p(1/2))")),DAE.C_CONST(),DAE.BINDING_FROM_DEFAULT_VALUE()),
NONE()
)
}),NONE),DAE.NO_INLINE),NONE);
Expand Down
6 changes: 3 additions & 3 deletions Compiler/Ceval.mo
Expand Up @@ -5280,7 +5280,7 @@ protected function crefEqualValue ""
input DAE.Binding v;
output Boolean outBoolean;
algorithm outBoolean := matchcontinue(c,v)
case(c,(v as DAE.EQBOUND(DAE.CREF(c2,_),NONE,_)))
case(c,(v as DAE.EQBOUND(DAE.CREF(c2,_),NONE,_,_)))
local DAE.ComponentRef c2;
equation
true = Exp.crefEqual(c,c2);
Expand Down Expand Up @@ -5356,7 +5356,7 @@ algorithm
// range is constant!
exp_type = Exp.typeof(exp);
iter_type = Types.expTypetoTypesType(exp_type);
new_env = Env.extendFrameForIterator(env, iteratorName, iter_type, DAE.VALBOUND(value), SCode.VAR(), SOME(DAE.C_CONST()));
new_env = Env.extendFrameForIterator(env, iteratorName, iter_type, DAE.VALBOUND(value, DAE.BINDING_FROM_DEFAULT_VALUE()), SCode.VAR(), SOME(DAE.C_CONST()));
(new_cache, value, new_st) = ceval(new_cache, new_env, exp,
implicitInstantiation, new_st, dim, msg);
then (new_cache, value, new_st);
Expand All @@ -5367,7 +5367,7 @@ algorithm
iteratorName, rest_values, implicitInstantiation, new_st, dim, msg);
exp_type = Exp.typeof(exp);
iter_type = Types.expTypetoTypesType(exp_type);
new_env = Env.extendFrameForIterator(new_env, iteratorName, iter_type, DAE.VALBOUND(value), SCode.VAR(), SOME(DAE.C_CONST()));
new_env = Env.extendFrameForIterator(new_env, iteratorName, iter_type, DAE.VALBOUND(value, DAE.BINDING_FROM_DEFAULT_VALUE()), SCode.VAR(), SOME(DAE.C_CONST()));
(new_cache, value, new_st) = ceval(new_cache, new_env, exp,
implicitInstantiation, new_st, dim, msg);
reduced_value = op(value, value2);
Expand Down
16 changes: 9 additions & 7 deletions Compiler/CevalScript.mo
Expand Up @@ -3365,7 +3365,8 @@ algorithm
(cache, env, _, dae) =
Inst.instantiateClass(inCache, InnerOuter.emptyInstHierarchy, p_1, className);
dae = DAEUtil.transformationsBeforeBackend(dae);
ic_1 = Interactive.addInstantiatedClass(ic, Interactive.INSTCLASS(className,dae,env));
// adrpo: do not store instantiated class as we don't use it later!
// ic_1 = Interactive.addInstantiatedClass(ic, Interactive.INSTCLASS(className,dae,env));
elimLevel = RTOpts.eliminationLevel();
RTOpts.setEliminationLevel(0); // No variable elimination
(dlow as DAELow.DAELOW(orderedVars = DAELow.VARIABLES(numberOfVars = varSize),orderedEqs = eqns))
Expand Down Expand Up @@ -3401,7 +3402,8 @@ algorithm
(cache, env, _, dae) =
Inst.instantiateFunctionImplicit(inCache, InnerOuter.emptyInstHierarchy, p_1, className);

ic_1 = Interactive.addInstantiatedClass(ic, Interactive.INSTCLASS(className,dae,env));
// adrpo: do not store instantiated class as we don't use it later!
// ic_1 = Interactive.addInstantiatedClass(ic, Interactive.INSTCLASS(className,dae,env));
classNameStr = Absyn.pathString(className);
warnings = Error.printMessagesStr();
// TODO: add a check if warnings is empty, if so then remove \n... --> warnings,"\nClass <--- line below.
Expand Down Expand Up @@ -3487,7 +3489,7 @@ algorithm
classname_1 = Static.componentRefToPath(classname) "Check cached instantiated class" ;
Interactive.INSTCLASS(_,dae,env) = Interactive.getInstantiatedClass(ic, classname_1);
cref_1 = Exp.joinCrefs(cref, DAE.CREF_IDENT("stateSelect",DAE.ET_OTHER(),{}));
(cache,attr,ty,DAE.EQBOUND(exp,_,_),_,_,_,_,_) = Lookup.lookupVar(cache, env, cref_1);
(cache,attr,ty,DAE.EQBOUND(exp,_,_,_),_,_,_,_,_) = Lookup.lookupVar(cache, env, cref_1);
str = Exp.printExpStr(exp);
then
(cache,Values.STRING(str),st);
Expand All @@ -3512,7 +3514,7 @@ algorithm
(cache,env4,_,_,dae1,csets_1,ci_state_1,tys,_,_,_,_) = Inst.instClassIn(cache,env3, InnerOuter.emptyInstHierarchy,UnitAbsyn.noStore,DAE.NOMOD(), Prefix.NOPRE(), Connect.emptySet,
ci_state, c, false, {}, false, ConnectionGraph.EMPTY,NONE);
cref_1 = Exp.joinCrefs(cref, DAE.CREF_IDENT("stateSelect",DAE.ET_OTHER(),{}));
(cache,attr,ty,DAE.EQBOUND(exp,_,_),_,_,_,_,_) = Lookup.lookupVar(cache, env4, cref_1);
(cache,attr,ty,DAE.EQBOUND(exp,_,_,_),_,_,_,_,_) = Lookup.lookupVar(cache, env4, cref_1);
ic_1 = Interactive.addInstantiatedClass(ic, Interactive.INSTCLASS(classname_1,dae1,env4));
str = Exp.printExpStr(exp);
then
Expand All @@ -3529,7 +3531,7 @@ algorithm
classname_1 = Static.componentRefToPath(classname);
Interactive.INSTCLASS(_,dae,env) = Interactive.getInstantiatedClass(ic, classname_1);
cref_1 = Exp.joinCrefs(cref, DAE.CREF_IDENT(attribute,DAE.ET_OTHER(),{}));
(cache,attr,ty,DAE.VALBOUND(v),_,_,_,_,_) = Lookup.lookupVar(cache, env, cref_1);
(cache,attr,ty,DAE.VALBOUND(v,_),_,_,_,_,_) = Lookup.lookupVar(cache, env, cref_1);
then
(cache,v,st);

Expand All @@ -3553,7 +3555,7 @@ algorithm
(cache,env4,_,_,dae1,csets_1,ci_state_1,tys,_,_,_,_) = Inst.instClassIn(cache,env3, InnerOuter.emptyInstHierarchy, UnitAbsyn.noStore,DAE.NOMOD(), Prefix.NOPRE(), Connect.emptySet,
ci_state, c, false, {}, false, ConnectionGraph.EMPTY,NONE);
cref_1 = Exp.joinCrefs(cref, DAE.CREF_IDENT(attribute,DAE.ET_OTHER(),{}));
(cache,attr,ty,DAE.VALBOUND(v),_,_,_,_,_) = Lookup.lookupVar(cache, env4, cref_1);
(cache,attr,ty,DAE.VALBOUND(v,_),_,_,_,_,_) = Lookup.lookupVar(cache, env4, cref_1);
ic_1 = Interactive.addInstantiatedClass(ic, Interactive.INSTCLASS(classname_1,dae1,env4));
then
(cache,v,Interactive.SYMBOLTABLE(p,aDep,sp,ic_1,vars,cf,lf));
Expand Down Expand Up @@ -3957,7 +3959,7 @@ algorithm
case (cache,env,className,(st as Interactive.SYMBOLTABLE(ast = p,explodedAst = sp,instClsLst = ic,lstVarVal = iv,compiledFunctions = cf)),msg)
equation
allClassPaths = getAllClassPathsRecursive(className, p);
// allClassPaths = Util.listSelect(allClassPaths, filterLib);
allClassPaths = Util.listSelect(allClassPaths, filterLib);
// allClassPaths = listReverse(allClassPaths);
print("Number of classes to check: " +& intString(listLength(allClassPaths)) +& "\n");
// print ("All paths: \n" +& Util.stringDelimitList(Util.listMap(allClassPaths, Absyn.pathString), "\n") +& "\n");
Expand Down
34 changes: 17 additions & 17 deletions Compiler/Cevalfunc.mo
Expand Up @@ -226,7 +226,7 @@ algorithm
DAE.TYPES_VAR(
varName,
DAE.ATTR(false,false,SCode.RW(),SCode.VAR(),Absyn.BIDIR(),Absyn.UNSPECIFIED()),
false,tty,DAE.VALBOUND(val1),NONE()), NONE, Env.VAR_TYPED(), complexEnv);
false,tty,DAE.VALBOUND(val1,DAE.BINDING_FROM_DEFAULT_VALUE()),NONE()), NONE, Env.VAR_TYPED(), complexEnv);
env2 = extendEnvWithInputArgs(env1,eles1,vals1,restExps, ht2);
then
env2;
Expand All @@ -238,7 +238,7 @@ algorithm
tty = Types.typeOfValue(val1);
env1 = Env.extendFrameV(env,
DAE.TYPES_VAR(varName,DAE.ATTR(false,false,SCode.RW(),SCode.VAR(),Absyn.BIDIR(),Absyn.UNSPECIFIED()),
false,tty,DAE.VALBOUND(val1),NONE()), NONE, Env.VAR_TYPED(), {});
false,tty,DAE.VALBOUND(val1,DAE.BINDING_FROM_DEFAULT_VALUE()),NONE()), NONE, Env.VAR_TYPED(), {});
env2 = extendEnvWithInputArgs(env1,eles1,vals1,restExps, ht2);
then
env2;
Expand Down Expand Up @@ -273,7 +273,7 @@ algorithm
//since we do not have a value we use the class name to get type of variable.
tty = getTypeFromName(apath,env);
tty = addDims(tty,adim,env, ht2);
(binding as DAE.VALBOUND(vv)) = makeBinding(mod1,env,tty, ht2);
(binding as DAE.VALBOUND(vv,_)) = makeBinding(mod1,env,tty, ht2);
// print("extendEnvWithInputArgs -> NONE component: " +& varName +& " ty: " +& Types.printTypeStr(tty) +& " opt dim: " +& Dump.printArraydimStr(adim) +& "\n");
env1 = Env.extendFrameV(env,
DAE.TYPES_VAR(varName,DAE.ATTR(false,false,SCode.RW(),SCode.VAR(),Absyn.BIDIR(),Absyn.UNSPECIFIED()),
Expand Down Expand Up @@ -385,12 +385,12 @@ algorithm
case(DAE.TYPES_VAR(varName2,a,p,t,DAE.UNBOUND(),constOfForIteratorRange),{},{})
equation
val = typeOfValue(t);
tv = DAE.TYPES_VAR(varName2,a,p,t,DAE.VALBOUND(val),constOfForIteratorRange);
tv = DAE.TYPES_VAR(varName2,a,p,t,DAE.VALBOUND(val,DAE.BINDING_FROM_DEFAULT_VALUE()),constOfForIteratorRange);
then
tv;

// value bound
case(tv as DAE.TYPES_VAR(binding = DAE.VALBOUND(val)),{},{})
case(tv as DAE.TYPES_VAR(binding = DAE.VALBOUND(val,_)),{},{})
then
tv;

Expand All @@ -401,13 +401,13 @@ algorithm
true = stringEqual(varName3, varName2);
lv2 = setValuesInRecord(typeslst,names,vals);
ty2 = (DAE.T_COMPLEX(ClassInf.RECORD(fpath) ,lv2 , NONE, NONE),NONE);
tv = DAE.TYPES_VAR(varName3,a,p,ty2,DAE.VALBOUND(val),constOfForIteratorRange);
tv = DAE.TYPES_VAR(varName3,a,p,ty2,DAE.VALBOUND(val,DAE.BINDING_FROM_DEFAULT_VALUE()),constOfForIteratorRange);
then tv;

case(DAE.TYPES_VAR(varName3,a,p,t,b,constOfForIteratorRange) ,varName2::varNames, val::values)
equation
true = stringEqual(varName3, varName2);
tv = DAE.TYPES_VAR(varName3,a,p,t,DAE.VALBOUND(val),constOfForIteratorRange);
tv = DAE.TYPES_VAR(varName3,a,p,t,DAE.VALBOUND(val,DAE.BINDING_FROM_DEFAULT_VALUE()),constOfForIteratorRange);
then tv;

case(tv1,varName3::varNames, val::values)
Expand Down Expand Up @@ -1075,21 +1075,21 @@ algorithm outVal := matchcontinue(inVal,env,toAssign)
// print("setValue -> component: " +& str +& " ty: " +& Types.printTypeStr(t) +& "\n");
env1 = Env.updateFrameV(env,
DAE.TYPES_VAR(str,DAE.ATTR(false,false,SCode.RW(),SCode.VAR(),Absyn.BIDIR(),Absyn.UNSPECIFIED()),
false,t,DAE.VALBOUND(value),NONE()), Env.VAR_TYPED(), complexEnv);
false,t,DAE.VALBOUND(value,DAE.BINDING_FROM_DEFAULT_VALUE()),NONE()), Env.VAR_TYPED(), complexEnv);
then
env1;
// any other values with ident cref
case(value,env,Absyn.CREF(Absyn.CREF_IDENT(str,subs)))
equation
(_,_,t,DAE.VALBOUND(value2),_,_,_,_,_) = Lookup.lookupVar(Env.emptyCache(),env, DAE.CREF_IDENT(str,DAE.ET_OTHER(),{}));
(_,_,t,DAE.VALBOUND(value2,_),_,_,_,_,_) = Lookup.lookupVar(Env.emptyCache(),env, DAE.CREF_IDENT(str,DAE.ET_OTHER(),{}));
value = mergeValues(value2,value,subs,env,t);
env1 = updateVarinEnv(env,str,value,t);
then
env1;
// any other values with qualified cref
case(value,env,me as Absyn.CREF(Absyn.CREF_QUAL(str,subs,child)))
equation
(_,_,t,DAE.VALBOUND(value2),_,_,_,_,_) = Lookup.lookupVar(Env.emptyCache(),env, DAE.CREF_IDENT(str,DAE.ET_OTHER(),{}));
(_,_,t,DAE.VALBOUND(value2,_),_,_,_,_,_) = Lookup.lookupVar(Env.emptyCache(),env, DAE.CREF_IDENT(str,DAE.ET_OTHER(),{}));
env1 = setQualValue(env,value,Absyn.CREF_QUAL(str,subs,child));
then
env1;
Expand Down Expand Up @@ -1122,7 +1122,7 @@ algorithm
baseType := Types.typeOfValue(startValue);
baseValue := typeOfValue(baseType);
newEnv := Env.openScope(env, false, SOME(Env.forScopeName));
newEnv := Env.extendFrameForIterator(newEnv, iterName, baseType, DAE.VALBOUND(baseValue), iterVariability, constOfForIteratorRange);
newEnv := Env.extendFrameForIterator(newEnv, iterName, baseType, DAE.VALBOUND(baseValue,DAE.BINDING_FROM_DEFAULT_VALUE()), iterVariability, constOfForIteratorRange);
end addForLoopScope;

protected function setQualValue "Function: setQualValue
Expand Down Expand Up @@ -1250,7 +1250,7 @@ algorithm
// print("updateVarinEnv -> component: " +& varName +& " ACTUAL ty: " +& Types.printTypeStr(t) +& "\n");
env1 = Env.updateFrameV(env,
DAE.TYPES_VAR(varName,DAE.ATTR(false,false,SCode.RW(),SCode.VAR(),Absyn.BIDIR(),Absyn.UNSPECIFIED()),
false,ty,DAE.VALBOUND(newVal),NONE()), Env.VAR_TYPED(), {});
false,ty,DAE.VALBOUND(newVal,DAE.BINDING_FROM_DEFAULT_VALUE()),NONE()), Env.VAR_TYPED(), {});
then
env1;
case(_,_,_,_) equation
Expand Down Expand Up @@ -1281,24 +1281,24 @@ algorithm
ae1 = Util.tuple21(absynExp);
value = evaluateSingleExpression(ae1,env,SOME(ty), ht2);
then
DAE.VALBOUND(value);
DAE.VALBOUND(value,DAE.BINDING_FROM_DEFAULT_VALUE());
case(SCode.MOD(absynExpOption = SOME(absynExp), eachPrefix = Absyn.EACH) ,env,ty , ht2)
equation
ae1 = Util.tuple21(absynExp);
value = evaluateSingleExpression(ae1,env,SOME(ty), ht2);
value2 = instFunctionArray(ty,SOME(value));
then
DAE.VALBOUND(value2);
DAE.VALBOUND(value2,DAE.BINDING_FROM_DEFAULT_VALUE());
case(SCode.MOD(absynExpOption = NONE),_,ty, ht2)
equation
baseValue = instFunctionArray(ty,NONE);
then
DAE.VALBOUND(baseValue);
DAE.VALBOUND(baseValue,DAE.BINDING_FROM_DEFAULT_VALUE());
case(SCode.NOMOD,_,ty, ht2)
equation
baseValue = instFunctionArray(ty,NONE);
then
DAE.VALBOUND(baseValue);
DAE.VALBOUND(baseValue,DAE.BINDING_FROM_DEFAULT_VALUE());
case(SCode.MOD(absynExpOption = SOME(absynExp)),_,_, ht2)
equation
Debug.fprint("failtrace", "- Cevalfunc.makeBinding failed not fully implemented\n");
Expand Down Expand Up @@ -1506,7 +1506,7 @@ algorithm
case({},_) then {};
case(((ele1 as SCode.COMPONENT(component = varName, attributes = SCode.ATTR(direction = Absyn.OUTPUT() ) ))::eles1),env)
equation
(_,_,_,DAE.VALBOUND(value),_,_,_,_,_) = Lookup.lookupVar(Env.emptyCache(),env, DAE.CREF_IDENT(varName,DAE.ET_OTHER(),{}));
(_,_,_,DAE.VALBOUND(value,_),_,_,_,_,_) = Lookup.lookupVar(Env.emptyCache(),env, DAE.CREF_IDENT(varName,DAE.ET_OTHER(),{}));
lval = getOutputVarValues(eles1,env);
then
value::lval;
Expand Down
15 changes: 11 additions & 4 deletions Compiler/DAE.mo
Expand Up @@ -622,18 +622,25 @@ uniontype Attributes "- Attributes"

end Attributes;

public uniontype BindingSource "where this binding came from: either default binding or start value"
record BINDING_FROM_DEFAULT_VALUE "the binding came from the default value" end BINDING_FROM_DEFAULT_VALUE;
record BINDING_FROM_START_VALUE "the binding came from the start value" end BINDING_FROM_START_VALUE;
end BindingSource;

public
uniontype Binding "- Binding"
record UNBOUND end UNBOUND;

record EQBOUND
Exp exp "exp" ;
Option<Values.Value> evaluatedExp "evaluatedExp; evaluated exp" ;
Const constant_ "constant" ;
Exp exp "exp";
Option<Values.Value> evaluatedExp "evaluatedExp; evaluated exp";
Const constant_ "constant";
BindingSource source "Used for error reporting: this boolean tells us that the parameter did not had a binding but had a start value that was used instead.";
end EQBOUND;

record VALBOUND
Values.Value valBound "valBound" ;
Values.Value valBound "valBound";
BindingSource source "Used for error reporting: this boolean tells us that the parameter did not had a binding but had a start value that was used instead";
end VALBOUND;

end Binding;
Expand Down
4 changes: 2 additions & 2 deletions Compiler/DAEDump.mo
Expand Up @@ -1346,10 +1346,10 @@ algorithm
str := matchcontinue(binding)
local DAE.Exp e; Values.Value v;
case(DAE.UNBOUND()) then "";
case(DAE.EQBOUND(exp=e)) equation
case(DAE.EQBOUND(exp=e, source=DAE.BINDING_FROM_DEFAULT_VALUE())) equation
str = " = "+&Exp.printExpStr(e);
then str;
case(DAE.VALBOUND(v)) equation
case(DAE.VALBOUND(valBound=v, source=DAE.BINDING_FROM_DEFAULT_VALUE())) equation
str = " = " +& ValuesUtil.valString(v);
then str;
end matchcontinue;
Expand Down

0 comments on commit caab1f9

Please sign in to comment.