Search in sources :

Example 1 with ConnectionInstance

use of org.osate.aadl2.instance.ConnectionInstance in project osate2 by osate.

the class FeatureToConnectionsMap method addForFeatureGroups.

private void addForFeatureGroups(FeatureInstance fi, ConnectionInstance connInst) {
    EObject parent = fi.eContainer();
    while (parent instanceof FeatureInstance) {
        add((FeatureInstance) parent, connInst);
        parent = parent.eContainer();
    }
}
Also used : FeatureInstance(org.osate.aadl2.instance.FeatureInstance) EObject(org.eclipse.emf.ecore.EObject)

Example 2 with ConnectionInstance

use of org.osate.aadl2.instance.ConnectionInstance in project osate2 by osate.

the class PropertyTotals method calcWeight.

private static Result calcWeight(ComponentInstance ci, boolean needWeight) {
    Result result = ResultFactory.eINSTANCE.createResult();
    result.setModelElement(ci);
    final boolean getWeight = hasWeight.contains(ci.getCategory());
    final double net = getWeight ? PropertyUtils.getScaled(Sei::getNetweight, ci, Weightunits.KG).orElse(0.0) : 0.0;
    double weight = 0.0;
    final double gross = getWeight ? PropertyUtils.getScaled(Sei::getGrossweight, ci, Weightunits.KG).orElse(0.0) : 0.0;
    double sublimit = 0.0;
    EList<ComponentInstance> cil = ci.getComponentInstances();
    for (ComponentInstance subi : cil) {
        ComponentCategory subcat = subi.getCategory();
        if (!(subcat.equals(ComponentCategory.PROCESS) || subcat.equals(ComponentCategory.VIRTUAL_BUS) || subcat.equals(ComponentCategory.VIRTUAL_PROCESSOR))) {
            Result subresult = calcWeight(subi, (needWeight && (gross == 0.0 || net > 0.0)));
            result.getSubResults().add(subresult);
            double subweight = ResultUtil.getReal(subresult, 0);
            weight += subweight;
            sublimit += hasWeight.contains(subi.getCategory()) ? PropertyUtils.getScaled(Sei::getWeightlimit, subi, Weightunits.KG).orElse(0.0) : 0.0;
        }
    }
    EList<ConnectionInstance> connl = ci.getConnectionInstances();
    for (ConnectionInstance connectionInstance : connl) {
        ConnectionInstanceEnd source = connectionInstance.getSource();
        ConnectionInstanceEnd destination = connectionInstance.getDestination();
        if ((source instanceof FeatureInstance && ((FeatureInstance) source).getCategory() == FeatureCategory.BUS_ACCESS) || (destination instanceof FeatureInstance && ((FeatureInstance) destination).getCategory() == FeatureCategory.BUS_ACCESS)) {
            double netconn = PropertyUtils.getScaled(Sei::getNetweight, connectionInstance, Weightunits.KG).orElse(0.0);
            double grossconn = PropertyUtils.getScaled(Sei::getGrossweight, connectionInstance, Weightunits.KG).orElse(0.0);
            weight += netconn > 0 ? netconn : grossconn;
            if (netconn > 0 || grossconn > 0) {
                String ResultMsg = String.format(connectionInstance.getName() + ": Weight of access connection is %.3f kg", netconn > 0 ? netconn : grossconn);
                result.getDiagnostics().add(ResultUtil.createInfoDiagnostic(ResultMsg, connectionInstance));
            }
            sublimit += connectionInstance.getKind() == ConnectionKind.ACCESS_CONNECTION ? PropertyUtils.getScaled(Sei::getWeightlimit, connectionInstance, Weightunits.KG).orElse(0.0) : 0.0;
        }
    }
    if (weight == 0.0 && cil.isEmpty()) {
        if (gross == 0 && net > 0) {
            weight = net;
        } else {
            weight = gross;
        }
    } else {
        weight += net;
    }
    if (gross > 0.0) {
        if (weight > gross) {
            // problem
            result.getDiagnostics().add(ResultUtil.createWarningDiagnostic(String.format("[G] Sum of weights (%.3f kg) exceeds gross weight of %.3f kg", weight, gross), ci));
        // Set gross weight
        } else if (weight > 0 && weight < gross) {
            // problem
            result.getDiagnostics().add(ResultUtil.createWarningDiagnostic(String.format("[G] Sum of weights (%.3f kg) less than gross weight of %.3f kg (using gross weight)", weight, gross), ci));
            weight = gross;
        }
        if (weight == 0.0) {
            weight = gross;
        }
    }
    final double limit = getWeight ? PropertyUtils.getScaled(Sei::getWeightlimit, ci, Weightunits.KG).orElse(0.0) : 0.0;
    if (limit > 0.0) {
        if (weight > limit) {
            // problem
            String ResultMsg = String.format("[A] Sum of weights (%.3f kg) exceeds weight limit of %.3f kg", weight, limit);
            result.getDiagnostics().add(ResultUtil.createErrorDiagnostic(ResultMsg, ci));
        } else {
            if (sublimit > limit) {
                // problem
                result.getDiagnostics().add(ResultUtil.createWarningDiagnostic(String.format("[L] Sum of subcomponent weight limits (%.3f kg) exceeds weight limit of %.3f kg", sublimit, limit), ci));
            }
            if (weight < limit) {
                String ResultMsg = String.format("[A] Sum of weights (%.3f kg) is below weight limit of %.3f kg (%.1f %% Weight slack)", weight, limit, (limit - weight) / limit * 100);
                result.getDiagnostics().add(ResultUtil.createInfoDiagnostic(ResultMsg, ci));
            }
        }
    } else {
        if (weight > 0.0) {
            String ResultMsg = String.format("[L] Sum of weights / gross weight is %.3f kg (no limit specified)", weight);
            result.getDiagnostics().add(ResultUtil.createInfoDiagnostic(ResultMsg, ci));
        } else if (needWeight) {
            String ResultMsg = "[L] No net weight plus subcomponent weight or no gross weight";
            result.getDiagnostics().add(ResultUtil.createWarningDiagnostic(ResultMsg, ci));
        }
    }
    ResultUtil.addRealValue(result, weight, "kg");
    ResultUtil.addRealValue(result, gross, "kg");
    ResultUtil.addRealValue(result, net, "kg");
    ResultUtil.addRealValue(result, limit, "kg");
    return result;
}
Also used : ConnectionInstance(org.osate.aadl2.instance.ConnectionInstance) FeatureInstance(org.osate.aadl2.instance.FeatureInstance) Sei(org.osate.contribution.sei.sei.Sei) ConnectionInstanceEnd(org.osate.aadl2.instance.ConnectionInstanceEnd) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) ComponentCategory(org.osate.aadl2.ComponentCategory) Result(org.osate.result.Result) AnalysisResult(org.osate.result.AnalysisResult)

Example 3 with ConnectionInstance

use of org.osate.aadl2.instance.ConnectionInstance in project osate2 by osate.

the class FlowLatencyAnalysisSwitch method mapComponentInstance.

private void mapComponentInstance(final EndToEndFlowInstance etef, final FlowElementInstance flowElementInstance, LatencyReportEntry entry) {
    ComponentInstance componentInstance;
    final boolean hasLatency = flowElementInstance instanceof FlowSpecificationInstance || flowElementInstance instanceof ConnectionInstance || flowElementInstance instanceof EndToEndFlowInstance || latencyCats.contains(((ComponentInstance) flowElementInstance).getCategory());
    final RealRange expected = hasLatency ? PropertyUtils.getScaledRange(org.osate.aadl2.contrib.communication.CommunicationProperties::getLatency, flowElementInstance, TimeUnits.MS).orElse(RealRange.ZEROED) : RealRange.ZEROED;
    if (flowElementInstance instanceof FlowSpecificationInstance) {
        componentInstance = flowElementInstance.getComponentInstance();
    } else {
        componentInstance = (ComponentInstance) flowElementInstance;
    }
    FeatureInstance incomingConnectionFI = FlowLatencyUtil.getIncomingConnectionFeatureInstance(etef, flowElementInstance);
    /**
     * Get all the relevant properties.
     */
    double period = periodCats.contains(componentInstance.getCategory()) ? PropertyUtils.getScaled(TimingProperties::getPeriod, componentInstance, TimeUnits.MS).orElse(0.0) : 0.0;
    double deadline = deadlineCats.contains(componentInstance.getCategory()) ? PropertyUtils.getScaled(TimingProperties::getDeadline, componentInstance, TimeUnits.MS).orElse(0.0) : 0.0;
    boolean isAssignedDeadline = isAssignedDeadline(componentInstance);
    final boolean isThreadOrDevice = InstanceModelUtil.isThread(componentInstance) || InstanceModelUtil.isDevice(componentInstance) || InstanceModelUtil.isAbstract(componentInstance);
    final boolean isPeriodic = period > 0 && (isThreadOrDevice ? (!InstanceModelUtil.isSporadicComponent(componentInstance) && !InstanceModelUtil.isTimedComponent(componentInstance) && !InstanceModelUtil.isAperiodicComponent(componentInstance)) : true);
    final RealRange responseTime = getResponseTimeInMilliSec(flowElementInstance, componentInstance, isPeriodic);
    final RealRange executionTime = getExecutionTimeInMilliSec(flowElementInstance, componentInstance, isPeriodic);
    /**
     * The component is periodic. Therefore it will sample its input unless we have an immediate connection or delayed connection
     */
    boolean checkLastImmediate = false;
    if (isPeriodic) {
        // we have a periodic component that samples
        if (incomingConnectionFI != null) {
            // it is not the first component in the ETEF. We need to add sampling latency
            if (incomingConnectionFI.getCategory() == FeatureCategory.DATA_PORT || incomingConnectionFI.getCategory() == FeatureCategory.ABSTRACT_FEATURE) {
                // sampling incoming data
                // period is set, and if thread, abstract, or device needs to be dispatched as periodic
                // We sample only data ports. Event and event data ports have queuing latency
                LatencyContributorComponent samplingLatencyContributor = new LatencyContributorComponent(componentInstance, flowElementInstance, report.isMajorFrameDelay());
                samplingLatencyContributor.setSamplingPeriod(period);
                if ((InstanceModelUtil.isThread(componentInstance) || InstanceModelUtil.isDevice(componentInstance)) && !hasAssignedPropertyValue(componentInstance, "Dispatch_Protocol")) {
                    samplingLatencyContributor.reportInfo("Assume Periodic dispatch because period is set");
                }
                if (FlowLatencyUtil.isPreviousConnectionDelayed(etef, flowElementInstance)) {
                    samplingLatencyContributor.setBestCaseMethod(LatencyContributorMethod.DELAYED);
                    samplingLatencyContributor.setWorstCaseMethod(LatencyContributorMethod.DELAYED);
                } else if (FlowLatencyUtil.isPreviousConnectionImmediate(etef, flowElementInstance)) {
                    // the cumulative does not exceed the deadline of the last.
                    if (!FlowLatencyUtil.isNextConnectionImmediate(etef, flowElementInstance)) {
                        checkLastImmediate = true;
                    }
                } else {
                    // sampled. We may under sample
                    ComponentInstance prevComp = FlowLatencyUtil.getPreviousComponent(etef, flowElementInstance);
                    double prevPeriod = prevComp != null ? PropertyUtils.getScaled(TimingProperties::getPeriod, prevComp, TimeUnits.MS).orElse(0.0) : 0;
                    if (period > 0 && prevPeriod > 0 && period % prevPeriod == 0.0) {
                        samplingLatencyContributor.setSamplingPeriod(prevPeriod);
                    } else {
                        samplingLatencyContributor.setSamplingPeriod(period);
                    }
                    samplingLatencyContributor.setBestCaseMethod(LatencyContributorMethod.SAMPLED);
                    samplingLatencyContributor.setWorstCaseMethod(LatencyContributorMethod.SAMPLED);
                }
                entry.addContributor(samplingLatencyContributor);
            } else {
            // queuing latency handled later
            // do nothing here
            }
        } else {
            // The periodic component is the first component in the ETEF
            // record fact that first element is periodic so we can process synchronous behavior correctly
            LatencyContributorComponent samplingLatencyContributor = new LatencyContributorComponent(componentInstance, flowElementInstance, report.isMajorFrameDelay());
            samplingLatencyContributor.setBestCaseMethod(LatencyContributorMethod.FIRST_PERIODIC);
            samplingLatencyContributor.setWorstCaseMethod(LatencyContributorMethod.FIRST_PERIODIC);
            entry.addContributor(samplingLatencyContributor);
        }
    } else {
        // the component is not executing periodically
        if (entry.getContributors().isEmpty()) {
            // insert first partition sampling for the aperiodic case. For other partitions it is inserted by connection processing
            ComponentInstance firstPartition = FlowLatencyUtil.getPartition(componentInstance);
            if (firstPartition != null) {
                double partitionLatency = FlowLatencyUtil.getPartitionPeriod(firstPartition);
                List<ScheduleWindow> schedule = FlowLatencyUtil.getModuleSchedule(firstPartition);
                double partitionDuration = FlowLatencyUtil.getPartitionDuration(firstPartition, schedule);
                LatencyContributorComponent platencyContributor = new LatencyContributorComponent(firstPartition, flowElementInstance, report.isMajorFrameDelay());
                if (!FlowLatencyUtil.isInSchedule(firstPartition, schedule)) {
                    platencyContributor.reportWarning("Partition not found in ARINC653 schedule of processor " + FlowLatencyUtil.getModule(firstPartition).getName());
                }
                if (partitionDuration > 0) {
                    platencyContributor.setSamplingPeriod(partitionLatency);
                    double frameOffset = FlowLatencyUtil.getPartitionFrameOffset(firstPartition, schedule);
                    platencyContributor.setPartitionOffset(frameOffset);
                    platencyContributor.setPartitionDuration(partitionDuration);
                    platencyContributor.setWorstCaseMethod(LatencyContributorMethod.PARTITION_SCHEDULE);
                    platencyContributor.setBestCaseMethod(LatencyContributorMethod.PARTITION_SCHEDULE);
                    entry.addContributor(platencyContributor);
                } else {
                    platencyContributor.setSamplingPeriod(partitionLatency);
                    platencyContributor.setWorstCaseMethod(LatencyContributorMethod.PARTITION_FRAME);
                    platencyContributor.setBestCaseMethod(LatencyContributorMethod.PARTITION_FRAME);
                    entry.addContributor(platencyContributor);
                }
            }
        }
    }
    /**
     * Selection of the worst case value, generic case.
     */
    LatencyContributorMethod bestmethod;
    LatencyContributorMethod worstmethod;
    double worstCaseValue = 0.0;
    double bestCaseValue = 0.0;
    worstmethod = LatencyContributorMethod.UNKNOWN;
    LatencyContributorComponent processingLatencyContributor = new LatencyContributorComponent(componentInstance, flowElementInstance, report.isMajorFrameDelay());
    if (responseTime.getMaximum() != 0.0) {
        worstCaseValue = responseTime.getMaximum();
        worstmethod = LatencyContributorMethod.RESPONSE_TIME;
    } else if (executionTime.getMaximum() != 0.0) {
        if (!report.isWorstCaseDeadline()) {
            // Use execution time for worst-case if preferences specify not deadline or no deadline is specified
            worstCaseValue = executionTime.getMaximum();
            worstmethod = LatencyContributorMethod.PROCESSING_TIME;
        } else if (!isAssignedDeadline) {
            worstCaseValue = executionTime.getMaximum();
            worstmethod = LatencyContributorMethod.PROCESSING_TIME;
            processingLatencyContributor.reportInfo("Using execution time as deadline was not set");
        }
    }
    if ((worstCaseValue == 0.0) && isAssignedDeadline && report.isWorstCaseDeadline()) {
        // use deadline if no execution time and deadline was explicitly assigned
        worstCaseValue = deadline;
        worstmethod = LatencyContributorMethod.DEADLINE;
    }
    if ((worstCaseValue == 0.0) && (expected.getMaximum() != 0.0)) {
        // use flow latency if neither deadline nor execution time
        worstCaseValue = expected.getMaximum();
        worstmethod = LatencyContributorMethod.SPECIFIED;
    } else if (worstCaseValue == 0.0 && deadline != 0.0) {
        // if no flow spec value then use default deadline == period
        worstCaseValue = deadline;
        worstmethod = LatencyContributorMethod.DEADLINE;
        processingLatencyContributor.reportInfo("Using deadline as execution time was not set");
    }
    /**
     * Selection of the best case value, generic cases.
     */
    bestmethod = LatencyContributorMethod.UNKNOWN;
    if (responseTime.getMinimum() != 0.0) {
        bestCaseValue = responseTime.getMinimum();
        bestmethod = LatencyContributorMethod.RESPONSE_TIME;
    } else if (executionTime.getMinimum() != 0.0) {
        bestCaseValue = executionTime.getMinimum();
        bestmethod = LatencyContributorMethod.PROCESSING_TIME;
    }
    if ((bestCaseValue == 0.0) && (expected.getMinimum() != 0.0)) {
        bestCaseValue = expected.getMinimum();
        bestmethod = LatencyContributorMethod.SPECIFIED;
    }
    // take into account queuing delay
    if (incomingConnectionFI != null) {
        double qs = 0;
        LatencyContributorComponent ql = new LatencyContributorComponent(componentInstance, flowElementInstance, report.isMajorFrameDelay());
        if (hasAssignedPropertyValue(incomingConnectionFI, org.osate.xtext.aadl2.properties.util.CommunicationProperties.QUEUE_SIZE)) {
            qs = CommunicationProperties.getQueueSize(incomingConnectionFI).orElse(0);
        } else if (incomingConnectionFI.getCategory() == FeatureCategory.DATA_PORT && isThreadOrDevice && (InstanceModelUtil.isSporadicComponent(componentInstance) || InstanceModelUtil.isTimedComponent(componentInstance) || InstanceModelUtil.isAperiodicComponent(componentInstance))) {
            // treat data port as a port of queue size 1 when not a sampling thread
            qs = 1;
            ql.reportInfo("Data port as queue size 1 for sporadic, aperiodic, timed dispatch");
        }
        if (qs != 0) {
            // take into account queuing delay on event and event data ports.
            double dl = 0.0;
            if (InstanceModelUtil.isSporadicComponent(componentInstance) || InstanceModelUtil.isPeriodicComponent(componentInstance)) {
                dl = period;
                ql.reportInfo("Sporadic or periodic has period delay per queue element");
            } else {
                dl = worstCaseValue;
            }
            double queuingDelay = qs * dl;
            ql.setMaximum(queuingDelay);
            if (report.isBestcaseEmptyQueue()) {
                ql.setMinimum(0.0);
                ql.reportInfo("Assume best case empty queue");
            } else {
                double mindl = (InstanceModelUtil.isSporadicComponent(componentInstance) || InstanceModelUtil.isPeriodicComponent(componentInstance) ? period : bestCaseValue);
                ql.setMinimum(qs * mindl);
                ql.reportInfo("Assume best case full queue");
            }
            ql.setWorstCaseMethod(LatencyContributorMethod.QUEUED);
            ql.setBestCaseMethod(LatencyContributorMethod.QUEUED);
            entry.addContributor(ql);
        }
    }
    processingLatencyContributor.setWorstCaseMethod(worstmethod);
    processingLatencyContributor.setBestCaseMethod(bestmethod);
    processingLatencyContributor.setMaximum(worstCaseValue);
    processingLatencyContributor.setMinimum(bestCaseValue);
    processingLatencyContributor.setExpectedMaximum(expected.getMaximum());
    processingLatencyContributor.setExpectedMinimum(expected.getMinimum());
    if (checkLastImmediate && deadline > 0.0) {
        processingLatencyContributor.setImmediateDeadline(deadline);
    }
    processingLatencyContributor.checkConsistency();
    entry.addContributor(processingLatencyContributor);
}
Also used : ConnectionInstance(org.osate.aadl2.instance.ConnectionInstance) RealRange(org.osate.pluginsupport.properties.RealRange) CommunicationProperties(org.osate.aadl2.contrib.communication.CommunicationProperties) FeatureInstance(org.osate.aadl2.instance.FeatureInstance) LatencyContributorMethod(org.osate.analysis.flows.model.LatencyContributor.LatencyContributorMethod) FlowSpecificationInstance(org.osate.aadl2.instance.FlowSpecificationInstance) ScheduleWindow(org.osate.contribution.sei.arinc653.ScheduleWindow) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) LatencyContributorComponent(org.osate.analysis.flows.model.LatencyContributorComponent) EndToEndFlowInstance(org.osate.aadl2.instance.EndToEndFlowInstance) TimingProperties(org.osate.aadl2.contrib.timing.TimingProperties)

Example 4 with ConnectionInstance

use of org.osate.aadl2.instance.ConnectionInstance in project osate2 by osate.

the class FlowLatencyAnalysisSwitch method processTransmissionTime.

/**
 * add latency sub-contribution due to transmission by bus (or virtual bus)
 * works for an instance object and for a classifier.
 * We determine the transmission latency from the data size and transmission time property.
 * If not present we get it from the latency property.
 * If neither is present and we are a connection or virtual bus we do not add a latency.
 * If we are HW component, we add unknown latency.
 * targetMedium: a connection instance, or the binding target (virtual bus or bus)
 * transmissionDataSize: the size of data to be transmitted.
 * latencyContributor: the place where we add a subcontributor.
 */
private void processTransmissionTime(NamedElement targetMedium, double datasizeinbyte, LatencyContributor latencyContributor, final ConnectionInstance onBehalfOfConnection) {
    // XXX: [Code Coverage] targetMedium cannot be null.
    if (targetMedium != null) {
        final RealRange busLatency = PropertyUtils.getScaledRange(org.osate.aadl2.contrib.communication.CommunicationProperties::getLatency, targetMedium, TimeUnits.MS).orElse(RealRange.ZEROED);
        final RealRange busTransferTime = getTimeToTransferData(targetMedium, datasizeinbyte);
        if (busLatency.getMaximum() == 0 && busTransferTime.getMaximum() == 0) {
            // connection or protocol has nothing to contribute
            return;
        }
        LatencyContributor subContributor = new LatencyContributorComponent(targetMedium, report.isMajorFrameDelay());
        subContributor.setExpectedMaximum(busLatency.getMaximum());
        subContributor.setExpectedMinimum(busLatency.getMinimum());
        if (busTransferTime.getMaximum() > 0) {
            subContributor.setMaximum(busTransferTime.getMaximum());
            subContributor.reportInfo("Using data transfer time");
            if (datasizeinbyte == 0.0) {
                subContributor.reportInfo("Data size = 0. Possibly data type on port missing");
            }
            subContributor.setWorstCaseMethod(LatencyContributorMethod.TRANSMISSION_TIME);
            // Record the latency for use by asynchronous bus waiting times
            if (targetMedium instanceof ComponentInstance) {
                computedMaxTransmissionLatencies.put(new Pair<>((ComponentInstance) targetMedium, onBehalfOfConnection), busTransferTime.getMaximum());
            }
        } else if (busLatency.getMaximum() > 0) {
            subContributor.setMaximum(busLatency.getMaximum());
            subContributor.setWorstCaseMethod(LatencyContributorMethod.SPECIFIED);
            subContributor.reportInfo("Using specified bus latency");
            // Record the latency for use by asynchronous bus waiting times
            if (targetMedium instanceof ComponentInstance) {
                computedMaxTransmissionLatencies.put(new Pair<>((ComponentInstance) targetMedium, onBehalfOfConnection), busTransferTime.getMaximum());
            }
        } else {
            // XXX: [Code Coverage] Only executable if maxBusTransferTime or maxBusLatency is negative.
            subContributor.setWorstCaseMethod(LatencyContributorMethod.UNKNOWN);
        }
        if (busTransferTime.getMinimum() > 0) {
            subContributor.setMinimum(busTransferTime.getMinimum());
            subContributor.setBestCaseMethod(LatencyContributorMethod.TRANSMISSION_TIME);
        } else if (busLatency.getMinimum() > 0) {
            subContributor.setMinimum(busLatency.getMinimum());
            subContributor.setBestCaseMethod(LatencyContributorMethod.SPECIFIED);
        } else {
            // XXX: [Code Coverage] Only executable if minBusTransferTime or minBusLatency is negative.
            subContributor.setBestCaseMethod(LatencyContributorMethod.UNKNOWN);
        }
        latencyContributor.addSubContributor(subContributor);
    }
}
Also used : RealRange(org.osate.pluginsupport.properties.RealRange) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) LatencyContributor(org.osate.analysis.flows.model.LatencyContributor) LatencyContributorComponent(org.osate.analysis.flows.model.LatencyContributorComponent)

Example 5 with ConnectionInstance

use of org.osate.aadl2.instance.ConnectionInstance in project osate2 by osate.

the class FlowLatencyAnalysisSwitch method sortBoundConnectionsHelper.

private static final void sortBoundConnectionsHelper(final ComponentInstance compInstance, final Map<ComponentInstance, Set<ConnectionInstance>> map) {
    for (final ConnectionInstance ci : compInstance.getConnectionInstances()) {
        final List<InstanceObject> bindings = DeploymentProperties.getActualConnectionBinding(ci).orElse(Collections.emptyList());
        for (final InstanceObject io : bindings) {
            final ComponentInstance componentInstance = (ComponentInstance) io;
            addToHashedSet(map, componentInstance, ci);
            processComponentBindings(map, ci, componentInstance);
        }
    }
    for (final ComponentInstance child : compInstance.getComponentInstances()) {
        sortBoundConnectionsHelper(child, map);
    }
}
Also used : ConnectionInstance(org.osate.aadl2.instance.ConnectionInstance) InstanceObject(org.osate.aadl2.instance.InstanceObject) ComponentInstance(org.osate.aadl2.instance.ComponentInstance)

Aggregations

ConnectionInstance (org.osate.aadl2.instance.ConnectionInstance)71 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)64 ConnectionReference (org.osate.aadl2.instance.ConnectionReference)32 ConnectionInstanceEnd (org.osate.aadl2.instance.ConnectionInstanceEnd)28 FeatureInstance (org.osate.aadl2.instance.FeatureInstance)25 Classifier (org.osate.aadl2.Classifier)22 InstanceObject (org.osate.aadl2.instance.InstanceObject)21 Connection (org.osate.aadl2.Connection)16 ArrayList (java.util.ArrayList)15 Element (org.osate.aadl2.Element)15 NamedElement (org.osate.aadl2.NamedElement)13 PropertyExpression (org.osate.aadl2.PropertyExpression)13 SystemInstance (org.osate.aadl2.instance.SystemInstance)13 SystemOperationMode (org.osate.aadl2.instance.SystemOperationMode)13 ComponentClassifier (org.osate.aadl2.ComponentClassifier)12 ComponentImplementation (org.osate.aadl2.ComponentImplementation)10 ListValue (org.osate.aadl2.ListValue)10 BasicEList (org.eclipse.emf.common.util.BasicEList)9 Feature (org.osate.aadl2.Feature)9 EndToEndFlowInstance (org.osate.aadl2.instance.EndToEndFlowInstance)9