08-26-2024 08:08 AM
Here is what ChatGPT made for python, you can call a python node in labview, or try and reproduce this code with labVIEW
08-27-2024 07:05 AM
@UnholyPenguin wrote:
Here is what ChatGPT made for python, you can call a python node in labview, or try and reproduce this code with labVIEW
I suggest to test if that code produces the expected output...
08-27-2024 07:38 AM - edited 08-27-2024 07:42 AM
@mrdas9820 wrote:
Hello prof,
The blue squares are just to make it easier to group the steps, it is not for code function.
it looks like you want to use a sequence instead of blue squares... use it so that the local variables are written properly
I don't understand why you use the z*, it looks like you are guessing...
@mrdas9820 wrote:
For this for loop, I am still confused. How is the formula converted into a block diagram?
identify the input variables you already have
e.g. Yᵢᵢ, which is an array and it looks like you already have Yᵢⱼ but it is named "ADMITTANCE (yji)"
you have to clearify your name-ing, otherwise this is a waste of time...
10-03-2024 05:33 AM - edited 10-03-2024 05:34 AM
Please help me to convert this matlab code into block diagram in LabVIEW:
10-03-2024 07:25 AM - edited 10-03-2024 07:32 AM
@mrdas9820 wrote:
Please help me to convert this matlab code into block diagram in LabVIEW:
iter=0;maxerror=10;while maxerror >= accuracy & iter <= maxiteriter=iter+1;for n = 1:nbus;YV = 0+j*0;for L = 1:nbr;if nl(L) == n, k=nr(L);YV = YV + Ybus(n,k)*V(k);elseif nr(L) == n, k=nl(L);YV = YV + Ybus(n,k)*V(k);endendSc = conj(V(n))*(Ybus(n,n)*V(n) + YV) ;Sc = conj(Sc);DP(n) = P(n) - real(Sc);DQ(n) = Q(n) - imag(Sc);if kb(n) == 1S(n) =Sc; P(n) = real(Sc); Q(n) = imag(Sc); DP(n) =0; DQ(n)=0;Vc(n) = V(n);elseif kb(n) == 2Q(n) = imag(Sc); S(n) = P(n) + j*Q(n);if Qmax(n) ~= 0Qgc = Q(n)*basemva + Qd(n) - Qsh(n);if abs(DQ(n)) <= .005 & iter >= 10 % After 10 iterationsif DV(n) <= 0.045 % the Mvar of generator buses areif Qgc < Qmin(n), % tested. If not within limits Vm(n)Vm(n) = Vm(n) + 0.005; % is changed in steps of 0.005 puDV(n) = DV(n)+.005; % up to .05 pu in order to bringelseif Qgc > Qmax(n), % the generator Mvar within theVm(n) = Vm(n) - 0.005; % specified limits.DV(n)=DV(n)+.005; endelse, endelse,endelse,endendif kb(n) ~= 1Vc(n) = (conj(S(n))/conj(V(n)) - YV )/ Ybus(n,n);else, endif kb(n) == 0V(n) = V(n) + accel*(Vc(n)-V(n));elseif kb(n) == 2VcI = imag(Vc(n));VcR = sqrt(Vm(n)^2 - VcI^2);Vc(n) = VcR + j*VcI;V(n) = V(n) + accel*(Vc(n) -V(n));endendmaxerror=max( max(abs(real(DP))), max(abs(imag(DQ))) );if iter == maxiter & maxerror > accuracyfprintf('\nWARNING: Iterative solution did not converged after ')fprintf('%g', iter), fprintf(' iterations.\n\n')fprintf('Press Enter to terminate the iterations and print the results \n')converge = 0; pause, else, endend
Moving to MATLAB Script Nodes from MathScript Nodes in LabVIEW – Benchmark Examples - NI Community