osate / osate2

Open Source AADL2 Tool Environment
http://osate.org
Eclipse Public License 2.0
39 stars 8 forks source link

Modal AADL Property Values exception and SOM enumeration limits #984

Closed stevevestal closed 6 years ago

stevevestal commented 6 years ago
-- There are two issues for this package.
--
-- First, if you instantiate this package, open the aaxl2 file, 
-- navigate to the Compute_Execution_Time property in the p1.t 
-- thread in the AADL Property Values tab, and then attempt to
-- open the Compute_Exectuion_Time property value, an
-- exception popup occurs: 
-- org.osate.aadl2.instance.implComponentInstanceImpl
-- cannot be cast to org.osate.aadl2.ComponentClassifier.
--
-- Second, OSATE now enumerates the entire SOM mode-space and
-- lists them all in the instance file.  It seems to impose a
-- limit to avoid explosion, which for this example results in the
-- error message "List of System Operating Modes is incomplete."
-- For a large mode-space, is there a way to control which
-- portion of the mode-space is enumerated?  (We are currently
-- using a custom boolean-valued property to identify modes that
-- are to be included when doing various analyses of a model.)
-- In the mean time, is there a property or preference to set
-- the limit on number of SOMs that will be enumerated?
--
-- Note that only idle and cold_start modes are reachable in
-- this model.  Are there any plans to enumerate only the
-- SOMs that are reachable from the initial SOM?

package Mode_Issues
public

    thread A653_Thread
        modes
            idle: initial mode;
            cold_start: mode;
            warm_start: mode;
            normal: mode;       
    end A653_Thread;

    process A653_Application
        features
            bootup: in event port;
        modes
            idle: initial mode;
            cold_start: mode;
            warm_start: mode;
            normal: mode;
            ic: idle -[bootup]-> cold_start;
    end A653_Application;

    process implementation A653_Application.Impl
        subcomponents
            t: thread A653_Thread 
               in modes (idle => idle, cold_start => cold_start, warm_start => warm_start, normal => normal);
        properties
            Compute_Execution_Time => 0ms .. 0ms in modes (idle), 10ms .. 10ms applies to t;            
    end A653_Application.Impl;

    virtual processor A653_Partition
    end A653_Partition;

    processor A653_Module
    end A653_Module;

    system A653
    end A653;

    system implementation A653.Impl
        subcomponents
            a1: process A653_Application.Impl;
            a2: process A653_Application.Impl;
            a3: process A653_Application.Impl;
            a4: process A653_Application.Impl;
            a5: process A653_Application.Impl;
            a6: process A653_Application.Impl;                      
            p1: virtual processor A653_Partition;
            p2: virtual processor A653_Partition;
            p3: virtual processor A653_Partition;
            p4: virtual processor A653_Partition;
            p5: virtual processor A653_Partition;
            p6: virtual processor A653_Partition;                           
            m: processor A653_Module;
        properties
            Actual_Processor_Binding => (reference (p1)) applies to a1;
            Actual_Processor_Binding => (reference (m)) applies to p1;
            Actual_Processor_Binding => (reference (p2)) applies to a2;
            Actual_Processor_Binding => (reference (m)) applies to p2;
            Actual_Processor_Binding => (reference (p3)) applies to a3;
            Actual_Processor_Binding => (reference (m)) applies to p3;
            Actual_Processor_Binding => (reference (p4)) applies to a4;
            Actual_Processor_Binding => (reference (m)) applies to p4;
            Actual_Processor_Binding => (reference (p5)) applies to a5;
            Actual_Processor_Binding => (reference (m)) applies to p5;
            Actual_Processor_Binding => (reference (p6)) applies to a6;
            Actual_Processor_Binding => (reference (m)) applies to p6;                                                                          
    end A653.Impl;

end Mode_Issues;
lwrage commented 6 years ago

@stevevestal When you paste an AADL file into github, please enclose it in lines containing ``` (triple backquotes). Otherwise the formatting is messed up. You can switch to the preview tab to check the result before posting.

``` pasted AADL file goes here ```

lwrage commented 6 years ago

The exception looks like a bug. Which OSATE version are you using? The SOMs have always been part of the instance model, we only changed the representation. BTW, I'd prefer to use the Google group for questions like this. The limit is currently hard coded to 1000 (see #666). Could you file a separate issue to have it changed or made a preference, please?

lwrage commented 6 years ago

The exception still occurs in 2.3.1.

AaronGreenhouse commented 6 years ago

The exception is not just a problem on the instance model. It also happens with the declarative model. it is linked to using the "default" property association case in the property association when there is a mode list:

package Exception
public
    with PS;

    System S
        modes
            m1 : initial mode;
            m2 : mode;
            m3 : mode;
        properties
            PS::prop1 => "foo1";
            PS::prop2 => "foo1" in modes (m1);
            PS::prop3 => "foo1" in modes (m1), "bar1" in modes (m2);
            PS::prop4 => "foo1" in modes (m1), "bar1";
    end S;

    System T
    end T;

    System implementation T.impl
        subcomponents
            sub: system S;
            sub2: system S {
                PS::prop1 => "foo3";
                PS::prop2 => "foo3" in modes (m1);
                PS::prop3 => "foo3" in modes (m1), "bar2" in modes (m2);
                PS::prop4 => "foo3" in modes (m1), "bar2";
            };
        properties
            PS::prop1 => "foo2" applies to sub;
            PS::prop2 => "foo2" in modes (m1) applies to sub;
            PS::prop3 => "foo2" in modes (m1), "bar2" in modes (m2) applies to sub;
            PS::prop4 => "foo2" in modes (m1), "bar2" applies to sub;
    end T.impl;
end Exception;

with the property set

property set PS is
    prop1 : aadlstring applies to (system);
    prop2 : aadlstring applies to (system);
    prop3 : aadlstring applies to (system);
    prop4 : aadlstring applies to (system);
end PS;

Here the error only occurs when you try expand the property PS::prop4 on the subcomponent sub or sub of T.impl.

Interestingly, it doesn't occur if you expand the property PS::prop4 on the system type S directly, even though that also has a "default" case in the property association.

The direct cause of this is PropertyColumnLabelProvider.getText(), which seems to be making a bad assumption about the type of an object in the case of the modal property association. Need to better understand that this object is and what types it can actually have.

AaronGreenhouse commented 6 years ago

The problematic segment of code is trying to get the list of declared modes so it can find out which modes do not have an explicit property association, and thus are affected by the "default" one. The code seems to be assuming that the modelpropertyassociation comes from the property section of a classifier declaration, and thus is assuming that the object the AADL Property View is focused on is a classifier. Clearly this is a bad assumption, as it can be a subcomponent declaration. Can probably be a bunch of things, I need to figure out which ones are relevant to this situation.

AaronGreenhouse commented 6 years ago

Okay, so the bug was that the existing code was assumed the AADL Property View was focused on a component classifier. It wants to get the list of modes declared in that classifier. There are three cases we need to deal with:

  1. The view is focused on an InstanceObject. In this case we just get the SystemInstance object and use its list of system operation modes.
  2. The view is focused on a Subcomponent. In this case we get the component classifier of the subcomponent and use its list of modes.
  3. The view is focused on some other declarative object. In this case we get the containing component classifier and use its list of modes.
AaronGreenhouse commented 6 years ago

Fixed this.