05-19-2011 08:31 AM
Hi all,
I'm trying to create a program that can use math scipts, formulas etc on waveforms. I've done it for one signal, but I don't know how to change work on 2 or more signals;/ Let's see exampe: one channel is voltage, the second is current and I want to see both of them and as a third signal power so I'm writting formula ch3=ch1*ch2. Another example: I've signal which represents speed of starting motor (500 points) but I need only few points so the formula will be: ch1(20:120) and I have points from 20 to 120. Is it possible to do it? I can't do it using blocks cause I don't know which signal means what... so ch1 can be voltage, ch2 speed, ch3 current ch4-torqu etc. I know that I can cut a part of signal by subarray or subwaveform but it must be done by formula to use (for example) something like that:
ch1(1:20)=0 <- replace all point from 1 to 20 of ch1 by 0
ch2(50)=40 <-replace point 50 of ch2 by 40
ch3=ch1*2 + ch2 <- do this operation but first do both above this one.
Is it possible? or it's to complicated?
I attached my vi which is working for one selected signal (I don't want to select it... but I don't know how to do it;/) and signal that I'm using to check how it's work
Thanks
Mike
05-19-2011 01:00 PM
I've upgraded it a little and it works with 2 signals but very sensible;/ formula must have this construction: c3= ... , both of signals must be switched on, there's no way to use part of signal (e.g.c1(21:54) ) and I can't use 2 rows (something like this: c3=c1*c2; c3=c1 doesn't work);/ additionally I wanted to have possibility to use all of signals as input and all of them as output
05-19-2011 04:56 PM
edit:
I forget to save vi for previous version
Now I attached my vi for LV 8.6, and I hope now someone can help me:)
05-19-2011 07:01 PM
Your small express VI that converts the blue dynamic datatype wire is wrong. You have it set to convert to a single waveform, thus the reason you are only getting one waveform. Change it to be a 1-D array of waveforms. Now you can use index array to get at each waveform individuallyk.
05-20-2011 08:31 AM
@Ravens Fan wrote:
Your small express VI that converts the blue dynamic datatype wire is wrong. You have it set to convert to a single waveform, thus the reason you are only getting one waveform. Change it to be a 1-D array of waveforms. Now you can use index array to get at each waveform individuallyk.
Yes, but when I change it I can't connect it to "Get Waveform Components" ;/ this problem is just addition to my general problem - how to make formula more advanced etc - my first post in this topic
05-20-2011 08:41 AM
Because then you have an array. As I said, you need to use index array to get each individual waveform out of the array. Then you can use Get waveform components on the output from the Index array function.