LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multiplying a 1D array with a scalar

Hello Everyone,

I'm trying to turn on a back-to-back thyristor by sending a current pulse outputed from the DAQ. The delay of this pulse would depend on the line current. I have a forumla that relates the line current and the delay and that includes fixed values for capacitance and inductance, however, the voltage would vary (some numeric constant).The forumla is as follows:

I = V(w*c-(1/w*L)(1-(2*alpha/pi)-(sin(2*alpha)/pi)); alpha is the delay  in radians, w is the angular  frequency  2*pi*60 rad/s, L and C are my inductor and  capacitor value respectively, V is the varied voltage, and finally I  is the current.
Since V is a constant which can be detected all the time from the DAQ, I thought about desiging an array for the other terms that just depends on alpha which vary from 0 to 90 degrees or 0 to pi/2 radians. I called (w*c-(1/w*L)(1-(2*alpha/pi)-(sin(2*alpha)/pi)) to be F which is an array to have the different values of F for alpha 0 to 90 degrees , after that I want to multiply this 1 D array with V (scalar) to get a current array. I used searh array to compare the whole current array with an element (which would extracted from my circuit and in labview would be tested as a constant). Using the same index for the found current, I want to extract an alpha value from an alpha array.

so basically, I want to multiply F by V to get I, then search through I and compare all the columns by a constant value, and then extract the value of alpha from the same index. I attached my vi, plz help 
0 Kudos
Message 1 of 16
(4,978 Views)
You typically cannot seach a DBL array directly, because it is very unlikely to find an exact match. You need to find a fractional index using threashold array. Then you can get interpolate array to get the value of the fractional index in the other arrays.
 
It is sufficient to calculate the lookup table exactly once, then you can store it in a shift register for later use. Maybe the attached modification can lead you in the right direction (LV8). Let me know if you have questions.
Message 2 of 16
(4,951 Views)
Hello !

I still haven't switched to LV 8, could you repost your VI in LV 7 or post a screen shot image of the diagram please Smiley Surprised ?

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 3 of 16
(4,949 Views)

Sure, here are the guts of the code. The loop on the left creates the lookup table.

entering a current level will calculate the fractional index, then return the corresponding value from the x array. The "current value" output is basically the "current level" input coerced to the valid y-range of the lookup table.

Note that threshold and interpolate do a linear interpolation only. It is also required that the function increases monotonically, if not there will be multiple solutions and it would need extra code to get them all. 😉

Message Edited by altenbach on 02-25-2006 01:00 PM

Message 4 of 16
(4,947 Views)
0 Kudos
Message 5 of 16
(4,943 Views)
0 Kudos
Message 6 of 16
(4,930 Views)
Thank you very much for the help, really appreicate it. The VI you suggested worked perfectly. However, I tried to seperate the while loop and the rest of lookup construction as shown in the pics attached. Even thought the program runs, it doesn't change the delay angle (alpha), the alpha remains at 90 degs all the time. I think there is a misunderstanding in the file (find alpha solution) when I created an indicator and an array with the same name,i.e, current and alpha arrays. I can't fine a way to solve this mystry. I attached the circuit on my previous reply so that it gives you a better of where each subVI is located. Please look into it , and I appreicate ur help. Thanks
0 Kudos
Message 7 of 16
(4,934 Views)

I cannot test your VI because you did not include the subVIs. Please save everything in an llb.

You don't need to place the lookup table generation in a different subVI and wire the two arrays. You can use my solution directly. The lookup table will only be generated the first time the VI is called, just wire the desired inputs and outputs. You can even generate the table at the very beginning, by placing another instance of the subVI before the while loop and discarding the output.

Please get rid of your stacked sequence structure. It servers no purpose because there is complete data dependency. It only clutters the diagram, hides code, and forces backwards wires. This is bad form! 🙂 (Convert it to a flat sequence, then remove the sequence).

Message 8 of 16
(4,922 Views)
Thanks for the reply, I removed the sequence as you suggested but again, the alpha remains at 90 deg although I changed the load type and accordinly the line current has to change and the alpha delay has to change as well . I'm not sure whether I'm missing something. I attached all the subVI I have used. Thanks for the help
0 Kudos
Message 9 of 16
(4,900 Views)
Still missing "calc current magnitude and phase" or similar, called inside "simulate load 2". 😞
0 Kudos
Message 10 of 16
(4,883 Views)