VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

niveristand-python: Use a ChannelReference as parameter

Hello all,

 

I am currently working on a project using NI VeriStand 2021 R2, doing some RT measurements using niveristand-python.

The task is to measure the on-duration of several analog input channels of a PXI system.

 

To make my code reusable I am searching for a way to set the input channel as a parameter of the function that is calculating the on-duration.

As far as I understand, I would need to set a ChannelReference as a parameter...By now I was not sucessfull.

 

Does anyone have some suggestions for this?

 

 

Thank you!

 

PS: attached is some example python code that is working but using a fixed channel

0 Kudos
Message 1 of 5
(986 Views)

If you want to reuse the python script on different VeriStand projects, you should configure all those VeriStand projects to have the same channels name.

0 Kudos
Message 2 of 5
(963 Views)

Well, ok...

 

But how can I handle different channels in the same VeriStand project without hard-coding them into the python module?

Any ideas?

 

Thank you.

0 Kudos
Message 3 of 5
(958 Views)

You can use the user channels. Hard code the user channel name in the python script, then change the mapping in VeriStand project as needed.

0 Kudos
Message 4 of 5
(953 Views)

Thank you @ZYOng for your reply.

 

I know I can also go with the user channels. But hard coding is not the solution I am looking for.

However, it seems there is no other way for handling this problem.

0 Kudos
Message 5 of 5
(914 Views)