osate / ErrorModelV2

Old AADL EMV2 annex repository, kept for reference
3 stars 10 forks source link

Internal events are not usable as error detection effects #93

Closed sprocter closed 8 years ago

sprocter commented 8 years ago

Overview

The version of the EMV2 standard I have specifies that internal events can be used as error detection effects, but the xtext grammar seems to not allow this.

Details

The version of the EMV2 Standard I have says that:

error_detection ::=
  [ defining_error_detection_identifier : ]
  ( error_source_state | all )
    -[ [ error_condition ] ]->
    error_detection_effect ;

error_detection_effect ::=
    ( outgoing_port_reference | internal_event_reference ) !
    [ ( error_code_value ) ]

But the XText grammar specification of an ErrorDetection is:

ErrorDetection returns ErrorDetection: 
    (name = ID ':' )?
    ((state=[ErrorBehaviorState|ID] (typeTokenConstraint=TypeTokenConstraint)?)|
        allStates?='all'
    )
    '-[' (condition=ConditionExpression)? ']->' 
    ( detectionReportingPort=[aadl2::TriggerPort|ID] ) '!'
    ('('errorCode=ErrorCodeValue')')?
    ';' 
;

I was wondering which of these two sources was in error.

Minimal working example

package ErrorDetectionExample
public

    system ErrorDetectionExample
    end ErrorDetectionExample;

    system implementation ErrorDetectionExample.imp
    annex EMV2 {**
        component error behavior
            events
                 ExampleEvent : error event;
            detections
                test : all -[ ]-> ExampleEvent!;
        end component;
        **};
    end ErrorDetectionExample.imp;

end ErrorDetectionExample;

Expected result

The code parses successfully without any errors

Actual result

The following error is generated:

Description Resource Path Location Type
Couldn't resolve reference to TriggerPort 'ExampleEvent'. ErrorDetectionExample.aadl /Sandbox line: 6 /Sandbox/ErrorDetectionExample.aadl Xtext Check (fast)
reteprelief commented 8 years ago

Sam,

the grammar is ok. TriggerPort is a super class that includes InternalFeature.

Your problem is that you are referencing an error event, not an internal event, Below is the example with an internalevent declaration and reference. If the issue is how to detect an error event that is within a component: the error event results in a transition to an error state and the error state is referenced in teh detection declaration (see the example). `package ErrorDetectionExample public

system ErrorDetectionExample
    features
        extport: out event port;
end ErrorDetectionExample;

system implementation ErrorDetectionExample.imp
    internal features
    internalevent: event ;
annex EMV2 {**
    use behavior ErrorLibrary::FailStop;
    component error behavior
        events
             ExampleEvent : error event;
        transitions
        t1: Operational -[ExampleEvent]-> FailStop;
        detections
            test : Failstop -[ ]-> internalevent!;
            test1 : all -[ ]-> ExampleEvent!;
            test2 : Failstop -[ ]-> extport!;
    end component;
    **};
end ErrorDetectionExample.imp;

end ErrorDetectionExample; `

sprocter commented 8 years ago

Ahh, got it. Thanks for the explanation!