From: jplaine Date: Fri, 17 Dec 2010 09:46:22 +0000 (+0000) Subject: bugfix for if statements. X-Git-Tag: 2011-04-05-db-merge-trunk~47 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=56340eefd32b59d9909ffbde75a78b822c1f7da3;p=simantics%2Fsysdyn.git bugfix for if statements. git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@19157 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn.ontology/graph/Cancer.pgraph b/org.simantics.sysdyn.ontology/graph/Cancer.pgraph index 633f5bdb..e76d64bf 100644 --- a/org.simantics.sysdyn.ontology/graph/Cancer.pgraph +++ b/org.simantics.sysdyn.ontology/graph/Cancer.pgraph @@ -127,7 +127,7 @@ CMC.LungCsIIIBNoDAgeing : SYSDYN.Valve SYSDYN.HasExpressions _ : SYSDYN.Expressions @L0.list _ : SYSDYN.NormalExpression - SYSDYN.HasEquation "if Age==Age0 then -LungCsIIIBNoD[Type,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCsIIIBNoD[Type,Gender,Age], -1) else -LungCsIIIBNoD[Type,Gender,Age]+VECTOR_MAP(LungCsIIIBNoD[Type,Gender,Age], -1)" + SYSDYN.HasEquation "if Age==Age0 then -LungCsIIIBNoD[Type,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCsIIIBNoD[Type,Gender,Age], -1) else -LungCsIIIBNoD[Type,Gender,Age]+VECTOR_MAP(LungCsIIIBNoD[Type,Gender,Age], -1)*DummyRateForUnitsConversion" CMC.LungCProgressIBIVRate : SYSDYN.Auxiliary @L0.tag MOD.Mapped SYSDYN.HasExpressions _ : SYSDYN.Expressions @@ -373,7 +373,7 @@ CMC.LungCsIIIANoDAgeing : SYSDYN.Valve SYSDYN.HasExpressions _ : SYSDYN.Expressions @L0.list _ : SYSDYN.NormalExpression - SYSDYN.HasEquation "if Age==Age0 then -LungCsIIIANoD[Type,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCsIIIANoD[Type,Gender,Age], -1) else -LungCsIIIANoD[Type,Gender,Age]+VECTOR_MAP(LungCsIIIANoD[Type,Gender,Age], -1)" + SYSDYN.HasEquation "if Age==Age0 then -LungCsIIIANoD[Type,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCsIIIANoD[Type,Gender,Age], -1) else -LungCsIIIANoD[Type,Gender,Age]+VECTOR_MAP(LungCsIIIANoD[Type,Gender,Age], -1)*DummyRateForUnitsConversion" CMC.LungCOutputsIBNsDiagnosis : SYSDYN.Auxiliary @L0.tag MOD.Mapped SYSDYN.HasExpressions _ : SYSDYN.Expressions @@ -509,13 +509,13 @@ CMC.LungCsIANoDAgeing : SYSDYN.Valve SYSDYN.HasExpressions _ : SYSDYN.Expressions @L0.list _ : SYSDYN.NormalExpression - SYSDYN.HasEquation "if Age==Age0 then -LungCsIANoD[Type,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCsIANoD[Type,Gender,Age], -1) else -LungCsIANoD[Type,Gender,Age]+VECTOR_MAP(LungCsIANoD[Type,Gender,Age], -1)" + SYSDYN.HasEquation "if Age==Age0 then -LungCsIANoD[Type,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCsIANoD[Type,Gender,Age], -1) else -LungCsIANoD[Type,Gender,Age]+VECTOR_MAP(LungCsIANoD[Type,Gender,Age], -1)*DummyRateForUnitsConversion" CMC.LungCCured1Ageing : SYSDYN.Valve @L0.tag MOD.Mapped SYSDYN.HasExpressions _ : SYSDYN.Expressions @L0.list _ : SYSDYN.NormalExpression - SYSDYN.HasEquation "if Age==Age0 then -LungCCured1[Type,Stage,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCCured1[Type,Stage,Gender,Age], -1) else -LungCCured1[Type,Stage,Gender,Age]+VECTOR_MAP(LungCCured1[Type,Stage,Gender,Age], -1)" + SYSDYN.HasEquation "if Age==Age0 then -LungCCured1[Type,Stage,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCCured1[Type,Stage,Gender,Age], -1) else -LungCCured1[Type,Stage,Gender,Age]+VECTOR_MAP(LungCCured1[Type,Stage,Gender,Age], -1)*DummyRateForUnitsConversion" CMC.LungCProgress03IARate : SYSDYN.Auxiliary @L0.tag MOD.Mapped SYSDYN.HasExpressions _ : SYSDYN.Expressions @@ -665,7 +665,7 @@ CMC.LungCDAgeing : SYSDYN.Valve SYSDYN.HasExpressions _ : SYSDYN.Expressions @L0.list _ : SYSDYN.NormalExpression - SYSDYN.HasEquation "if Age==Age0 then -LungCD[Type,Stage,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCD[Type,Stage,Gender,Age], -1) else -LungCD[Type,Stage,Gender,Age]+VECTOR_MAP(LungCD[Type,Stage,Gender,Age], -1)" + SYSDYN.HasEquation "if Age==Age0 then -LungCD[Type,Stage,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCD[Type,Stage,Gender,Age], -1) else -LungCD[Type,Stage,Gender,Age]+VECTOR_MAP(LungCD[Type,Stage,Gender,Age], -1)*DummyRateForUnitsConversion" CMC.LungCOutputProgressing2 : SYSDYN.Auxiliary @L0.tag MOD.Mapped SYSDYN.HasExpressions _ : SYSDYN.Expressions @@ -678,7 +678,7 @@ CMC.LungCT1ProgressingAgeing : SYSDYN.Valve SYSDYN.HasExpressions _ : SYSDYN.Expressions @L0.list _ : SYSDYN.NormalExpression - SYSDYN.HasEquation "if Age==Age0 then -LungCT1Progressing[Type,Stage,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCT1Progressing[Type,Stage,Gender,Age], -1) else -LungCT1Progressing[Type,Stage,Gender,Age]+VECTOR_MAP(LungCT1Progressing[Type,Stage,Gender,Age], -1)" + SYSDYN.HasEquation "if Age==Age0 then -LungCT1Progressing[Type,Stage,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCT1Progressing[Type,Stage,Gender,Age], -1) else -LungCT1Progressing[Type,Stage,Gender,Age]+VECTOR_MAP(LungCT1Progressing[Type,Stage,Gender,Age], -1)*DummyRateForUnitsConversion" CMC.LungCT1ProgToDisabling : SYSDYN.Valve @L0.tag MOD.Mapped SYSDYN.HasExpressions _ : SYSDYN.Expressions @@ -725,7 +725,7 @@ CMC.LungCT2ProgressingAgeing : SYSDYN.Valve SYSDYN.HasExpressions _ : SYSDYN.Expressions @L0.list _ : SYSDYN.NormalExpression - SYSDYN.HasEquation "if Age==Age0 then -LungCT2Progressing[Type,Stage,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCT2Progressing[Type,Stage,Gender,Age], -1) else -LungCT2Progressing[Type,Stage,Gender,Age]+VECTOR_MAP(LungCT2Progressing[Type,Stage,Gender,Age], -1)" + SYSDYN.HasEquation "if Age==Age0 then -LungCT2Progressing[Type,Stage,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCT2Progressing[Type,Stage,Gender,Age], -1) else -LungCT2Progressing[Type,Stage,Gender,Age]+VECTOR_MAP(LungCT2Progressing[Type,Stage,Gender,Age], -1)*DummyRateForUnitsConversion" CMC.LungCTherapy1 : SYSDYN.Valve @L0.tag MOD.Mapped SYSDYN.HasExpressions _ : SYSDYN.Expressions @@ -1068,7 +1068,7 @@ CMC.LungCs01Ageing : SYSDYN.Valve SYSDYN.HasExpressions _ : SYSDYN.Expressions @L0.list _ : SYSDYN.NormalExpression - SYSDYN.HasEquation "if Age==Age0 then -LungCs01[Type,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCs01[Type,Gender,Age], -1) else -LungCs01[Type,Gender,Age]+VECTOR_MAP(LungCs01[Type,Gender,Age], -1)" + SYSDYN.HasEquation "if Age==Age0 then -LungCs01[Type,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCs01[Type,Gender,Age], -1) else -LungCs01[Type,Gender,Age]+VECTOR_MAP(LungCs01[Type,Gender,Age], -1)*DummyRateForUnitsConversion" CMC.LungCOutputsIBNosNoD : SYSDYN.Auxiliary @L0.tag MOD.Mapped SYSDYN.HasExpressions _ : SYSDYN.Expressions @@ -1178,7 +1178,7 @@ CMC.LungCTreated1Ageing : SYSDYN.Valve SYSDYN.HasExpressions _ : SYSDYN.Expressions @L0.list _ : SYSDYN.NormalExpression - SYSDYN.HasEquation "if Age==Age0 then -LungCNotProgressing1[Type,Stage,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCNotProgressing1[Type,Stage,Gender,Age], -1) else -LungCNotProgressing1[Type,Stage,Gender,Age]+VECTOR_MAP(LungCNotProgressing1[Type,Stage,Gender,Age], -1)" + SYSDYN.HasEquation "if Age==Age0 then -LungCNotProgressing1[Type,Stage,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCNotProgressing1[Type,Stage,Gender,Age], -1) else -LungCNotProgressing1[Type,Stage,Gender,Age]+VECTOR_MAP(LungCNotProgressing1[Type,Stage,Gender,Age], -1)*DummyRateForUnitsConversion" CMC.LungCT2DisablingPopCorr : SYSDYN.Valve @L0.tag MOD.Mapped SYSDYN.HasExpressions _ : SYSDYN.Expressions @@ -1394,7 +1394,7 @@ CMC.LungCsIIBNoDAgeing : SYSDYN.Valve SYSDYN.HasExpressions _ : SYSDYN.Expressions @L0.list _ : SYSDYN.NormalExpression - SYSDYN.HasEquation "if Age==Age0 then -LungCsIIBNoD[Type,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCsIIBNoD[Type,Gender,Age], -1) else -LungCsIIBNoD[Type,Gender,Age]+VECTOR_MAP(LungCsIIBNoD[Type,Gender,Age], -1)" + SYSDYN.HasEquation "if Age==Age0 then -LungCsIIBNoD[Type,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCsIIBNoD[Type,Gender,Age], -1) else -LungCsIIBNoD[Type,Gender,Age]+VECTOR_MAP(LungCsIIBNoD[Type,Gender,Age], -1)*DummyRateForUnitsConversion" CMC.LungCProgressIIIAIIIB : SYSDYN.Valve @L0.tag MOD.Mapped SYSDYN.HasExpressions _ : SYSDYN.Expressions @@ -1478,7 +1478,7 @@ CMC.LungCs02Ageing : SYSDYN.Valve SYSDYN.HasExpressions _ : SYSDYN.Expressions @L0.list _ : SYSDYN.NormalExpression - SYSDYN.HasEquation "if Age==Age0 then -LungCs02[Type,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCs02[Type,Gender,Age], -1) else -LungCs02[Type,Gender,Age]+VECTOR_MAP(LungCs02[Type,Gender,Age], -1)" + SYSDYN.HasEquation "if Age==Age0 then -LungCs02[Type,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCs02[Type,Gender,Age], -1) else -LungCs02[Type,Gender,Age]+VECTOR_MAP(LungCs02[Type,Gender,Age], -1)*DummyRateForUnitsConversion" CMC.LungCOutputDisabling1 : SYSDYN.Auxiliary @L0.tag MOD.Mapped SYSDYN.HasExpressions _ : SYSDYN.Expressions @@ -1498,7 +1498,7 @@ CMC.LungCsIIANoDAgeing : SYSDYN.Valve SYSDYN.HasExpressions _ : SYSDYN.Expressions @L0.list _ : SYSDYN.NormalExpression - SYSDYN.HasEquation "if Age==Age0 then -LungCsIIANoD[Type,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCsIIANoD[Type,Gender,Age], -1) else -LungCsIIANoD[Type,Gender,Age]+VECTOR_MAP(LungCsIIANoD[Type,Gender,Age], -1)" + SYSDYN.HasEquation "if Age==Age0 then -LungCsIIANoD[Type,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCsIIANoD[Type,Gender,Age], -1) else -LungCsIIANoD[Type,Gender,Age]+VECTOR_MAP(LungCsIIANoD[Type,Gender,Age], -1)*DummyRateForUnitsConversion" CMC.LungCOutputsIIIANosNoD : SYSDYN.Auxiliary @L0.tag MOD.Mapped SYSDYN.HasExpressions _ : SYSDYN.Expressions @@ -1601,7 +1601,7 @@ CMC.LungCs03Ageing : SYSDYN.Valve SYSDYN.HasExpressions _ : SYSDYN.Expressions @L0.list _ : SYSDYN.NormalExpression - SYSDYN.HasEquation "if Age==Age0 then -LungCs03[Type,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCs03[Type,Gender,Age], -1) else -LungCs03[Type,Gender,Age]+VECTOR_MAP(LungCs03[Type,Gender,Age], -1)" + SYSDYN.HasEquation "if Age==Age0 then -LungCs03[Type,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCs03[Type,Gender,Age], -1) else -LungCs03[Type,Gender,Age]+VECTOR_MAP(LungCs03[Type,Gender,Age], -1)*DummyRateForUnitsConversion" CMC.LungCOutputNsDiagnosis : SYSDYN.Auxiliary @L0.tag MOD.Mapped SYSDYN.HasExpressions _ : SYSDYN.Expressions @@ -1720,7 +1720,7 @@ CMC.LungCsIVNoDAgeing : SYSDYN.Valve SYSDYN.HasExpressions _ : SYSDYN.Expressions @L0.list _ : SYSDYN.NormalExpression - SYSDYN.HasEquation "if Age==Age0 then -LungCsIVNoD[Type,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCsIVNoD[Type,Gender,Age], -1) else -LungCsIVNoD[Type,Gender,Age]+VECTOR_MAP(LungCsIVNoD[Type,Gender,Age], -1)" + SYSDYN.HasEquation "if Age==Age0 then -LungCsIVNoD[Type,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCsIVNoD[Type,Gender,Age], -1) else -LungCsIVNoD[Type,Gender,Age]+VECTOR_MAP(LungCsIVNoD[Type,Gender,Age], -1)*DummyRateForUnitsConversion" CMC.LungCModelPopCorrectionRate : SYSDYN.Auxiliary @L0.tag MOD.Mapped SYSDYN.HasExpressions _ : SYSDYN.Expressions @@ -1832,7 +1832,7 @@ CMC.LungCCured2Ageing : SYSDYN.Valve SYSDYN.HasExpressions _ : SYSDYN.Expressions @L0.list _ : SYSDYN.NormalExpression - SYSDYN.HasEquation "if Age==Age0 then -LungCCured2[Type,Stage,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCCured2[Type,Stage,Gender,Age], -1) else -LungCCured2[Type,Stage,Gender,Age]+VECTOR_MAP(LungCCured2[Type,Stage,Gender,Age], -1)" + SYSDYN.HasEquation "if Age==Age0 then -LungCCured2[Type,Stage,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCCured2[Type,Stage,Gender,Age], -1) else -LungCCured2[Type,Stage,Gender,Age]+VECTOR_MAP(LungCCured2[Type,Stage,Gender,Age], -1)*DummyRateForUnitsConversion" CMC.LungCs03 : SYSDYN.Stock @L0.tag MOD.Mapped SYSDYN.HasExpressions _ : SYSDYN.Expressions @@ -1930,7 +1930,7 @@ CMC.LungCTreated2Ageing : SYSDYN.Valve SYSDYN.HasExpressions _ : SYSDYN.Expressions @L0.list _ : SYSDYN.NormalExpression - SYSDYN.HasEquation "if Age==Age0 then -LungCNotProgressing2[Type,Stage,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCNotProgressing2[Type,Stage,Gender,Age], -1) else -LungCNotProgressing2[Type,Stage,Gender,Age]+VECTOR_MAP(LungCNotProgressing2[Type,Stage,Gender,Age], -1)" + SYSDYN.HasEquation "if Age==Age0 then -LungCNotProgressing2[Type,Stage,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCNotProgressing2[Type,Stage,Gender,Age], -1) else -LungCNotProgressing2[Type,Stage,Gender,Age]+VECTOR_MAP(LungCNotProgressing2[Type,Stage,Gender,Age], -1)*DummyRateForUnitsConversion" CMC.LungCs01IniVal : SYSDYN.Auxiliary @L0.tag MOD.Mapped SYSDYN.HasExpressions _ : SYSDYN.Expressions @@ -2252,7 +2252,7 @@ CMC.LungCsIBNoDAgeing : SYSDYN.Valve SYSDYN.HasExpressions _ : SYSDYN.Expressions @L0.list _ : SYSDYN.NormalExpression - SYSDYN.HasEquation "if Age==Age0 then -LungCsIBNoD[Type,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCsIBNoD[Type,Gender,Age], -1) else -LungCsIBNoD[Type,Gender,Age]+VECTOR_MAP(LungCsIBNoD[Type,Gender,Age], -1)" + SYSDYN.HasEquation "if Age==Age0 then -LungCsIBNoD[Type,Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCsIBNoD[Type,Gender,Age], -1) else -LungCsIBNoD[Type,Gender,Age]+VECTOR_MAP(LungCsIBNoD[Type,Gender,Age], -1)*DummyRateForUnitsConversion" CMC.LungCOutputNosDiagnosis : SYSDYN.Auxiliary @L0.tag MOD.Mapped SYSDYN.HasExpressions _ : SYSDYN.Expressions @@ -2812,7 +2812,7 @@ CMC.LungCHealthyAgeing : SYSDYN.Valve SYSDYN.HasExpressions _ : SYSDYN.Expressions @L0.list _ : SYSDYN.NormalExpression - SYSDYN.HasEquation "(if Age==Age0 then -LungCHealthy[Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCHealthy[Gender,Age], -1) else -LungCHealthy[Gender,Age]+VECTOR_MAP(LungCHealthy[Gender,Age], -1))" + SYSDYN.HasEquation "(if Age==Age0 then -LungCHealthy[Gender,Age] elseif Age==Age100 then +VECTOR_MAP(LungCHealthy[Gender,Age], -1) else -LungCHealthy[Gender,Age]+VECTOR_MAP(LungCHealthy[Gender,Age], -1))*DummyRateForUnitsConversion" CMC.LungCsIVNoD : SYSDYN.Stock @L0.tag MOD.Mapped SYSDYN.HasExpressions _ : SYSDYN.Expressions @@ -4248,7 +4248,7 @@ CMC.TotalPopulationDeath : SYSDYN.Auxiliary SYSDYN.HasExpressions _ : SYSDYN.Expressions @L0.list _ : SYSDYN.NormalExpression - SYSDYN.HasEquation "if Age==Age99 then (TotalPopulation[Gender,Age99]+TotalPopulation[Gender,Age100]-TotalPopulationT1[Gender,Age100])/4 elseif Age==Age100 then (TotalPopulation[Gender,Age99]+TotalPopulation[Gender,Age100]-TotalPopulationT1[Gender,Age100])*3/4 else VECTOR_MAP(TotalPopulation[Gender,Age], 0)-VECTOR_MAP(TotalPopulationT1[Gender,Age], 1)" + SYSDYN.HasEquation "if Age==Age99 then (TotalPopulation[Gender,Age99]+TotalPopulation[Gender,Age100]-TotalPopulationT1[Gender,Age100])/4 elseif Age==Age100 then (TotalPopulation[Gender,Age99]+TotalPopulation[Gender,Age100]-TotalPopulationT1[Gender,Age100])*3/4 else VECTOR_MAP(TotalPopulation[Gender,Age], 0)-VECTOR_MAP(TotalPopulationT1[Gender,Age], 1)*DummyRateForUnitsConversion" CMC.d6 : SYSDYN.Dependency @WM.conf_dependency CMC.TotalPopulationDeath CMC.TotalPopulation diff --git a/org.simantics.sysdyn.ontology/mdl2pgraph.pl b/org.simantics.sysdyn.ontology/mdl2pgraph.pl index 3e0f83c6..dc58c5ed 100755 --- a/org.simantics.sysdyn.ontology/mdl2pgraph.pl +++ b/org.simantics.sysdyn.ontology/mdl2pgraph.pl @@ -123,6 +123,7 @@ sub token2str { my $subthen = token2str($tokens); match($tokens, 'Comma'); my $subelse = token2str($tokens); # TODO doesn't support elseif yet.. + match($tokens, 'CloseParen'); $else = "elseif $subcheck then $subthen else $subelse"; } else { $else = "else ".token2str($tokens)."";