Search in sources :

Example 21 with ComponentCategory

use of org.osate.aadl2.ComponentCategory in project osate2 by osate.

the class FlowLatencyAnalysisSwitch method processSamplingAndQueuingTimes.

/*
	 * boundBusOrRequiredClassifier is a ComponentInstance if it is a bus bound to connection instance, or a
	 * ComponentClassifier if it is a virtual bus required by a connection connnection or vb.
	 *
	 * bindingConnection is the ConnectionInstance that boundBusOrRequiredClassifier is bound to if
	 * boundBusOrRequiredClassifier is a componentInstance. Otherwise it is null.
	 */
private void processSamplingAndQueuingTimes(final NamedElement boundBusOrRequiredClassifier, final ConnectionInstance bindingConnection, final LatencyContributor latencyContributor) {
    // XXX: [Code Coverage] boundBus cannot be null.
    if (boundBusOrRequiredClassifier != null) {
        final ComponentCategory cc = boundBusOrRequiredClassifier instanceof ComponentInstance ? ((ComponentInstance) boundBusOrRequiredClassifier).getCategory() : ((ComponentClassifier) boundBusOrRequiredClassifier).getCategory();
        double period = hasPeriod.contains(cc) ? PropertyUtils.getScaled(TimingProperties::getPeriod, boundBusOrRequiredClassifier, TimeUnits.MS).orElse(0.0) : 0.0;
        if (period > 0) {
            // add sampling latency due to the protocol or bus being periodic
            LatencyContributor samplingLatencyContributor = new LatencyContributorComponent(boundBusOrRequiredClassifier, report.isMajorFrameDelay());
            samplingLatencyContributor.setBestCaseMethod(LatencyContributorMethod.SAMPLED_PROTOCOL);
            samplingLatencyContributor.setWorstCaseMethod(LatencyContributorMethod.SAMPLED_PROTOCOL);
            samplingLatencyContributor.setSamplingPeriod(period);
            latencyContributor.addSubContributor(samplingLatencyContributor);
            // add queuing latency: always zero in this case
            LatencyContributor queuingLatencyContributor = new LatencyContributorComponent(boundBusOrRequiredClassifier, report.isMajorFrameDelay());
            queuingLatencyContributor.setBestCaseMethod(LatencyContributorMethod.QUEUED);
            queuingLatencyContributor.setWorstCaseMethod(LatencyContributorMethod.QUEUED);
            queuingLatencyContributor.setMinimum(0.0);
            queuingLatencyContributor.setMaximum(0.0);
            latencyContributor.addSubContributor(queuingLatencyContributor);
        } else {
            /*
				 * Issue 1148
				 *
				 * if "boundBus" is really a bound component instance, and not a required component classifier,
				 * then we remember the bus as asynchronous. Later in fillInQueuingTimes() we go through this list,
				 * and then find all the connection instances bound to this bus. For each connection,
				 * we compute the sum of the max transmission times of the OTHER connections bound to the bus. This
				 * we set as the worse case queuing time. (Best case is 0.)
				 *
				 * We also remember the bus--connection pair that needs the queuing latency by storing its latency contributor.
				 */
            if (bindingConnection != null) {
                final ComponentInstance boundBus = (ComponentInstance) boundBusOrRequiredClassifier;
                /* Set the bus order and then add it to the ordered set */
                if (!busOrder.containsKey(boundBus)) {
                    busOrder.put(boundBus, nextBusId++);
                    asyncBuses.add(boundBus);
                }
                connectionsToContributors.put(new Pair<>(boundBus, bindingConnection), latencyContributor);
            }
        }
    }
}
Also used : ComponentInstance(org.osate.aadl2.instance.ComponentInstance) LatencyContributor(org.osate.analysis.flows.model.LatencyContributor) LatencyContributorComponent(org.osate.analysis.flows.model.LatencyContributorComponent) ComponentCategory(org.osate.aadl2.ComponentCategory) TimingProperties(org.osate.aadl2.contrib.timing.TimingProperties)

Example 22 with ComponentCategory

use of org.osate.aadl2.ComponentCategory in project osate2 by osate.

the class BoundResourceAnalysis method getMemoryBindings.

/*
	 * Issue 2169: This is copied from InstanceModelUtil.getBoundSWComponents, but we had
	 * to specialize it because now processor/virtual processors are treated as things
	 * that have memory and the original method gets the wrong things from the processors.
	 *
	 * associatedObject is of category memory, system, processor, virtual processor, abstract
	 */
private static EList<ComponentInstance> getMemoryBindings(final ComponentInstance associatedObject) {
    EList<Element> boundComponents = null;
    final SystemInstance root = associatedObject.getSystemInstance();
    final ComponentCategory cc = associatedObject.getCategory();
    if (cc == ComponentCategory.MEMORY || cc == ComponentCategory.SYSTEM || cc == ComponentCategory.PROCESSOR || cc == ComponentCategory.VIRTUAL_PROCESSOR || cc == ComponentCategory.ABSTRACT) {
        boundComponents = new ForAllElement() {

            @Override
            protected boolean suchThat(Element obj) {
                final List<InstanceObject> boundMemoryList = DeploymentProperties.getActualMemoryBinding((ComponentInstance) obj).orElse(Collections.emptyList());
                if (boundMemoryList.isEmpty()) {
                    return false;
                }
                return boundMemoryList.contains(associatedObject);
            }
        }.processPostOrderComponentInstance(root);
    } else {
        return new BasicEList<ComponentInstance>();
    }
    EList<ComponentInstance> topobjects = new BasicEList<ComponentInstance>();
    for (Object componentInstance : boundComponents) {
        InstanceModelUtil.addAsRoot(topobjects, (ComponentInstance) componentInstance);
    }
    return topobjects;
}
Also used : InstanceObject(org.osate.aadl2.instance.InstanceObject) ForAllElement(org.osate.aadl2.modelsupport.modeltraversal.ForAllElement) SystemInstance(org.osate.aadl2.instance.SystemInstance) Element(org.osate.aadl2.Element) ForAllElement(org.osate.aadl2.modelsupport.modeltraversal.ForAllElement) BasicEList(org.eclipse.emf.common.util.BasicEList) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) InstanceObject(org.osate.aadl2.instance.InstanceObject) ComponentCategory(org.osate.aadl2.ComponentCategory)

Example 23 with ComponentCategory

use of org.osate.aadl2.ComponentCategory in project osate2 by osate.

the class BoundResourceAnalysis method canHaveMemory.

private static boolean canHaveMemory(Element e) {
    if (e instanceof ComponentInstance) {
        final ComponentInstance ci = (ComponentInstance) e;
        final ComponentCategory cc = ci.getCategory();
        // memory, system, processor, virtual processor, abstract
        return cc == ComponentCategory.MEMORY || cc == ComponentCategory.SYSTEM || cc == ComponentCategory.PROCESSOR || cc == ComponentCategory.VIRTUAL_PROCESSOR || cc == ComponentCategory.ABSTRACT;
    } else {
        return false;
    }
}
Also used : ComponentInstance(org.osate.aadl2.instance.ComponentInstance) ComponentCategory(org.osate.aadl2.ComponentCategory)

Example 24 with ComponentCategory

use of org.osate.aadl2.ComponentCategory in project osate2 by osate.

the class Binpack method analyzeInstanceModel.

@Override
protected void analyzeInstanceModel(final IProgressMonitor monitor, final AnalysisErrorReporterManager errManager, final SystemInstance root, final SystemOperationMode som) {
    try {
        monitor.beginTask("Binding threads to processors in " + root.getName(), IProgressMonitor.UNKNOWN);
        logInfo("Binpacker Analysis Report\n");
        /*
			 * Verify that all the busses have a transmission time
			 */
        final ForAllElement addBuses = new ForAllElement(errManager) {

            @Override
            public void process(Element obj) {
                checkBuses((ComponentInstance) obj);
            }
        };
        addBuses.processPreOrderComponentInstance(root, ComponentCategory.BUS);
        /*
			 * Find and report all thread and device instances that don't have a
			 * period specified.
			 */
        EList<Element> incompletethreads = new ForAllElement() {

            @Override
            protected boolean suchThat(Element obj) {
                final ComponentCategory cat = ((ComponentInstance) obj).getCategory();
                if (cat == ComponentCategory.THREAD || cat == ComponentCategory.DEVICE) {
                    return org.osate.pluginsupport.properties.PropertyUtils.getScaled(TimingProperties::getPeriod, (ComponentInstance) obj, TimeUnits.MS).orElse(0.0) == 0.0;
                } else {
                    return false;
                }
            }
        }.processPreOrderComponentInstance(root);
        for (final Iterator<Element> i = incompletethreads.iterator(); i.hasNext(); ) {
            final ComponentInstance o = (ComponentInstance) i.next();
            logWarning((InstanceModelUtil.isThread(o) ? "Thread " : "Device ") + o.getComponentInstancePath() + " is missing period property. Using default of 1 ns");
        }
        /*
			 * Find and report all thread instances that don't have a
			 * compute execution time specified.
			 */
        incompletethreads = new ForAllElement() {

            @Override
            protected boolean suchThat(Element obj) {
                return GetProperties.getThreadExecutioninMilliSec((ComponentInstance) obj) == 0.0;
            }
        }.processPreOrderComponentInstance(root, ComponentCategory.THREAD);
        for (final Iterator<Element> i = incompletethreads.iterator(); i.hasNext(); ) {
            final ComponentInstance o = (ComponentInstance) i.next();
            logWarning("Thread " + o.getComponentInstancePath() + " is missing compute_execution_time or InstructionsPerDispatch property. Using default of 0 ns");
        }
        /*
			 * Find if all the port connections have data size
			 */
        final ForAllElement addThreadConnections = new ForAllElement(errManager) {

            @Override
            public void process(Element obj) {
                if (obj instanceof ConnectionInstance) {
                    final ConnectionInstance connInst = (ConnectionInstance) obj;
                    if (connInst.getKind() == ConnectionKind.PORT_CONNECTION) {
                        final FeatureInstance src = (FeatureInstance) connInst.getSource();
                        Feature srcAP = src.getFeature();
                        Classifier cl = srcAP.getClassifier();
                        if (cl instanceof DataClassifier) {
                            DataClassifier srcDC = (DataClassifier) cl;
                            if (AadlContribUtils.getDataSize(srcDC, SizeUnits.BYTES) == 0) {
                                logWarning("Data size of connection source port " + src.getComponentInstancePath() + " not specified");
                            }
                        }
                    }
                }
            }
        };
        addThreadConnections.processPreOrderAll(root);
        /* The partitionChoice is set in initializeANalysis() */
        NoExpansionExpansor expansor = new NoExpansionExpansor();
        LowLevelBinPacker packer = null;
        if (partitionChoice == IMMEDIATE_PARTITION) {
            packer = new BFCPBinPacker(expansor);
        } else if (partitionChoice == DEFER_EXEC_TIME) {
            packer = new DFCPBinPacker(expansor);
        } else if (partitionChoice == DEFER_BANDWIDTH) {
            packer = new DFBPBinPacker(expansor);
        }
        AssignmentResult result = binPackSystem(root, expansor, packer, errManager, som);
        reportResults(som, result);
        if (result.isSuccess()) {
            showResults(som, root, result);
        } else {
            showNoResults(som);
        }
    } catch (InvalidModelException e) {
        error(e.getElement(), e.getMessage());
    }
}
Also used : ConnectionInstance(org.osate.aadl2.instance.ConnectionInstance) NoExpansionExpansor(EAnalysis.BinPacking.NoExpansionExpansor) BFCPBinPacker(EAnalysis.BinPacking.BFCPBinPacker) FeatureInstance(org.osate.aadl2.instance.FeatureInstance) Element(org.osate.aadl2.Element) ForAllElement(org.osate.aadl2.modelsupport.modeltraversal.ForAllElement) NamedElement(org.osate.aadl2.NamedElement) AssignmentResult(EAnalysis.BinPacking.AssignmentResult) Classifier(org.osate.aadl2.Classifier) SystemClassifier(org.osate.aadl2.SystemClassifier) ComponentClassifier(org.osate.aadl2.ComponentClassifier) DataClassifier(org.osate.aadl2.DataClassifier) ProcessorClassifier(org.osate.aadl2.ProcessorClassifier) DataClassifier(org.osate.aadl2.DataClassifier) ComponentCategory(org.osate.aadl2.ComponentCategory) Feature(org.osate.aadl2.Feature) InvalidModelException(org.osate.aadl2.properties.InvalidModelException) ForAllElement(org.osate.aadl2.modelsupport.modeltraversal.ForAllElement) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) LowLevelBinPacker(EAnalysis.BinPacking.LowLevelBinPacker) DFCPBinPacker(EAnalysis.BinPacking.DFCPBinPacker) DFBPBinPacker(EAnalysis.BinPacking.DFBPBinPacker)

Example 25 with ComponentCategory

use of org.osate.aadl2.ComponentCategory in project osate2 by osate.

the class ComponentPrototypeActualItemProvider method getText.

/**
 * This returns the label text for the adapted class.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public String getText(Object object) {
    ComponentCategory labelValue = ((ComponentPrototypeActual) object).getCategory();
    String label = labelValue == null ? null : labelValue.toString();
    return label == null || label.length() == 0 ? getString("_UI_ComponentPrototypeActual_type") : getString("_UI_ComponentPrototypeActual_type") + " " + label;
}
Also used : ComponentPrototypeActual(org.osate.aadl2.ComponentPrototypeActual) ComponentCategory(org.osate.aadl2.ComponentCategory)

Aggregations

ComponentCategory (org.osate.aadl2.ComponentCategory)30 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)22 Element (org.osate.aadl2.Element)9 ForAllElement (org.osate.aadl2.modelsupport.modeltraversal.ForAllElement)8 SystemInstance (org.osate.aadl2.instance.SystemInstance)7 BasicEList (org.eclipse.emf.common.util.BasicEList)6 NamedElement (org.osate.aadl2.NamedElement)6 FeatureInstance (org.osate.aadl2.instance.FeatureInstance)6 EList (org.eclipse.emf.common.util.EList)5 ComponentClassifier (org.osate.aadl2.ComponentClassifier)5 ConnectionInstance (org.osate.aadl2.instance.ConnectionInstance)5 EObject (org.eclipse.emf.ecore.EObject)4 Aadl2Package (org.osate.aadl2.Aadl2Package)4 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)3 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 List (java.util.List)2 EcorePackage (org.eclipse.emf.ecore.EcorePackage)2 Classifier (org.osate.aadl2.Classifier)2 ComponentPrototype (org.osate.aadl2.ComponentPrototype)2