Adding MatLab script into Labview process

Posted on March 10, 2012

0


Long time passed from my last post. Both Work and the last year B.Sc dagree occupy my time .

This semester me and my colleague started to work on our final project. One of our first golas was to immulate a MPPT alogarithm using labview.The problem was that during that time ,our MPPT had no physical inputs yet. So we found ourselfs trying to immulate inputs using Labview and Matlab.

Stage One, Matlab

We started writing a very basic MPPT code according to several IEEE articles that dealt that issue. The final code looks like that:

% default initial values
i1=20*rand(1)
v1=20*rand(1)
p1=v1*i1
% voltage and current from pv array
p2=v2*i2
% in real project it would get information from NI hardware
% checking p(t)>p(t-1)
if p2>p1
if i2>i1
x=1
if i2<i1
x=0
elseif i2==i1
end
end
end
% opened new if loop for simplicity
if p2<p1
if i2>i1
x=0
if i2<i1
x=1
elseif i2==i1
end
end
end

It’s a very stright forward code in order to prevent future problems.

Stage Two, the Labview integration

We looked for a good way to run our Matlab code via Labview. One of the alternatives that draw our attention was the Matlab Script function. At start we found it very tricky to initate Matlab code in Labview since we got errors regarding variables and constants definitions and also input and outputs connection problems when using the function.

We found, for instance, that when usinge the function, closing both Matlab and Labview is necessary. Only then, open Matlab first and Labview second. also you have to define clearly your inputs and outputs in low case letter because otherwise the script won’t run.

תמונה

Posted in: Electronic