Search in sources :

Example 1 with CommunicationProperties

use of org.osate.aadl2.contrib.communication.CommunicationProperties in project osate2 by osate.

the class GetProperties method getActualLatencyinMS.

public static double getActualLatencyinMS(final NamedElement ne) {
    Property actualLatency = lookupPropertyDefinition(ne, CommunicationProperties._NAME, CommunicationProperties.ACTUAL_LATENCY);
    UnitLiteral milliSecond = findUnitLiteral(actualLatency, AadlProject.MS_LITERAL);
    return PropertyUtils.getScaledNumberValue(ne, actualLatency, milliSecond, 0.0);
}
Also used : UnitLiteral(org.osate.aadl2.UnitLiteral) BasicProperty(org.osate.aadl2.BasicProperty) Property(org.osate.aadl2.Property)

Example 2 with CommunicationProperties

use of org.osate.aadl2.contrib.communication.CommunicationProperties in project osate2 by osate.

the class GetProperties method getActualLatencyinMicroSec.

public static double getActualLatencyinMicroSec(final NamedElement ne) {
    Property actualLatency = lookupPropertyDefinition(ne, CommunicationProperties._NAME, CommunicationProperties.ACTUAL_LATENCY);
    UnitLiteral microSecond = findUnitLiteral(actualLatency, AadlProject.US_LITERAL);
    return PropertyUtils.getScaledNumberValue(ne, actualLatency, microSecond, 0.0);
}
Also used : UnitLiteral(org.osate.aadl2.UnitLiteral) BasicProperty(org.osate.aadl2.BasicProperty) Property(org.osate.aadl2.Property)

Example 3 with CommunicationProperties

use of org.osate.aadl2.contrib.communication.CommunicationProperties in project osate2 by osate.

the class GetProperties method getLatencyinMicroSec.

public static double getLatencyinMicroSec(final NamedElement ne) {
    Property Latency = lookupPropertyDefinition(ne, CommunicationProperties._NAME, CommunicationProperties.LATENCY);
    UnitLiteral microSecond = PropertiesLinkingService.findUnitLiteral(Latency, AadlProject.US_LITERAL);
    return PropertyUtils.getScaledRangeMaximum(ne, Latency, microSecond, 0.0);
}
Also used : UnitLiteral(org.osate.aadl2.UnitLiteral) BasicProperty(org.osate.aadl2.BasicProperty) Property(org.osate.aadl2.Property)

Example 4 with CommunicationProperties

use of org.osate.aadl2.contrib.communication.CommunicationProperties in project osate2 by osate.

the class GetProperties method getOutgoingMessageRatePerSecond.

/*
	 * Look for Message_Rate or SEI::Data_Rate first. Then pick up Output_Rate,
	 * whose default value is 1 per dispatch That rate is converted to persecond
	 * using Period. If Period is zero then the resulting data rate is zero as
	 * well.
	 */
public static double getOutgoingMessageRatePerSecond(final NamedElement ne) {
    double res = GetProperties.getMessageRatePerSecond(ne);
    if (res > 0) {
        return res;
    }
    Property outputRate = lookupPropertyDefinition(ne, CommunicationProperties._NAME, CommunicationProperties.OUTPUT_RATE);
    RecordValue rec = GetProperties.getOutPutRate(ne);
    if (rec != null) {
        res = GetProperties.getMaxDataRate(rec);
        EnumerationLiteral unit = GetProperties.getRateUnit(rec);
        double period = 0;
        if (unit == null || unit.getName().equalsIgnoreCase("PerDispatch")) {
            if (ne instanceof InstanceObject) {
                period = GetProperties.getPeriodInSeconds(((InstanceObject) ne).getContainingComponentInstance(), 0);
            } else {
                period = GetProperties.getPeriodInSeconds(ne.getContainingClassifier(), 0);
            }
            if (period == 0) {
                return 0;
            }
            res = res / period;
        }
        if (res > 0) {
            return res;
        }
    }
    double period = GetProperties.getPeriodInSeconds(ne.getContainingClassifier(), 0);
    if (period == 0) {
        return 0;
    }
    res = 1 / period;
    return res;
}
Also used : InstanceObject(org.osate.aadl2.instance.InstanceObject) RecordValue(org.osate.aadl2.RecordValue) BasicProperty(org.osate.aadl2.BasicProperty) Property(org.osate.aadl2.Property) EnumerationLiteral(org.osate.aadl2.EnumerationLiteral)

Example 5 with CommunicationProperties

use of org.osate.aadl2.contrib.communication.CommunicationProperties in project osate2 by osate.

the class GetProperties method getMaximumLatencyinMilliSec.

public static double getMaximumLatencyinMilliSec(final NamedElement ne) {
    Property Latency = lookupPropertyDefinition(ne, CommunicationProperties._NAME, CommunicationProperties.LATENCY);
    UnitLiteral milliSecond = PropertiesLinkingService.findUnitLiteral(Latency, AadlProject.MS_LITERAL);
    return PropertyUtils.getScaledRangeMaximum(ne, Latency, milliSecond, 0.0);
}
Also used : UnitLiteral(org.osate.aadl2.UnitLiteral) BasicProperty(org.osate.aadl2.BasicProperty) Property(org.osate.aadl2.Property)

Aggregations

BasicProperty (org.osate.aadl2.BasicProperty)8 Property (org.osate.aadl2.Property)8 UnitLiteral (org.osate.aadl2.UnitLiteral)7 ConnectionInstance (org.osate.aadl2.instance.ConnectionInstance)2 EnumerationLiteral (org.osate.aadl2.EnumerationLiteral)1 RecordValue (org.osate.aadl2.RecordValue)1 InstanceObject (org.osate.aadl2.instance.InstanceObject)1