use of edu.umn.cs.crisys.safety.safety.impl.ProbabilityStatementImpl in project AMASE by loonwerks.
the class IvcToFTGenerator method extractFaultMCSElem.
private void extractFaultMCSElem(String compName, AgreeRenaming renaming, FTAndNode mcsSetNode, String faultName, String faultRefName, String originalFaultName) {
// differentiate same fault definitions activated in subcomponents of different parent components
String updatedFaultName = MHSUtils.updateElemName(compName + "_" + faultName);
// if mcsElem is not yet in leaf nodes
if (!faultTree.leafNodes.containsKey(updatedFaultName)) {
FaultStatementImpl faultStmtImpl = (FaultStatementImpl) renaming.getRefMap().get(faultRefName);
// original fault name specified by the user
String faultUserName = faultStmtImpl.getName();
// original fault explanation specified by the user
String faultUserExplanation = faultStmtImpl.getStr();
// probability string
String probStr = "";
// failure probability
float failureProb = (float) 0.0;
for (FaultSubcomponent faultSub : faultStmtImpl.getFaultDefinitions()) {
if (faultSub instanceof ProbabilityStatementImpl) {
probStr = ((ProbabilityStatementImpl) faultSub).getProbability();
failureProb = Float.parseFloat(probStr);
}
}
// TODO: need to have component specify failure rate and exposure time in the future
// currently treat exposure time and failure rate as (float) 1.0
// and set the failure probability from the fault statement as the failure rate
FTLeafNode ftLeafNode = new FTLeafNode(compName, updatedFaultName, (float) 1.0, (float) 1.0, failureProb, originalFaultName, faultUserName, faultUserExplanation);
faultTree.addLeafNode(updatedFaultName, ftLeafNode);
mcsSetNode.addChildNode(updatedFaultName, ftLeafNode);
// update intermediate node
faultTree.addIntermediateNode(mcsSetNode.nodeName, mcsSetNode);
// ftLeafNode.addParentNode(mcsSetNode);
} else {
FTLeafNode leafNode = faultTree.leafNodes.get(updatedFaultName);
mcsSetNode.addChildNode(updatedFaultName, leafNode);
faultTree.addIntermediateNode(mcsSetNode.nodeName, mcsSetNode);
// leafNode.addParentNode(mcsSetNode);
}
}
use of edu.umn.cs.crisys.safety.safety.impl.ProbabilityStatementImpl in project AMASE by loonwerks.
the class IvcToSoteriaGenerator method extractFaultIvcElem.
private void extractFaultIvcElem(SoteriaComp comp, AgreeRenaming renaming, SoteriaFormulaSubgroup formulaSubgroup, String faultName, String faultRefName) {
// get the fault name for that fault activation variable in ivcElement
CompFaultActivation faultActivation = new CompFaultActivation(comp.componentName, faultName);
formulaSubgroup.addFormulaElem(faultActivation);
// if ivcElem is not yet in basicEvents
if (!comp.basicEvents.containsKey(faultName)) {
FaultStatementImpl faultStmtImpl = (FaultStatementImpl) renaming.getRefMap().get(faultRefName);
for (FaultSubcomponent faultSub : faultStmtImpl.getFaultDefinitions()) {
if (faultSub instanceof ProbabilityStatementImpl) {
String probStr = ((ProbabilityStatementImpl) faultSub).getProbability();
float failureProb = Float.parseFloat(probStr);
// TODO: need to have component specify failure rate and exposure time in the future
// currently treat exposure time as (float) 1.0
// and treat the failure probability from the fault statement as the failure rate
SoteriaFault basicEvent = new SoteriaFault(updateElemName(faultName), failureProb, (float) 1.0);
comp.addBasicEvent(faultName, basicEvent);
}
}
}
}
Aggregations