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