@@ -57,6 +57,9 @@ void setStartValues(ModelInstance *comp) {
5757 strncpy (M (Binary_input ), BINARY_START , BINARY_MAX_LEN );
5858 M (Binary_output_size ) = strlen (BINARY_START );
5959 strncpy (M (Binary_output ), BINARY_START , BINARY_MAX_LEN );
60+
61+ M (Enumeration_input ) = Option1 ;
62+ M (Enumeration_output ) = Option1 ;
6063}
6164
6265Status calculateValues (ModelInstance * comp ) {
@@ -88,6 +91,8 @@ Status calculateValues(ModelInstance *comp) {
8891 M (Binary_output_size ) = M (Binary_input_size );
8992 memcpy (M (Binary_output ), M (Binary_input ), M (Binary_input_size ));
9093
94+ M (Enumeration_output ) = M (Enumeration_input );
95+
9196 return OK ;
9297}
9398
@@ -237,6 +242,14 @@ Status getInt32(ModelInstance* comp, ValueReference vr, int32_t values[], size_t
237242 case vr_Int32_output :
238243 values [(* index )++ ] = M (Int32_output );
239244 break ;
245+ #if FMI_VERSION == 1 || FMI_VERSION == 2
246+ case vr_Enumeration_input :
247+ values [(* index )++ ] = M (Enumeration_input );
248+ break ;
249+ case vr_Enumeration_output :
250+ values [(* index )++ ] = M (Enumeration_output );
251+ break ;
252+ #endif
240253 default :
241254 logError (comp , "Get Int32 is not allowed for value reference %u." , vr );
242255 return Error ;
@@ -275,6 +288,14 @@ Status getInt64(ModelInstance* comp, ValueReference vr, int64_t values[], size_t
275288 case vr_Int64_output :
276289 values [(* index )++ ] = M (Int64_output );
277290 break ;
291+ #if FMI_VERSION == 3
292+ case vr_Enumeration_input :
293+ values [(* index )++ ] = M (Enumeration_input );
294+ break ;
295+ case vr_Enumeration_output :
296+ values [(* index )++ ] = M (Enumeration_output );
297+ break ;
298+ #endif
278299 default :
279300 logError (comp , "Get Int64 is not allowed for value reference %u." , vr );
280301 return Error ;
@@ -517,6 +538,15 @@ Status setInt32(ModelInstance* comp, ValueReference vr, const int32_t values[],
517538 case vr_Int32_input :
518539 M (Int32_input ) = values [(* index )++ ];
519540 break ;
541+ #if FMI_VERSION == 1 || FMI_VERSION == 2
542+ case vr_Enumeration_input :
543+ if (values [* index ] != Option1 && values [* index ] != Option2 ) {
544+ logError (comp , "%d is not a legal value for Enumeration_input." , values [* index ]);
545+ return Error ;
546+ }
547+ M (Enumeration_input ) = values [(* index )++ ];
548+ break ;
549+ #endif
520550 default :
521551 logError (comp , "Set Int32 is not allowed for value reference %u." , vr );
522552 return Error ;
@@ -553,6 +583,15 @@ Status setInt64(ModelInstance* comp, ValueReference vr, const int64_t values[],
553583 case vr_Int64_input :
554584 M (Int64_input ) = values [(* index )++ ];
555585 break ;
586+ #if FMI_VERSION == 3
587+ case vr_Enumeration_input :
588+ if (values [* index ] != Option1 && values [* index ] != Option2 ) {
589+ logError (comp , "%llu is not a legal value for Enumeration_input." , values [* index ]);
590+ return Error ;
591+ }
592+ M (Enumeration_input ) = values [(* index )++ ];
593+ break ;
594+ #endif
556595 default :
557596 logError (comp , "Set Int64 is not allowed for value reference %u." , vr );
558597 return Error ;
0 commit comments