How do I create an PV system in Simulink?
9 次查看(过去 30 天)
显示 更早的评论
I'm quite new to simulink and I've been trying to get a PV system in simulink running for a few days now and I keep running into a multitude of errors. The most recent error that I have been unable to fix is:
An error occurred while running the simulation and the simulation was terminated
Caused by:
- Solver encountered an error while simulating model 'untitled1' at time 0 and cannot continue. Please check the model for errors.
- Solver could not solve the system of algebraic equations because a singular iteration matrix was encountered. Consider providing more accurate initial conditions. If the problem persists, check the model structure and values of parameters.
Here is the code inside the PandO block:
function D = PandO(Vpv,Ipv)
%#codegen
% ************************************************************
% MATLAB implementation of a Perturb and Observe algorithm
% for Maximum Power Point Tracking. This algorithm is designed
% to operate with a buck converter
%
% Created by: Carlos Osorio
% ************************************************************
% Define internal values for the voltage and power as persistent
% variables
persistent Dprev Pprev Vprev
% Initialize the internal values for the voltage and power on the
% first pass
if isempty(Dprev)
Dprev = 0.7;
Vprev = 190;
Pprev = 1000;
end
% Initialize algorithm parameters
deltaD = 0.025;
% Calculate measured array power
Ppv = Vpv*Ipv;
% Increase or decrease duty cycle based on conditions
if (Ppv-Pprev) ~= 0
if (Ppv-Pprev) > 0
if (Vpv-Vprev) > 0
D = Dprev - deltaD;
else
D = Dprev + deltaD;
end
else
if (Vpv-Vprev) > 0
D = Dprev + deltaD;
else
D = Dprev - deltaD;
end
end
else
D = Dprev;
end
% Update internal values
Dprev = D;
Vprev = Vpv;
Pprev = Ppv;
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/207458/image.png)
I've also attached a picture of the full simulink model. Just hoping to get some help with this as I've been struggling for a while now. Are there any glaring problems?
1 个评论
Arvind Sathyanarayanan
2019-3-8
编辑:Arvind Sathyanarayanan
2019-3-8
Try adding a ground block to your system and also try moving the the sovler configuration to power system domain maybe negative terminal of the the PV array.
It would be helpful if you could attach the model (in 2017b as I dont have 2018b).
回答(1 个)
Joel Van Sickel
2020-8-24
Hello Johanna,
as mentioned by Arvind, please at an electrical reference block. Also, you are putting a duty cycle into your converter. Make sure that the converter is set to average. Your location of solver configuration will work as is.
Here is a basic example of using the solar cell: https://www.mathworks.com/help/physmod/sps/examples/solar-cell-power-curve.html
Regards,
Joel
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!