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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations