Simulink Constant Ramp Controller
9 次查看(过去 30 天)
显示 更早的评论
Hi all,
In order to explain my problem, I've attached a Simulink model to this post. It consists of a classic PID control loop which calculates the response of the system to a signal step at the input. What I am looking for is a controller to replace the PID, which guarantees a constant slope over the entire step response, ideally without any remaining controll error. I've already tried different approaches, none of them seem to work reliably. Any ideas?:)
Cheers
Alex
2 个评论
Nikhil
2023-7-6
Can you explain what you mean by ' a constant slope over the entire step response ' ?
采纳的回答
Sam Chak
2023-7-6
I didn't check the Simulink model. However, the desired response can be achieved with a nonlinear controller. See example below.
tspan = linspace(0, 4, 10001);
x0 = 0;
opts = odeset('RelTol', 1e-12, 'AbsTol', 1e-9);
[t, x] = ode45(@odefcn, tspan, x0, opts);
% Solution Plot
plot(t, x, 'linewidth', 1.5), hold on,
plot(t, heaviside(t - 1), 'r--'), grid on,
xlabel('t'), ylabel('x(t)')
legend('output', 'input', 'location', 'east')
function xdot = odefcn(t, x)
k = 1; % parameter that determines the strength of u
g = 1000; % parameter that determines steepness of u
ref = heaviside(t - 1); % reference input to be tracked
% controller
u = - k*tanh(g*(x - ref)); % nonlinear controller
% system
xdot = u; % equivalent to the plant transfer function, Gp(s) = 1/s
end
更多回答(1 个)
Nikhil
2023-7-6
编辑:Nikhil
2023-7-6
Yes, It helps. You can derive the transfer function for the controller since you know the transfer function for the system and the desired output from the equation:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1428053/image.png)
where Y(s) is the output, which would be
for a signal of constant slope m,
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1428058/image.png)
G(s) is C(s)*P(s), where P(s) is the system tranfer function, which in your case is
as your system is an integrator,
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1428063/image.png)
H(s) is the feedback transfer function, which is 1,
U(s) is the input signal, which would be
for the case of a step input.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1428063/image.png)
The controller transfer function would then turn out to be ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1428073/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1428073/image.png)
You can then use a Transfer Function block to implement the controller.
3 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!