@@ -634,7 +634,20 @@ fmi2Status fmi2GetInteger(fmi2Component c, const fmi2ValueReference vr[], size_t
634634 return fmi2Error ;
635635 if (nvr > 0 && nullPointer (comp , "fmi2GetInteger" , "value[]" , value ))
636636 return fmi2Error ;
637- for (i = 0 ; i < nvr ; i ++ ) {
637+
638+ if (comp -> _need_update )
639+ {
640+ comp -> fmuData -> callback -> functionODE (comp -> fmuData , comp -> threadData );
641+ overwriteOldSimulationData (comp -> fmuData );
642+ comp -> fmuData -> callback -> functionAlgebraics (comp -> fmuData , comp -> threadData );
643+ comp -> fmuData -> callback -> output_function (comp -> fmuData , comp -> threadData );
644+ comp -> fmuData -> callback -> function_storeDelayed (comp -> fmuData , comp -> threadData );
645+ storePreValues (comp -> fmuData );
646+ comp -> _need_update = 0 ;
647+ }
648+
649+ for (i = 0 ; i < nvr ; i ++ )
650+ {
638651 if (vrOutOfRange (comp , "fmi2GetInteger" , vr [i ], NUMBER_OF_INTEGERS ))
639652 return fmi2Error ;
640653 value [i ] = getInteger (comp , vr [i ]); // to be implemented by the includer of this file
@@ -653,6 +666,18 @@ fmi2Status fmi2GetBoolean(fmi2Component c, const fmi2ValueReference vr[], size_t
653666 return fmi2Error ;
654667 if (nvr > 0 && nullPointer (comp , "fmi2GetBoolean" , "value[]" , value ))
655668 return fmi2Error ;
669+
670+ if (comp -> _need_update )
671+ {
672+ comp -> fmuData -> callback -> functionODE (comp -> fmuData , comp -> threadData );
673+ overwriteOldSimulationData (comp -> fmuData );
674+ comp -> fmuData -> callback -> functionAlgebraics (comp -> fmuData , comp -> threadData );
675+ comp -> fmuData -> callback -> output_function (comp -> fmuData , comp -> threadData );
676+ comp -> fmuData -> callback -> function_storeDelayed (comp -> fmuData , comp -> threadData );
677+ storePreValues (comp -> fmuData );
678+ comp -> _need_update = 0 ;
679+ }
680+
656681 for (i = 0 ; i < nvr ; i ++ )
657682 {
658683 if (vrOutOfRange (comp , "fmi2GetBoolean" , vr [i ], NUMBER_OF_BOOLEANS ))
@@ -673,7 +698,20 @@ fmi2Status fmi2GetString(fmi2Component c, const fmi2ValueReference vr[], size_t
673698 return fmi2Error ;
674699 if (nvr > 0 && nullPointer (comp , "fmi2GetString" , "value[]" , value ))
675700 return fmi2Error ;
676- for (i = 0 ; i < nvr ; i ++ ) {
701+
702+ if (comp -> _need_update )
703+ {
704+ comp -> fmuData -> callback -> functionODE (comp -> fmuData , comp -> threadData );
705+ overwriteOldSimulationData (comp -> fmuData );
706+ comp -> fmuData -> callback -> functionAlgebraics (comp -> fmuData , comp -> threadData );
707+ comp -> fmuData -> callback -> output_function (comp -> fmuData , comp -> threadData );
708+ comp -> fmuData -> callback -> function_storeDelayed (comp -> fmuData , comp -> threadData );
709+ storePreValues (comp -> fmuData );
710+ comp -> _need_update = 0 ;
711+ }
712+
713+ for (i = 0 ; i < nvr ; i ++ )
714+ {
677715 if (vrOutOfRange (comp , "fmi2GetString" , vr [i ], NUMBER_OF_STRINGS ))
678716 return fmi2Error ;
679717 value [i ] = getString (comp , vr [i ]); // to be implemented by the includer of this file
0 commit comments