Search in sources :

Example 16 with SystemOperationMode

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

the class BoundResourceAnalysis method checkMemoryLoads.

private void checkMemoryLoads(SystemInstance si, final SystemOperationMode som) {
    count = 0;
    ForAllElement countme = new ForAllElement() {

        @Override
        protected void process(Element obj) {
            if (canHaveMemory(obj)) {
                if (getROMCapacityInKB(obj) > 0.0 || getRAMCapacityInKB(obj) > 0.0 || getMemorySize(obj) > 0.0) {
                    count = count + 1;
                }
            }
        }
    };
    countme.processPreOrderComponentInstance(si);
    if (count > 0) {
        errManager.infoSummaryReportOnly(si, null, "\nMemory Summary Report: " + Aadl2Util.getPrintableSOMName(som));
    } else {
        errManager.infoSummaryReportOnly(si, null, "\nMemory Summary Report: " + Aadl2Util.getPrintableSOMName(som) + "\n  No Memory with Memory_Size or RAMCapacity or ROMCapacity");
    }
    ForAllElement mal = new ForAllElement() {

        @Override
        protected void process(Element obj) {
            if (canHaveMemory(obj)) {
                checkMemoryLoad((ComponentInstance) obj, som);
            }
        }
    };
    mal.processPreOrderComponentInstance(si);
}
Also used : ForAllElement(org.osate.aadl2.modelsupport.modeltraversal.ForAllElement) Element(org.osate.aadl2.Element) ForAllElement(org.osate.aadl2.modelsupport.modeltraversal.ForAllElement)

Example 17 with SystemOperationMode

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

the class CheckPriorityInversion method analyzeInstanceModel.

@Override
protected void analyzeInstanceModel(final IProgressMonitor monitor, final AnalysisErrorReporterManager errManager, final SystemInstance root, final SystemOperationMode som) {
    monitor.beginTask(getActionName(), IProgressMonitor.UNKNOWN);
    try {
        final PriorityInversion pi = new PriorityInversion(errManager);
        pi.checkSystemPriorityInversion(root);
    } catch (InvalidModelException e) {
        error(e.getElement(), e.getMessage());
    }
    monitor.done();
}
Also used : InvalidModelException(org.osate.aadl2.properties.InvalidModelException) PriorityInversion(org.osate.analysis.scheduling.inversion.PriorityInversion)

Example 18 with SystemOperationMode

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

the class BoundResourceAnalysis method doMemoryLoad.

/**
 * check the load from components bound to the given memory The components
 * can be threads or higher level components.
 *
 * @param curMemory Component Instance of memory
 */
private void doMemoryLoad(ComponentInstance curMemory, final SystemOperationMode som, double Memorycapacity, EList<ComponentInstance> boundComponents, ResourceKind rk) {
    double totalMemory = 0.0;
    String somName = null;
    String resourceName = rk.name();
    boolean isROM = rk.equals(ResourceKind.ROM);
    if (boundComponents.size() == 0 && Memorycapacity > 0) {
        errManager.infoSummary(curMemory, somName, "  No application components bound to " + curMemory.getComponentInstancePath() + " with " + resourceName + " capacity " + toStringScaled(Memorycapacity, SizeUnits.KBYTE));
        return;
    }
    if (Memorycapacity == 0) {
        errManager.errorSummary(curMemory, somName, "  Memory " + curMemory.getComponentInstancePath() + " has no " + resourceName + " capacity but has bound components.");
    }
    logHeader("\n\nDetailed Workload Report: " + Aadl2Util.getPrintableSOMName(som) + " for memory " + curMemory.getComponentInstancePath() + " with Capacity " + toStringScaled(Memorycapacity, SizeUnits.KBYTE) + "\n\nComponent,Budget,Actual");
    Set<ComponentInstance> budgeted = new HashSet<>();
    for (ComponentInstance bci : boundComponents) {
        String notes = "";
        double totalactual = sumMemoryActualPropertyValue(bci, isROM);
        double budget = isROM ? getROMBudgetInKB(bci) : getRAMBudgetInKB(bci);
        double actualsize = getMemoryUseActual(bci, resourceName, SizeUnits.KBYTE);
        if (actualsize > 0) {
            // only compare if there were actuals
            if (budget > 0 && actualsize > budget) {
                notes = ",Error: " + resourceName + " subtotal exceeds budget by " + (actualsize - budget) + " KB";
            } else if (actualsize < budget) {
                notes = ",Warning: " + resourceName + " Subtotal under budget by " + (budget - actualsize) + " KB";
            }
            if (totalactual > 0 && totalactual != actualsize) {
                notes = notes + ",Warning: " + resourceName + " Data_Size differs from RAM/ROMActual";
            }
        }
        if (totalactual > 0) {
            // only compare if there were actuals
            if (budget > 0 && totalactual > budget) {
                notes = notes + ",Error: " + resourceName + " subtotal exceeds budget by " + (totalactual - budget) + " KB";
            } else if (totalactual < budget) {
                notes = notes + ",Warning: " + resourceName + " Subtotal under budget by " + (budget - totalactual) + " KB";
            }
        }
        if (totalactual == 0.0 && actualsize == 0.0) {
            // we use a budget number as there are no actuals
            if (budget > 0 && !budgeted.contains(bci)) {
                // only add it if no children budget numbers have been added
                totalMemory += budget;
                detailedLog(bci, budget, budget, "No actual. Added budget to total.");
                // add ancestors to budgeted list so their budget does not get added later
                while ((bci = bci.getContainingComponentInstance()) != null) {
                    budgeted.add(bci);
                }
            }
        } else {
            if (actualsize > 0) {
                detailedLog(bci, budget, actualsize, notes);
                totalMemory += actualsize;
            } else {
                // add only the current actual; the children actual have been added before
                double currentActual = isROM ? getROMActualInKB(bci) : getRAMActualInKB(bci);
                detailedLog(bci, budget, currentActual, notes);
                totalMemory += currentActual;
            }
        }
    }
    detailedLogTotal2(null, totalMemory, SizeUnits.KBYTE);
    if (Memorycapacity == 0) {
        errManager.errorSummary(curMemory, somName, "  " + resourceName + curMemory.getComponentInstancePath() + " has no memory capacity specified");
    }
    if (totalMemory > Memorycapacity) {
        errManager.errorSummary(curMemory, somName, "  Total Memory " + totalMemory + " KB of bounds tasks exceeds Memory capacity " + Memorycapacity + " KB of " + curMemory.getComponentInstancePath());
    } else if (totalMemory == 0.0 && Memorycapacity == 0.0) {
        errManager.warningSummary(curMemory, somName, "  " + resourceName + curMemory.getComponentInstancePath() + " has no capacity. Bound app's have no memory budget.");
    } else {
        errManager.infoSummary(curMemory, somName, "  Total " + resourceName + " " + totalMemory + " KB of bound tasks within Memory capacity " + Memorycapacity + " KB of " + curMemory.getComponentInstancePath());
    }
}
Also used : ComponentInstance(org.osate.aadl2.instance.ComponentInstance) HashSet(java.util.HashSet)

Example 19 with SystemOperationMode

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

the class BoundResourceAnalysis method checkVirtualProcessorLoads.

private void checkVirtualProcessorLoads(SystemInstance si, final SystemOperationMode som) {
    count = 0;
    ForAllElement countme = new ForAllElement() {

        @Override
        protected void process(Element obj) {
            count = count + 1;
        }
    };
    countme.processPreOrderComponentInstance(si, ComponentCategory.VIRTUAL_PROCESSOR);
    if (count > 0) {
        errManager.infoSummaryReportOnly(si, null, "\nVirtual Processor Summary Report: " + Aadl2Util.getPrintableSOMName(som));
    }
    ForAllElement mal = new ForAllElement() {

        @Override
        protected void process(Element obj) {
            checkProcessorLoad((ComponentInstance) obj, som);
        }
    };
    mal.processPreOrderComponentInstance(si, ComponentCategory.VIRTUAL_PROCESSOR);
}
Also used : ForAllElement(org.osate.aadl2.modelsupport.modeltraversal.ForAllElement) Element(org.osate.aadl2.Element) ForAllElement(org.osate.aadl2.modelsupport.modeltraversal.ForAllElement)

Example 20 with SystemOperationMode

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

the class BusLoadAnalysis method checkBusLoads.

private void checkBusLoads(SystemInstance si, final SystemOperationMode som) {
    errManager.infoSummaryReportOnly(si, null, "\nBus Summary Report: " + Aadl2Util.getPrintableSOMName(som));
    ForAllElement mal = new ForAllElement() {

        @Override
        protected void process(final Element obj) {
            final ComponentInstance ci = (ComponentInstance) obj;
            final ComponentCategory cat = ci.getCategory();
            if (cat == ComponentCategory.BUS) {
                checkBusBandWidthLoad(ci, som);
            } else if (cat == ComponentCategory.VIRTUAL_BUS) {
                checkVirtualBusBandWidthLoad(ci, som);
            }
        }
    };
    mal.processPreOrderComponentInstance(si);
}
Also used : ForAllElement(org.osate.aadl2.modelsupport.modeltraversal.ForAllElement) Element(org.osate.aadl2.Element) ForAllElement(org.osate.aadl2.modelsupport.modeltraversal.ForAllElement) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) ComponentCategory(org.osate.aadl2.ComponentCategory)

Aggregations

SystemOperationMode (org.osate.aadl2.instance.SystemOperationMode)27 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)21 SystemInstance (org.osate.aadl2.instance.SystemInstance)18 ConnectionInstance (org.osate.aadl2.instance.ConnectionInstance)12 Classifier (org.osate.aadl2.Classifier)10 Element (org.osate.aadl2.Element)10 InstanceObject (org.osate.aadl2.instance.InstanceObject)9 ForAllElement (org.osate.aadl2.modelsupport.modeltraversal.ForAllElement)9 FeatureInstance (org.osate.aadl2.instance.FeatureInstance)7 ArrayList (java.util.ArrayList)6 AadlPackage (org.osate.aadl2.AadlPackage)6 PropertyAssociation (org.osate.aadl2.PropertyAssociation)6 ModeInstance (org.osate.aadl2.instance.ModeInstance)6 InvalidModelException (org.osate.aadl2.properties.InvalidModelException)6 Optional (java.util.Optional)5 Inject (com.google.inject.Inject)4 HashSet (java.util.HashSet)4 EList (org.eclipse.emf.common.util.EList)4 ComponentClassifier (org.osate.aadl2.ComponentClassifier)4 ModalPropertyValue (org.osate.aadl2.ModalPropertyValue)4