Skip to content

Commit

Permalink
- add more error info on the issues that might appear.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13874 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Nov 12, 2012
1 parent f4d2ce6 commit 843c11a
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions Compiler/BackEnd/OpenTURNS.mo
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ algorithm

varLst := BackendDAEUtil.getAllVarLst(dae2);
varLst := List.select(varLst,BackendVariable.varHasDistributionAttribute);
Util.addInternalError(listLength(varLst) == 0, "OpenTURNS.generateDistributions: No variable in the DAE has the distribution attribute! Check your model ...");
dists := List.map(varLst,BackendVariable.varDistribution);
(sLst,distributionVarLst) := List.map1_2(List.threadTuple(dists,List.map(varLst,BackendVariable.varCref)),generateDistributionVariable,dae2);

Expand Down Expand Up @@ -431,11 +432,32 @@ protected
array<DAE.Algorithm> algs;
DAE.Algorithm correlationAlg;
String header;
algorithm
algs := BackendDAEUtil.getAlgorithms(dae);
header := "RS = CorrelationMatrix("+&intString(numDists)+&")\n";
SOME(correlationAlg) := Util.arrayFindFirstOnTrue(algs,hasCorrelationStatement);
correlationMatrix := header +& generateCorrelationMatrix2(correlationAlg,uncertainVars);
algorithm
correlationMatrix := matchcontinue(dae, numDists, uncertainVars)
case (_, _, _)
equation
algs = BackendDAEUtil.getAlgorithms(dae);
header = "RS = CorrelationMatrix("+&intString(numDists)+&")\n";
SOME(correlationAlg) = Util.arrayFindFirstOnTrue(algs,hasCorrelationStatement);
correlationMatrix = header +& generateCorrelationMatrix2(correlationAlg,uncertainVars);
then
correlationMatrix;

case (_, _, _)
equation
algs = BackendDAEUtil.getAlgorithms(dae);
header = "RS = CorrelationMatrix("+&intString(numDists)+&")\n";
NONE() = Util.arrayFindFirstOnTrue(algs,hasCorrelationStatement);
Util.addInternalError(true, "OpenTURNS.generateCorrelationMatrix failed because it could not find any correlation statement in algorithm.");
then
fail();

else
equation
Util.addInternalError(true, "OpenTURNS.generateCorrelationMatrix failed ...");
then
fail();
end matchcontinue;
end generateCorrelationMatrix;

protected function stripCorrelationFromDae "removes the correlation vector and it's corresponding algorithm section from the DAE.
Expand Down

0 comments on commit 843c11a

Please sign in to comment.