Search in sources :

Example 21 with BUS

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;
}
Also used : InstanceObject(org.osate.aadl2.instance.InstanceObject) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) ArrayList(java.util.ArrayList) PropertyExpression(org.osate.aadl2.PropertyExpression) InstanceReferenceValue(org.osate.aadl2.instance.InstanceReferenceValue) BasicProperty(org.osate.aadl2.BasicProperty) Property(org.osate.aadl2.Property) PropertyLookupException(org.osate.aadl2.properties.PropertyLookupException) PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException)

Example 22 with BUS

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;
}
Also used : NumberValue(org.osate.aadl2.NumberValue) RecordValue(org.osate.aadl2.RecordValue) RangeValue(org.osate.aadl2.RangeValue)

Example 23 with BUS

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;
}
Also used : NumberValue(org.osate.aadl2.NumberValue) RecordValue(org.osate.aadl2.RecordValue) RangeValue(org.osate.aadl2.RangeValue)

Example 24 with BUS

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);
}
Also used : ConnectionInstance(org.osate.aadl2.instance.ConnectionInstance) UnitLiteral(org.osate.aadl2.UnitLiteral) BasicProperty(org.osate.aadl2.BasicProperty) Property(org.osate.aadl2.Property)

Example 25 with BUS

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);
}
Also used : ConnectionInstance(org.osate.aadl2.instance.ConnectionInstance) UnitLiteral(org.osate.aadl2.UnitLiteral) BasicProperty(org.osate.aadl2.BasicProperty) Property(org.osate.aadl2.Property)

Aggregations

ComponentInstance (org.osate.aadl2.instance.ComponentInstance)22 ArrayList (java.util.ArrayList)16 ConnectionInstance (org.osate.aadl2.instance.ConnectionInstance)14 FeatureInstance (org.osate.aadl2.instance.FeatureInstance)11 ComponentImplementation (org.osate.aadl2.ComponentImplementation)9 NamedElement (org.osate.aadl2.NamedElement)9 CyberMission (com.ge.research.osate.verdict.dsl.verdict.CyberMission)8 CyberRel (com.ge.research.osate.verdict.dsl.verdict.CyberRel)8 CyberReq (com.ge.research.osate.verdict.dsl.verdict.CyberReq)8 Event (com.ge.research.osate.verdict.dsl.verdict.Event)8 SafetyRel (com.ge.research.osate.verdict.dsl.verdict.SafetyRel)8 SafetyReq (com.ge.research.osate.verdict.dsl.verdict.SafetyReq)8 Statement (com.ge.research.osate.verdict.dsl.verdict.Statement)8 Verdict (com.ge.research.osate.verdict.dsl.verdict.Verdict)8 AnnexSubclause (org.osate.aadl2.AnnexSubclause)8 BusAccess (org.osate.aadl2.BusAccess)8 DataPort (org.osate.aadl2.DataPort)8 EventDataPort (org.osate.aadl2.EventDataPort)8 EventPort (org.osate.aadl2.EventPort)8 InstanceObject (org.osate.aadl2.instance.InstanceObject)8