From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with MPPT algorithm VI

Part of my final project would be to create a high level design of a PV system. This would involve a model of a solar cell, a maximum power point tracking (MPPT) algorithm, and a DC-DC converter. For the MPPT part, I have created a VI that is based on the incremental conductance algorithm. I have attached a flowchart of the algorithm for reference. Now for the algorithm I used multiple case structures to implement the branching in the flowchart. The algorithm should decide whether to increment or decrement the duty cycle (d) that will be fed to the DC-DC converter.

 

The initial value of the duty cycle (marked as "initial d") is fed to a shift register. This value passes through multiple case structures, and is incremented or decremented, and is supposed to go to the other shift register at the end. The problem is that whenever the VI runs and goes through the algorithm, I noticed that the updated duty cycle does not pass through a wire where its supposed to go to the other shift register (marked with a circle in attached pic of block diagram).

 

Can anyone help me with this?

 

Thanks in advance.

 

 

 

Download All
0 Kudos
Message 1 of 9
(5,112 Views)

Hello Spectre,

 

I ran your VI in highlighted execution with the step through button and a value did pass through that wire. I don’t know what are the initial values you’re using, but maybe you can try running it exactly like that and check if it is really nothing passing through that wire and if so, why.

 

Best Regards,

0 Kudos
Message 2 of 9
(5,099 Views)

Hi! Sorry for the late reply. A value did pass through that wire. But another problem came up. I used the MPPT VI as a subVI, and it cannot seem to output "d". I'm not sure but my VI cannot seem to pass values out of the for loop. I have attached the updated VI. I placed "d" outside the for loop.

 

Thanks,

0 Kudos
Message 3 of 9
(5,054 Views)

Are you trying to get intermediate values of d, that is, the value of d on each iteration of the loop? SubVIs do not return any data until they stop running. The only value of d you get is the one that is on the shift register when the loop stops.

 

To run this as a subVI you probably do not want the stop button. You need to define a condition on the data (such as the change in d is less than 0.01) and stop when that condition is met. If you want to do something in the calling program for every value of d, then you need to set the loop up to run only one iteration each time the subVI is called.

 

Also it is generally not a good idea to use equality comparisons on floating points numbers because of the way data is represented in the computer. A better way is to test to see if the values are within some tolerance or ragne of each other.  Look at the In Range and Coerce function.

 

Lynn

Message 4 of 9
(5,044 Views)

Thanks for answering! I'd like the MPPT VI to output every value of d, but as you said the MPPT VI does not output anything until they stop running. Can I do this by replacing the while loop with an event structure?

0 Kudos
Message 5 of 9
(5,019 Views)

No.  You do not want an event structure in a subVI because subVIs normally run with their front panels closed and the event structure would wait forever for front panel input.

 

You should probably do one of two things.  Since I have not seen your complete program it is difficult to tell which might be better.  One way is to remove the loop completely from the subVI. Just do one calculation and end the VI, which returns the value of d.  The other way is to make a loop which only iterates one time before ending.  Use a while loop with True wired to the stop terminal. This also returns each value of d. The choice comes down to whether you need feedback from previous calculations and whether you want to keep that feedback inside the subVI or handle it in the outer loop.

 

Lynn

Message 6 of 9
(5,014 Views)

The VI needs the previous values of d, since it adds or subtracts 0.5 from d for every iteration. If I just wire True to the stop terminal, the VI does not keep the previous values of d. This VI is supposed to receive two sets of array data, which is then fed to this VI's while loop. This VI is just a part of a larger program, which I'm attaching. You'll see that I haven't started modeling the buck converter VI though, so it's just there to receive values of d.

 

I'll try to rework this VI so that it won't use a while loop.

 

Thanks for the answers

0 Kudos
Message 7 of 9
(5,005 Views)

You need to change to an unitialized shift register.  That will "remember" the data between successive calls. You can use the First Call? primitive to initialize the shift register inside the loop.

 

You also need to feed your V_new and I_new data in one value at a time because the loop only runs one iteration each time the subVI is called.

 

I modified your VI to get you started.  You may also need to make changes in the buck converter VI if the data is not available as an array.  I used arbitrary functions just to generate some data so that I could see that the VIs work.  I do not know if they perform the calculations correctly.

 

You may need to put in some test for divide by zero.  If V_new is zero or two successive values of V_new are identical you divide by zero.  This does not crash LV but may affect your results.

 

Lynn

Download All
Message 8 of 9
(5,001 Views)

Greetings ! , May I have the Boast Converter VI.


@SPECTRE wrote:

Part of my final project would be to create a high level design of a PV system. This would involve a model of a solar cell, a maximum power point tracking (MPPT) algorithm, and a DC-DC converter. For the MPPT part, I have created a VI that is based on the incremental conductance algorithm. I have attached a flowchart of the algorithm for reference. Now for the algorithm I used multiple case structures to implement the branching in the flowchart. The algorithm should decide whether to increment or decrement the duty cycle (d) that will be fed to the DC-DC converter.

 

The initial value of the duty cycle (marked as "initial d") is fed to a shift register. This value passes through multiple case structures, and is incremented or decremented, and is supposed to go to the other shift register at the end. The problem is that whenever the VI runs and goes through the algorithm, I noticed that the updated duty cycle does not pass through a wire where its supposed to go to the other shift register (marked with a circle in attached pic of block diagram).

 

Can anyone help me with this?

 

Thanks in advance.

 

 

 



@SPECTRE wrote:

Part of my final project would be to create a high level design of a PV system. This would involve a model of a solar cell, a maximum power point tracking (MPPT) algorithm, and a DC-DC converter. For the MPPT part, I have created a VI that is based on the incremental conductance algorithm. I have attached a flowchart of the algorithm for reference. Now for the algorithm I used multiple case structures to implement the branching in the flowchart. The algorithm should decide whether to increment or decrement the duty cycle (d) that will be fed to the DC-DC converter.

 

The initial value of the duty cycle (marked as "initial d") is fed to a shift register. This value passes through multiple case structures, and is incremented or decremented, and is supposed to go to the other shift register at the end. The problem is that whenever the VI runs and goes through the algorithm, I noticed that the updated duty cycle does not pass through a wire where its supposed to go to the other shift register (marked with a circle in attached pic of block diagram).

 

Can anyone help me with this?

 

Thanks in advance.

 

 

 


 

0 Kudos
Message 9 of 9
(2,879 Views)