取消
顯示結果 
搜尋替代 
您的意思是: 

Reverse engineering a VI

已解決!
前往解決方案

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 積分
1 條訊息(共 13 條)
3,771 檢視

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..

2 條訊息(共 13 條)
3,695 檢視

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.

 

 

3 條訊息(共 13 條)
3,654 檢視

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

 

 

下載全部
0 積分
4 條訊息(共 13 條)
3,637 檢視

@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.



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
5 條訊息(共 13 條)
3,624 檢視

@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 積分
6 條訊息(共 13 條)
3,611 檢視
解決方案
接受者 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.



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
7 條訊息(共 13 條)
3,604 檢視
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 積分
8 條訊息(共 13 條)
3,572 檢視

Hi Jay,

 

it's still an IndexArray function…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
9 條訊息(共 13 條)
3,563 檢視

@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.

10 條訊息(共 13 條)
3,559 檢視