Intended Re-definition of parameters in simulink, overshadowing of parameter values
In C-Code there is a way to define a parameter using the #ifndef pre-processor directive. Is there a way to replicate this mechanism in Simulink, using data dictionaries?
For example, assume a vehicle system consisting of various subsystems. For this example assume a brake control system and an engine control system. To perform their calculations, both systems require to know the parameter "VehicleMass", so they define it as a parameter in their models. However, when they get integrated in a higher level vehicle model, the "VehicleMass" should best be described on the vehicle model level, to avoid incompatible / inconsistent definitions. But if it is define on vehicle model level, from my understanding it is currently required to first delete the lower level definitions, in order to avoid re-definition failures.
That causes another issue though, because if either of those lower level models is meant to be re-used, it can not be guaranteed that the top level integration model will always provide this value. What if the lower level model is meant to be standalone?
In C-Code, #ifndef checks if a value is already defined. If yes, that higher value is used. If no, a definition is done at this level. This mechanism prevents the issue described above.
In addition to parameters, I am experiencing the same issue with datatype definitions, so the lower level models use a given enum, but that enum might also be available in an integration environment.In C-Code there is a way to define a parameter using the #ifndef pre-processor directive. Is there a way to replicate this mechanism in Simulink, using data dictionaries?
For example, assume a vehicle system consisting of various subsystems. For this example assume a brake control system and an engine control system. To perform their calculations, both systems require to know the parameter "VehicleMass", so they define it as a parameter in their models. However, when they get integrated in a higher level vehicle model, the "VehicleMass" should best be described on the vehicle model level, to avoid incompatible / inconsistent definitions. But if it is define on vehicle model level, from my understanding it is currently required to first delete the lower level definitions, in order to avoid re-definition failures.
That causes another issue though, because if either of those lower level models is meant to be re-used, it can not be guaranteed that the top level integration model will always provide this value. What if the lower level model is meant to be standalone?
In C-Code, #ifndef checks if a value is already defined. If yes, that higher value is used. If no, a definition is done at this level. This mechanism prevents the issue described above.
In addition to parameters, I am experiencing the same issue with datatype definitions, so the lower level models use a given enum, but that enum might also be available in an integration environment. In C-Code there is a way to define a parameter using the #ifndef pre-processor directive. Is there a way to replicate this mechanism in Simulink, using data dictionaries?
For example, assume a vehicle system consisting of various subsystems. For this example assume a brake control system and an engine control system. To perform their calculations, both systems require to know the parameter "VehicleMass", so they define it as a parameter in their models. However, when they get integrated in a higher level vehicle model, the "VehicleMass" should best be described on the vehicle model level, to avoid incompatible / inconsistent definitions. But if it is define on vehicle model level, from my understanding it is currently required to first delete the lower level definitions, in order to avoid re-definition failures.
That causes another issue though, because if either of those lower level models is meant to be re-used, it can not be guaranteed that the top level integration model will always provide this value. What if the lower level model is meant to be standalone?
In C-Code, #ifndef checks if a value is already defined. If yes, that higher value is used. If no, a definition is done at this level. This mechanism prevents the issue described above.
In addition to parameters, I am experiencing the same issue with datatype definitions, so the lower level models use a given enum, but that enum might also be available in an integration environment. parameter, simulink, data dictionary MATLAB Answers — New Questions