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");
}
}
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();
}
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();
}
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();
}
}
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);
}
}
}
}
}
Aggregations