Skip to content

Commit

Permalink
Merge pull request #47 from DLR-SR/master
Browse files Browse the repository at this point in the history
update the Master branch to the release branch
  • Loading branch information
Franciscus van der Linden authored Jul 19, 2016
2 parents 2ea2a56 + 8afa12d commit fb32147
Show file tree
Hide file tree
Showing 23 changed files with 488 additions and 225 deletions.
100 changes: 49 additions & 51 deletions FaultTriggering/Examples/ActuatorExample/ActuatorPackage.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -157,11 +161,5 @@ extends FaultTriggering.Utilities.Icons.FaultSubBus;
ActuatorPackage.Interfaces.externalBooleanFault externalBooleanFault;
end fault;
end Interfaces;
annotation (Documentation(revisions="<html><table border=0 cellspacing=0 cellpadding=0>
<tr><td valign=\"center\"> <img src=\"modelica://FaultTriggering/Resources/Documentation/Images/logo_dlr.png\" width=60></td>
<td valign=\"center\"><b>Copyright</b>
<br><b>&copy; 2012-2015, DLR Institute of System Dynamics and Control</b></td>
</tr>
</table>
</html>"));
annotation ();
end ActuatorPackage;
Original file line number Diff line number Diff line change
Expand Up @@ -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}})));
Expand Down Expand Up @@ -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}},
Expand All @@ -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
Expand Down Expand Up @@ -165,8 +169,5 @@ extends FaultTriggering.Utilities.Icons.FaultSubBus;
ActuatorPackageStatistics.Interfaces.externalBooleanFault externalBooleanFault;
end fault;
end Interfaces;
annotation (Documentation(info="<html>
<p>This package shows the use of a stochastical fault in a simulation. For more information, please see the AdvancedNoise Library on <a href=\"https://github.com/DLR-SR/AdvancedNoise\">https://github.com/DLR-SR/AdvancedNoise</a>.</p>
<p><br>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. </p>
</html>"));
annotation ();
end ActuatorPackageStatistics;
3 changes: 2 additions & 1 deletion FaultTriggering/FaultOutput/Internal/InternalBooleanFault.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion FaultTriggering/FaultOutput/Internal/InternalIntegerFault.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion FaultTriggering/FaultOutput/Internal/InternalRealFault.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -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");
2 changes: 1 addition & 1 deletion FaultTriggering/Utilities/Icons/Motors.mo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
within FaultTriggering.Utilities.Icons;
partial class Motors
partial package Motors
extends FaultTriggering.Utilities.Icons.Package;

annotation (Icon(graphics={
Expand Down
Loading

0 comments on commit fb32147

Please sign in to comment.