VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting VI with event structure into Veristand

This is in response to the results from this thread:

https://forums.ni.com/t5/LabVIEW/Single-numeric-controlled-by-8-Booleans/td-p/3748779

 

 

Every VI with an event structure I've tried to run in veristand will not work correctly. The output never changes from zero, and it causes the target to time out the 2nd try I try to deploy it, or any other project.

 

I made a simpler VI without a case structure and it worked fine.

 

Is there a way to use a case structure in veristand?

0 Kudos
Message 1 of 9
(3,590 Views)

Most of the examples of custom devices included with Veristand have case structures.  You mentioned Event Structures though, and those are definitely special.  Can you clarify which you are trying to get working?

 

 

-Bear

 

Regards,

Ben Johnson
ʕง•ᴥ•ʔง
0 Kudos
Message 2 of 9
(3,560 Views)

To me, the question is, why do you absolutely NEED the event structure?

 

Assuming this ties in with your other posts recently, you could use boolean elements on the VeriStand UI and calculate the value sent to the RS-232 in a calculated channel. Or you could use boolean elements and do the calculation in the custom device, since you have access to its source code anyway.

 

However, If you absolutely need the event you can build a custom workspace element. Those use Events to determine value changes. This is the reason you also get event based behaviour with my first two suggestions. The NI tutorial on custom workspace elements should get you there: http://www.ni.com/tutorial/9989/en/



Remember Cunningham's Law
0 Kudos
Message 3 of 9
(3,548 Views)

So I came up with this and it works, kind of. The problem is that if a user clicks the buttons too fast, before it has time to send the entire message, it can cause problems. Maybe there is a simple way to make all the switch booleans wait until all the rest are 0? I read up on queuing but didn't think that looked like the answer.

0 Kudos
Message 4 of 9
(3,542 Views)

I think it's time to take a step back and think about the solution instead of the problem. What do you want to do?

Can you give a very high-level description of your problem? Something like: I want to enter X on the front panel to communicate to Y via Z. The Data needs to look like...

 

I have the feeling you're overcomplicating things.



Remember Cunningham's Law
0 Kudos
Message 5 of 9
(3,522 Views)

Fair enough, I know more about what I want to do now than when I made the first post.

 

Setup: 8 on/off booleans for inputs, 1 numeric output, 1 boolean output.

 

 

Function:

User toggles one of the bools.

The other 7 bools are disabled from doing anything.

A number is sent to the numeric output corresponding to the bool position.

(Bool 1...8 ON should send 8....15. Bool 1...8 OFF should send 0...7)

100ms delay

Bool output goes ON for 100ms to toggle the serial send command.

1000ms delay (to give veristand time to complete the serial send)

Re enable all the input bools.

 

Can't use event structures, or for/while loops. 

0 Kudos
Message 6 of 9
(3,519 Views)

So, if I understand this correctly, you have 8 boolean controls all set to false at the start. If I

switch 1 on (zero based, so the 2nd one) the output is 9, if I then

switch 3 on the output is 11, if I then

switch 3 off the output is 3, if I then

switch 1 off the output is 0

 

Is that correct?

If so, I think the best way would be to use an event structure and have 1 event handling the value change of all 8 buttons. Then you search an array of the button names for the name of the triggering element and add 8 to the result if the new value is true. In this case, you can also disable all the buttons while you send. Can't give you an example right now, sorry.

 

It should be fairly easy to implement this in the basic custom workspace element template from the link I posted earlier. You're just going to have to use 2 hidden elements for the numeric and boolean outputs.



Remember Cunningham's Law
0 Kudos
Message 7 of 9
(3,515 Views)

These are the commands, it has to perform like I described above.

 

Relay 1 set Off=0 On=8

Relay 2 set Off=1 On=9

Relay 3 set Off=2 On=10

....

Relay 8 set Off=7 On=15

 

 

Again, Veristand doesn't seem to allow event structures to be used. Everytime I have tried to use one, it locks up.

 

0 Kudos
Message 8 of 9
(3,513 Views)

I described exactly that, but without the one-based vs. zero-based confusion. In my example, relays were numbered 0..7.

 

Did you take a look at my link? The event structure is the central element in a custom workspace element, so what happens when you do it like this? Could you please post snippets or at least screen shots? I don't have LabVIEW 2017 installed.



Remember Cunningham's Law
0 Kudos
Message 9 of 9
(3,509 Views)