diff --git a/FaultTriggering/Examples/ActuatorExample/ActuatorPackage.mo b/FaultTriggering/Examples/ActuatorExample/ActuatorPackage.mo index d52a687..47606e0 100644 --- a/FaultTriggering/Examples/ActuatorExample/ActuatorPackage.mo +++ b/FaultTriggering/Examples/ActuatorExample/ActuatorPackage.mo @@ -10,16 +10,19 @@ constBooleanFault = faultTrigger.faultRecord.parameterFaults. constBooleanFault = faultTrigger.faultRecord.parameterFaults.booleanValue[2]), friction( externalRealFault = FaultTriggering.Utilities.Types.Variable_Fault_Real( - externalFaultOn=true,faultIndex=1,faultMode=1)), + externalFaultOn=true,faultIndex=1,faultMode=faultTrigger.faultRecord.variableFaults.realFaultMode[1])), bearing(fault( externalBooleanFault = FaultTriggering.Utilities.Types.Variable_Fault_Boolean( - externalFaultOn=true,faultIndex=2,faultMode=1)))), motor(ktFault( + externalFaultOn=true,faultIndex=2,faultMode=faultTrigger.faultRecord.variableFaults.booleanFaultMode[2])))), + motor(ktFault( externalIntegerFault = FaultTriggering.Utilities.Types.Variable_Fault_Integer( - externalFaultOn=true,faultIndex=1,faultMode=1)), speedSensor( + externalFaultOn=true,faultIndex=1,faultMode=faultTrigger.faultRecord.variableFaults.integerFaultMode[1])), + speedSensor( externalBooleanFault = FaultTriggering.Utilities.Types.Variable_Fault_Boolean( - externalFaultOn=true,faultIndex=1,faultMode=1)))); + externalFaultOn=true,faultIndex=1,faultMode=faultTrigger.faultRecord.variableFaults.booleanFaultMode[1])))); inner FaultTriggerController faultTrigger annotation (Placement(transformation(extent={{60,60},{80,80}}))); + annotation (experiment(StopTime=10, Interval=0.001)); end ActuatorWrapper; model FaultTriggerController @@ -30,9 +33,9 @@ ActuatorPackage.Interfaces.Faults faults annotation (Placement(transformation(extent={{84,-20},{124,20}}))); public Modelica.Blocks.Sources.BooleanStep motorSpeedSensor(startTime=0.6) - annotation (Placement(transformation(extent={{-38,-24},{-18,-4}}))); + annotation (Placement(transformation(extent={{-40,-24},{-20,-4}}))); Modelica.Blocks.Sources.BooleanStep drivelineBearing(startTime=0.8) - annotation (Placement(transformation(extent={{-38,-54},{-18,-34}}))); + annotation (Placement(transformation(extent={{-40,-54},{-20,-34}}))); Modelica.Blocks.Sources.IntegerStep motorKtFailure(startTime=0.2, offset=1) annotation (Placement(transformation(extent={{-40,40},{-20,60}}))); Modelica.Blocks.Sources.Step drivelineFriction(startTime=0.4) @@ -49,66 +52,67 @@ booleanFault[2] = faults.driveline.bearing.fault.externalBooleanFault; smooth=Smooth.None)); connect(motorSpeedSensor.y, faults.motor.speedSensor.externalBooleanFault) annotation (Line( - points={{-17,-14},{42,-14},{42,0.1},{104.1,0.1}}, + points={{-19,-14},{40,-14},{40,0.1},{104.1,0.1}}, color={255,0,255}, smooth=Smooth.None)); connect(drivelineFriction.y, faults.driveline.friction.externalRealFault) annotation (Line( - points={{-19,18},{42,18},{42,0.1},{104.1,0.1}}, + points={{-19,18},{40,18},{40,0.1},{104.1,0.1}}, color={0,0,127}, smooth=Smooth.None)); connect(drivelineBearing.y, faults.driveline.bearing.fault.externalBooleanFault) annotation (Line( - points={{-17,-44},{40,-44},{40,0.1},{104.1,0.1}}, + points={{-19,-44},{40,-44},{40,0.1},{104.1,0.1}}, color={255,0,255}, smooth=Smooth.None)); -annotation (defaultComponentPrefixes="inner",defaultComponentName="faultTrigger",Diagram( - coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100, - 100}}), graphics)); +annotation (defaultComponentPrefixes="inner",defaultComponentName="faultTrigger",Diagram(graphics)); end FaultTriggerController; record FaultRecord "Predefined Fault record" extends FaultTriggering.Utilities.Records.Faults( parameterFaults = FaultTriggering.Utilities.Records.Parameter_Faults( - realFaults = {FaultTriggering.Utilities.Records.RealFaults( - name = "", - path = "")}, - realValue = fill(0,0), - integerFaults = {FaultTriggering.Utilities.Records.IntegerFaults( - name = "", - path = "")}, - integerValue = fill(0,0), - booleanFaults = {FaultTriggering.Utilities.Records.BooleanFaults( - name = "FaultTriggering.Utilities.Types.Parameter_Fault_Boolean", - path = "FaultTriggering.Examples.ActuatorExample.Actuator.driveline.disconnect.constBooleanFault"), + realFaults= {FaultTriggering.Utilities.Records.RealFaults( + name= "", + path= "")}, + realValue= fill(0,0), + integerFaults= {FaultTriggering.Utilities.Records.IntegerFaults( + name= "", + path= "")}, + integerValue= fill(0,0), + booleanFaults= {FaultTriggering.Utilities.Records.BooleanFaults( + name= "FaultTriggering.Utilities.Types.Parameter_Fault_Boolean", + path= "FaultTriggering.Examples.ActuatorExample.Actuator.driveline.disconnect.constBooleanFault"), FaultTriggering.Utilities.Records.BooleanFaults( - name = "FaultTriggering.Utilities.Types.Parameter_Fault_Boolean", - path = "FaultTriggering.Examples.ActuatorExample.Actuator.driveline.speedSensor.constBooleanFault")}, - booleanValue = {false, false}), + name= "FaultTriggering.Utilities.Types.Parameter_Fault_Boolean", + path= "FaultTriggering.Examples.ActuatorExample.Actuator.driveline.speedSensor.constBooleanFault")}, + booleanValue= {false, false}), variableFaults = FaultTriggering.Utilities.Records.Variable_Faults( - realFaults = {FaultTriggering.Utilities.Records.RealFaults( - name = "FaultTriggering.Utilities.Types.Variable_Fault_Real", - path = "FaultTriggering.Examples.ActuatorExample.Actuator.driveline.friction.externalRealFault")}, - realFaultSelect = {1}, - realFaultMode = {1}, - integerFaults = {FaultTriggering.Utilities.Records.IntegerFaults( - name = "FaultTriggering.Utilities.Types.Variable_Fault_Integer", - path = "FaultTriggering.Examples.ActuatorExample.Actuator.motor.ktFault.externalIntegerFault")}, - integerFaultSelect = {1}, - integerFaultMode = {1}, - booleanFaults = {FaultTriggering.Utilities.Records.BooleanFaults( - name = "FaultTriggering.Utilities.Types.Variable_Fault_Boolean", - path = "FaultTriggering.Examples.ActuatorExample.Actuator.motor.speedSensor.externalBooleanFault"), + realFaults= {FaultTriggering.Utilities.Records.RealFaults( + name= "FaultTriggering.Utilities.Types.Variable_Fault_Real", + path= "FaultTriggering.Examples.ActuatorExample.Actuator.driveline.friction.externalRealFault")}, + realFaultSelect= {1}, + realFaultMode= {1}, + realFaultDefault= {0}, + integerFaults= {FaultTriggering.Utilities.Records.IntegerFaults( + name= "FaultTriggering.Utilities.Types.Variable_Fault_Integer", + path= "FaultTriggering.Examples.ActuatorExample.Actuator.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.Actuator.motor.speedSensor.externalBooleanFault"), FaultTriggering.Utilities.Records.BooleanFaults( - name = "FaultTriggering.Utilities.Types.Variable_Fault_Boolean", - path = "FaultTriggering.Examples.ActuatorExample.Actuator.driveline.bearing.fault.externalBooleanFault")}, - booleanFaultSelect = {1, 2}, - booleanFaultMode = {1, 1})); + name= "FaultTriggering.Utilities.Types.Variable_Fault_Boolean", + path= "FaultTriggering.Examples.ActuatorExample.Actuator.driveline.bearing.fault.externalBooleanFault")}, + booleanFaultSelect= {1, 2}, + booleanFaultMode= {1, 1}, + booleanFaultDefault= {false, false})); end FaultRecord; connector FaultsInput = input ActuatorPackage.Interfaces.Faults "'input Faults' as connector" annotation (Icon(graphics={Rectangle(extent={{-8,4},{10,0}},lineColor={255,0,0}, - lineThickness = 0.5)})); + lineThickness = 0.5)})); package Interfaces extends FaultTriggering.Utilities.Icons.InterfacesPackage; connector Faults @@ -157,11 +161,5 @@ extends FaultTriggering.Utilities.Icons.FaultSubBus; ActuatorPackage.Interfaces.externalBooleanFault externalBooleanFault; end fault; end Interfaces; - annotation (Documentation(revisions=" - - - -
Copyright -
© 2012-2015, DLR Institute of System Dynamics and Control
-")); + annotation (); end ActuatorPackage; diff --git a/FaultTriggering/Examples/ActuatorExample/ActuatorPackageStatistics.mo b/FaultTriggering/Examples/ActuatorExample/ActuatorPackageStatistics.mo index 12e6301..714c019 100644 --- a/FaultTriggering/Examples/ActuatorExample/ActuatorPackageStatistics.mo +++ b/FaultTriggering/Examples/ActuatorExample/ActuatorPackageStatistics.mo @@ -4,33 +4,34 @@ import FaultTriggering; extends FaultTriggering.Utilities.Icons.Fault; model ActuatorWrapper extends FaultTriggering.Examples.ActuatorExample.Actuator(driveline( - disconnect( + disconnect( constBooleanFault = faultTrigger.faultRecord.parameterFaults.booleanValue[1]), - speedSensor( + speedSensor( constBooleanFault = faultTrigger.faultRecord.parameterFaults.booleanValue[2]), - friction( + friction( externalRealFault = FaultTriggering.Utilities.Types.Variable_Fault_Real( externalFaultOn=true,faultIndex=1,faultMode=faultTrigger.faultRecord.variableFaults.realFaultMode[1])), - bearing(fault( + bearing(fault( externalBooleanFault = FaultTriggering.Utilities.Types.Variable_Fault_Boolean( externalFaultOn=true,faultIndex=2,faultMode=faultTrigger.faultRecord.variableFaults.booleanFaultMode[2])))), - motor(ktFault( + motor(ktFault( externalIntegerFault = FaultTriggering.Utilities.Types.Variable_Fault_Integer( externalFaultOn=true,faultIndex=1,faultMode=faultTrigger.faultRecord.variableFaults.integerFaultMode[1])), - speedSensor( + speedSensor( externalBooleanFault = FaultTriggering.Utilities.Types.Variable_Fault_Boolean( externalFaultOn=true,faultIndex=1,faultMode=faultTrigger.faultRecord.variableFaults.booleanFaultMode[1])))); inner FaultTriggerController faultTrigger annotation (Placement(transformation(extent={{60,60},{80,80}}))); + annotation (experiment(StopTime=10, Interval=0.001)); end ActuatorWrapper; model FaultTriggerController extends FaultTriggering.FaultOutput.Partial_FaultTrigger(realFaultSize = 1,integerFaultSize = 1,booleanFaultSize = 2); parameter FaultRecord faultRecord; - + protected ActuatorPackageStatistics.Interfaces.Faults faults - annotation (Placement(transformation(extent={{84,-20},{124,20}}))); - + annotation (Placement(transformation(extent={{84,-20},{124,20}}))); + public Modelica.Blocks.Sources.IntegerConstant motorKtFailure(k=1) annotation (Placement(transformation(extent={{-40,30},{-20,50}}))); @@ -62,9 +63,9 @@ booleanFault[2] = faults.driveline.bearing.fault.externalBooleanFault; points={{-19,10},{40,10},{40,0.1},{104.1,0.1}}, color={0,0,127}, smooth=Smooth.None)); - connect(failureRateMotorSpeedSensor.y, motorSpeedSensor.u) + connect(failureRateMotorSpeedSensor.y,motorSpeedSensor. u) annotation (Line(points={{-59,-30},{-59,-30},{-42,-30}}, color={0,0,127})); - connect(failureRateDrivelineBearing.y, drivelineBearing.u) + connect(failureRateDrivelineBearing.y,drivelineBearing. u) annotation (Line(points={{-59,-70},{-59,-70},{-42,-70}}, color={0,0,127})); connect(motorSpeedSensor.y, faults.motor.speedSensor.externalBooleanFault) annotation (Line(points={{-19,-30},{10,-30},{40,-30},{40,0.1},{104.1,0.1}}, @@ -78,40 +79,43 @@ end FaultTriggerController; record FaultRecord "Predefined Fault record" extends FaultTriggering.Utilities.Records.Faults( parameterFaults = FaultTriggering.Utilities.Records.Parameter_Faults( - realFaults = {FaultTriggering.Utilities.Records.RealFaults( - name = "", - path = "")}, - realValue = fill(0,0), - integerFaults = {FaultTriggering.Utilities.Records.IntegerFaults( - name = "", - path = "")}, - integerValue = fill(0,0), - booleanFaults = {FaultTriggering.Utilities.Records.BooleanFaults( - name = "FaultTriggering.Utilities.Types.Parameter_Fault_Boolean", - path = "FaultTriggering.Examples.ActuatorExample.Actuator.driveline.disconnect.constBooleanFault"), + realFaults= {FaultTriggering.Utilities.Records.RealFaults( + name= "", + path= "")}, + realValue= fill(0,0), + integerFaults= {FaultTriggering.Utilities.Records.IntegerFaults( + name= "", + path= "")}, + integerValue= fill(0,0), + booleanFaults= {FaultTriggering.Utilities.Records.BooleanFaults( + name= "FaultTriggering.Utilities.Types.Parameter_Fault_Boolean", + path= "FaultTriggering.Examples.ActuatorExample.Actuator.driveline.disconnect.constBooleanFault"), FaultTriggering.Utilities.Records.BooleanFaults( - name = "FaultTriggering.Utilities.Types.Parameter_Fault_Boolean", - path = "FaultTriggering.Examples.ActuatorExample.Actuator.driveline.speedSensor.constBooleanFault")}, - booleanValue = {false, false}), + name= "FaultTriggering.Utilities.Types.Parameter_Fault_Boolean", + path= "FaultTriggering.Examples.ActuatorExample.Actuator.driveline.speedSensor.constBooleanFault")}, + booleanValue= {false, false}), variableFaults = FaultTriggering.Utilities.Records.Variable_Faults( - realFaults = {FaultTriggering.Utilities.Records.RealFaults( - name = "FaultTriggering.Utilities.Types.Variable_Fault_Real", - path = "FaultTriggering.Examples.ActuatorExample.Actuator.driveline.friction.externalRealFault")}, - realFaultSelect = {1}, - realFaultMode = {1}, - integerFaults = {FaultTriggering.Utilities.Records.IntegerFaults( - name = "FaultTriggering.Utilities.Types.Variable_Fault_Integer", - path = "FaultTriggering.Examples.ActuatorExample.Actuator.motor.ktFault.externalIntegerFault")}, - integerFaultSelect = {1}, - integerFaultMode = {1}, - booleanFaults = {FaultTriggering.Utilities.Records.BooleanFaults( - name = "FaultTriggering.Utilities.Types.Variable_Fault_Boolean", - path = "FaultTriggering.Examples.ActuatorExample.Actuator.motor.speedSensor.externalBooleanFault"), + realFaults= {FaultTriggering.Utilities.Records.RealFaults( + name= "FaultTriggering.Utilities.Types.Variable_Fault_Real", + path= "FaultTriggering.Examples.ActuatorExample.Actuator.driveline.friction.externalRealFault")}, + realFaultSelect= {1}, + realFaultMode= {1}, + realFaultDefault= {0}, + integerFaults= {FaultTriggering.Utilities.Records.IntegerFaults( + name= "FaultTriggering.Utilities.Types.Variable_Fault_Integer", + path= "FaultTriggering.Examples.ActuatorExample.Actuator.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.Actuator.motor.speedSensor.externalBooleanFault"), FaultTriggering.Utilities.Records.BooleanFaults( - name = "FaultTriggering.Utilities.Types.Variable_Fault_Boolean", - path = "FaultTriggering.Examples.ActuatorExample.Actuator.driveline.bearing.fault.externalBooleanFault")}, - booleanFaultSelect = {1, 2}, - booleanFaultMode = {1, 2})); + name= "FaultTriggering.Utilities.Types.Variable_Fault_Boolean", + path= "FaultTriggering.Examples.ActuatorExample.Actuator.driveline.bearing.fault.externalBooleanFault")}, + booleanFaultSelect= {1, 2}, + booleanFaultMode= {1, 1}, + booleanFaultDefault= {false, false})); end FaultRecord; connector FaultsInput = input ActuatorPackageStatistics.Interfaces.Faults @@ -165,8 +169,5 @@ extends FaultTriggering.Utilities.Icons.FaultSubBus; ActuatorPackageStatistics.Interfaces.externalBooleanFault externalBooleanFault; end fault; end Interfaces; - annotation (Documentation(info=" -

This package shows the use of a stochastical fault in a simulation. For more information, please see the AdvancedNoise Library on https://github.com/DLR-SR/AdvancedNoise.

-


Using such simulations can help to trigger stochastical faults during a simulation. Such simulations can be done to see if monitoring algorithms can cope with the different times where the faults are triggered.

-")); + annotation (); end ActuatorPackageStatistics; diff --git a/FaultTriggering/FaultOutput/Internal/InternalBooleanFault.mo b/FaultTriggering/FaultOutput/Internal/InternalBooleanFault.mo index 2e2e2c2..225a228 100644 --- a/FaultTriggering/FaultOutput/Internal/InternalBooleanFault.mo +++ b/FaultTriggering/FaultOutput/Internal/InternalBooleanFault.mo @@ -11,7 +11,8 @@ block InternalBooleanFault "Generate variable Fault of type Boolean" Modelica.Blocks.Interfaces.BooleanOutput fault "Final fault value"; FaultTriggering.Utilities.Types.Fault_SelectBooleanFault faultNumber - "Internal variable automatically set by the FaultTriggering library. Do NOT change!" annotation(Dialog(tab="Advanced", enable=false)); + "Internal variable automatically set by the FaultTriggering library. Do NOT change!" + annotation(Dialog(tab="Advanced", enable=false)); equation faultNumber = externalBooleanFault.faultIndex; fault = if externalBooleanFault.externalFaultOn then faultTrigger.booleanFault[faultNumber] else diff --git a/FaultTriggering/FaultOutput/Internal/InternalIntegerFault.mo b/FaultTriggering/FaultOutput/Internal/InternalIntegerFault.mo index 14ca0ef..7dbf8a4 100644 --- a/FaultTriggering/FaultOutput/Internal/InternalIntegerFault.mo +++ b/FaultTriggering/FaultOutput/Internal/InternalIntegerFault.mo @@ -12,7 +12,8 @@ block InternalIntegerFault "Generate variable Fault of type Integer" FaultTriggering.Utilities.Types.Fault_SelectIntegerFault faultNumber - "Internal variable automatically set by the FaultTriggering library. Do NOT change!" annotation(Dialog(tab="Advanced", enable=false)); + "Internal variable automatically set by the FaultTriggering library. Do NOT change!" + annotation(Dialog(tab="Advanced", enable=false)); equation faultNumber = externalIntegerFault.faultIndex; fault = if externalIntegerFault.externalFaultOn then faultTrigger.integerFault[faultNumber] else diff --git a/FaultTriggering/FaultOutput/Internal/InternalRealFault.mo b/FaultTriggering/FaultOutput/Internal/InternalRealFault.mo index 53beeb3..e081e3c 100644 --- a/FaultTriggering/FaultOutput/Internal/InternalRealFault.mo +++ b/FaultTriggering/FaultOutput/Internal/InternalRealFault.mo @@ -11,7 +11,8 @@ block InternalRealFault "Generate variable Fault of type Real" FaultTriggering.Utilities.Types.Fault_SelectRealFault faultNumber - "Internal variable automatically set by the FaultTriggering library. Do NOT change!" annotation(Dialog(tab="Advanced", enable=false)); + "Internal variable automatically set by the FaultTriggering library. Do NOT change!" + annotation(Dialog(tab="Advanced", enable=false)); equation faultNumber = externalRealFault.faultIndex; fault = if externalRealFault.externalFaultOn then faultTrigger.realFault[faultNumber] else diff --git a/FaultTriggering/Resources/Documentation/Images/logo_EU.png b/FaultTriggering/Resources/Documentation/Images/logo_EU.png new file mode 100644 index 0000000..215c544 Binary files /dev/null and b/FaultTriggering/Resources/Documentation/Images/logo_EU.png differ diff --git a/FaultTriggering/Resources/Scripts/Convert_from_0.6.4_to_0.6.5.mos b/FaultTriggering/Resources/Scripts/Convert_from_0.6.4_to_0.6.5.mos new file mode 100644 index 0000000..30d0dff --- /dev/null +++ b/FaultTriggering/Resources/Scripts/Convert_from_0.6.4_to_0.6.5.mos @@ -0,0 +1,7 @@ +// Convert from FaultTriggering 0.6.4 to FaultTriggering 0.6.5 +// clear +convertClear(); +convertClass("FaultTriggering.Utilities.Records.Faults", + "FaultTriggering.Utilities.Records.Obsolete.Faults_Depreciated"); +convertClass("FaultTriggering.Utilities.Records.Variable_Faults", + "FaultTriggering.Utilities.Records.Obsolete.Variable_Faults_Depreciated"); \ No newline at end of file diff --git a/FaultTriggering/Utilities/Icons/Motors.mo b/FaultTriggering/Utilities/Icons/Motors.mo index 4d04031..f67b231 100644 --- a/FaultTriggering/Utilities/Icons/Motors.mo +++ b/FaultTriggering/Utilities/Icons/Motors.mo @@ -1,5 +1,5 @@ within FaultTriggering.Utilities.Icons; -partial class Motors +partial package Motors extends FaultTriggering.Utilities.Icons.Package; annotation (Icon(graphics={ diff --git a/FaultTriggering/Utilities/Internal/Real2BooleanVector.mo b/FaultTriggering/Utilities/Internal/Real2BooleanVector.mo new file mode 100644 index 0000000..774bdfc --- /dev/null +++ b/FaultTriggering/Utilities/Internal/Real2BooleanVector.mo @@ -0,0 +1,15 @@ +within FaultTriggering.Utilities.Internal; +function Real2BooleanVector "converts a real to a boolean" + input Real x[:] "input"; + input Real t=0.5 "threshold"; + output Boolean y[size(x,1)] "output"; + +algorithm + if size(x, 1) > 0 then + for i in 1:size(x, 1) loop + y[i] :=x[i] >= t; + end for; + else + y := fill(true,0); + end if; +end Real2BooleanVector; diff --git a/FaultTriggering/Utilities/Internal/Records/Faults2str.mo b/FaultTriggering/Utilities/Internal/Records/Faults2str.mo index a6ddfd5..5551662 100644 --- a/FaultTriggering/Utilities/Internal/Records/Faults2str.mo +++ b/FaultTriggering/Utilities/Internal/Records/Faults2str.mo @@ -24,11 +24,13 @@ function Faults2str "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"), @@ -42,7 +44,8 @@ function Faults2str "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})); + booleanFaultMode={1,1,1,1}, + booleanFaultDefault={true,true,false,false})); input String comma=","; input Integer level=0; output String y[:]; @@ -346,6 +349,11 @@ algorithm y, {Indention(level + 2) + "realFaultMode = " + RealVector2str(faults.variableFaults.realFaultMode) + ","}); + y := cat( + 1, + y, + {Indention(level + 2) + "realFaultDefault = " + RealVector2str(faults.variableFaults.realFaultDefault) + + ","}); // --------------------------------------------------- // ------------------- Integer faults -------------- @@ -416,6 +424,11 @@ algorithm y, {Indention(level + 2) + "integerFaultMode = " + RealVector2str(faults.variableFaults.integerFaultMode) + ","}); + y := cat( + 1, + y, + {Indention(level + 2) + "integerFaultDefault = " + RealVector2str(faults.variableFaults.integerFaultDefault) + + ","}); // --------------------------------------------------- // ------------------- Boolean faults -------------- @@ -485,7 +498,12 @@ algorithm y := cat( 1, y, - {Indention(level + 2) + "booleanFaultMode = " + RealVector2str(faults.variableFaults.booleanFaultMode)}); + {Indention(level + 2) + "booleanFaultMode = " + RealVector2str(faults.variableFaults.booleanFaultMode) + + ","}); + y := cat( + 1, + y, + {Indention(level + 2) + "booleanFaultDefault = " + BooleanVector2str(faults.variableFaults.booleanFaultDefault)}); // close variable faults y := cat( diff --git a/FaultTriggering/Utilities/Internal/createFaultPackageInternal.mo b/FaultTriggering/Utilities/Internal/createFaultPackageInternal.mo index cdcf469..816c578 100644 --- a/FaultTriggering/Utilities/Internal/createFaultPackageInternal.mo +++ b/FaultTriggering/Utilities/Internal/createFaultPackageInternal.mo @@ -36,11 +36,13 @@ function createFaultPackageInternal "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"), @@ -54,7 +56,8 @@ function createFaultPackageInternal "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})); + booleanFaultMode={1,1,1,1}, + booleanFaultDefault={true,true,false,false})); input String modelName="FaultTriggering.Examples.ActuatorExample.ActuatorFaultBus" "Model name"; input String packageName="Faults.mo"; @@ -83,6 +86,7 @@ protected Integer dummyI; FaultTriggering.Utilities.Types.FaultType name_Type[:] "type of the fault"; Integer loopMax; + Integer totalVariableFaults "total number of variable faults"; Integer modelNameLength; String[:] realFaultParameterPaths; String[:] integerFaultParameterPaths; @@ -271,6 +275,28 @@ assert( not Streams.print("protected", packageName); Streams.print(readAfterDot(modelName) + "Package" + ".Interfaces.Faults faults annotation (Placement(transformation(extent={{84,-20},{124,20}})));", packageName); + +totalVariableFaults :=size(faults.variableFaults.realFaults, 1) + size(faults.variableFaults.integerFaults, + 1) + size(faults.variableFaults.booleanFaults, 1); + + // -------------------------- add default blocks ------------------------------- + + for nameNr in 1:size(faultNames, 1) loop + if faultType[nameNr] == FaultTriggering.Utilities.Types.FaultType.realVar then + Streams.print("Modelica.Blocks.Sources.Constant " + Strings.replace(readToLastDot(faultNames[nameNr]),".","_") + + "(k = faultRecord.variableFaults.realFaultDefault["+ String(faultChannel[nameNr]) + "])" + + " annotation (Placement(transformation(extent={{-80," + String(70-(nameNr-1)/(totalVariableFaults-1)*160) + "},{-60," + String(90-(nameNr-1)/(totalVariableFaults-1)*160) + "}})));", packageName); + elseif faultType[nameNr] == FaultTriggering.Utilities.Types.FaultType.intVar then + Streams.print("Modelica.Blocks.Sources.IntegerConstant " + Strings.replace(readToLastDot(faultNames[nameNr]),".","_") + + "(k = faultRecord.variableFaults.integerFaultDefault["+ String(faultChannel[nameNr]) + "])" + + " annotation (Placement(transformation(extent={{-80," + String(70-(nameNr-1)/(totalVariableFaults-1)*160) + "},{-60," + String(90-(nameNr-1)/(totalVariableFaults-1)*160) + "}})));", packageName); + elseif faultType[nameNr] == FaultTriggering.Utilities.Types.FaultType.boolVar then + Streams.print("Modelica.Blocks.Sources.BooleanConstant " + Strings.replace(readToLastDot(faultNames[nameNr]),".","_") + + "(k = faultRecord.variableFaults.booleanFaultDefault["+ String(faultChannel[nameNr]) + "])" + + " annotation (Placement(transformation(extent={{-80," + String(70-(nameNr-1)/(totalVariableFaults-1)*160) + "},{-60," + String(90-(nameNr-1)/(totalVariableFaults-1)*160) + "}})));", packageName); + end if; + end for; + Streams.print("equation", packageName); for nameNr in 1:size(faultNames, 1) loop @@ -285,6 +311,28 @@ assert( not + faultNames[nameNr] + ";", packageName); end if; end for; + // connect blocks to bus + for nameNr in 1:size(faultNames, 1) loop + if faultType[nameNr] == FaultTriggering.Utilities.Types.FaultType.realVar then + Streams.print("connect( " + Strings.replace(readToLastDot(faultNames[nameNr]),".","_") + ".y, faults." + + faultNames[nameNr] + ") annotation(Line(points= + {{-60," + String(80-(nameNr-1)/(totalVariableFaults-1)*160) + "}," + + "{ 0 ," + String(80-(nameNr-1)/(totalVariableFaults-1)*160) + "}," + + "{0,0},{100,0}}, color={0,0,127}, smooth=None));", packageName); + elseif faultType[nameNr] == FaultTriggering.Utilities.Types.FaultType.intVar then + Streams.print("connect( " + Strings.replace(readToLastDot(faultNames[nameNr]),".","_") + ".y, faults." + + faultNames[nameNr] + ") annotation(Line(points= + {{-60," + String(80-(nameNr-1)/(totalVariableFaults-1)*160) + "}," + + "{ 0 ," + String(80-(nameNr-1)/(totalVariableFaults-1)*160) + "}," + + "{0,0},{100,0}}, color={255,127,0}, smooth=None));", packageName); + elseif faultType[nameNr] == FaultTriggering.Utilities.Types.FaultType.boolVar then + Streams.print("connect( " + Strings.replace(readToLastDot(faultNames[nameNr]),".","_") + ".y, faults." + + faultNames[nameNr] + ") annotation(Line(points= + {{-60," + String(80-(nameNr-1)/(totalVariableFaults-1)*160) + "}," + + "{ 0 ," + String(80-(nameNr-1)/(totalVariableFaults-1)*160) + "}," + + "{0,0},{100,0}}, color={255,0,255}, smooth=None));", packageName); + end if; + end for; Streams.print("annotation (defaultComponentPrefixes=\"inner\",defaultComponentName=\"faultTrigger\",Diagram(graphics));", packageName); diff --git a/FaultTriggering/Utilities/Internal/faultProcessingForFaultBus.mo b/FaultTriggering/Utilities/Internal/faultProcessingForFaultBus.mo index 7908a95..e842264 100644 --- a/FaultTriggering/Utilities/Internal/faultProcessingForFaultBus.mo +++ b/FaultTriggering/Utilities/Internal/faultProcessingForFaultBus.mo @@ -8,6 +8,7 @@ function faultProcessingForFaultBus 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; @@ -15,7 +16,6 @@ function faultProcessingForFaultBus output String[:] integerFaultNames; output String[:] booleanFaultNames; output FaultTriggering.Utilities.Records.Faults faults; - protected String[:] realFaultParameterPaths; String[:] integerFaultParameterPaths; @@ -36,31 +36,17 @@ protected algorithm modelNameLength := Modelica.Utilities.Strings.length(modelName); - // ---------------------------------------------------------- - // ----------------- Get Parameter Faults ----------------- - // ---------------------------------------------------------- - - (booleanFaultParameterPaths,booleanFaultParameterNames, - integerFaultParameterPaths,integerFaultParameterNames, - realFaultParameterPaths,realFaultParameterNames) := - FaultTriggering.Utilities.Internal.gatherParameterFaults(modelName,true); - // setup the record with the loaded values - faults.parameterFaults.realFaults := - FaultTriggering.Utilities.Records.RealFaults(realFaultParameterPaths, - realFaultParameterNames); - faults.parameterFaults.integerFaults := - FaultTriggering.Utilities.Records.IntegerFaults(integerFaultParameterPaths, - integerFaultParameterNames); - faults.parameterFaults.booleanFaults := - FaultTriggering.Utilities.Records.BooleanFaults(booleanFaultParameterPaths, - booleanFaultParameterNames); // ---------------------------------------------------------- // ----------------- Get Variable Faults ----------------- // ---------------------------------------------------------- (booleanFaultComponents,booleanFaultNames,integerFaultComponents, integerFaultNames,realFaultComponents,realFaultNames) := - FaultTriggering.Utilities.Internal.gatherVariableFaults(modelName,false); + FaultTriggering.Utilities.Internal.gatherVariableFaults(modelName,true); + + // ----------------------------------------------------------- + // ----------------- Initialize fault record ----------------- + // ----------------------------------------------------------- // setup the record with the loaded values faults.variableFaults.booleanFaults := @@ -73,73 +59,6 @@ algorithm FaultTriggering.Utilities.Records.RealFaults(realFaultComponents, realFaultNames); - // // Load the names and component names of the variable REAL faults - // (realFaultComponents,realFaultNames) := - // FaultTriggering.Utilities.Internal.gatherFaults( - // modelName, - // maxSearchSize, - // "Variable_Fault_Real"); - // // setup the record with the loaded values - // faults.variableFaults.realFaults := - // FaultTriggering.Utilities.Records.RealFaults(realFaultComponents, - // realFaultNames); - // - // // Load the names and component names of the variable INTEGER faults - // (integerFaultComponents,integerFaultNames) := - // FaultTriggering.Utilities.Internal.gatherFaults( - // modelName, - // maxSearchSize, - // "Variable_Fault_Integer"); - // - // // setup the record with the loaded values - // faults.variableFaults.integerFaults := - // FaultTriggering.Utilities.Records.IntegerFaults(integerFaultComponents, - // integerFaultNames); - // - // // Load the names and component names of the variable BOOLEAN faults - // (booleanFaultComponents,booleanFaultNames) := - // FaultTriggering.Utilities.Internal.gatherFaults( - // modelName, - // maxSearchSize, - // "Variable_Fault_Boolean"); - // // setup the record with the loaded values - // faults.variableFaults.booleanFaults := - // FaultTriggering.Utilities.Records.BooleanFaults(booleanFaultComponents, - // booleanFaultNames); - - // ---------------------------------------------------------- - // ----------------- Get Parameter Default Values ----------- - // ---------------------------------------------------------- - - // setup default REAL values - faults.parameterFaults.realValue := - FaultTriggering.Utilities.Internal.getParameterValues( - realFaultParameterNames, - modelName, - true); - - // setup default INTEGER values - faults.parameterFaults.integerValue := integer(floor( - FaultTriggering.Utilities.Internal.getParameterValues( - integerFaultParameterNames, - modelName, - false))); - - // setup default BOOLEAN values - - tempBooleanValues := FaultTriggering.Utilities.Internal.getParameterValues( - booleanFaultParameterNames, - modelName, - false); - faults.parameterFaults.booleanValue := fill(true, size(tempBooleanValues, 1)); - for i in size(tempBooleanValues, 1):-1:1 loop - if tempBooleanValues[i] > 0.5 then - faults.parameterFaults.booleanValue[i] := true; - else - faults.parameterFaults.booleanValue[i] := false; - end if; - end for; - // ---------------------------------------------------------- // ----------------- Set Variable Default Values ------------ // ---------------------------------------------------------- @@ -149,12 +68,15 @@ algorithm // setup default REAL values faults.variableFaults.realFaultSelect := 1:size(realFaultNames, 1); + faults.variableFaults.realFaultDefault := 1:size(realFaultNames, 1); // setup default INTEGER values faults.variableFaults.integerFaultSelect := 1:size(integerFaultNames, 1); + faults.variableFaults.integerFaultDefault := 1:size(integerFaultNames, 1); // setup default BOOLEAN values faults.variableFaults.booleanFaultSelect := 1:size(booleanFaultNames, 1); + faults.variableFaults.booleanFaultDefault := fill(true,size(booleanFaultNames, 1)); // setup the fault mode selection // Real faults @@ -163,18 +85,86 @@ algorithm realFaultNames, modelName, false))); + faults.variableFaults.realFaultDefault := + FaultTriggering.Utilities.Internal.getVariableValues( + realFaultNames, + modelName, + false); + // Integer Faults faults.variableFaults.integerFaultMode := integer(floor( FaultTriggering.Utilities.Internal.getVariableMode( integerFaultNames, modelName, false))); + faults.variableFaults.integerFaultDefault := integer(floor( + FaultTriggering.Utilities.Internal.getVariableValues( + integerFaultNames, + modelName, + false))); // Boolean Faults faults.variableFaults.booleanFaultMode := integer(floor( FaultTriggering.Utilities.Internal.getVariableMode( booleanFaultNames, modelName, false))); + faults.variableFaults.booleanFaultDefault := Real2BooleanVector( + FaultTriggering.Utilities.Internal.getVariableValues( + booleanFaultNames, + modelName, + false)); + + // ---------------------------------------------------------- + // ----------------- Get Parameter Faults ----------------- + // ---------------------------------------------------------- + + (booleanFaultParameterPaths,booleanFaultParameterNames, + integerFaultParameterPaths,integerFaultParameterNames, + realFaultParameterPaths,realFaultParameterNames) := + FaultTriggering.Utilities.Internal.gatherParameterFaults(modelName,true); + // setup the record with the loaded values + faults.parameterFaults.realFaults := + FaultTriggering.Utilities.Records.RealFaults(realFaultParameterPaths, + realFaultParameterNames); + faults.parameterFaults.integerFaults := + FaultTriggering.Utilities.Records.IntegerFaults(integerFaultParameterPaths, + integerFaultParameterNames); + faults.parameterFaults.booleanFaults := + FaultTriggering.Utilities.Records.BooleanFaults(booleanFaultParameterPaths, + booleanFaultParameterNames); + + // ---------------------------------------------------------- + // ----------------- Get Parameter Default Values ----------- + // ---------------------------------------------------------- + + // setup default REAL values + faults.parameterFaults.realValue := + FaultTriggering.Utilities.Internal.getParameterValues( + realFaultParameterNames, + modelName, + true); + + // setup default INTEGER values + faults.parameterFaults.integerValue := integer(floor( + FaultTriggering.Utilities.Internal.getParameterValues( + integerFaultParameterNames, + modelName, + false))); + + // setup default BOOLEAN values + + tempBooleanValues := FaultTriggering.Utilities.Internal.getParameterValues( + booleanFaultParameterNames, + modelName, + false); + faults.parameterFaults.booleanValue := fill(true, size(tempBooleanValues, 1)); + for i in size(tempBooleanValues, 1):-1:1 loop + if tempBooleanValues[i] > 0.5 then + faults.parameterFaults.booleanValue[i] := true; + else + faults.parameterFaults.booleanValue[i] := false; + end if; + end for; // ---------------------------------------- // --------------- Start GUI -------------- @@ -182,7 +172,7 @@ algorithm // display fault setting GUI where all parameter faults can be set. // Variable faults are predefined and need not to be set. - faults := PromptFor(faults); + faults := PromptFor(faults); // // ---------------------------------------- // // --------------- Apply Results ---------- diff --git a/FaultTriggering/Utilities/Internal/getVariableValues.mo b/FaultTriggering/Utilities/Internal/getVariableValues.mo index 93b16d2..9b312a5 100644 --- a/FaultTriggering/Utilities/Internal/getVariableValues.mo +++ b/FaultTriggering/Utilities/Internal/getVariableValues.mo @@ -1,8 +1,8 @@ within FaultTriggering.Utilities.Internal; function getVariableValues "gets the variable default values from the model" - input String[:] faultNames={"FaultTriggering.Examples.ActuatorExample.ActuatorExternalFault.driveline.SpeedSensor.externalFault"}; - input String modelName="FaultTriggering.Examples.ActuatorExample.ActuatorExternalFault"; + input String[:] faultNames={"FaultTriggering.Examples.ActuatorExample.Actuator.driveline.friction.externalRealFault"}; + input String modelName="FaultTriggering.Examples.ActuatorExample.Actuator"; input Boolean translateFirst=true "translate model if flag is true"; output Real[size(faultNames, 1)] outputValues "Values of the variables"; @@ -31,8 +31,8 @@ algorithm // get attributes of the faults and save them into outputValues for n in 1:size(faultNames, 1) loop n2 := n2 + 1; - attributes := Dymola_Initialization_getAttributes({bareFaultNames[n] + ".faultIndex"}, - 4); + // attributes := Dymola_Initialization_getAttributes({bareFaultNames[n] + ".faultIndex"},4); + attributes := Dymola_Initialization_getAttributes({readToLastDot(bareFaultNames[n]) + ".fault_local"},4); outputValues[n2] :=attributes[1, 2]; end for; diff --git a/FaultTriggering/Utilities/Internal/package.order b/FaultTriggering/Utilities/Internal/package.order index 149b0b5..601fafa 100644 --- a/FaultTriggering/Utilities/Internal/package.order +++ b/FaultTriggering/Utilities/Internal/package.order @@ -13,5 +13,6 @@ findInIntegerVector findIfIntegerVector emptyStringVector checkInString +Real2BooleanVector isWindows Records diff --git a/FaultTriggering/Utilities/Records/Obsolete/Faults_Depreciated.mo b/FaultTriggering/Utilities/Records/Obsolete/Faults_Depreciated.mo new file mode 100644 index 0000000..149960b --- /dev/null +++ b/FaultTriggering/Utilities/Records/Obsolete/Faults_Depreciated.mo @@ -0,0 +1,44 @@ +within FaultTriggering.Utilities.Records.Obsolete; +record Faults_Depreciated "Fault information" + extends Modelica.Icons.ObsoleteModel; +// CaseDefinition Definition[:] annotation (Dialog(label="Name / Active")); + +// ------- -------------------------------------------- +// ------- Parameter Faults ------------------------- +// ------- -------------------------------------------- + +parameter FaultTriggering.Utilities.Records.Parameter_Faults parameterFaults; + +// ------- -------------------------------------------- +// ------- Vairable Faults ------------------------- +// ------- -------------------------------------------- + + parameter + FaultTriggering.Utilities.Records.Obsolete.Variable_Faults_Depreciated + variableFaults; + + annotation (Icon(graphics={Polygon( + points={{70,90},{-22,10},{0,-10},{-70,-90},{30,-10},{10,10},{70,90}}, + smooth=Smooth.None, + fillColor={0,0,255}, + fillPattern=FillPattern.Solid, + lineThickness=0.5, + pattern=LinePattern.None), + Text( + extent={{-150,150},{150,110}}, + lineColor={0,0,255}, + lineThickness=0.5, + fillColor={255,255,0}, + fillPattern=FillPattern.Solid, + textString="%name")}), Documentation(revisions=" + + + +
Copyright +
© 2012-2015, DLR Institute of System Dynamics and Control
+", + info=" +

Legacy version of the Fault Record without default variable values.

+")); + +end Faults_Depreciated; diff --git a/FaultTriggering/Utilities/Records/Obsolete/Variable_Faults_Depreciated.mo b/FaultTriggering/Utilities/Records/Obsolete/Variable_Faults_Depreciated.mo new file mode 100644 index 0000000..8694cb6 --- /dev/null +++ b/FaultTriggering/Utilities/Records/Obsolete/Variable_Faults_Depreciated.mo @@ -0,0 +1,113 @@ +within FaultTriggering.Utilities.Records.Obsolete; +record Variable_Faults_Depreciated "Variable Faults" + extends Modelica.Icons.ObsoleteModel; + +// ------- -------------------------------------------- +// ------- Variable Faults ------------------------- +// ------- -------------------------------------------- + +// ------- Real Variable Faults ------------ + FaultTriggering.Utilities.Records.RealFaults realFaults[:] annotation (Dialog( + label="Real Variable Fault names", + button="Select parameters", + onlyStart=true, + fields(name=initialName, unit=initialValue.path))); + + FaultTriggering.Utilities.Types.Fault_SelectRealFault realFaultSelect[:] + "Real Fault Index" annotation (Dialog( + tab="Advanced", + treeView=false, + label="Real Variable Fault values", + rowHeadings=realFaults.path, + columnHeadings={"Real Fault"})); + FaultTriggering.Utilities.Types.Fault_SelectRealFault realFaultMode[:] + "Optional fault mode for model reconfiguration" annotation (Dialog( + label="Real Model Configuration", + treeView=true, + rowHeadings=realFaults.path, + columnHeadings={"Real Fault"})); + +/* final parameter FaultTriggering.Utilities.Records.RealFaultValue realFaultDefault[size(realFaultMode, 1)] = fill(1,size(realFaults, 1)) + "Default Real Fault Values" annotation (Dialog( + label="Default Variable Fault values", + treeView=true, + rowHeadings=realFaults.path, + columnHeadings={"Default Real Fault"})); +*/ +// ------- Integer Variable Faults ------------ + FaultTriggering.Utilities.Records.IntegerFaults integerFaults[:] annotation ( + Dialog( + label="Integer Variable Fault names", + button="Select parameters", + onlyStart=true, + fields(name=initialName, unit=initialValue.path))); + + FaultTriggering.Utilities.Types.Fault_SelectIntegerFault integerFaultSelect[:] + "Integer Fault Index" annotation (Dialog( + tab="Advanced", + treeView=false, + label="Integer Variable Fault values", + rowHeadings=integerFaults.path, + columnHeadings={"Integer Fault"})); + FaultTriggering.Utilities.Types.Fault_SelectIntegerFault integerFaultMode[:] + "Optional fault mode for model reconfiguration" annotation (Dialog( + label="Integer Model Configuration", + treeView=true, + rowHeadings=integerFaults.path, + columnHeadings={"Integer Fault"})); +/* final parameter FaultTriggering.Utilities.Records.IntegerFaultValue integerFaultDefault[size(integerFaults, 1)] = fill(1,size(integerFaults, 1)) + "Default Real Fault Values" annotation (Dialog( + label="Default Variable Fault values", + treeView=true, + rowHeadings=integerFaults.path, + columnHeadings={"Default Integer Fault"})); +*/ +// ------- Boolean Variable Faults ------------ + FaultTriggering.Utilities.Records.BooleanFaults booleanFaults[:] annotation ( + Dialog( + label="Boolean Parameter Fault names", + label="Boolean Fault names", + button="Select parameters", + onlyStart=true, + fields(name=initialName, unit=initialValue.path))); + + FaultTriggering.Utilities.Types.Fault_SelectBooleanFault booleanFaultSelect[:] + "Boolean Fault Index" annotation (Dialog( + tab="Advanced", + treeView=false, + label="Boolean Variable Fault values", + treeView=true, + rowHeadings=booleanFaults.path, + columnHeadings={"Boolean Fault"})); + FaultTriggering.Utilities.Types.Fault_SelectBooleanFault booleanFaultMode[:] + "Optional fault mode for model reconfiguration" annotation (Dialog( + label="Boolean Model Configuration", + treeView=true, + rowHeadings=booleanFaults.path, + columnHeadings={"Boolean Fault"})); +/* final parameter FaultTriggering.Utilities.Records.BooleanFaultValue booleanFaultDefault[size(booleanFaults, 1)] = fill(true,size(booleanFaults, 1)) + "Default Real Fault Values" annotation (Dialog( + label="Default Variable Fault values", + treeView=true, + rowHeadings=booleanFaults.path, + columnHeadings={"Default Boolean Fault"})); +*/ + annotation (Icon(graphics={Text( + extent={{-100,100},{100,-100}}, + lineColor={0,0,0}, + textStyle={TextStyle.Bold,TextStyle.Italic}, + textString="V")}), Diagram(graphics={Text( + extent={{-100,-60},{100,60}}, + lineColor={0,0,255}, + textString="Par")}), + Documentation(revisions=" + + + +
Copyright +
© 2012-2015, DLR Institute of System Dynamics and Control
+", + info=" +

Legacy version of the Variable Fault Record without default variable values.

+")); +end Variable_Faults_Depreciated; diff --git a/FaultTriggering/Utilities/Records/Obsolete/package.mo b/FaultTriggering/Utilities/Records/Obsolete/package.mo new file mode 100644 index 0000000..6a49382 --- /dev/null +++ b/FaultTriggering/Utilities/Records/Obsolete/package.mo @@ -0,0 +1,7 @@ +within FaultTriggering.Utilities.Records; +package Obsolete + extends FaultTriggering.Utilities.Icons.Records; + + extends Modelica.Icons.ObsoleteModel; + +end Obsolete; diff --git a/FaultTriggering/Utilities/Records/Obsolete/package.order b/FaultTriggering/Utilities/Records/Obsolete/package.order new file mode 100644 index 0000000..9e1d23e --- /dev/null +++ b/FaultTriggering/Utilities/Records/Obsolete/package.order @@ -0,0 +1,2 @@ +Faults_Depreciated +Variable_Faults_Depreciated diff --git a/FaultTriggering/Utilities/Records/Variable_Faults.mo b/FaultTriggering/Utilities/Records/Variable_Faults.mo index e8a59ee..d31a419 100644 --- a/FaultTriggering/Utilities/Records/Variable_Faults.mo +++ b/FaultTriggering/Utilities/Records/Variable_Faults.mo @@ -7,7 +7,7 @@ record Variable_Faults "Variable Faults" // ------- Real Variable Faults ------------ FaultTriggering.Utilities.Records.RealFaults realFaults[:] annotation (Dialog( - label="Real Parameter Fault names", + label="Real Variable Fault names", button="Select parameters", onlyStart=true, fields(name=initialName, unit=initialValue.path))); @@ -16,7 +16,6 @@ record Variable_Faults "Variable Faults" "Real Fault Index" annotation (Dialog( tab="Advanced", treeView=false, - label="Real Parameter Fault names", label="Real Variable Fault values", rowHeadings=realFaults.path, columnHeadings={"Real Fault"})); @@ -26,11 +25,18 @@ record Variable_Faults "Variable Faults" treeView=true, rowHeadings=realFaults.path, columnHeadings={"Real Fault"})); + + FaultTriggering.Utilities.Records.RealFaultValue realFaultDefault[:] + "Default Real Fault Values" annotation (Dialog( + label="Default Variable Fault values", + treeView=true, + rowHeadings=realFaults.path, + columnHeadings={"Default Real Fault"})); //[size(realFaultMode, 1)] = fill(1,size(realFaults, 1)) + // ------- Integer Variable Faults ------------ FaultTriggering.Utilities.Records.IntegerFaults integerFaults[:] annotation ( Dialog( - label="Integer Parameter Fault names", - label="Integer Parameter Fault names", + label="Integer Variable Fault names", button="Select parameters", onlyStart=true, fields(name=initialName, unit=initialValue.path))); @@ -39,7 +45,6 @@ record Variable_Faults "Variable Faults" "Integer Fault Index" annotation (Dialog( tab="Advanced", treeView=false, - label="Integer Parameter Fault names", label="Integer Variable Fault values", rowHeadings=integerFaults.path, columnHeadings={"Integer Fault"})); @@ -49,6 +54,13 @@ record Variable_Faults "Variable Faults" treeView=true, rowHeadings=integerFaults.path, columnHeadings={"Integer Fault"})); + FaultTriggering.Utilities.Records.IntegerFaultValue integerFaultDefault[:] + "Default Real Fault Values" annotation (Dialog( + label="Default Variable Fault values", + treeView=true, + rowHeadings=integerFaults.path, + columnHeadings={"Default Integer Fault"})); //[size(integerFaults, 1)] = fill(1,size(integerFaults, 1)) + // ------- Boolean Variable Faults ------------ FaultTriggering.Utilities.Records.BooleanFaults booleanFaults[:] annotation ( Dialog( @@ -62,7 +74,6 @@ record Variable_Faults "Variable Faults" "Boolean Fault Index" annotation (Dialog( tab="Advanced", treeView=false, - label="Boolean Parameter Fault names", label="Boolean Variable Fault values", treeView=true, rowHeadings=booleanFaults.path, @@ -73,6 +84,12 @@ record Variable_Faults "Variable Faults" treeView=true, rowHeadings=booleanFaults.path, columnHeadings={"Boolean Fault"})); + FaultTriggering.Utilities.Records.BooleanFaultValue booleanFaultDefault[:] + "Default Real Fault Values" annotation (Dialog( + label="Default Variable Fault values", + treeView=true, + rowHeadings=booleanFaults.path, + columnHeadings={"Default Boolean Fault"})); //[size(booleanFaults, 1)] = fill(true,size(booleanFaults, 1)) annotation (Icon(graphics={Text( extent={{-100,100},{100,-100}}, diff --git a/FaultTriggering/Utilities/Records/package.order b/FaultTriggering/Utilities/Records/package.order index 6c9d1f2..fae83c7 100644 --- a/FaultTriggering/Utilities/Records/package.order +++ b/FaultTriggering/Utilities/Records/package.order @@ -7,3 +7,4 @@ IntegerFaults IntegerFaultValue BooleanFaults BooleanFaultValue +Obsolete diff --git a/FaultTriggering/Utilities/Types/Variable_Fault_Real.mo b/FaultTriggering/Utilities/Types/Variable_Fault_Real.mo index 159e8d0..306e211 100644 --- a/FaultTriggering/Utilities/Types/Variable_Fault_Real.mo +++ b/FaultTriggering/Utilities/Types/Variable_Fault_Real.mo @@ -1,8 +1,8 @@ within FaultTriggering.Utilities.Types; record Variable_Fault_Real "External Fault Triggering parameters" - Boolean externalFaultOn=false "External fault controlling (true = global)" annotation (Dialog); - Integer faultIndex = 1 "External fault index" annotation (Dialog(tab = "Advanced")); - Integer faultMode = 1 "Optional fault mode for model reconfiguration"; + Boolean externalFaultOn=false "External fault controlling (true = global)" annotation (Dialog); + Integer faultIndex = 1 "External fault index" annotation (Dialog(tab = "Advanced")); + Integer faultMode = 1 "Optional fault mode for model reconfiguration"; annotation (Icon(graphics={Text( extent={{-100,100},{100,-100}}, lineColor={0,0,255}, diff --git a/FaultTriggering/package.mo b/FaultTriggering/package.mo index 6938fcc..546a0e0 100644 --- a/FaultTriggering/package.mo +++ b/FaultTriggering/package.mo @@ -7,12 +7,8 @@ package FaultTriggering "Library for Fault Triggering" import Modelica.Utilities.Strings; - - - - annotation (uses(Modelica(version="3.2.1")), - version="0.6.4", conversion(noneFromVersion="0.5.0"), + version="0.6.5", conversion(from(version="0.6.4", to="0.6.5", script="modelica://FaultTriggering/Resources/Scripts/Convert_from_0.6.4_to_0.6.5.mos")), versionDate="2015-07-15", preferredView="info", Documentation(info=" @@ -36,9 +32,11 @@ preferredView="info",

Acknowledgement

The research leading to these results has received funding from the European Union’s Seventh Framework Program (FP7-284916) for ACTUATION 2015 under grant agreement no. 284915.

-

 

+

 

+

Release Notes

- +
+ @@ -76,24 +74,18 @@ preferredView="info", - +

Version  

Comments

0.6.5

2016-04-20: Allow custom modes switching in the FaultTrigger gontroller

2016-04-20: Allow custom modes switching in the FaultTrigger controller

-

Licensed by the DLR Institute of System Dynamics and Control under the Modelica License 2

-

Copyright © 2016, DLR Institute of System Dynamics and Control

-

This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2.

- - - +

Licensed by the DLR Institute of System Dynamics and Control under the Modelica License 2

Copyright © 2016, DLR Institute of System Dynamics and Control

This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see Modelica.UsersGuide.ModelicaLicense2 or visit https://www.modelica.org/licenses/ModelicaLicense2.

+ +", revisions=" +
+ +

Copyright

© 2012-2016, DLR Institute of System Dynamics and Control

-", revisions=" - - - -
Copyright -
© 2012-2015, DLR Institute of System Dynamics and Control
"), Icon(graphics={ Polygon( diff --git a/README.md b/README.md index 4d51fed..5d151ba 100644 --- a/README.md +++ b/README.md @@ -34,3 +34,9 @@ The library was developed by the **DLR** German Aerospace Center contributors: You may report any issues with using the [Issues](../../issues) button. Contributions in shape of [Pull Requests](../../pulls) are always welcome. + +## Acknowledgement + +The research leading to these results has received funding from the European Union’s Seventh Framework Program (FP7-284916) for ACTUATION 2015 under grant agreement no. 284915. + +![EU-Logo](/FaultTriggering/Resources/Documentation/Images/logo_EU.png)