New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion failures in Petri Net backends on incomplete models #10

Closed
bulletshot60 opened this Issue Mar 21, 2013 · 5 comments

Comments

Projects
None yet
2 participants
@bulletshot60
Contributor

bulletshot60 commented Mar 21, 2013

While trying to compile aadl v2 code into a petri net I run into the following error.

 ------------------------------------------
 ------ Ocarina Petri Nets Generator ------
 ------------------------------------------

 +========================== OCARINA BUG DETECTED =========================+
 | Detected exception: SYSTEM.ASSERTIONS.ASSERT_FAILURE                    |
 | Error: ocarina-backends-pn-nodes.adb:463                                |
 | Please refer to the User's Guide for more details.                      |
 +=========================================================================+

 Exception name: SYSTEM.ASSERTIONS.ASSERT_FAILURE
 Message: ocarina-backends-pn-nodes.adb:463

The aadl code is as follows:

package vehicle
    public

    data on_off
    end on_off;

    process control
    features
        command_data: out data port on_off;
        engage: out data port on_off;
        disengage: out data port on_off;
    end control;

    process implementation control.standard
    end control.standard;

    ------------------------------------------------------------------------------------------  

    feature group vehicle_cmd_in
    features
        speed_command: out data port on_off;
        position_command: out data port on_off;
        airbag_command: out data port on_off;
        direction_command: out data port on_off;
    end vehicle_cmd_in;

    system vehicle
    features
        vehicle_cmd_input: feature group vehicle_cmd_in;
    end vehicle;

    system implementation vehicle.standard
    subcomponents
        speed_controller: process control.standard;
        position_controller: process control.standard;
        airbag_controller: process control.standard;
        direction_controller: process control.standard;
    connections
        event_distribution1: port vehicle_cmd_input.speed_command -> speed_controller.command_data;
        event_distribution2: port vehicle_cmd_input.position_command -> position_controller.command_data;
        event_distribution3: port vehicle_cmd_input.airbag_command -> airbag_controller.command_data;
        event_distribution4: port vehicle_cmd_input.direction_command -> direction_controller.command_data;
    end vehicle.standard;

    system root
    end root;

    system implementation root.impl
    subcomponents
        vehicle: system vehicle.standard;
    end root.impl;

end vehicle;

The command used to launch ocarina is

ocarina -g pertri_nets -aadlv2 vehicle.aadl

Not sure if the error is on my end or if this is something wrong in ocarina. Thanks for any assistance that you are able to offer.

@yoogx

This comment has been minimized.

Contributor

yoogx commented Mar 21, 2013

I agree the message is not user friendly. Basically your model is incomplete: your model is made of systems and processes, two categories of components without behavior. Hence, the backend bugs on an incomplete model, you needs threads to have a working model. Please review the examples in Ocarina distribution.

yoogx added a commit that referenced this issue Mar 21, 2013

@yoogx yoogx closed this Mar 21, 2013

@bulletshot60

This comment has been minimized.

Contributor

bulletshot60 commented Mar 21, 2013

Thanks.

Perhaps you might answer one further question about an error. I'm getting a Thread Implementation unknown error after adding in the threads and an appropriate subprogram.

package vehicle
public

data on_off
end on_off;

------------------------------------------------------------------------------------------

subprogram vehicle_subprogram
    features
        input: in parameter on_off;
        output: out parameter on_off;
end vehicle_subprogram;

subprogram implementation vehicle_subprogram.impl
    properties
        Compute_Execution_Time => 1 Us .. 1 Us;
end vehicle_subprogram.impl;

------------------------------------------------------------------------------------------

thread computation
    features
        input: in data port on_off;
        output: out data port on_off;
end computation;

thread implementation computation.standard  
    calls 
        Main: {
            computation: subprogram vehicle_subprogram.impl;
        };
    connections
        parameter input -> computation.input;
        parameter computation.output -> output;
    properties
        Dispatch_Protocol  => Periodic;
        Period             => 10 Ms;
        Compute_Execution_Time => 1 Us .. 1 Us;
end computation.standard;

------------------------------------------------------------------------------------------

process control
    features
        command_data: out data port on_off;
        engage: out data port on_off;
        disengage: out data port on_off;
end control;

process implementation control.standard
    subcomponents
        computation: thread computation.standard;
end control.standard;

------------------------------------------------------------------------------------------  

feature group vehicle_cmd_out
    features
        speed_command: in data port on_off;
        position_command: in data port on_off;
        airbag_command: in data port on_off;
        direction_command: in data port on_off;
end vehicle_cmd_out;

system vehicle
    features
        vehicle_cmd_input: feature group vehicle_cmd_out;
end vehicle;

system implementation vehicle.standard
    subcomponents
        speed_controller: process control.standard;
        position_controller: process control.standard;
        airbag_controller: process control.standard;
        direction_controller: process control.standard;
    connections
        event_distribution1: port vehicle_cmd_input.speed_command -> speed_controller.command_data;
        event_distribution2: port vehicle_cmd_input.position_command -> position_controller.command_data;
        event_distribution3: port vehicle_cmd_input.airbag_command -> airbag_controller.command_data;
        event_distribution4: port vehicle_cmd_input.direction_command -> direction_controller.command_data;
end vehicle.standard;

system root
end root;

system implementation root.impl
    subcomponents
        vehicle: system vehicle.standard;
end root.impl;

end vehicle;

The exact error with line number and stack trace is:

------------------------------------------
------ Ocarina Petri Nets Generator ------
------------------------------------------

+========================== OCARINA BUG DETECTED =========================+
| Detected exception: CONSTRAINT_ERROR                                    |
| Error: ocarina-me_aadl-aadl_instances-nodes.adb:98 index check failed   |
| Please refer to the User's Guide for more details.                      |
+=========================================================================+

Exception name: CONSTRAINT_ERROR
Message: ocarina-me_aadl-aadl_instances-nodes.adb:98 index check failed
Call stack traceback locations:
0x83c3562 0x80da621 0x80da4ac 0x80d9c2b 0x80d73a0 0x80d71d5 0x80d71a0 0x80d71a0 0x80d3c8d 
0x833d514 0x833d71e 0x829c00b 0x806901e 0x8066b4f 0xb7672e44

Finally, I look at a several of the examples. Most of them, as far as I can tell, fail to pass through Ocarina. Is there an example within the distribution (written in AADLv2) that will successfully return? If so, would you mind posting the path to it within the distribution.

yoogx added a commit that referenced this issue Mar 22, 2013

@yoogx

This comment has been minimized.

Contributor

yoogx commented Mar 22, 2013

I updated an AADL1.0 example to v2 in commit d1c0a47

Note your second model is also incomplete, I'll update the error message as well

@yoogx

This comment has been minimized.

Contributor

yoogx commented Mar 22, 2013

Regarding the second test case, Ocarina now reports this:
test2.aadl:24:09 Backends: fatal error : This IN port is not connected to any destination

and actually, ports of the threads are not connected to the corresponding ports of the enclosing process.
If you have further inquiries, please open a separate issue.

@yoogx yoogx closed this Mar 22, 2013

@ghost ghost assigned yoogx Mar 22, 2013

@bulletshot60

This comment has been minimized.

Contributor

bulletshot60 commented Mar 22, 2013

Thank you very much for the upgraded example. I understand now what was causing the code to fail. Thanks for the quick responses and upgraded error messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment