use of org.osate.aadl2.instance.ConnectionInstance in project osate2 by osate.
the class FHAReport method processHazards.
protected void processHazards(ConnectionInstance conni, WriteToFile report) {
ErrorSource ces = EMV2Util.findConnectionErrorSourceForConnection(conni);
if (ces == null) {
return;
}
Element localContext = null;
// error propagation is originating hazard
TypeSet ts = ces.getTypeTokenConstraint();
List<EMV2PropertyAssociation> HazardPA = getHazardsPropertyInCurrentFormat(conni, ces, ts);
List<EMV2PropertyAssociation> Sev = EMV2Properties.getSeverityProperty(conni, ces, ts);
List<EMV2PropertyAssociation> Like = EMV2Properties.getLikelihoodProperty(conni, ces, ts);
NamedElement target = ces;
// XXX we may have more than one matching hazard
if (!HazardPA.isEmpty()) {
reportHazardProperty(conni, HazardPA, Sev, Like, target, ts, localContext, report);
}
}
use of org.osate.aadl2.instance.ConnectionInstance in project osate2 by osate.
the class InstanceModelUtil method getConnectedBuses.
/**
* list of buses the hardware component is directly connected to
*
* @param HWcomp ComponentInstance hardware component
* @return list of buses
*/
public static EList<ComponentInstance> getConnectedBuses(ComponentInstance HWcomp) {
EList<ComponentInstance> result = new BasicEList<ComponentInstance>();
EList<ConnectionInstance> acl = HWcomp.getSrcConnectionInstances();
for (ConnectionInstance srcaci : acl) {
ComponentInstance res = srcaci.getDestination().getComponentInstance();
if (res.getCategory() == ComponentCategory.BUS) {
result.add(res);
}
}
// we have to check the connection the other way around. The bus be the source or destination
acl = HWcomp.getDstConnectionInstances();
for (ConnectionInstance dstaci : acl) {
ComponentInstance res = dstaci.getSource().getComponentInstance();
if (res.getCategory() == ComponentCategory.BUS) {
result.add(res);
}
}
return result;
}
use of org.osate.aadl2.instance.ConnectionInstance in project osate2 by osate.
the class InstanceModelUtil method getRelatedComponentSource.
/**
* Get the component that is connected at the source side of the connection.
* @param connectionInstance - the connection to process
* @return - the component that is the source
*/
public static ComponentInstance getRelatedComponentSource(ConnectionInstance connectionInstance) {
ConnectionInstanceEnd sourceEnd;
ComponentInstance source;
source = null;
sourceEnd = connectionInstance.getSource();
if (!(sourceEnd instanceof ComponentInstance)) {
source = sourceEnd.getContainingComponentInstance();
} else {
source = (ComponentInstance) sourceEnd;
}
return source;
}
use of org.osate.aadl2.instance.ConnectionInstance in project osate2 by osate.
the class InstanceModelUtil method connectedByBus.
/**
* true if the processor of the port connection source is connected to the
* specified bus
*
* @param pci
* @param curBus
* @return
*/
public static boolean connectedByBus(ConnectionInstance pci, ComponentInstance curBus) {
ComponentInstance srcHW = getHardwareComponent(pci.getSource());
ComponentInstance dstHW = getHardwareComponent(pci.getDestination());
if (srcHW == null || dstHW == null || srcHW == dstHW) {
return false;
}
return connectedToBus(srcHW, curBus) && connectedToBus(dstHW, curBus);
}
use of org.osate.aadl2.instance.ConnectionInstance in project osate2 by osate.
the class InstanceModelUtil method getBoundConnections.
/**
* get all connections bound to the given bus or virtual bus
* @param busorVB
* @return
*/
public static EList<ConnectionInstance> getBoundConnections(final ComponentInstance busorVB) {
EList<ConnectionInstance> result;
EList<ConnectionInstance> connections;
SystemInstance root;
if (!boundBusConnections.containsKey(busorVB)) {
result = new BasicEList<ConnectionInstance>();
root = busorVB.getSystemInstance();
connections = root.getAllConnectionInstances();
for (ConnectionInstance connectionInstance : connections) {
if (InstanceModelUtil.isBoundToBus(connectionInstance, busorVB) || // we derived a bus connection from the connection end bindings
(!InstanceModelUtil.hasBusBinding(connectionInstance) && InstanceModelUtil.connectedByBus(connectionInstance, busorVB))) {
result.add(connectionInstance);
}
}
boundBusConnections.put(busorVB, result);
}
return boundBusConnections.get(busorVB);
}
Aggregations