I represented the system through the blocks, the system created is formed by a container block and the other blocks are components of the block container. Each block has a statechart that during the simulation performs the operations. The goal is to create a LOG block that receives all the names of the states and the possible failures of operations and then write them to a text file. The problem is having so many independent statechart that need to access the LOG block during the simulation. How can I develop it? How can I use synchronization with threads? I could use a function (example:

I don't know a way to do this automatically. Or if this is possible to be done automatically in a painless way.

The only API that I know to "discover" the state of object is the IS_IN macro.

Maybe you could create a macro like "LOG_STATE(<state_name>)", and put it in the begining of every state that you want to log. This macro can call a method in a singleton object to write in the log file. To do this with different threads, the method can use a mutex to ensure mutual exclusion.

This is not very nice because you must manually synchronize the state name and the LOG_STATE call in every state, but is simple.

- I don't know a way to accomplish the state-chart thing you mentioned. There is a way but then you need to adapt the code generation. There is a sample model with a changed CG under the "Samples" Folder in your Rhapsody installation.- The Mutex that you use when you set the GUARDED property is to prevent functions from being called by 2 threads at the same time.When you want to sync threads you can perhaps use events that you send between statecharts.

greetings

Walter

===============================================Who is General Failure and why is he reading my drive?