LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

simple state machine Where to begin?

Hello

 

Got a question that is simple for the experienced people here I guess. But don't know where to start..... Here is what I want to try to do:

 

I have got a lot of inputs, to keep the question simple I have only drawn a few of them but eventually there will be tens of inputs. For now I will only use the front panel and no real IO box (hardware), just to see if I can make a State machine that can handle this "problem" in a organized / proper way.

 

What I want is to do is read a sensor, for example sensor B1 and multiply it with the multiplication factor (column Process input) and show the result on the front panel.

 

There will be different types of sensors, some need multiplication, others sensors need just a constant be added to the input before the result is shown in the Result column etc.Of every sensor there will be a lot, so just wiring them all in one place will create chaos, and I don't like chaos (only dr chaos in South park is fun but I would not have him in my labview code either).

 

Can anyone tell me how to approach this "problem" ?

 

Thank you for the advice!!

 

SM_question.jpg

 

 

 

 

 

 

 

0 Kudos
Message 1 of 4
(2,639 Views)

Well, this does not really sound like a state machine, a simple polling loop is probably sufficient.

 

Use an array of booleans for the selector and for the status LEDs. Use a 1D array for the inputs, then multiply it with a 1D array of equal size containing all multipliers (element is 1 if not needed), and add another array for the offset to be added (element is 0 if not needed). The result will be an array of scaled outputs.

 

If you need more inputs, all you need is resize the arrays.

 

Repeat the loop at the desired sampling rate.

0 Kudos
Message 2 of 4
(2,630 Views)

Hello

0 Kudos
Message 3 of 4
(2,592 Views)

You can make an array of Cluster, with the cluster containing the needed info for the sensors, such as:

Name:string

Type:enum

Scaling:double

Offset:double

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 4
(2,559 Views)