LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Mini state machines for each aspect of cRIO. Is this software design overly complex? /

Solved!
Go to solution

In my current FPGA setup, I subVIs that rely on shift nodes to tell to make a mini state machine for each of the NI cards. (This prevents me from having to use sequence structures).

 

This way, I am able to turn on/off any of my parallel loops for my state machine, and I can easily copy/paste for any additional AI/AO or DI/DO on the card. and it will run in parralel.

 

For the cRIO real-time, I was planning on creating TCP connections in while loops for each input and output.

For the RTD sensor for example, one port at 4000 to receive temperature adjustment commands and then ports 4001,4002,4003,4004 for RTD0-4.

 

This would allow be to control the cRIO with anything, .NET, web-client, as long as I can access these TCP connections.

 

Is this overly complex? Is there a better way to do this with less TCP Connections?

0 Kudos
Message 1 of 4
(259 Views)
Solution
Accepted by topic author eli.barber

@eli.barber wrote:

In my current FPGA setup, I subVIs that rely on shift nodes to tell to make a mini state machine for each of the NI cards. (This prevents me from having to use sequence structures).

 

This way, I am able to turn on/off any of my parallel loops for my state machine, and I can easily copy/paste for any additional AI/AO or DI/DO on the card. and it will run in parralel.

 

Is this overly complex? Is there a better way to do this with less TCP Connections?


In my opinion (not having seen your code), the answer to the final question is "Yes, Sequence Structures are a "better way" for FPGA".

 

After a decade or two of "regular" LabVIEW, I got my first exposure to programming an FPGA in a RIO, which taught me to appreciate Sequence Structures in FPGA code.  They serve to "isolate" sections of code and allow the FPGA to "be an FPGA" and run maximally concurrently.

 

Bob "If It Ain't Broke, Don't Fix It." Schor

 

 

Message 2 of 4
(185 Views)

Let me ask you this,

 

How would you transfer data from a state machine, to faster running parallel loops?

 

The state machine loop, (Top loop), transfers data to data acquisition loops running in parallel. it simple adjusts the controls that are in each of the acquisition/control loops.

0 Kudos
Message 3 of 4
(152 Views)
Solution
Accepted by topic author eli.barber

@eli.barber wrote:

How would you transfer data from a state machine, to faster running parallel loops?

 

The state machine loop, (Top loop), transfers data to data acquisition loops running in parallel. it simple adjusts the controls that are in each of the acquisition/control loops.


I can't open your LabVIEW 2024 vi as I am running LabVIEW 2021 (and 2019).  The general question of how to transfer data to a parallel loop is via the Producer/Consumer Design Pattern.  The State Machine (the "Producer") produces data, typically an array of values, which you "export" from the State Machine (and its enclosing While Loop) via a Queue or (in my case) a Stream Channel Wire to another parallel Loop (the "Consumer) that accepts the incoming data and processes it.  As long as the average rate of the Consumer is greater than the average rate of the Producer, and there is some "expansion" capability in the Queue or Channel Wire, this works like a charm.

 

Bob Schor

0 Kudos
Message 4 of 4
(146 Views)