Skip to content

Commit

Permalink
- Fixed FMI import code generation.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@23724 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Dec 11, 2014
1 parent a138e6b commit 3917aaf
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions Compiler/Template/CodegenFMU.tpl
Expand Up @@ -1919,9 +1919,9 @@ case FMIIMPORT(fmiInfo=INFO(__),fmiExperimentAnnotation=EXPERIMENTANNOTATION(__)
parameter Real flowInitInputs(fixed=false);
Real flowStatesInputs;
<%if not stringEq(realInputVariablesVRs, "") then "Real "+realInputVariablesReturnNames+";"%>
<%if not stringEq(integerInputVariablesVRs, "") then "Real "+integerInputVariablesReturnNames+";"%>
<%if not stringEq(booleanInputVariablesVRs, "") then "Real "+booleanInputVariablesReturnNames+";"%>
<%if not stringEq(stringInputVariablesVRs, "") then "Real "+stringInputVariablesReturnNames+";"%>
<%if not stringEq(integerInputVariablesVRs, "") then "Integer "+integerInputVariablesReturnNames+";"%>
<%if not stringEq(booleanInputVariablesVRs, "") then "Boolean "+booleanInputVariablesReturnNames+";"%>
<%if not stringEq(stringInputVariablesVRs, "") then "String "+stringInputVariablesReturnNames+";"%>
Boolean callEventUpdate;
constant Boolean intermediateResults = false;
Boolean newStatesAvailable(fixed = true);
Expand All @@ -1940,7 +1940,6 @@ case FMIIMPORT(fmiInfo=INFO(__),fmiExperimentAnnotation=EXPERIMENTANNOTATION(__)
<%if not stringEq(realParametersVRs, "") then "flowParamsStart := fmi1Functions.fmi1SetRealParameter(fmi1me, {"+realParametersVRs+"}, {"+realParametersNames+"});"%>
<%if not stringEq(integerParametersVRs, "") then "flowParamsStart := fmi1Functions.fmi1SetIntegerParameter(fmi1me, {"+integerParametersVRs+"}, {"+integerParametersNames+"});"%>
<%if not stringEq(booleanParametersVRs, "") then "flowParamsStart := fmi1Functions.fmi1SetBooleanParameter(fmi1me, {"+booleanParametersVRs+"}, {"+booleanParametersNames+"});"%>
<%/*Opening the below line fails the JuliansBib.mos test. fmiSetString returns out of memmory error. TODO: check the implementation of fmisetstring.*/%>
<%if not stringEq(stringParametersVRs, "") then "flowParamsStart := fmi1Functions.fmi1SetStringParameter(fmi1me, {"+stringParametersVRs+"}, {"+stringParametersNames+"});"%>
flowInitInputs:=1;
initial equation
Expand Down Expand Up @@ -2134,7 +2133,7 @@ case FMIIMPORT(fmiInfo=INFO(__),fmiExperimentAnnotation=EXPERIMENTANNOTATION(__)
input FMI1ModelExchange fmi1me;
input Real booleanValueReferences[:];
input Boolean booleanValues[size(booleanValueReferences, 1)];
output Integer outValues[size(booleanValueReferences, 1)] = booleanValues;
output Boolean outValues[size(booleanValueReferences, 1)] = booleanValues;
external "C" fmi1SetBoolean_OMC(fmi1me, size(booleanValueReferences, 1), booleanValueReferences, booleanValues, 1) annotation(Library = {"OpenModelicaFMIRuntimeC", "fmilib"<%if stringEq(platform, "win32") then ", \"shlwapi\""%>});
end fmi1SetBoolean;

Expand All @@ -2158,7 +2157,7 @@ case FMIIMPORT(fmiInfo=INFO(__),fmiExperimentAnnotation=EXPERIMENTANNOTATION(__)
input FMI1ModelExchange fmi1me;
input Real stringValueReferences[:];
input String stringValues[size(stringValueReferences, 1)];
output Integer outValues[size(stringValueReferences, 1)] = stringValues;
output String outValues[size(stringValueReferences, 1)] = stringValues;
external "C" fmi1SetString_OMC(fmi1me, size(stringValueReferences, 1), stringValueReferences, stringValues, 1) annotation(Library = {"OpenModelicaFMIRuntimeC", "fmilib"<%if stringEq(platform, "win32") then ", \"shlwapi\""%>});
end fmi1SetString;

Expand Down Expand Up @@ -2714,7 +2713,7 @@ case FMIIMPORT(fmiInfo=INFO(__),fmiExperimentAnnotation=EXPERIMENTANNOTATION(__)
input FMI1CoSimulation fmi1cs;
input Real booleanValuesReferences[:];
input Boolean booleanValues[size(booleanValuesReferences, 1)];
output Real out_Values[size(booleanValuesReferences, 1)];
output Boolean out_Values[size(booleanValuesReferences, 1)];
external "C" fmi1SetBoolean_OMC(fmi1cs, size(booleanValuesReferences, 1), booleanValuesReferences, booleanValues, out_Values, 2) annotation(Library = {"OpenModelicaFMIRuntimeC", "fmilib"<%if stringEq(platform, "win32") then ", \"shlwapi\""%>});
end fmi1SetBoolean;

Expand All @@ -2730,7 +2729,7 @@ case FMIIMPORT(fmiInfo=INFO(__),fmiExperimentAnnotation=EXPERIMENTANNOTATION(__)
input FMI1CoSimulation fmi1cs;
input Real stringValuesReferences[:];
input String stringValues[size(stringValuesReferences, 1)];
output Real out_Values[size(stringValuesReferences, 1)];
output String out_Values[size(stringValuesReferences, 1)];
external "C" fmi1SetString_OMC(fmi1cs, size(stringValuesReferences, 1), stringValuesReferences, stringValues, out_Values, 2) annotation(Library = {"OpenModelicaFMIRuntimeC", "fmilib"<%if stringEq(platform, "win32") then ", \"shlwapi\""%>});
end fmi1SetString;
end fmi1Functions;
Expand Down

0 comments on commit 3917aaf

Please sign in to comment.