3

How do you put a computed cluster value into a queue? I modified the "Producer/Consumer Event" design pattern so that the type of the queue is a cluster rather than a string, but I cannot figure out how to get different values into the queue on each iteration of the loop:enter image description here

The cluster constant labeled "This should be dynamic" will eventually be a computed value containing the current time and the value extracted from .NET event argument.

1 Answer 1

5

Instead of using a cluster constant (called 'This should be dynamic' in your picture) use the 'Bundle by Name' element with the 'SlopeEvent' cluster as input. Then you can dynamically update the values of 'Time' and 'Value'. Like So

enter image description here

If you use the 'SlopeEvent' cluster at severla locations in your code it might be a good idea turning it into a TypeDef (right click the cluster>'Make Type Def.' > Open Type Def. > Save in your project folder).

Note: The picture I attached is a VI snippet. Just drag-and-drop it onto your block diagram. That way you don't have to copy code from pictures all the time. This is especially useful for much larger code snippets...

2
  • Not sure if you noticed but there already is a SlopeEvent typedef where the queue is obtained. All OP has to do is ctrl+click & drag that over to the event structure.
    – Dave_St
    Commented Jun 5, 2019 at 15:15
  • Or, instead of ctrl+click & drag, just fork the wire from outside the loop to the Bundle node. No need for two constants of the same default value. But the indicator in the top loop should still be changed to be the typedef.
    – srm
    Commented Jun 5, 2019 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.