This Function gathers all the faults in the model modelName, sets the values of the faults and saves it into the modelica script scriptName. The Integer maxSearchSize is needed to preallocate the number of searched elements.
Unfortunately it is impossibke to read the default values directly from the model using the ModelManagement.Structure.AST libray, therefore all parameter values are set to 0, and all variable faults to index 1 by default.
Copyright © DLR Institute of System Dynamics and Control |
function faultProcessingForFaultBus extends FaultTriggering.Utilities.Icons.FaultFunction; input String modelName = "FaultTriggering.Examples.ActuatorExample.Actuator" "Model name"; input String scriptName = "SetFaults.mos" "Name of output script"; input Boolean overWriteScripts = false "Replaces existing models without propmpting" annotation( choices(checkBox = true)); output String[:] realFaultParameterNames; output String[:] integerFaultParameterNames; output String[:] booleanFaultParameterNames; output String[:] realFaultNames; output String[:] integerFaultNames; output String[:] booleanFaultNames; output FaultTriggering.Utilities.Records.Faults faults; end faultProcessingForFaultBus;