use of org.osate.aadl2.instance.SystemOperationMode in project osate2 by osate.
the class NamedElementImpl method getNonModalPropertyValue.
/**
* Retrieves the property value (single or list) of a non-modal property. Throws an exception
* if its a modal value or undefined.
* @param property Property
* @return The property expression or null if the property has no value.
*/
public PropertyExpression getNonModalPropertyValue(final Property property) throws InvalidModelException, PropertyNotPresentException, PropertyIsModalException, IllegalStateException, IllegalArgumentException, PropertyDoesNotApplyToHolderException {
PropertyAssociation pa = getPropertyValue(property, false).first();
if (pa == null) {
if (property.getDefaultValue() == null) {
throw new PropertyNotPresentException(this, property, "No property association was found");
}
return property.getDefaultValue();
} else {
if (!pa.isModal()) {
// should always exist because it's not modal
if (pa.getOwnedValues().isEmpty()) {
throw new PropertyNotPresentException(this, property, "Property association has no value (yet)");
}
return pa.getOwnedValues().get(0).getOwnedValue();
} else {
// If we are an InstanceObject, get the value in the current SOM
if (this instanceof InstanceObject) {
final SystemInstance si = ((InstanceObject) this).getSystemInstance();
final SystemOperationMode som = si.getCurrentSystemOperationMode();
if (som != null) {
PropertyExpression defaultPE = null;
// find value in SOM
for (ModalPropertyValue mpv : pa.getOwnedValues()) {
if (mpv.getInModes() == null || mpv.getInModes().size() == 0) {
defaultPE = mpv.getOwnedValue();
} else if (mpv.getInModes().contains(som)) {
return mpv.getOwnedValue();
}
}
// default
if (defaultPE != null) {
return defaultPE;
}
// use global default
return property.getDefaultValue();
} else {
throw new PropertyIsModalException(this, property, "Cannot use simple property lookup because the instance model has not been projected into a System Operation Mode." + " This occurred when looking up Property " + property.getName() + " on NamedElement " + getName() + ".");
}
} else {
throw new PropertyIsModalException(this, property, "A non-modal property lookup method was called for a modal property." + " This occurred when looking up Property " + property.getName() + " on NamedElement " + getName() + ".");
}
}
}
}
use of org.osate.aadl2.instance.SystemOperationMode in project osate2 by osate.
the class FlowLatencyAnalysisSwitch method invoke.
/**
* Invoke the analysis on all ETEF owned by the given component instance and return Result collection
*
* @param etef The end to end flow instance
* @param som The mode to run the analysis in. If null then run all SOMs
* @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
* @return A populated report in AnalysisResult format.
* @since org.osate.analysis.flows 3.0
*/
public AnalysisResult invoke(EndToEndFlowInstance etef, SystemOperationMode som, boolean asynchronousSystem, boolean majorFrameDelay, boolean worstCaseDeadline, boolean bestCaseEmptyQueue, boolean disableQueuingLatency) {
SystemInstance root = etef.getSystemInstance();
if (som == null) {
// we need to run it for every SOM
for (SystemOperationMode eachsom : root.getSystemOperationModes()) {
root.setCurrentSystemOperationMode(eachsom);
invokeOnSOM(etef, eachsom, asynchronousSystem, majorFrameDelay, worstCaseDeadline, bestCaseEmptyQueue, disableQueuingLatency);
root.clearCurrentSystemOperationMode();
}
} else {
invokeOnSOM(etef, som, asynchronousSystem, majorFrameDelay, worstCaseDeadline, bestCaseEmptyQueue, disableQueuingLatency);
}
// Issue 1148
fillInQueuingTimes(etef.getSystemInstance());
final List<Result> finalizedResults = finalizeResults();
return FlowLatencyUtil.recordAsAnalysisResult(finalizedResults, etef, asynchronousSystem, majorFrameDelay, worstCaseDeadline, bestCaseEmptyQueue, disableQueuingLatency);
}
use of org.osate.aadl2.instance.SystemOperationMode in project osate2 by osate.
the class FlowLatencyAnalysisSwitch method invoke.
/**
* Invoke the analysis on all ETEF in system instance and return Result collection
*
* @param root The root system instance
* @param som The mode to run the analysis in. If null then run all SOMs
* @param asynchronousSystem Whether the system is treated as synchronous by default
* @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
* @return A populated report in AnalysisResult format.
* @since org.osate.analysis.flows 3.0
*/
// NB. This method is used to invoke the analysis from unit tests
public AnalysisResult invoke(SystemInstance root, SystemOperationMode som, boolean asynchronousSystem, boolean majorFrameDelay, boolean worstCaseDeadline, boolean bestCaseEmptyQueue, boolean disableQueuingLatency) {
if (som == null) {
if (root.getSystemOperationModes().isEmpty() || root.getSystemOperationModes().get(0).getCurrentModes().isEmpty()) {
// no SOM
invokeOnSOM(root, root.getSystemOperationModes().get(0), asynchronousSystem, majorFrameDelay, worstCaseDeadline, bestCaseEmptyQueue, disableQueuingLatency);
} else {
// we need to run it for every SOM
for (SystemOperationMode eachsom : root.getSystemOperationModes()) {
root.setCurrentSystemOperationMode(eachsom);
invokeOnSOM(root, eachsom, asynchronousSystem, majorFrameDelay, worstCaseDeadline, bestCaseEmptyQueue, disableQueuingLatency);
root.clearCurrentSystemOperationMode();
}
}
} else {
invokeOnSOM(root, som, asynchronousSystem, majorFrameDelay, worstCaseDeadline, bestCaseEmptyQueue, disableQueuingLatency);
}
// Issue 1148
final List<Result> finalizedResults = finalizeResults();
return FlowLatencyUtil.recordAsAnalysisResult(finalizedResults, root, asynchronousSystem, majorFrameDelay, worstCaseDeadline, bestCaseEmptyQueue, disableQueuingLatency);
}
use of org.osate.aadl2.instance.SystemOperationMode in project osate2 by osate.
the class BoundResourceAnalysis method checkProcessorLoad.
/**
* check the load from components bound to the given processor The
* components can be threads or higher level components.
*
* @param curProcessor Component Instance of processor
*/
private void checkProcessorLoad(ComponentInstance curProcessor, final SystemOperationMode som) {
if (!curProcessor.isActive(som)) {
return;
}
double MIPScapacity = getMIPSCapacityInMIPS(curProcessor, 0.0);
if (MIPScapacity == 0 && InstanceModelUtil.isVirtualProcessor(curProcessor)) {
MIPScapacity = PropertyUtils.getScaled(Sei::getMipsbudget, curProcessor, ProcessorSpeedUnits.MIPS).orElse(0.0);
}
EList<ComponentInstance> boundComponents = InstanceModelUtil.getBoundSWComponents(curProcessor);
if (boundComponents.size() == 0 && MIPScapacity > 0) {
errManager.infoSummary(curProcessor, som.getName(), "No application components bound to " + curProcessor.getComponentInstancePath() + " with MIPS capacity " + toStringScaled(MIPScapacity, ProcessorSpeedUnits.MIPS));
return;
}
if (MIPScapacity == 0 && InstanceModelUtil.isVirtualProcessor(curProcessor)) {
errManager.warningSummary(curProcessor, som.getName(), "Virtual processor " + curProcessor.getComponentInstancePath() + " has no MIPS capacity or budget.");
return;
}
if (MIPScapacity == 0 && InstanceModelUtil.isProcessor(curProcessor)) {
errManager.errorSummary(curProcessor, som.getName(), "Processor " + curProcessor.getComponentInstancePath() + " has no MIPS capacity but has bound components.");
}
if (InstanceModelUtil.isVirtualProcessor(curProcessor)) {
logHeader("\n\nDetailed Workload Report: " + Aadl2Util.getPrintableSOMName(som) + " for Virtual Processor " + curProcessor.getComponentInstancePath() + " with Capacity " + toStringScaled(MIPScapacity, ProcessorSpeedUnits.MIPS) + "\n\nComponent,Budget,Actual");
} else {
logHeader("\n\nDetailed Workload Report: " + Aadl2Util.getPrintableSOMName(som) + " for Processor " + curProcessor.getComponentInstancePath() + " with Capacity " + toStringScaled(MIPScapacity, ProcessorSpeedUnits.MIPS) + "\n\nComponent,Budget,Actual");
}
double totalMIPS = 0.0;
for (Iterator<ComponentInstance> it = boundComponents.iterator(); it.hasNext(); ) {
ComponentInstance bci = it.next();
double actualmips = sumBudgets(bci, ResourceKind.MIPS, som, "");
if (actualmips > 0) {
totalMIPS += actualmips;
}
}
logHeader("Total,," + toStringScaled(totalMIPS, ProcessorSpeedUnits.MIPS));
if (totalMIPS > MIPScapacity) {
errManager.errorSummary(curProcessor, null, " Processor " + curProcessor.getComponentInstancePath() + ": Total MIPS " + toStringScaled(totalMIPS, ProcessorSpeedUnits.MIPS) + " of bound tasks exceeds MIPS capacity " + toStringScaled(MIPScapacity, ProcessorSpeedUnits.MIPS));
} else if (totalMIPS == 0.0) {
errManager.warningSummary(curProcessor, null, " Processor " + curProcessor.getComponentInstancePath() + ": Bound app's have no MIPS budget.");
} else {
errManager.infoSummary(curProcessor, null, " Processor " + curProcessor.getComponentInstancePath() + ": Total MIPS " + toStringScaled(totalMIPS, ProcessorSpeedUnits.MIPS) + " of bound tasks within " + "MIPS capacity " + toStringScaled(MIPScapacity, ProcessorSpeedUnits.MIPS) + " of " + curProcessor.getComponentInstancePath());
}
}
use of org.osate.aadl2.instance.SystemOperationMode in project osate2 by osate.
the class BoundResourceAnalysis method analysisBody.
public void analysisBody(final IProgressMonitor monitor, final Element obj) {
if (obj instanceof InstanceObject) {
SystemInstance root = ((InstanceObject) obj).getSystemInstance();
monitor.beginTask(actionName, IProgressMonitor.UNKNOWN);
final SOMIterator soms = new SOMIterator(root);
while (soms.hasNext()) {
final SystemOperationMode som = soms.nextSOM();
checkProcessorLoads(root, som);
checkVirtualProcessorLoads(root, som);
checkMemoryLoads(root, som);
}
monitor.done();
} else {
Dialog.showError("Bound Resource Analysis Error", "Can only check system instances");
}
}
Aggregations