11-11-2009 08:17 AM - edited 11-11-2009 08:20 AM
Can I call a case in an eventstructure via the value change of a LED?
The reason for this is the following:
In my VI is a xy graph and the update of the dispaly and the x-scale takes a lot of time, so I would like to do the update outside of my main-loop to avoid that other processes get delayed. The attached VI is just an example.
(In my real VI, I have a consumer and producer loop and lots of data processing, so in that case the disply update should not interrupt the data processing.)
I tried to put the x-scale update in the event structure and call the event structure via the change of a boolean value, but that does not work. The event is not recognised and the x-scale does not change.
Johannes
LabVIEW 7.1
11-11-2009 08:30 AM
You can use Value (Signaling) property of your Update boolean at the lower loop. Instead of writing straight to terminal use this property.
Also,
You must really consider cleaning up your block diagram.
1. Maintain straight wires as much as possible.
2. Reduce local variables
3. Follow left-right allignment- Its better to wire to a structure at left border of the structure
11-11-2009 08:39 AM
11-11-2009 08:58 AM
Antoher way would be to create and generate a User Event. If you want to know more about it just search in the Example Finder.
Christian
11-11-2009 10:17 AM
Thank you for the answers.
@Vsh:
1. and 3.: Better like this?
2. How can I overgive a value to an event structure if the terminal of that value is already used somewhere else in the VI?
@ Tim:
Al right, yes it works! Thank you!
11-11-2009 11:54 AM
Hi Johannes,
some more notes on your code:
- there's a function that computes Sin&Cos in one block
- you can resize "index array" to output more than one element
- try to minimize type coercions, this will help a lot as soon as you work on bigger arrays
11-11-2009 12:00 PM
Hello Gerd,
I don't understand. What do you mean by "resize index array"?
What type coercions should I mimimize? The coercions " array <--> cluster " etc.? But they are necessary...
11-11-2009 12:16 PM - edited 11-11-2009 12:19 PM
Hi Johannes,
- some (array) functions are resizable, like "index array". Move the mouse over the lower border of the function and you can resize it to have more outputs. Read the context help for the function!
- type coercions: whenever you have that small grey dot on a function input (I prefer to change that color setting to RED) LabView has to change the datatype. Look at the Q&R function in the lower part: one input is DBL, the other is INT. One input of !&R has a grey dot as the function needs both inputs in the same datatype... Or the grey dots at the wait function... Type coercions can become a major performance hit when occuring on arrays! Try searching the labview help for "coercion"
11-11-2009 12:42 PM
I really don't understand why it has to be a parallel event structure. Why don't you just place the code of the event structure in a case structure in the main loop connected to the boolean. Keep the FALSE case empty and you get the same effect without jumping through flaming hoops. 😉
Overall, you biggest bottleneck, and possible performance issue, is you constant memory allocations of complicated data structures with delete from array and insert into array. Any array resizing operation is expensive. You should keep the array at a fixed size and operate in place.
As others have said, many of your operations are very convoluted and inefficient. I'll have a look....
11-11-2009 02:06 PM - edited 11-11-2009 02:06 PM
johanneshoer wrote:I don't understand. What do you mean by "resize index array"?
Here's one example. Your code is on the left and uses two "index array" nodes. All you need is one, configured for two outputs.
Also, of you want consecutive indices, starting at zero, you don't need to wire the index inputs.
An alternative is shown on the right.