Search in sources :

Example 21 with ConnectionInstance

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);
    }
}
Also used : ErrorSource(org.osate.xtext.aadl2.errormodel.errorModel.ErrorSource) Element(org.osate.aadl2.Element) ConditionElement(org.osate.xtext.aadl2.errormodel.errorModel.ConditionElement) NamedElement(org.osate.aadl2.NamedElement) TypeSet(org.osate.xtext.aadl2.errormodel.errorModel.TypeSet) EMV2PropertyAssociation(org.osate.xtext.aadl2.errormodel.errorModel.EMV2PropertyAssociation) NamedElement(org.osate.aadl2.NamedElement)

Example 22 with ConnectionInstance

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;
}
Also used : ConnectionInstance(org.osate.aadl2.instance.ConnectionInstance) BasicEList(org.eclipse.emf.common.util.BasicEList) ComponentInstance(org.osate.aadl2.instance.ComponentInstance)

Example 23 with ConnectionInstance

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;
}
Also used : ConnectionInstanceEnd(org.osate.aadl2.instance.ConnectionInstanceEnd) ComponentInstance(org.osate.aadl2.instance.ComponentInstance)

Example 24 with ConnectionInstance

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);
}
Also used : ComponentInstance(org.osate.aadl2.instance.ComponentInstance)

Example 25 with ConnectionInstance

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);
}
Also used : ConnectionInstance(org.osate.aadl2.instance.ConnectionInstance) SystemInstance(org.osate.aadl2.instance.SystemInstance)

Aggregations

ConnectionInstance (org.osate.aadl2.instance.ConnectionInstance)71 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)64 ConnectionReference (org.osate.aadl2.instance.ConnectionReference)32 ConnectionInstanceEnd (org.osate.aadl2.instance.ConnectionInstanceEnd)28 FeatureInstance (org.osate.aadl2.instance.FeatureInstance)25 Classifier (org.osate.aadl2.Classifier)22 InstanceObject (org.osate.aadl2.instance.InstanceObject)21 Connection (org.osate.aadl2.Connection)16 ArrayList (java.util.ArrayList)15 Element (org.osate.aadl2.Element)15 NamedElement (org.osate.aadl2.NamedElement)13 PropertyExpression (org.osate.aadl2.PropertyExpression)13 SystemInstance (org.osate.aadl2.instance.SystemInstance)13 SystemOperationMode (org.osate.aadl2.instance.SystemOperationMode)13 ComponentClassifier (org.osate.aadl2.ComponentClassifier)12 ComponentImplementation (org.osate.aadl2.ComponentImplementation)10 ListValue (org.osate.aadl2.ListValue)10 BasicEList (org.eclipse.emf.common.util.BasicEList)9 Feature (org.osate.aadl2.Feature)9 EndToEndFlowInstance (org.osate.aadl2.instance.EndToEndFlowInstance)9