LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

need help with Call By Reference on cRIO-9012

I have a RT application running on a cRIO-9012 in which I am attempting to establish references to a variable number of clones of the PID Autotuning (Temperature).vi, and then passing these references to a FOR loop in which I am opening each clone with a Call By Reference node to perform the PID.  Essentially, I am trying to make the PID Autotuning (Temperature).vi accept an array of process variables, similar to the behaviour that some of the simpler PID VIs provide out-of-the-box. 

 

The code I am using to obtain the references is here:

 

STS code 1.png

...and the code within the control loop where I am trying to do the processing is here:

 

STS code 2.png

 

The problem I am encountering, according to the Highlight Execution tool, is that all inputs to the Call By Reference node are present and reach the node, but all processing stops at this point on the first iteration and the cRIO hangs.  I cannot stop the SubVI or the RT parent VI without performing a software restart on the target.

 

I don't know if I am using the Call By Reference node or Open VI Reference functions incorrectly, or if there is a problem with the VI being part of a library, or if something else is wrong.  Any help would be appreciated.

 

Sean

 

0 Kudos
Message 1 of 7
(2,671 Views)

I'm not sure this is your issue, but I think there's a conflict between opening a bunch of rereferences, and then setting the asynchronous call pool size for one of them.You don't need asynchronous execution here, you just need reentrant parallel execution (you may not even need the parallel part; your current code, if it worked, would execute sequentially, and the PID calculation is just math so should be quick and may not benefit from parallel execution). You do need reentrant execution to maintain separate data spaces.

 

Try opening the references with the 0x08 (Prepare for Reentrant Run) flag instead. Remove the Populate Asynchronous Call Pool. If this works, you can run in parallel by enabling For loop parallelism - but you might find that's actually slower, especially on a cRIO.

0 Kudos
Message 2 of 7
(2,659 Views)

Just tried that suggestion.  No change in behaviour.

0 Kudos
Message 3 of 7
(2,654 Views)

How many concurrent loops are you trying to run? Is there some number of loops that can run successfully?

 

Are you doing anything unusual with execution subsystems? I ran into what I thought was a problem with trying to spread execution on a cRIO across multiple execution subsystems, but I never investigated. If I remember correctly the code stopped unexpectedly when different loops were in different subsystems, and ran fine in the same subsystem, and performance was fine so I stopped worrying about it. Anyway the cRIO (at least the one I was using) is a single-core processor, if I'm not mistaken, so there was no particular advantage to trying to encourage parallel processing.

0 Kudos
Message 4 of 7
(2,640 Views)

The cRIO-9012 is a single-core processor, and I am only trying to run the one FOR loop as shown in the posted code.  The PID Autotuning (Temperature).vi I am attempting to call is set to preallocated reentrant clone.

 

0 Kudos
Message 5 of 7
(2,638 Views)

Sorry for lack of clarity - the question I was trying to ask is how many instances of the PID VI you're allocating? Or, how many times would the For loop iterate, if it ran?

 

I assume you've confirmed that no there is no error occurring either at Open VI Reference or at the Call by Reference?

0 Kudos
Message 6 of 7
(2,634 Views)

Post-configuration, the number of clones could be any value from 1 to 16; however, for the purpose of testing, I started with an array containing a single element: one active group, one VI reference, one set of PID parameters etc.  I have verified that the VI reference is non-zero, and that the correct inputs are coming into the FOR loop.  Highlighting execution shows data entering the Call By Reference node, at which point the system hangs.

 

0 Kudos
Message 7 of 7
(2,631 Views)