How to incorporate disturbances via scripts in MATLAB using a Model Predictive Controller.
Show older comments
I have the code mentioned here, and I want to assign `u(4)` and `u(5)` to the measured disturbances (MD) in the same way that `u(1)`, `u(2)`, and `u(3)` were assigned to the manipulated variables (MV). However, I am encountering an error with the MD assignment. What could be the reason for this?
Code:
nlobj = nlmpc(3,2,'MV',[1 2 3],'MD',[4 5]);
nlobj.States(1).Name = 'SoCbat'; % Battery's state-of-charge
nlobj.States(2).Name = 'SoCsc'; % Super-capacitor's state-of-charge
nlobj.States(1).Units = '%';
nlobj.States(2).Units = '%';
nlobj.OV(1).Name = 'SoCbat';
nlobj.OV(2).Name = 'SoCsc';
nlobj.OV(1).Units = '%';
nlobj.OV(2).Units = '%';
nlobj.MV(1).Name = 'Pbat'; % super capacitor's power
nlobj.MV(2).Name = 'Psm'; % Synchronous machine's power
nlobj.MV(3).Name = 'Pload'; % Load demand
nlobj.MV(1).Units = 'kW';
nlobj.MV(2).Units = 'kW';
nlobj.MV(3).Units = 'kW';
nlobj.MD(1).Name = 'Ppv'; % Solar panel generated power
nlobj.MD(2).Name = 'Pwt'; % Wind turbine generated power
nlobj.MD(1).Units = 'kW';
nlobj.MD(2).Units = 'kW';
U(1) = nlobj.MV(1); % Pbat
U(2) = nlobj.MV(2); % Psm
U(3) = nlobj.MV(3); % Pload
U(4) = nlobj.MD(1); % Pbat
Accepted Answer
More Answers (0)
Categories
Find more on Model Predictive Control Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!