establishing context - urgent request

Moderator: Moderators

establishing context - urgent request

Postby tpen3219 » Thu Mar 07, 2013 5:18 pm

I would like to understand if and how I can control the context of each behavior. I have had intermittent success. What are the rules for insuring that an activity (diagram) is in the context of a specific object?

In my simulation I have a set of three nested loops. Within each loop I would like the context to be the object being acted upon. It seems however that the context is always the object that owns the state machine that launches the simulation and the other objects have to passed in as parameters.

My application logic is as follows:
The Simulation Context object owns the primary state machine.
One of the events fires off a state in whose entry activity moves people through a series of areas and portals in an evacuation plan.

For each Portal in the Plan
For each destination area attached to the portal
For each source area attached to the portal
move people from the source area to the destination area

I started out by placing operations in the Plan, Portal, and Area blocks. Each operation method was an activity diagram or opaque behavior created under the associated block.

For example, when I perform the callBehaviorAction with a target of Facility, the readSelf action within it returns the Simulation Context instead of the Facility which owns the behavior.

So my question, restated, is how do I determine which object will be the context for a particular activity diagram?

Please direct you answer to the specific looping construct that I described above.

Thank you very much
tpen3219
Forum Beginner
Forum Beginner
 
Posts: 93
Posts Rating:3
Joined: Fri Nov 04, 2011 11:57 am

Re: establishing context - urgent request

Postby tpen3219 » Mon Mar 18, 2013 3:27 pm

I am resubmitting this because I have not received a response in 11 days.
This was explicitly titled as an urgent request.
tpen3219
Forum Beginner
Forum Beginner
 
Posts: 93
Posts Rating:3
Joined: Fri Nov 04, 2011 11:57 am

Re: establishing context - urgent request

Postby kampanath_p » Tue Mar 19, 2013 4:45 am

I have just assigned to investigate this issue. Now I am investigating.
kampanath_p
Customer Support
Customer Support
 
Posts: 5
Posts Rating:0
Joined: Sun Aug 05, 2012 9:26 pm

Re: establishing context - urgent request

Postby kampanath_p » Tue Mar 19, 2013 4:59 am

Dear tpen3219

Normally the context of the action, which also be the result of readSelf action, is the classifier that own the action. I investigate the file named "AEC v3.6 for Kritsana 20130304-2" and I noticed that there is every activity is owned by the activity owned by the block named named Simulation Context, therefore, readSelf action will return Simulation Context.

If you want to specify the context of the activity, set the designated object (object that you want it be a context of the activity) as the owner of the activity.

By the way, if the aforementioned model is not the model in your question, can you send your model to me at kampanath_p@nomagicasia.com ?

Best Regards,
Kampanath Panthithosanyu
kampanath_p
Customer Support
Customer Support
 
Posts: 5
Posts Rating:0
Joined: Sun Aug 05, 2012 9:26 pm

Re: establishing context - urgent request

Postby tpen3219 » Tue Mar 19, 2013 12:13 pm

Thank you very much for your help!

I am working on a much later version of the project (attached).

I think I might have found the problem. Please see the attached image of the transition specification in Context Problem.png.
The effect specification points to an operation on the Facility block called displayPlan.
But the effect name displayPlan yields a behavior element called displayPlan that is in the Simulation Context block.

I tried changing the name of the Facility operation to displayPlanX.
See Context Problem 2.png.
MD created an activity diagram named displayPlanX in the Simulation Context block.

It appears that a Class/Block may only call operations or activities on itself.
Is this true?

Thanks
You do not have the required permissions to view the files attached to this post.
tpen3219
Forum Beginner
Forum Beginner
 
Posts: 93
Posts Rating:3
Joined: Fri Nov 04, 2011 11:57 am

Re: establishing context - urgent request

Postby kritsana_u » Tue Mar 19, 2013 9:04 pm

Dear Tom,

We are investigating the problem. Preliminary, we found that you use call behavior action calling to the EvacuateFacility activity of Facility block within the activity of Simulation Context block which causes the problem with the context. Because, the EvacuateFacility activity of the Facility block must be performed by the Facility object (or subtype) only. If you want to call such activity in the Simulation Context, you have to use callOperation action because it allows you to specify the object which will perform the operation, through its target pin.

First, you have to create an operation in Facility block. This operation must have the same signature as the EvacuateFacility activity. Then specify, the EvacuateFacility to be a method of the operation. Finally, using callOperation action calling to the create operation and specify the target pin the Facility object, instead of using the callBehavior action. See the attached image, evacuate is the created operation in the Facility block, whose method is the EvacuateFacility activity.

Cameo Systems Modeler 17.0.4 beta - AEC 6.jpg


Yours sincerely,

Kritsana U.
You do not have the required permissions to view the files attached to this post.
kritsana_u
Forum Expert
Forum Expert
 
Posts: 116
Posts Rating:3
Joined: Wed Jan 27, 2010 3:02 am

Re: establishing context - urgent request

Postby tpen3219 » Wed Mar 20, 2013 9:00 am

That distinction between the use of call Behavior and call Operation was exactly what I was looking for. Thank you

To restate:
to invoke an behavior on the local context I can use either callOperation or callBehavior
to invoke an behavior on an object other than the local context I must use callOperation and provide the target on the callOperation.

Is this accurate?
tpen3219
Forum Beginner
Forum Beginner
 
Posts: 93
Posts Rating:3
Joined: Fri Nov 04, 2011 11:57 am

Re: establishing context - urgent request

Postby tpen3219 » Mon Apr 01, 2013 1:04 pm

I have everything working.
I was told somewhere else that I do not need the target pin when I am calling operations on the current context.
However, I get warning messages when I remove the target pins.
Obviously warning messages do not effect simulation but if this is legal why is it an error at all?
If it is really OK I will remove all the target pins when I call context operations. It will reduce the complexity of the diagrams quite a bit.
tpen3219
Forum Beginner
Forum Beginner
 
Posts: 93
Posts Rating:3
Joined: Fri Nov 04, 2011 11:57 am

Re: establishing context - urgent request

Postby kritsana_u » Mon Apr 01, 2013 8:04 pm

According to the UML v2.4.1 Superstructure, it is clearly that the callOperationAction must have one target pin.
If you want to call to a behavior of the current context, you should use callBehaviorAction instead.
You can simply drag the activity to which you want to call, from the containment browser and drop it to the activity diagram.
MagicDraw will automatically create the callBehaviorAction calling to the dropped activity for you.

UML 2.4.1 Superstructure - 11.3.10.png


Best regards,

Kritsana U.
You do not have the required permissions to view the files attached to this post.
kritsana_u
Forum Expert
Forum Expert
 
Posts: 116
Posts Rating:3
Joined: Wed Jan 27, 2010 3:02 am

Re: establishing context - urgent request

Postby tpen3219 » Mon Apr 01, 2013 10:39 pm

I realize that the callOperation has the input pin "target".

I am asking if MagicDraw assumes the target is the current context.

[3/1/2013 5:22:20 AM] Nerijus Jankevicius: use ReadSelfAction or even delete target pin
[3/1/2013 5:22:31 AM] Nerijus Jankevicius: it should work. if target is null, we use context as a target
tpen3219
Forum Beginner
Forum Beginner
 
Posts: 93
Posts Rating:3
Joined: Fri Nov 04, 2011 11:57 am

Next

Return to Cameo Simulation Toolkits

Who is online

Users browsing this forum: No registered users and 1 guest