Search in sources :

Example 1 with PropagationGraphPath

use of org.osate.aadl2.errormodel.PropagationGraph.PropagationGraphPath in project osate2 by osate.

the class UnhandledFaultsHandler method doAaxlAction.

@Override
public void doAaxlAction(IProgressMonitor monitor, Element obj) {
    monitor.beginTask("UnhandledFaults", IProgressMonitor.UNKNOWN);
    // Get the system instance (if any)
    SystemInstance si;
    if (obj instanceof InstanceObject) {
        si = ((InstanceObject) obj).getSystemInstance();
    } else {
        return;
    }
    setCSVLog("UnhandledFaults", si);
    PropagationGraph currentPropagationGraph = Util.generatePropagationGraph(si, false);
    Collection<PropagationGraphPath> pathlist = currentPropagationGraph.getPropagationGraphPaths();
    for (PropagationGraphPath path : pathlist) {
        checkPropagationPathErrorTypes(path);
    }
    monitor.done();
}
Also used : InstanceObject(org.osate.aadl2.instance.InstanceObject) PropagationGraph(org.osate.aadl2.errormodel.PropagationGraph.PropagationGraph) SystemInstance(org.osate.aadl2.instance.SystemInstance) PropagationGraphPath(org.osate.aadl2.errormodel.PropagationGraph.PropagationGraphPath)

Example 2 with PropagationGraphPath

use of org.osate.aadl2.errormodel.PropagationGraph.PropagationGraphPath in project osate2 by osate.

the class PropagationGraphBackwardTraversal method traverseIncomingErrorPropagation.

/**
 * traverse backwards according to propagation paths
 * if preProcessing result is non-null return it instead of result of actual traversal (used for shared subtrees)
 * handle external incoming propagations as origin by calling on processIncomingErrorPropagation
 * handle source outgoing propagation
 * collection of those results are post processed postProcessIncomingPropagation.
 * If empty incoming propagation itself is processed as "leaf" by processIncomingErrorPropagation
 * @param component component instance with incoming propagation
 * @param errorPropagation incoming propagation
 * @param type error type
 * @return EObject (can be null)
 */
private EObject traverseIncomingErrorPropagation(ComponentInstance component, ErrorPropagation errorPropagation, TypeToken proptype, BigDecimal scale) {
    List<EObject> results = new LinkedList<EObject>();
    Collection<TypeToken> filteredtypes = filterTokenThroughConstraint(errorPropagation.getTypeSet(), proptype);
    if (filteredtypes.isEmpty()) {
        return null;
    }
    boolean traversed = false;
    boolean hasCycle = false;
    List<EObject> subResults = new LinkedList<EObject>();
    for (TypeToken type : filteredtypes) {
        boolean didProp = false;
        // we want to track cycles.
        // we do that by tagging the feature instance of the error propagation with the error type (as token)
        ErrorModelState st = null;
        FeatureInstance fi = EMV2Util.findFeatureInstance(errorPropagation, component);
        if (fi != null) {
            st = (ErrorModelState) ErrorModelStateAdapterFactory.INSTANCE.adapt(fi, ErrorModelState.class);
        } else {
            st = (ErrorModelState) ErrorModelStateAdapterFactory.INSTANCE.adapt(component, ErrorModelState.class);
        }
        if (st.visited(errorPropagation, type)) {
            // we were there before.
            hasCycle = true;
            continue;
        } else {
            st.setVisitToken(errorPropagation, type);
        }
        EObject preResult = preProcessIncomingErrorPropagation(component, errorPropagation, type, scale);
        if (preResult != null) {
            // found common event
            addSubresult(results, preResult);
            continue;
        }
        for (PropagationGraphPath ppr : Util.getAllReversePropagationPaths(currentAnalysisModel, component, errorPropagation)) {
            // traverse incoming
            if (ppr.getConnection() != null) {
                ErrorSource ces = EMV2Util.findConnectionErrorSourceForConnection(ppr.getConnection());
                // the type constraint has to come from the error source as the connection does not have one
                if (ces != null && contains(ces.getTypeTokenConstraint(), type)) {
                    // XXX filter type
                    EObject result = processConnectionErrorSource(ppr.getConnection(), ces, type, scale);
                    addSubresult(subResults, result);
                    didProp = true;
                }
                ComponentInstance contextCI = ppr.getConnection().getComponentInstance();
                TypeTransformationSet tts = EMV2Util.getAllTypeTransformationSet(contextCI);
                for (PropagationPathEnd ppe : Util.getAllPropagationSourceEnds(currentAnalysisModel, ppr.getConnection())) {
                    ComponentInstance componentSource = ppe.getComponentInstance();
                    ErrorPropagation propagationSource = ppe.getErrorPropagation();
                    TypeSet newtype = reverseMapTypeTokenToContributor(type, tts);
                    if (newtype != null) {
                        EList<TypeToken> ttlist = flattenTypesetElements(newtype);
                        for (TypeToken typeToken : ttlist) {
                            TypeToken ntype = EMV2TypeSetUtil.contains(typeToken, type) ? type : typeToken;
                            EObject result = traverseOutgoingErrorPropagation(componentSource, propagationSource, ntype, scale);
                            addSubresult(subResults, result);
                            didProp = true;
                        }
                    } else {
                        EObject result = traverseOutgoingErrorPropagation(componentSource, propagationSource, type, scale);
                        addSubresult(subResults, result);
                        didProp = true;
                    }
                    // source of connection
                    newtype = reverseMapTypeTokenToSource(type, tts);
                    if (newtype != null) {
                        EList<TypeToken> ttlist = flattenTypesetElements(newtype);
                        for (TypeToken typeToken : ttlist) {
                            TypeToken ntype = EMV2TypeSetUtil.contains(typeToken, type) ? type : typeToken;
                            EObject result = traverseOutgoingErrorPropagation(componentSource, propagationSource, ntype, scale);
                            addSubresult(subResults, result);
                            didProp = true;
                        }
                    } else {
                        EObject result = traverseOutgoingErrorPropagation(componentSource, propagationSource, type, scale);
                        if (!addSubresult(subResults, result)) {
                            didProp = true;
                        }
                    }
                }
            }
            PropagationPathEnd ppe = ppr.getPathSrc();
            ComponentInstance componentSource = ppe.getComponentInstance();
            ErrorPropagation propagationSource = ppe.getErrorPropagation();
            if (propagationSource.getDirection() == DirectionType.IN) {
                // we have an external incoming propagation
                EObject result = processIncomingErrorPropagation(componentSource, propagationSource, type, scale);
                addSubresult(subResults, result);
                didProp = true;
            } else {
                EObject result = traverseOutgoingErrorPropagation(componentSource, propagationSource, type, scale);
                addSubresult(subResults, result);
                didProp = true;
            }
        }
        st.removeVisitedToken(errorPropagation, type);
        if (didProp) {
            traversed = true;
        }
    }
    if (!subResults.isEmpty()) {
        return postProcessIncomingErrorPropagation(component, errorPropagation, proptype, subResults, scale);
    }
    if (traversed || hasCycle) {
        return null;
    }
    // we have no subresults and did not prune. Allow handling of incoming propagation as endpoint of traversal
    return processIncomingErrorPropagation(component, errorPropagation, proptype, scale);
}
Also used : FeatureInstance(org.osate.aadl2.instance.FeatureInstance) PropagationPathEnd(org.osate.aadl2.errormodel.PropagationGraph.PropagationPathEnd) PropagationGraphPath(org.osate.aadl2.errormodel.PropagationGraph.PropagationGraphPath) LinkedList(java.util.LinkedList) ErrorModelState(org.osate.xtext.aadl2.errormodel.util.ErrorModelState) TypeTransformationSet(org.osate.xtext.aadl2.errormodel.errorModel.TypeTransformationSet) ErrorSource(org.osate.xtext.aadl2.errormodel.errorModel.ErrorSource) TypeToken(org.osate.xtext.aadl2.errormodel.errorModel.TypeToken) EObject(org.eclipse.emf.ecore.EObject) TypeSet(org.osate.xtext.aadl2.errormodel.errorModel.TypeSet) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) ErrorPropagation(org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation)

Example 3 with PropagationGraphPath

use of org.osate.aadl2.errormodel.PropagationGraph.PropagationGraphPath in project osate2 by osate.

the class Util method getAllPropagationPaths.

/**
 * return all propagation paths out of the outgoing error propagation we
 * assume that any type token to be propagated meets the ep type constraint
 *
 * @param ci
 * @param outEP
 * @return
 */
public static EList<PropagationGraphPath> getAllPropagationPaths(PropagationGraph pg, ComponentInstance ci, ErrorPropagation outEP) {
    EList<PropagationGraphPath> result = new BasicEList<PropagationGraphPath>();
    for (PropagationGraphPath propagationPath : pg.getPropagationGraphPaths()) {
        PropagationPathEnd src = propagationPath.getPathSrc();
        if (src.getComponentInstance() == ci) {
            if (src.getErrorPropagation() == outEP) {
                result.add(propagationPath);
            } else {
                // check if one EP is in an ancestor feature instance
                FeatureInstance outepfi = EMV2Util.findFeatureInstance(outEP, ci);
                FeatureInstance srcfi = EMV2Util.findFeatureInstance(src.getErrorPropagation(), ci);
                if (Aadl2InstanceUtil.containedIn(outepfi, srcfi) || Aadl2InstanceUtil.containedIn(srcfi, outepfi)) {
                    result.add(propagationPath);
                }
            }
        }
    }
    return result;
}
Also used : FeatureInstance(org.osate.aadl2.instance.FeatureInstance) BasicEList(org.eclipse.emf.common.util.BasicEList) PropagationPathEnd(org.osate.aadl2.errormodel.PropagationGraph.PropagationPathEnd) PropagationGraphPath(org.osate.aadl2.errormodel.PropagationGraph.PropagationGraphPath)

Example 4 with PropagationGraphPath

use of org.osate.aadl2.errormodel.PropagationGraph.PropagationGraphPath in project osate2 by osate.

the class PropagationGraphPackageImpl method initializePackageContents.

/**
 * Complete the initialization of the package and its meta-model.  This
 * method is guarded to have no affect on any invocation but its first.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void initializePackageContents() {
    if (isInitialized)
        return;
    isInitialized = true;
    // Initialize package
    setName(eNAME);
    setNsPrefix(eNS_PREFIX);
    setNsURI(eNS_URI);
    // Obtain other dependent packages
    InstancePackage theInstancePackage = (InstancePackage) EPackage.Registry.INSTANCE.getEPackage(InstancePackage.eNS_URI);
    ErrorModelPackage theErrorModelPackage = (ErrorModelPackage) EPackage.Registry.INSTANCE.getEPackage(ErrorModelPackage.eNS_URI);
    // Create type parameters
    // Set bounds for type parameters
    // Add supertypes to classes
    // Initialize classes, features, and operations; add parameters
    initEClass(propagationGraphEClass, PropagationGraph.class, "PropagationGraph", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getPropagationGraph_Name(), ecorePackage.getEString(), "name", null, 0, 1, PropagationGraph.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getPropagationGraph_Description(), ecorePackage.getEString(), "description", null, 0, 1, PropagationGraph.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getPropagationGraph_Components(), theInstancePackage.getComponentInstance(), null, "components", null, 0, -1, PropagationGraph.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getPropagationGraph_PropagationGraphPaths(), this.getPropagationGraphPath(), null, "propagationGraphPaths", null, 0, -1, PropagationGraph.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getPropagationGraph_Connections(), theInstancePackage.getConnectionInstance(), null, "connections", null, 0, -1, PropagationGraph.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getPropagationGraph_Root(), theInstancePackage.getComponentInstance(), null, "root", null, 0, 1, PropagationGraph.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(propagationGraphPathEClass, PropagationGraphPath.class, "PropagationGraphPath", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getPropagationGraphPath_Name(), ecorePackage.getEString(), "name", null, 0, 1, PropagationGraphPath.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getPropagationGraphPath_PathSrc(), this.getPropagationPathEnd(), null, "pathSrc", null, 0, 1, PropagationGraphPath.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getPropagationGraphPath_PathDst(), this.getPropagationPathEnd(), null, "pathDst", null, 0, 1, PropagationGraphPath.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getPropagationGraphPath_Highlight(), ecorePackage.getEBoolean(), "highlight", null, 0, 1, PropagationGraphPath.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getPropagationGraphPath_Type(), this.getPropagationType(), "type", null, 0, 1, PropagationGraphPath.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getPropagationGraphPath_Connection(), theInstancePackage.getConnectionInstance(), null, "connection", null, 0, 1, PropagationGraphPath.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(propagationPathEndEClass, PropagationPathEnd.class, "PropagationPathEnd", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getPropagationPathEnd_ConnectionInstance(), theInstancePackage.getConnectionInstance(), null, "connectionInstance", null, 0, 1, PropagationPathEnd.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getPropagationPathEnd_ErrorPropagation(), theErrorModelPackage.getErrorPropagation(), null, "errorPropagation", null, 0, 1, PropagationPathEnd.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getPropagationPathEnd_ComponentInstance(), theInstancePackage.getComponentInstance(), null, "componentInstance", null, 0, 1, PropagationPathEnd.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getPropagationPathEnd_Highlight(), ecorePackage.getEBoolean(), "highlight", null, 0, 1, PropagationPathEnd.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    // Initialize enums and add enum literals
    initEEnum(propagationTypeEEnum, PropagationType.class, "PropagationType");
    addEEnumLiteral(propagationTypeEEnum, PropagationType.CONNECTION);
    addEEnumLiteral(propagationTypeEEnum, PropagationType.BINDING);
    addEEnumLiteral(propagationTypeEEnum, PropagationType.USER_DEFINED);
    // Create resource
    createResource(eNS_URI);
}
Also used : InstancePackage(org.osate.aadl2.instance.InstancePackage) ErrorModelPackage(org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelPackage)

Example 5 with PropagationGraphPath

use of org.osate.aadl2.errormodel.PropagationGraph.PropagationGraphPath in project osate2 by osate.

the class Util method addPropagationpathRecord.

private static void addPropagationpathRecord(PropagationGraph pg, ComponentInstance srcCI, ErrorPropagation srcprop, ConnectionInstance dstConni) {
    PropagationGraphPath path = PropagationGraphFactory.eINSTANCE.createPropagationGraphPath();
    PropagationPathEnd srcPE = PropagationGraphFactory.eINSTANCE.createPropagationPathEnd();
    PropagationPathEnd dstPE = PropagationGraphFactory.eINSTANCE.createPropagationPathEnd();
    srcPE.setComponentInstance(srcCI);
    srcPE.setErrorPropagation(srcprop);
    dstPE.setConnectionInstance(dstConni);
    dstPE.setErrorPropagation(null);
    path.setPathSrc(srcPE);
    path.setPathDst(dstPE);
    // new PropagationPathRecord(srcCI, srcprop, dstCI, dstprop, connectionInstance);
    pg.getPropagationGraphPaths().add(path);
    pg.getComponents().add(srcCI);
}
Also used : PropagationPathEnd(org.osate.aadl2.errormodel.PropagationGraph.PropagationPathEnd) PropagationGraphPath(org.osate.aadl2.errormodel.PropagationGraph.PropagationGraphPath)

Aggregations

PropagationGraphPath (org.osate.aadl2.errormodel.PropagationGraph.PropagationGraphPath)7 PropagationPathEnd (org.osate.aadl2.errormodel.PropagationGraph.PropagationPathEnd)5 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)3 FeatureInstance (org.osate.aadl2.instance.FeatureInstance)3 ErrorPropagation (org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation)3 PropagationGraph (org.osate.aadl2.errormodel.PropagationGraph.PropagationGraph)2 SystemInstance (org.osate.aadl2.instance.SystemInstance)2 TypeSet (org.osate.xtext.aadl2.errormodel.errorModel.TypeSet)2 TypeToken (org.osate.xtext.aadl2.errormodel.errorModel.TypeToken)2 TypeTransformationSet (org.osate.xtext.aadl2.errormodel.errorModel.TypeTransformationSet)2 ErrorModelState (org.osate.xtext.aadl2.errormodel.util.ErrorModelState)2 LinkedList (java.util.LinkedList)1 BasicEList (org.eclipse.emf.common.util.BasicEList)1 EObject (org.eclipse.emf.ecore.EObject)1 ConnectionInstance (org.osate.aadl2.instance.ConnectionInstance)1 InstanceObject (org.osate.aadl2.instance.InstanceObject)1 InstancePackage (org.osate.aadl2.instance.InstancePackage)1 ErrorModelPackage (org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelPackage)1 ErrorSource (org.osate.xtext.aadl2.errormodel.errorModel.ErrorSource)1 TypeMappingSet (org.osate.xtext.aadl2.errormodel.errorModel.TypeMappingSet)1