LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Max and Min function

Hello!

 

I am doing an MPPT scanning. I am scanning from DutyCycle 0 to 1 with a step of 0,1. The corresponding voltage,current and power values are inserted to arrays. After DutyCycle 1 I will look after the MPP and the corresponding DutyCycle index and hold that DutyCycle constant.

The problem I have is that the MPP-index is pointing to an empty index in the DutyCycle-array and the the MPP-index is increasing every iteration.

 

I the file " DutyCycle_result.png" I have attached the values I get when running the program. In that very case I want the Pmax Index to be "7".

 

Any ideas what could be source to the problem?

 

I will attach the VI, but I think you will not be able to run it because you need a boost converter. I am using LabView 15.

 

// braxel

 

0 Kudos
Message 1 of 4
(2,447 Views)

There is no problem, the function found a max of 2.58791, which is higher than P[7] = 2.58299.

0 Kudos
Message 2 of 4
(2,439 Views)

Also note that none of your feedback nodes are initialized, that means that they will contain stale data from previous runs of the same LabVIEW session and will grow forever with each run. Is that really what you want?

0 Kudos
Message 3 of 4
(2,415 Views)

I agree with gregoryj.  The problem is not with Max and Min function, as your title suggests.  The problem, apparently, is with your array generation. 

Suggestions/questions:

  • The first while loop on the left can be replace with Ramp Pattern VI.  Use Ctrl+Space to search for it. 
  • Why do you divide the while loop index by 500?  For the first 251 iterations of this while loop, the result of that operation (converted to I16) is zero.  So you are indexing your D-Array with 0 for 251 iterations. Iteration 252 thru 750, the result of this operation is 1.  By the time you have indexed your D-Array for the third value, your P-Array now has 1000 values.  And it keeps growing from there.
  • I am working off your pictures and can't see the entire VI but is there some timing mechanism?  Do you want to run a specific duty cycle for a certain amount of time and then switch to the next value?  How much data do you want to acquire during each step of the cycle?  You should really look at a state machine architecture to organize your code into a readable format. 
aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 4 of 4
(2,411 Views)