From 4413ae6b03db3ae134fc725507e1c677b5112f5f Mon Sep 17 00:00:00 2001 From: rfranke Date: Wed, 24 May 2023 11:31:13 +0200 Subject: [PATCH] Remove duplicate check for top level IOs in BackendVariable NFConvertDAE.makeDAEVar takes care of this. An additional check in BackendVariable only effects the model structure and not the list of model variables and thus may cause contradictions, e.g. when using --nonStdExposeLocalIOs, see #10599. --- .../Compiler/BackEnd/BackendVariable.mo | 18 ++-- .../fmu/modelExchange/2.0/exposeLocalIOs.mos | 86 ++++++++++--------- 2 files changed, 56 insertions(+), 48 deletions(-) diff --git a/OMCompiler/Compiler/BackEnd/BackendVariable.mo b/OMCompiler/Compiler/BackEnd/BackendVariable.mo index b118fb7e98f..d80fa64f33d 100644 --- a/OMCompiler/Compiler/BackEnd/BackendVariable.mo +++ b/OMCompiler/Compiler/BackEnd/BackendVariable.mo @@ -2042,18 +2042,20 @@ algorithm kind := getVarKind(var); end getVarKindForVar; -public function isVarOnTopLevelAndOutput "and has the DAE.VarDirection = OUTPUT - The check for top-model is done by spliting the name at \'.\' and - check if the list-length is 1" +public function isVarOnTopLevelAndOutput "has the DAE.VarDirection = OUTPUT + Don't check for top level here as this is done by NFConvertDAE.makeDAEVar. + Otherwise the list of model variables may contradict with model structure, e.g. with --nonStdExposeLocalIOs." input BackendDAE.Var inVar; - output Boolean outBoolean = DAEUtil.topLevelOutput(inVar.varName, inVar.varDirection, inVar.connectorType); + //output Boolean outBoolean = DAEUtil.topLevelOutput(inVar.varName, inVar.varDirection, inVar.connectorType); + output Boolean outBoolean = isOutputVar(inVar); end isVarOnTopLevelAndOutput; -public function isVarOnTopLevelAndInput "and has the DAE.VarDirection = INPUT - The check for top-model is done by splitting the name at '.' and checking if - the list-length is 1." +public function isVarOnTopLevelAndInput "has the DAE.VarDirection = INPUT + Don't check for top level here as this is done by NFConvertDAE.makeDAEVar. + Otherwise the list of model variables may contradict with model structure, e.g. with --nonStdExposeLocalIOs." input BackendDAE.Var inVar; - output Boolean outBoolean = DAEUtil.topLevelInput(inVar.varName, inVar.varDirection, inVar.connectorType); + //output Boolean outBoolean = DAEUtil.topLevelInput(inVar.varName, inVar.varDirection, inVar.connectorType); + output Boolean outBoolean = isInput(inVar); end isVarOnTopLevelAndInput; public function isVarOnTopLevelAndInputNoDerInput diff --git a/testsuite/openmodelica/cppruntime/fmu/modelExchange/2.0/exposeLocalIOs.mos b/testsuite/openmodelica/cppruntime/fmu/modelExchange/2.0/exposeLocalIOs.mos index 01df9bb9fd3..faacae6f042 100644 --- a/testsuite/openmodelica/cppruntime/fmu/modelExchange/2.0/exposeLocalIOs.mos +++ b/testsuite/openmodelica/cppruntime/fmu/modelExchange/2.0/exposeLocalIOs.mos @@ -95,8 +95,7 @@ readFile("modelDescription.tmp.xml"); // true // "" // "LocalIOs.System.fmu" -// "Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->Show additional information from the initialization process, in OMNotebook call setCommandLineOptions(\"-d=initialization\"). -// " +// "" // 0 // " // // // -// +// name=\"component.measurement\" +// valueReference=\"1\" +// causality=\"output\" +// > +// // // // // // // // // @@ -148,7 +148,7 @@ readFile("modelDescription.tmp.xml"); // // // @@ -156,7 +156,7 @@ readFile("modelDescription.tmp.xml"); // // // @@ -164,95 +164,94 @@ readFile("modelDescription.tmp.xml"); // // // // // // -// +// // // // -// +// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // @@ -267,8 +266,15 @@ readFile("modelDescription.tmp.xml"); // // // +// +// +// +// +// // +// // +// // // //