- Index
- » Developer
- » OpenModelica development
- » Variability of redeclared component...
Variability of redeclared component changed
Variability of redeclared component changed
Hi,
my model (ModelReplacParamCont) contains two elements of type parameter record, one of them is replaceable. In my model tester, I change the type of replaceable parameter, and perform an assignment between these two parameters.
When I call the translateModel in OMshell, I get the following error message:
------------------------------
translateModel(VerktorSizeNullPkg.RepacParam.ModelReplacParamContTester)
"There were errors during translation. Use getErrorString() to see them."
[C:/Users/erick/Desktop/TISC_OM_report/ProblemTester/vektorSizeNull/VerktorSizeNullPkg.mo:109:7-111:74:writable] Error: Component container.param2 of variability PARAM has binding container.param of higher variability VAR.
Error: Error occurred while flattening model VerktorSizeNullPkg.RepacParam.ModelReplacParamContTester
---------------------------------------
Should in this case the redeclared object keep the same variability (in ths case, parameter) ?
Here is my testcode:
package RepacParam "test for variability error in OMshell"
record ModelReplacParamBasis
constant Integer x;
end ModelReplacParamBasis;
record ModelReplacParam1
extends VerktorSizeNullPkg.RepacParam.ModelReplacParamBasis(final x=1);
end ModelReplacParam1;
record ModelReplacParam2
extends VerktorSizeNullPkg.RepacParam.ModelReplacParamBasis(final x=10);
end ModelReplacParam2;
model ModelReplacParamCont
replaceable parameter VerktorSizeNullPkg.RepacParam.ModelReplacParam1
param
constrainedby VerktorSizeNullPkg.RepacParam.ModelReplacParamBasis;
parameter VerktorSizeNullPkg.RepacParam.ModelReplacParamBasis param2 = param;
end ModelReplacParamCont;
model ModelReplacParamContTester
VerktorSizeNullPkg.RepacParam.ModelReplacParamCont container(redeclare
VerktorSizeNullPkg.RepacParam.ModelReplacParam2 param); /*parameter*/
end ModelReplacParamContTester;
end RepacParam;
--------------------------------------------
Thanks in advance,
Erick
- Index
- » Developer
- » OpenModelica development
- » Variability of redeclared component...