Behavior context in nested UI

Moderator: Moderators

Behavior context in nested UI

Postby dmn2014 » Sun Jan 19, 2014 10:08 pm

Hello,

I have a SOA model and want to represent the service consumers and providers as parts of the system in a nested UI. I isolated the problem that I'm having in the attached model. The classifying behavior of the consumer block, ConsumeServices, works on initialization. The first action of that behavior does a read self which, as expected, returns the Consumer. When I click the UI button associated with the ConsumeServices behavior, the behavior fails because the read self action returns System. How can I get the button to execute the behavior with the Consumer as its context? Is there a better solution?

Thanks.
You do not have the required permissions to view the files attached to this post.
dmn2014
Forum Newbie
Forum Newbie
 
Posts: 2
Posts Rating:0
Joined: Sun Jan 19, 2014 9:14 pm

Re: Behavior context in nested UI

Postby Nerijus Jankevicius » Mon Jan 20, 2014 8:09 am

There are multiple issues with the way you model behaviors of composite structure.

1. Don't start behaviors of the parts on initialization - they could run out of sync, there is no guarantee that related objects will be created already.

2. Use state machines as main behaviors of the parts.
3. Use connectors and signals to trigger transitions to states which runs your desired behaviors on entry.

4. Use GUI buttons for triggering signals, not starting behaviors.

Please look at included model examples like FlashingLight or StopWatch to see simple communication patterns and GUI for signals triggering.
We would highly recommend 2-3 days onsite workshop or training.
Nerijus Jankevicius
Customer Support
Customer Support
 
Posts: 21
Posts Rating:1
Joined: Tue Mar 09, 2010 10:03 am

Re: Behavior context in nested UI

Postby dmn2014 » Mon Jan 20, 2014 10:50 am

The model that I posted was only created to investigate the issue. Consumer has a state machine that normally initializes it. I only switched to the behavior call in trying to understand what was happening. You can switch the classifying behavior to the Consumer state machine (which is still in the model) and it doesn't change what happens when using the UI.

The real question is this -- can you bind the operation or behavior call of a part to a button in a nested UI? The CST documentation doesn't say one way or another, but I'm guessing the answer is no because the context will be that of the parent block when it executes.
dmn2014
Forum Newbie
Forum Newbie
 
Posts: 2
Posts Rating:0
Joined: Sun Jan 19, 2014 9:14 pm

Re: Behavior context in nested UI

Postby arnon_l » Wed Jan 22, 2014 3:12 am

Currently (17.0.5), the operation and behavior call of a part to a nested UI button still use the main block as the context.
However, we will support the binding of part's context of operation and behavior call in a nested UI button at version 17.0.5 sp and 18.0
arnon_l
Customer Support
Customer Support
 
Posts: 78
Posts Rating:9
Joined: Thu Aug 30, 2012 3:39 am

Re: Behavior context in nested UI

Postby arnon_l » Tue Mar 11, 2014 7:49 pm

Please be informed that CST 17.0.5 SP1 has already been released.
It supports the binding of operation and behavior call of part's context in a nested UI button.
arnon_l
Customer Support
Customer Support
 
Posts: 78
Posts Rating:9
Joined: Thu Aug 30, 2012 3:39 am


Return to Cameo Simulation Toolkits

Who is online

Users browsing this forum: No registered users and 0 guests

cron