Search in sources :

Example 6 with AnalysisResult

use of org.osate.result.AnalysisResult 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);
}
Also used : SystemInstance(org.osate.aadl2.instance.SystemInstance) SystemOperationMode(org.osate.aadl2.instance.SystemOperationMode) Result(org.osate.result.Result) AnalysisResult(org.osate.result.AnalysisResult)

Example 7 with AnalysisResult

use of org.osate.result.AnalysisResult in project osate2 by osate.

the class FlowLatencyAnalysisSwitch method invokeAndSaveResult.

/**
 * @since org.osate.analysis.flows 3.0
 */
public AnalysisResult invokeAndSaveResult(SystemInstance root, SystemOperationMode som, boolean asynchronousSystem, boolean majorFrameDelay, boolean worstCaseDeadline, boolean bestCaseEmptyQueue, boolean disableQueuingLatency) {
    AnalysisResult ar = invoke(root, som, asynchronousSystem, majorFrameDelay, worstCaseDeadline, bestCaseEmptyQueue, disableQueuingLatency);
    FlowLatencyUtil.saveAnalysisResult(ar);
    LatencyCSVReport.generateCSVReport(ar);
    return ar;
}
Also used : AnalysisResult(org.osate.result.AnalysisResult)

Example 8 with AnalysisResult

use of org.osate.result.AnalysisResult 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);
}
Also used : SystemOperationMode(org.osate.aadl2.instance.SystemOperationMode) Result(org.osate.result.Result) AnalysisResult(org.osate.result.AnalysisResult)

Example 9 with AnalysisResult

use of org.osate.result.AnalysisResult in project osate2 by osate.

the class FlowLatencyUtil method createLatencyAnalysisResult.

/**
 * @since org.osate.analysis.flows 3.0
 */
public static AnalysisResult createLatencyAnalysisResult(EObject root, boolean asynchronousSystem, boolean majorFrameDelay, boolean worstCaseDeadline, boolean bestCaseEmptyQueue, boolean disableQueuingLatency) {
    AnalysisResult latencyResults = ResultUtil.createAnalysisResult(FlowLatencyUtil.LatencyAnalysisName, root);
    ResultUtil.addParameter(latencyResults, asynchronousSystem);
    ResultUtil.addParameter(latencyResults, majorFrameDelay);
    ResultUtil.addParameter(latencyResults, worstCaseDeadline);
    ResultUtil.addParameter(latencyResults, bestCaseEmptyQueue);
    ResultUtil.addParameter(latencyResults, disableQueuingLatency);
    latencyResults.setMessage(FlowLatencyUtil.getParametersAsLabels(asynchronousSystem, majorFrameDelay, worstCaseDeadline, bestCaseEmptyQueue, disableQueuingLatency));
    latencyResults.setModelElement(root);
    return latencyResults;
}
Also used : AnalysisResult(org.osate.result.AnalysisResult)

Example 10 with AnalysisResult

use of org.osate.result.AnalysisResult in project osate2 by osate.

the class PropertyTotals method invoke.

/**
 * Performs the weight analysis on a {@code ComponentInstance}.
 * <p>
 * The calculated weight and any issues encountered are returned in the {@code AnalysisResult}. The following
 * describes how the returned {@code AnalysisResult} is filled.
 * <p>
 * {@link AnalysisResult}:
 * <ul>
 *   <li>{@link AnalysisResult#getAnalysis()}: Set to the value {@code "Weight totals"}.
 *   <li>{@link AnalysisResult#getSourceReference()}: Set to the {@link ComponentInstance} passed to this method.
 *   <li>{@link AnalysisResult#getResults()}: One {@code Result} is created for the {@code ComponentInstance ci}.
 * </ul>
 * {@link Result}:
 * <ul>
 *   <li>{@link Result#getSourceReference()}: Set to the {@code ComponentInstance} for this {@code Result}.
 *   <li>{@link Result#getValues()}: Four {@code RealValue} are created.
 *   <ul>
 *     <li>Index {@code 0} is a {@code RealValue} for the calculated weight.
 *     <ul>
 *       <li>{@link RealValue#getValue()}: The calculated weight of the component.
 *       <li>{@link RealValue#getUnit()}: Weight units are in {@code kg}.
 *     </ul>
 *     <li>Index {@code 1} is a {@code RealValue} for the gross weight.
 *     <ul>
 *       <li>{@link RealValue#getValue()}: The value of the component's {@code SEI::GrossWeight} property.
 *       <li>{@link RealValue#getUnit()}: Weight units are in {@code kg}.
 *     </ul>
 *     <li>Index {@code 2} is a {@code RealValue} for the net weight.
 *     <ul>
 *       <li>{@link RealValue#getValue()}: The value of the component's {@code SEI::NetWeight} property.
 *       <li>{@link RealValue#getUnit()}: Weight units are in {@code kg}.
 *     </ul>
 *     <li>Index {@code 3} is a {@code RealValue} for the weight limit.
 *     <ul>
 *       <li>{@link RealValue#getValue()}: The value of the component's {@code SEI::WeightLimit} property.
 *       <li>{@link RealValue#getUnit()}: Weight units are in {@code kg}.
 *     </ul>
 *   </ul>
 *   <li>{@link Result#getDiagnostics()}: Zero or more {@code Diagnostic}s are created. Each one is a single issue
 *       discovered by the analysis to be reported to the user.
 *   <ul>
 *     <li>{@link Diagnostic#getType()}: {@link DiagnosticType#ERROR}, {@link DiagnosticType#WARNING}, or
 *         {@link DiagnosticType#INFO}.
 *     <li>{@link Diagnostic#getSourceReference()}: The location of the issue. Either the {@code ComponentInstance}
 *         of the {@code Result} or one of the component's {@link ConnectionInstance}s.
 *     <li>{@link Diagnostic#getMessage()}: The text of the issue.
 *   </ul>
 *   <li>{@link Result#getSubResults()}: Zero or more {@code Result}s are created: one for each subcomponent.
 * </ul>
 *
 * @param ci The component to run the weight analysis on.
 * @return An {@code AnalysisResult} containing the weight of the component and all subcomponents as well as any
 *         issues encountered during the analysis.
 */
public static AnalysisResult invoke(ComponentInstance ci) {
    AnalysisResult result = ResultUtil.createAnalysisResult("Weight totals", ci);
    result.getResults().add(calcWeight(ci, true));
    return result;
}
Also used : AnalysisResult(org.osate.result.AnalysisResult)

Aggregations

AnalysisResult (org.osate.result.AnalysisResult)12 Result (org.osate.result.Result)8 InstanceObject (org.osate.aadl2.instance.InstanceObject)4 SystemInstance (org.osate.aadl2.instance.SystemInstance)4 SystemOperationMode (org.osate.aadl2.instance.SystemOperationMode)4 Diagnostic (org.osate.result.Diagnostic)2 IOException (java.io.IOException)1 BigDecimal (java.math.BigDecimal)1 Locale (java.util.Locale)1 WorkbookSettings (jxl.WorkbookSettings)1 Label (jxl.write.Label)1 WritableSheet (jxl.write.WritableSheet)1 WritableWorkbook (jxl.write.WritableWorkbook)1 WriteException (jxl.write.WriteException)1 IFile (org.eclipse.core.resources.IFile)1 CoreException (org.eclipse.core.runtime.CoreException)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 Event (org.osate.aadl2.errormodel.FaultTree.Event)1 SOMIterator (org.osate.aadl2.modelsupport.modeltraversal.SOMIterator)1