![]() |
Telelogic Rhapsody (steve huntington) | ![]() |
Topic Title: Triggered Operation Topic Summary: Created On: 20-Oct-2006 12:16 Status: Read Only |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
I have amodel which has a couple of active classes. One of these allows some of its member variables to be read/written by another class. The read and writes are implemented as triggered operations, which are Reactions In State at the top level of the statechart for the class. I have noticed that sometimes when I try to read/write the values that they don't happen as expected. When I looked in the debugger, I could see that the code for these wasn't being executed. I suspect that this is because at the time of the read/write, the class is processing actions steps for a transition in a substate, and so is not in a position to deal with the triggered operation.
The help for Transition Labels provided the following information: "There might be a problem with the reply from triggered operations if the receiver object is not in a state in which it is able to react to a triggered operation. If a triggered operation is called when not expected, incorrect return values might result. Rather than use the IS_IN macro to determine what state the receiver is in, you can design your statechart so the triggered operation is never ignored. To do this, create a superstate encompassing the substates in the object, and in the superstate create a static reaction with a trigger to return the proper value. For example, to make sure that a sensor is always read regardless of what state an object is in, create a static reaction in the superstate with the following transition: opRead/reply(getStatus()) This way, no matter what substate the object is in, it will always return the proper value. Although both the trigger to the superstate and that to a substate are active when in a substate, the trigger on the transition to the superstate is taken because it is higher priority. See Transition Selection." This seems to be the problem that I am seeing, albeit I think that my code is between states when the triggered operation is called. Could somebody plesae confirm that what I believe to be happening is correct? Does anybody have any solutions to the problem? Thanks, Paul |
|
![]() |
|
![]() |
|
I have done some further debugging and think that the problem is caused by some of the NULL transitions that I have within the model.
Is there someway to check that all of these have been taken? I have another calss which calls a primitive operation on the probllem class (through a Port). The body of the operation waits on the value of one of the member variables to change. This change takes place on a transition. I currently have a while loop which won't exit until the value changes. Once it does the operation can complete and the other class can continue. This appears to be problematic, as at the point that this changes the NULL transitions have not been executed. I think that this means that the class can't properly handle the triggered operations. I need a way to not complete the function until the value has changed AND all NULL transitions have been taken (or not depending on the guard on them). Thanks, Paul |
|
![]() |
|
![]() |
|
I am not quite sure your problem. I guess I will make every change as a trigger event, then use an condition connector ( check the value change ) to decide the next state to transit to.
|
|
![]() |
Telelogic Rhapsody
» Rhapsody Category » Rhapsody
»
Triggered Operation
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.