use of org.osate.aadl2.contrib.communication.TransmissionTime in project osate2 by osate.
the class FlowLatencyAnalysisSwitch method getTimeToTransferData.
private static RealRange getTimeToTransferData(final NamedElement bus, double datasizeinbyte) {
final Optional<TransmissionTime> tt_o = org.osate.aadl2.contrib.communication.CommunicationProperties.getTransmissionTime(bus);
if (tt_o.isPresent()) {
final TransmissionTime tt = tt_o.get();
final RealRange fixedRange = PropertyUtils.scaleRange(tt.getFixed(), TimeUnits.MS).orElse(RealRange.ZEROED);
final RealRange perByteRange = PropertyUtils.scaleRange(tt.getPerbyte(), TimeUnits.MS).orElse(RealRange.ZEROED);
final double min = fixedRange.getMinimum() + (datasizeinbyte * perByteRange.getMinimum());
final double max = fixedRange.getMaximum() + (datasizeinbyte * perByteRange.getMaximum());
return new RealRange(min, max);
} else {
return new RealRange(0.0, 0.0);
}
}
use of org.osate.aadl2.contrib.communication.TransmissionTime in project osate2 by osate.
the class CommunicationProperties method getTransmissionTime.
public static Optional<TransmissionTime> getTransmissionTime(NamedElement lookupContext, Optional<Mode> mode) {
Property property = getTransmissionTime_Property(lookupContext);
try {
PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
return Optional.of(new TransmissionTime(resolved, lookupContext, mode));
} catch (PropertyNotPresentException e) {
return Optional.empty();
}
}
Aggregations