Search in sources :

Example 31 with ConnectionInstanceEnd

use of org.osate.aadl2.instance.ConnectionInstanceEnd in project osate2 by osate.

the class BusLoadAnalysis method calcBandwidthKBytesps.

/**
 * Calculate bandwidth demand from rate & data size
 *
 * @param pci Port connection instance
 * @return
 */
private double calcBandwidthKBytesps(ConnectionInstanceEnd cie) {
    double res = 0;
    // TODO-LW add other cases
    if (cie instanceof FeatureInstance) {
        FeatureInstance fi = (FeatureInstance) cie;
        double datasize = AadlContribUtils.getDataSize(fi, SizeUnits.KBYTE);
        double srcRate = GetProperties.getOutgoingMessageRatePerSecond(fi);
        res = datasize * srcRate;
        EList<FeatureInstance> fil = fi.getFeatureInstances();
        if (fil.size() > 0) {
            double subres = 0;
            for (Iterator<FeatureInstance> it = fil.iterator(); it.hasNext(); ) {
                FeatureInstance sfi = it.next();
                subres = subres + calcBandwidthKBytesps(sfi);
            }
            if (subres > res) {
                if (res > 0) {
                    errManager.warningSummary(fi, null, "Bandwidth of feature group ports " + subres + " exceeds feature group bandwidth " + res);
                }
                res = subres;
            }
        }
    }
    return res;
}
Also used : FeatureInstance(org.osate.aadl2.instance.FeatureInstance)

Example 32 with ConnectionInstanceEnd

use of org.osate.aadl2.instance.ConnectionInstanceEnd in project osate2 by osate.

the class AadlUtil method isComplete.

public static boolean isComplete(ConnectionInstance conni) {
    ConnectionInstanceEnd srcEnd = conni.getSource();
    ConnectionInstanceEnd dstEnd = conni.getDestination();
    ComponentInstance src = null;
    if (srcEnd instanceof ComponentInstance) {
        src = (ComponentInstance) srcEnd;
    } else if (srcEnd instanceof FeatureInstance) {
        src = srcEnd.getContainingComponentInstance();
    }
    ComponentInstance dst = null;
    if (dstEnd instanceof ComponentInstance) {
        dst = (ComponentInstance) dstEnd;
    } else if (dstEnd instanceof FeatureInstance) {
        dst = dstEnd.getContainingComponentInstance();
    }
    if (containedIn(src, dst) || containedIn(dst, src)) {
        return false;
    }
    return true;
}
Also used : FeatureInstance(org.osate.aadl2.instance.FeatureInstance) ConnectionInstanceEnd(org.osate.aadl2.instance.ConnectionInstanceEnd) ComponentInstance(org.osate.aadl2.instance.ComponentInstance)

Example 33 with ConnectionInstanceEnd

use of org.osate.aadl2.instance.ConnectionInstanceEnd in project osate2 by osate.

the class Aadl2InstanceUtil method getOutgoingConnections.

/**
 * get outgoing connection instances from the component instance or any contained component instance
 * @param ci component instance
 * @return list of connection instances
 */
public static EList<ConnectionInstance> getOutgoingConnections(ComponentInstance ci) {
    EList<ConnectionInstance> result = new BasicEList<ConnectionInstance>();
    Iterable<ConnectionInstance> it = ci.allEnclosingConnectionInstances();
    for (ConnectionInstance connectionInstance : it) {
        ConnectionInstanceEnd src = connectionInstance.getSource();
        ConnectionInstanceEnd dst = connectionInstance.getDestination();
        if (containedIn(src, ci) && !containedIn(dst, ci)) {
            result.add(connectionInstance);
        }
    }
    return result;
}
Also used : ConnectionInstance(org.osate.aadl2.instance.ConnectionInstance) ConnectionInstanceEnd(org.osate.aadl2.instance.ConnectionInstanceEnd) BasicEList(org.eclipse.emf.common.util.BasicEList)

Example 34 with ConnectionInstanceEnd

use of org.osate.aadl2.instance.ConnectionInstanceEnd in project osate2 by osate.

the class Aadl2InstanceUtil method getIncomingConnections.

/**
 * get incoming connection instances from the component instance or any contained component instance
 * @param ci component instance
 * @return list of connection instances
 */
public static EList<ConnectionInstance> getIncomingConnections(ComponentInstance ci) {
    EList<ConnectionInstance> result = new BasicEList<ConnectionInstance>();
    // allEnclosingConnectionInstances();
    Iterable<ConnectionInstance> it = ci.getSystemInstance().getAllConnectionInstances();
    for (ConnectionInstance connectionInstance : it) {
        ConnectionInstanceEnd src = connectionInstance.getSource();
        ConnectionInstanceEnd dst = connectionInstance.getDestination();
        if (!containedIn(src, ci) && containedIn(dst, ci)) {
            result.add(connectionInstance);
        }
    }
    return result;
}
Also used : ConnectionInstance(org.osate.aadl2.instance.ConnectionInstance) ConnectionInstanceEnd(org.osate.aadl2.instance.ConnectionInstanceEnd) BasicEList(org.eclipse.emf.common.util.BasicEList)

Example 35 with ConnectionInstanceEnd

use of org.osate.aadl2.instance.ConnectionInstanceEnd in project osate2 by osate.

the class Aadl2InstanceUtil method getIncomingConnectionReferences.

/**
 * get incoming connection instances from the component instance or any contained component instance
 * @param ci component instance
 * @return list of connection instances
 */
public static EList<ConnectionReference> getIncomingConnectionReferences(ComponentInstance ci) {
    EList<ConnectionReference> result = new BasicEList<ConnectionReference>();
    // allEnclosingConnectionInstances();
    Iterable<ConnectionInstance> it = ci.getSystemInstance().getAllConnectionInstances();
    for (ConnectionInstance connectionInstance : it) {
        ConnectionInstanceEnd src = connectionInstance.getSource();
        ConnectionInstanceEnd dst = connectionInstance.getDestination();
        if ((!containedIn(src, ci) || src.getContainingComponentInstance() == ci) && containedIn(dst, ci)) {
            EList<ConnectionReference> connreflist = connectionInstance.getConnectionReferences();
            for (ConnectionReference connectionReference : connreflist) {
                ComponentInstance pci = connectionReference.getContext();
                if (pci == ci) {
                    result.add(connectionReference);
                }
            }
        }
    }
    return result;
}
Also used : ConnectionInstance(org.osate.aadl2.instance.ConnectionInstance) ConnectionInstanceEnd(org.osate.aadl2.instance.ConnectionInstanceEnd) ConnectionReference(org.osate.aadl2.instance.ConnectionReference) BasicEList(org.eclipse.emf.common.util.BasicEList) ComponentInstance(org.osate.aadl2.instance.ComponentInstance)

Aggregations

ConnectionInstanceEnd (org.osate.aadl2.instance.ConnectionInstanceEnd)45 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)32 FeatureInstance (org.osate.aadl2.instance.FeatureInstance)30 ConnectionInstance (org.osate.aadl2.instance.ConnectionInstance)21 ConnectionReference (org.osate.aadl2.instance.ConnectionReference)16 ArrayList (java.util.ArrayList)11 Connection (org.osate.aadl2.Connection)8 BasicEList (org.eclipse.emf.common.util.BasicEList)7 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)7 Feature (org.osate.aadl2.Feature)7 InstanceObject (org.osate.aadl2.instance.InstanceObject)7 ConnectionEnd (org.osate.aadl2.ConnectionEnd)6 Subcomponent (org.osate.aadl2.Subcomponent)6 Element (org.osate.aadl2.Element)5 HashMap (java.util.HashMap)4 LinkedList (java.util.LinkedList)4 List (java.util.List)4 SystemInstance (org.osate.aadl2.instance.SystemInstance)4 InstantiatedClassifier (org.osate.aadl2.instance.util.InstanceUtil.InstantiatedClassifier)4 Collections (java.util.Collections)3