use of org.osate.aadl2.ComponentCategory.BUS in project osate2 by osate.
the class GetProperties method getActualProcessorBinding.
// /**
// * this method only picks up the first element, which may not be a bus
// * @param connection Connection Instance
// * @return
// */
// public static ComponentInstance getBoundBus(final ConnectionInstance
// connection) {
// List<ComponentInstance> ret = getActualConnectionBinding(connection);
// ComponentInstance ci = ret.isEmpty() ? null : ret.get(0);
// if (ci != null) {
// return ci;
// }
// return null;
// }
public static List<ComponentInstance> getActualProcessorBinding(final ComponentInstance io) {
ArrayList<ComponentInstance> components = new ArrayList<ComponentInstance>();
Property actualProcessorBinding = lookupPropertyDefinition(io, DeploymentProperties._NAME, DeploymentProperties.ACTUAL_PROCESSOR_BINDING);
List<? extends PropertyExpression> propertyValues;
try {
propertyValues = io.getPropertyValueList(actualProcessorBinding);
} catch (Exception e) {
return components;
}
for (PropertyExpression propertyExpression : propertyValues) {
if (propertyExpression != null) {
InstanceObject obj = ((InstanceReferenceValue) propertyExpression).getReferencedInstanceObject();
components.add((ComponentInstance) obj);
}
}
return components;
}
use of org.osate.aadl2.ComponentCategory.BUS in project osate2 by osate.
the class GetProperties method getMaximumTransmissionTimePerByte.
public static double getMaximumTransmissionTimePerByte(final NamedElement bus) {
RecordValue rv;
RangeValue bpa;
NumberValue nv;
rv = GetProperties.getTransmissionTime(bus);
if (rv == null) {
return 0;
}
bpa = (RangeValue) PropertyUtils.getRecordFieldValue(rv, "PerByte");
if (bpa != null) {
nv = bpa.getMaximumValue();
return nv.getScaledValue(GetProperties.getMSUnitLiteral(bus));
}
return 0;
}
use of org.osate.aadl2.ComponentCategory.BUS in project osate2 by osate.
the class GetProperties method getMinimumTransmissionTimeFixed.
public static double getMinimumTransmissionTimeFixed(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.getMinimumValue();
return nv.getScaledValue(GetProperties.getMSUnitLiteral(bus));
}
return 0;
}
use of org.osate.aadl2.ComponentCategory.BUS in project osate2 by osate.
the class GetProperties method getAccessLatencyinMilliSec.
public static double getAccessLatencyinMilliSec(final ComponentInstance HWcomp, final ComponentInstance bus) {
ConnectionInstance aci = InstanceModelUtil.getBusAccessConnection(HWcomp, bus);
if (aci == null) {
return 0.0;
}
Property Latency = lookupPropertyDefinition(aci, CommunicationProperties._NAME, CommunicationProperties.LATENCY);
UnitLiteral milliSecond = PropertiesLinkingService.findUnitLiteral(Latency, AadlProject.MS_LITERAL);
return PropertyUtils.getScaledRangeMaximum(aci, Latency, milliSecond, 0.0);
}
use of org.osate.aadl2.ComponentCategory.BUS in project osate2 by osate.
the class GetProperties method getAccessLatencyinMicroSec.
public static double getAccessLatencyinMicroSec(final ComponentInstance HWcomp, final ComponentInstance bus) {
ConnectionInstance aci = InstanceModelUtil.getBusAccessConnection(HWcomp, bus);
if (aci == null) {
return 0.0;
}
Property Latency = lookupPropertyDefinition(aci, CommunicationProperties._NAME, CommunicationProperties.LATENCY);
UnitLiteral microSecond = PropertiesLinkingService.findUnitLiteral(Latency, AadlProject.US_LITERAL);
return PropertyUtils.getScaledRangeMaximum(aci, Latency, microSecond, 0.0);
}
Aggregations