LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Concurrent statecharts

I'm having a weird output from statechart calls inside a parallel loop. I'm taking the instance name and comparing to the input passed to statechart.

 

The output matches with the loop Id but doesn't match with the input and the iteration index.

 

Clipboard01.png

 

 

The Calling VI is reentrant so I didn't expect this behaviour.

 

I used a synchronization scheme to avoid a dead lock in the parallel loop. This statechart has just one state to pass the name to the output.

 

Statechart.png

0 Kudos
Message 1 of 5
(2,746 Views)

How does the second part of the code ever run.  You have an infinite while loop to start your code with the False constant wired to the stop terminal.

0 Kudos
Message 2 of 5
(2,737 Views)

It runs because they are parallel.

 

But I could handle the issue with the output. I was using the entry action section to set the output of the statechart instead of use a static section.

 

Now I'm having another problem and this time I'm really worry about it. The same behaviour is happening now in the active state output, and it is handled directly by Labview.

 

I did a small chance to get the active state. The statechart now has five states (1,2,3,4,5). One state is activate for each chart name. But the state output is coupled with the loop Id.

 

 

Statechart.png

 

Clipboard02.png

0 Kudos
Message 3 of 5
(2,725 Views)

I'm sorry.  You're correct.

 

The way it was drawn side by side, and it was looking like the wire was coming out of a loop to go to the second.

 

Now paying closer attention, I see the source of those wires are outside of both loops.

0 Kudos
Message 4 of 5
(2,721 Views)

I'm thinking the Calling VI reentrancy is binded with the thread Id not to the Instance Name of the statechart. I won't get this working.

 

But I still need to run several statechart instances at the same time. Does anyone have any idea how to do this?

0 Kudos
Message 5 of 5
(2,714 Views)