osate / osate2

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

Bug with creating the connection instance with abstract component #118

Closed alnayeem closed 11 years ago

alnayeem commented 12 years ago

Hi,

I have noticed some problems with instantiating a system component that is using components based on AADL abstract component. I have created a simplified example to reproduce this bug.

Basically, I have a system S with two processes of type P. These processes have identical structure. They have a single thread group, TG. Inside TG, there is a single thread T. These components P, TG, T are all extended from an abstract component C. C only has two features: one for input and another for output. Input from one process goes to the output port of other process.

In this example, after instantiating an implementation of system S, I get the following error: "Connection from S_impl_Instance.p2.tg.t.output to S_impl_Instance.p2.tg.t.output has no valid direction. Connection instance not created. test_S_impl_Instance.aaxl2"

Also it appears that when I do not use the abstract component, there were no problems.

Please find the test examples in the following links: Using the abstract component: https://www.dropbox.com/s/n8fccv4heos59os/test_with_abstract.aadl Without using the abstract component: https://www.dropbox.com/s/rpsshuttmour7et/test_without_abstract.aadl

Best, Abdullah

juli1 commented 11 years ago

Hi,

Seems to be related to CreateConnectionSwitch.java, at line 242, there is something that would need to be checked. Will investigate that issue.

juli1 commented 11 years ago

Hi Abdullah,

For now, this issue exist because both the thread group and the threads extends the same abstract. For example, the following model does not have any issue (see below).

This is caused because OSATE2 try to see if there is an opposite connection. For that, it takes all the refinements of the port. When using the extends mechanisms, the port of the process/thread group and thread share the same refinement for the port. Thus, the connection is considered as an opposite and this lead to an error. Need to discuss how to fix this issue.

Greetings,

package With_Abstract public

-- Related to issue 118 on github

with Base_Types;

abstract C features input: in data port Base_Types::boolean; output: out data port Base_Types::boolean;
end C;

abstract D features input: in data port Base_Types::boolean; output: out data port Base_Types::boolean;
end D;

thread T extends C end T;

thread group TG extends D end TG;

process P extends C end P;

thread implementation T.impl end T.impl;

thread group implementation TG.impl subcomponents t: thread T.impl; connections C1: port input -> t.input; C2: port t.output -> output; end TG.impl;

process implementation P.impl subcomponents tg: thread group TG.impl; connections C1: port input -> tg.input; C2: port tg.output -> output; end P.impl;

system S end S;

system implementation S.impl subcomponents p1: process P.impl; p2: process P.impl; connections port p1.output -> p2.input; port p2.output -> p1.input; end S.impl;

end With_Abstract;

alnayeem commented 11 years ago

Thanks Julien for investigating this issue. Please let me know when you fix this problem. On Nov 17, 2012 10:35 AM, "Julien" notifications@github.com wrote:

Hi Abdullah,

For now, this issue exist because both the thread group and the threads extends the same abstract. For example, the following model does not have any issue (see below). We will investigate more and fix it.

Greetings,

package With_Abstract public

-- Related to issue 118 on github

with Base_Types;

abstract C features input: in data port Base_Types::boolean; output: out data port Base_Types::boolean;

end C;

abstract D features input: in data port Base_Types::boolean; output: out data port Base_Types::boolean;

end D;

thread T extends C end T;

thread group TG extends D end TG;

process P extends C end P;

thread implementation T.impl end T.impl;

thread group implementation TG.impl subcomponents t: thread T.impl; connections C1: port input -> t.input; C2: port t.output -> output; end TG.impl;

process implementation P.impl subcomponents tg: thread group TG.impl; connections C1: port input -> tg.input; C2: port tg.output -> output; end P.impl;

system S end S;

system implementation S.impl subcomponents p1: process P.impl; p2: process P.impl; connections port p1.output -> p2.input; port p2.output -> p1.input; end S.impl;

end With_Abstract;

— Reply to this email directly or view it on GitHubhttps://github.com/osate/osate2-core/issues/118#issuecomment-10475239.

juli1 commented 11 years ago

To summarize, fixing the issue would really introduce a complexity in the code we would not really like to introduce. Instead, we will not address a connection between two components that inherits the same abstract component. When such thing appears, we would show an error that states the operation is not supported. I know that this not fixes the issue but explain why this is not supported.