Copyright © DLR Institute of System Dynamics and Control |
function createFaultPackageInternal extends FaultTriggering.Utilities.Icons.FaultFunction; input String[:] faultNames = {"driveline.DriveFriction.externalRealFault", "motor.motorKtFault.externalIntegerFault", "motor.speedSensor.externalBooleanFault", "driveline.speedSensor.externalBooleanFault", "driveline.DrivelineDisconnect.constBooleanFault"}; input FaultTriggering.Utilities.Types.FaultType[:] faultType = {4, 5, 6, 6, 3} "fault type:"; input Integer[:] faultChannel = {1, 1, 1, 2, 1} "channel to which each fault is connected"; input Integer faultSizes[3] = {1, 1, 2} "size of the Real, Integer and Boolean faults"; input FaultTriggering.Utilities.Records.Faults faults = FaultTriggering.Utilities.Records.Faults(parameterFaults = FaultTriggering.Utilities.Records.Parameter_Faults(realFaults = {FaultTriggering.Utilities.Records.RealFaults(name = "FaultTriggering.Utilities.Types.Parameter_Fault_Real", path = "FaultTriggering.Examples.ActuatorExample.ActuatorFaultBus.driveline.realFaultConst.constRealFault")}, realValue = {1}, integerFaults = {FaultTriggering.Utilities.Records.IntegerFaults(name = "FaultTriggering.Utilities.Types.Parameter_Fault_Integer", path = "FaultTriggering.Examples.ActuatorExample.ActuatorFaultBus.driveline.integerFaultConst.constIntegerFault")}, integerValue = {1}, booleanFaults = {FaultTriggering.Utilities.Records.BooleanFaults(name = "FaultTriggering.Utilities.Types.Parameter_Fault_Boolean", path = "FaultTriggering.Examples.ActuatorExample.ActuatorFaultBus.driveline.disconnect.constBooleanFault"), FaultTriggering.Utilities.Records.BooleanFaults(name = "FaultTriggering.Utilities.Types.Parameter_Fault_Boolean", path = "FaultTriggering.Examples.ActuatorExample.ActuatorFaultBus.driveline.constantBooleanFault.constBooleanFault")}, booleanValue = {true, false}), variableFaults = FaultTriggering.Utilities.Records.Variable_Faults(realFaults = {FaultTriggering.Utilities.Records.RealFaults(name = "FaultTriggering.Utilities.Types.Variable_Fault_Real", path = "FaultTriggering.Examples.ActuatorExample.ActuatorFaultBus.driveline.friction.externalRealFault")}, realFaultSelect = {1}, realFaultMode = {1}, realFaultDefault = {0.0}, integerFaults = {FaultTriggering.Utilities.Records.IntegerFaults(name = "FaultTriggering.Utilities.Types.Variable_Fault_Integer", path = "FaultTriggering.Examples.ActuatorExample.ActuatorFaultBus.motor.ktFault.externalIntegerFault")}, integerFaultSelect = {1}, integerFaultMode = {1}, integerFaultDefault = {1}, booleanFaults = {FaultTriggering.Utilities.Records.BooleanFaults(name = "FaultTriggering.Utilities.Types.Variable_Fault_Boolean", path = "FaultTriggering.Examples.ActuatorExample.ActuatorFaultBus.loadSpeedSensor.externalBooleanFault"), FaultTriggering.Utilities.Records.BooleanFaults(name = "FaultTriggering.Utilities.Types.Variable_Fault_Boolean", path = "FaultTriggering.Examples.ActuatorExample.ActuatorFaultBus.motor.speedSensor.externalBooleanFault"), FaultTriggering.Utilities.Records.BooleanFaults(name = "FaultTriggering.Utilities.Types.Variable_Fault_Boolean", path = "FaultTriggering.Examples.ActuatorExample.ActuatorFaultBus.driveline.speedSensor.externalBooleanFault"), FaultTriggering.Utilities.Records.BooleanFaults(name = "FaultTriggering.Utilities.Types.Variable_Fault_Boolean", path = "FaultTriggering.Examples.ActuatorExample.ActuatorFaultBus.driveline.bearing.fault.externalBooleanFault")}, booleanFaultSelect = {1, 2, 3, 4}, booleanFaultMode = {1, 1, 1, 1}, booleanFaultDefault = {true, true, false, false})); input String modelName = "FaultTriggering.Examples.ActuatorExample.ActuatorFaultBus" "Model name"; input String packageName = "Faults.mo"; input Boolean overWriteScripts = false "Replaces existing models without propmpting" annotation( choices(checkBox = true)); output String[:] name "name of component"; output String[:] extendsTo "extending to"; output Integer[:] extensionDepths "extension depth"; output Boolean[:] finalVariable "indicates if it is the final extension"; end createFaultPackageInternal;