LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

else if error in code

Solved!
Go to solution

hi

 

i want to make 7-level quantized waveform by referancing 50Hz sinusoidal signal. i have three angles (angle1, angle2, angle3). and the principle for obtaing wave is attached in picture. 

for

 

0 to angle 1=0

 

angle 1 to angle 2=+1v

 

angle 2 to angle 3=+2v

 

angle 3 to (180-angle 3)=+3v

.

.

.

the states of S1,S2,S3 ...S12 are going to mosfet switches for making desired waveform 

 how i make program and do coding for this application.kindly help me i will be highly thankful.

 

with best regards

mudasir

 

 

 

.

.

.

 

 

 

 

 

Download All
0 Kudos
Message 1 of 12
(4,186 Views)
Solution
Accepted by topic author mudasir11

Hi mudasir,

 

attaching a VI is much more helpful than several images - we cannot debug images!

 

I see several solutions:

- you could use a sine function, scale the sin(angle) value and round to nearest multiple of V

- you could use one (1) case structure with several cases (using ranges like 0…angle1-1, angle1…angle2-1) and output the correct value

 

In general: get rid of the formula node…

Btw. LabVIEW has a "In range and coerce" function. It would greatly help to brush up your VI!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 12
(4,109 Views)

thank you so much sir for your kind reply. i am attaching here the project and code file. kindly debugg it sir, i will be highly thankful to yoou sir for this act of kindness. 

 

with best regards

mudasir ahmed

Download All
0 Kudos
Message 3 of 12
(4,071 Views)

Dear Sir,

 

here i am attaching the whole circuit in co-simulation mode. my circuit is in multisim file and their control is in labview. i have successfully built this logic in simulink but face little bit difficult in labview. i think the main problem lies in data types and their initialization. my circuit accept every time new patterns of angles and switch the transistor states accordingly. kindly help me sir. i have to first simulate this circuit using co simulation mode then have to implement it by using GPIC (general purpose inverter controller) which is the next step for me. but i am stuck in first step 😞 kindly help me sir 🙂

 

with best regards

mudasir ahmed

Download All
0 Kudos
Message 4 of 12
(4,049 Views)

Hi mudasir,

 

try something like this:

check.png

The first array functions determines the angle range, the IndexArray indexes the S values for that range.

 

Please learn the LabVIEW basics!

- Avoid local variables as they easily create race conditions!

- It makes no sense to read the value from a control and write it into the local variable of that control!

- It makes no sense to create arrays (your "D" values and then work with scalars in your formula node…

Again: learn the basics!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 12
(4,019 Views)

Dear Sir,

 

Thank you so much for your kind suggestions and i will definatly learn and will grip labview programming . at this stage, i modify same program and do all decisions in formula node although it is not look like a professional programming as i am learner. kindly sir, suggest me where i did mistake or the whole logic and program is wrong, as i implement same previous AND gate based logic in simulink and it works. If this program is not look like professional program but coorect in achieving desired objectives but have little mistakes then kindly sir pin-point these.

 

with best regards

mudasir ahmed

Download All
0 Kudos
Message 6 of 12
(4,002 Views)

Hi mudasir,

 

the error message you get when trying to start your VI is quite correct: "formula node: array indexing expected"!

 

As I wrote before you wire your phase array to the "degree" input of the formula node, but in the node you use a scalar "degree".

Either wire a scalar to the node input or get an array element inside the node…

 

The LabVIEW help also explains the formula node syntax and commands!

 

And again: what's the point in using local variables when you could use a wire instead?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 12
(3,979 Views)

Dear Sir,

 

It means the block of (extract single tone) take the phase(degrees) of  sinoidal wave form and combine the information in the form of array and sent it to formula node via degree input pin. i thought, at every instant this block measure degree(scalar) and send it to formula node for comparison. sir, for making data (degree) scalar what should i do. means every time any device or block contionously measure phase of waveform and send it formula node for comparison one by one. sir, i also delet variable logic and connect it through wires. really thanks sir for your guidance and help. 

 

with best regards

mudasir ahmed

0 Kudos
Message 8 of 12
(3,961 Views)

Dear sir,

 

it means there is no way to get degree in scalar format and send sequentially for comparison. okay sir i will learn arrays how to handle it. 

 

with best regards

mudasir ahmed

0 Kudos
Message 9 of 12
(3,914 Views)

Hi mudasir,

 

there is a way and it is quite obvious once you learned how to handle arrays with LabVIEW…

 

(Hint: there is a palette full of array functions and something called "autoindexing"!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 12
(3,901 Views)