Search in sources :

Example 16 with BUS

use of org.osate.aadl2.ComponentCategory.BUS 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 17 with BUS

use of org.osate.aadl2.ComponentCategory.BUS 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 18 with BUS

use of org.osate.aadl2.ComponentCategory.BUS 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)

Example 19 with BUS

use of org.osate.aadl2.ComponentCategory.BUS in project osate2 by osate.

the class InstanceModelUtil method getHardwareComponent.

/**
 * return the hardware component of the connection instance end.
 * If it is a hardware component or device return it.
 * If it is a software component, return the processor it is bound to.
 * If it is a component instance (BUS), return the bus
 * If it is a DATA, SUBPROGRAM, or SUBPROGRAM GROUP component instance, then return the memory it is bound to.
 * @param cie
 * @return hw component instance
 */
public static ComponentInstance getHardwareComponent(ConnectionInstanceEnd cie) {
    ComponentInstance swci = null;
    if (cie instanceof FeatureInstance) {
        FeatureInstance fi = (FeatureInstance) cie;
        swci = fi.getContainingComponentInstance();
    } else if (cie instanceof ComponentInstance) {
        swci = (ComponentInstance) cie;
    }
    if (isDevice(swci) || isProcessor(swci) || isBus(swci) || isMemory(swci)) {
        return swci;
    }
    return getBoundPhysicalProcessor(swci);
}
Also used : FeatureInstance(org.osate.aadl2.instance.FeatureInstance) ComponentInstance(org.osate.aadl2.instance.ComponentInstance)

Example 20 with BUS

use of org.osate.aadl2.ComponentCategory.BUS in project osate2 by osate.

the class GetProperties method getMaximumTransmissionTimeFixed.

public static double getMaximumTransmissionTimeFixed(final NamedElement bus) {
    RecordValue rv;
    RangeValue bpa;
    NumberValue nv;
    rv = GetProperties.getTransmissionTime(bus);
    if (rv == null) {
        return 0;
    }
    bpa = (RangeValue) PropertyUtils.getRecordFieldValue(rv, "Fixed");
    if (bpa != null) {
        nv = bpa.getMaximumValue();
        return nv.getScaledValue(GetProperties.getMSUnitLiteral(bus));
    }
    return 0;
}
Also used : NumberValue(org.osate.aadl2.NumberValue) RecordValue(org.osate.aadl2.RecordValue) RangeValue(org.osate.aadl2.RangeValue)

Aggregations

ComponentInstance (org.osate.aadl2.instance.ComponentInstance)22 ArrayList (java.util.ArrayList)16 ConnectionInstance (org.osate.aadl2.instance.ConnectionInstance)14 FeatureInstance (org.osate.aadl2.instance.FeatureInstance)11 ComponentImplementation (org.osate.aadl2.ComponentImplementation)9 NamedElement (org.osate.aadl2.NamedElement)9 CyberMission (com.ge.research.osate.verdict.dsl.verdict.CyberMission)8 CyberRel (com.ge.research.osate.verdict.dsl.verdict.CyberRel)8 CyberReq (com.ge.research.osate.verdict.dsl.verdict.CyberReq)8 Event (com.ge.research.osate.verdict.dsl.verdict.Event)8 SafetyRel (com.ge.research.osate.verdict.dsl.verdict.SafetyRel)8 SafetyReq (com.ge.research.osate.verdict.dsl.verdict.SafetyReq)8 Statement (com.ge.research.osate.verdict.dsl.verdict.Statement)8 Verdict (com.ge.research.osate.verdict.dsl.verdict.Verdict)8 AnnexSubclause (org.osate.aadl2.AnnexSubclause)8 BusAccess (org.osate.aadl2.BusAccess)8 DataPort (org.osate.aadl2.DataPort)8 EventDataPort (org.osate.aadl2.EventDataPort)8 EventPort (org.osate.aadl2.EventPort)8 InstanceObject (org.osate.aadl2.instance.InstanceObject)8