From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reverse engineering a VI

Solved!
Go to solution

Hello,

 

   Please check out the attached VI. I've inherited code from a previous engineer and I'm trying to wrap my head around how this particular VI works. I appreciate it!

 

 

Jay

 

 

0 Kudos
Message 1 of 13
(2,199 Views)

You did not attach your typedefs, but you have a cluster of two enums, each with four choices. Two bits are sufficient to describe four states, so you create an output array with four bits to fully describe the state of the two enums.

You can look at the help for any of the primitives. Let us know if anything is not clear..

Message 2 of 13
(2,123 Views)

Without the VIT Config cluster i can't tell you exactly what it does, but assuming that Voltage is in volts and Current is in amperes then what you are doing here is you convert an 8 bit number to boolean array, negate it and then take the first two values of boolean array.

 

So it basically ignores values less than 64 (so 64V or 64A) and then writes two most significant digits negated to DAQ.

 

EDIT: It'd also help to know what this controls, because right now i can't really imagine what you would control like this.

 

 

Message 3 of 13
(2,082 Views)

Hello,

 

   Thanks for the replies! I've attached the .ctl files that go with this.

 

So this VI sets the voltage and current range to be sensed and measured. Rather than having enum drop-down windows to select the ranges, I'm attempting to allow the user to just type in the what voltage and current the device under test requires, then the ranges automatically get set without needing to be selected.

 

I'm not sure what the best approach to this would be. Maybe tie the enums into a case structure? Although I believe the VIT may need the binary settings to be written to it all at once.

 

Any suggestions would be appreciated!

 

Jay

 

 

Download All
0 Kudos
Message 4 of 13
(2,065 Views)

@JayWW wrote:

So this VI sets the voltage and current range to be sensed and measured. Rather than having enum drop-down windows to select the ranges, I'm attempting to allow the user to just type in the what voltage and current the device under test requires, then the ranges automatically get set without needing to be selected.


What I have done for this is use the Threshold 1D Array with the desired range and an array of available ranges.  You can use Round To +Infinity To then use Index Array on the available ranges to get the actual range to use.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 13
(2,052 Views)

@crossrulz wrote:

@JayWW wrote:

So this VI sets the voltage and current range to be sensed and measured. Rather than having enum drop-down windows to select the ranges, I'm attempting to allow the user to just type in the what voltage and current the device under test requires, then the ranges automatically get set without needing to be selected.


What I have done for this is use the Threshold 1D Array with the desired range and an array of available ranges.  You can use Round To +Infinity To then use Index Array on the available ranges to get the actual range to use.


 

How would I interface this with the needed binary output to properly communicate what range to set the VIT?

 

Thanks,

Jay

0 Kudos
Message 6 of 13
(2,039 Views)
Solution
Accepted by JayWW

@JayWW wrote:

How would I interface this with the needed binary output to properly communicate what range to set the VIT?


Instead of indexing the original array, index another lookup table.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 7 of 13
(2,032 Views)
LVedit.PNG
@crossrulz wrote:

@JayWW wrote:

How would I interface this with the needed binary output to properly communicate what range to set the VIT?


Instead of indexing the original array, index another lookup table.


What kind of array is the circled icon? It doesn't look familiar.

 

Thanks,

Jay

0 Kudos
Message 8 of 13
(2,000 Views)

Hi Jay,

 

it's still an IndexArray function…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 13
(1,991 Views)

@JayWW wrote:

What kind of array is the circled icon? It doesn't look familiar.


 

"index array". It looks different because the input is a 2D array, requiring two inputs for the index. The primitive automatically adapts to the wired input.

Message 10 of 13
(1,987 Views)