Search in sources :

Example 26 with SystemInstance

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

the class CheckBindingConstraints method doAaxlAction.

@Override
protected void doAaxlAction(IProgressMonitor monitor, Element root) {
    if (root instanceof ComponentInstance) {
        SubMonitor subMonitor = SubMonitor.convert(monitor).checkCanceled();
        SystemInstance si = ((ComponentInstance) root).getSystemInstance();
        if (si != null) {
            List<Issue> issues = runAnalysis(subMonitor, si);
            issues.forEach(issue -> error(issue.target, issue.message));
            if (issues.isEmpty()) {
                getShell().getDisplay().asyncExec(() -> MessageDialog.openInformation(getShell(), "Check Binding Constraints", "No problems found"));
            } else {
                getShell().getDisplay().asyncExec(() -> MessageDialog.openError(getShell(), "Check Binding Constraints", issues.size() + " problem(s) found"));
            }
        }
    } else {
        Dialog.showWarning(getActionName(), "Please invoke command on an instance model");
    }
}
Also used : SystemInstance(org.osate.aadl2.instance.SystemInstance) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) SubMonitor(org.eclipse.core.runtime.SubMonitor)

Example 27 with SystemInstance

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

the class CheckConnectionBindingConsistency method doAaxlAction.

@Override
public void doAaxlAction(final IProgressMonitor monitor, final Element obj) {
    if (!(obj instanceof ComponentInstance)) {
        Dialog.showWarning(getActionName(), "Please invoke command on an instance model");
        return;
    }
    SystemInstance si = ((ComponentInstance) obj).getSystemInstance();
    monitor.beginTask(getActionName(), IProgressMonitor.UNKNOWN);
    ConnectionBindingConsistency anal = new ConnectionBindingConsistency(monitor, this);
    if (si != null) {
        anal.defaultTraversal(si);
    }
    if (anal.cancelled()) {
        throw new OperationCanceledException();
    }
    monitor.done();
}
Also used : SystemInstance(org.osate.aadl2.instance.SystemInstance) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) ConnectionBindingConsistency(org.osate.analysis.architecture.ConnectionBindingConsistency)

Example 28 with SystemInstance

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

the class DoPropertyTotals method doAaxlAction.

@Override
public void doAaxlAction(IProgressMonitor monitor, Element obj) {
    /*
		 * Doesn't make sense to set the number of work units, because
		 * the whole point of this action is count the number of elements.
		 * To set the work units we would effectively have to count everything
		 * twice.
		 */
    monitor.beginTask("Gathering weight summaries", IProgressMonitor.UNKNOWN);
    if (!(obj instanceof ComponentInstance)) {
        warning(obj, "Weight totals: Please invoke command on an instance model");
        monitor.done();
        return;
    }
    // Get the system instance (if any)
    SystemInstance si = ((ComponentInstance) obj).getSystemInstance();
    PropertyTotals.invoke(si).getResults().forEach(result -> generateMarkers(result));
    monitor.done();
}
Also used : SystemInstance(org.osate.aadl2.instance.SystemInstance) ComponentInstance(org.osate.aadl2.instance.ComponentInstance)

Example 29 with SystemInstance

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

the class FlowLatencyAnalysisSwitch method invokeOnSOM.

/**
 * Invoke the analysis and return Result collection
 *
 * @param etef The end to end flow instance
 * @param som The mode to run the analysis in. If the ETEF is not active it will not be run.
 * @param asynchronousSystem Whether the system is treated as asynchronous
 * @param majorFrameDelay Whether partition output is performed at a major frame (as opposed to the partition end)
 * @param worstCaseDeadline Use deadline based processing (as opposed to max compute execution time)
 * @param bestCaseEmptyQueue Assume empty queue (instead of full)
 * @param disableQueuingLatency <code>true</code> if queuing latency should always be reported as zero
 *
 * @since org.osate.analysis.flows 3.0
 */
private void invokeOnSOM(EndToEndFlowInstance etef, SystemOperationMode som, boolean asynchronousSystem, boolean majorFrameDelay, boolean worstCaseDeadline, boolean bestCaseEmptyQueue, boolean disableQueuingLatency) {
    if (report == null) {
        report = new LatencyReport();
    }
    report.setRootinstance(etef.getSystemInstance());
    report.setLatencyAnalysisParameters(asynchronousSystem, majorFrameDelay, worstCaseDeadline, bestCaseEmptyQueue, disableQueuingLatency);
    SystemInstance root = etef.getSystemInstance();
    if (etef.isActive(som)) {
        root.setCurrentSystemOperationMode(som);
        LatencyReportEntry latres = analyzeLatency(etef, som, asynchronousSystem);
        // Issue 1148
        report.addEntry(latres);
        root.clearCurrentSystemOperationMode();
    }
}
Also used : SystemInstance(org.osate.aadl2.instance.SystemInstance) LatencyReportEntry(org.osate.analysis.flows.model.LatencyReportEntry) LatencyReport(org.osate.analysis.flows.model.LatencyReport)

Example 30 with SystemInstance

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

the class FlowLatencyAnalysisSwitch method fillInQueuingTimes.

private void fillInQueuingTimes(final SystemInstance system) {
    // Nothing to do if there are no asynchronous buses
    if (!asyncBuses.isEmpty()) {
        // Get all the connections bound to a bus and group them together by the bus they are bound to
        final Map<ComponentInstance, Set<ConnectionInstance>> sortedConnections = sortBoundConnections(system);
        /*
			 * Go through the list of all the asynchronous buses
			 */
        for (final NamedElement ne : asyncBuses) {
            // only proceed if it is a bus instance and not a classifier (from Required_Virtual_Bus_Class)
            if (ne instanceof ComponentInstance) {
                final ComponentInstance bus = (ComponentInstance) ne;
                // Get all the connections bound to that bus
                final Set<ConnectionInstance> boundConnections = sortedConnections.getOrDefault(bus, Collections.emptySet());
                // Get all the transmission times and compute the total
                double totalTime = 0.0;
                final Map<ConnectionInstance, Double> transmissionTimes = new HashMap<>();
                for (final ConnectionInstance ci : boundConnections) {
                    final Double time = computedMaxTransmissionLatencies.getOrDefault(new Pair<ComponentInstance, ConnectionInstance>(bus, ci), 0.0);
                    transmissionTimes.put(ci, time);
                    totalTime += time;
                }
                /*
					 * Go through the list of connections again, and subtract the time associated
					 * with the current connection to find the max waiting time for each connection.
					 * (That each for each connection ci, we will have the sum of all the times
					 * for the _other_ connections bound to same bus. This gives us the max
					 * time that connection ci may have to wait to use the bus.)
					 */
                for (final ConnectionInstance ci : boundConnections) {
                    final Double ciTime = transmissionTimes.get(ci);
                    final double maxWaitingTime = totalTime - ciTime;
                    // Finally we can stick this into the latency contributor
                    final LatencyContributor latencyContributor = connectionsToContributors.get(new Pair<>(bus, ci));
                    final LatencyContributor queuingLatencyContributor = new LatencyContributorComponent(bus, report.isMajorFrameDelay());
                    queuingLatencyContributor.setBestCaseMethod(LatencyContributorMethod.QUEUED);
                    queuingLatencyContributor.setWorstCaseMethod(LatencyContributorMethod.QUEUED);
                    queuingLatencyContributor.setMinimum(0.0);
                    if (report.isDisableQueuingLatency()) {
                        // Hide the queuing time
                        queuingLatencyContributor.setMaximum(0.0);
                        queuingLatencyContributor.reportInfo("Ignoring queuing time of " + maxWaitingTime + "ms");
                    } else {
                        // Report the queuing time
                        queuingLatencyContributor.setMaximum(maxWaitingTime);
                    }
                    latencyContributor.addSubContributor(queuingLatencyContributor);
                    // add the sampling latency
                    LatencyContributor samplingLatencyContributor = new LatencyContributorComponent(bus, report.isMajorFrameDelay());
                    samplingLatencyContributor.setBestCaseMethod(LatencyContributorMethod.SAMPLED_PROTOCOL);
                    samplingLatencyContributor.setWorstCaseMethod(LatencyContributorMethod.SAMPLED_PROTOCOL);
                    samplingLatencyContributor.setSamplingPeriod(0.0);
                    latencyContributor.addSubContributor(samplingLatencyContributor);
                }
            }
        }
    }
}
Also used : ConnectionInstance(org.osate.aadl2.instance.ConnectionInstance) EnumSet(java.util.EnumSet) Set(java.util.Set) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) HashMap(java.util.HashMap) LatencyContributor(org.osate.analysis.flows.model.LatencyContributor) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) LatencyContributorComponent(org.osate.analysis.flows.model.LatencyContributorComponent) NamedElement(org.osate.aadl2.NamedElement)

Aggregations

SystemInstance (org.osate.aadl2.instance.SystemInstance)100 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)52 InstanceObject (org.osate.aadl2.instance.InstanceObject)26 ComponentImplementation (org.osate.aadl2.ComponentImplementation)25 Element (org.osate.aadl2.Element)25 SystemOperationMode (org.osate.aadl2.instance.SystemOperationMode)22 ConnectionInstance (org.osate.aadl2.instance.ConnectionInstance)21 Classifier (org.osate.aadl2.Classifier)18 ForAllElement (org.osate.aadl2.modelsupport.modeltraversal.ForAllElement)18 ComponentCategory (org.osate.aadl2.ComponentCategory)17 NamedElement (org.osate.aadl2.NamedElement)16 List (java.util.List)14 Resource (org.eclipse.emf.ecore.resource.Resource)14 AadlPackage (org.osate.aadl2.AadlPackage)14 FeatureInstance (org.osate.aadl2.instance.FeatureInstance)14 ArrayList (java.util.ArrayList)13 EList (org.eclipse.emf.common.util.EList)13 IOException (java.io.IOException)12 IStatus (org.eclipse.core.runtime.IStatus)12 Optional (java.util.Optional)10