首页 文章

比例控制Matlab

提问于
浏览
1

我正在与合作伙伴一起在matlab进行锅炉项目 . 我们仍然是该计划的新手,目前正致力于锅炉计划的比例控制部分 . 结果我们得到了3张图,就像我们应该的那样但是我们在中心图上看到了一个神秘的下降,如下所示 . 关于我们如何摆脱下滑的问题的任何诊断都是我们一直试图弄清楚的 .

这是我们的代码:

clear all;
close all;

endtime=60;
time=0;
ResPer=0.05; %declares basic functions
setpoint=7;
flowrate=2.4;
valveposition=0.2;

delay=5;
timeaxis=[1:endtime];
valveaxis=0;   %declares arrays related to time and graphing
steamaxis=0;

propconstant=0.25;
RelError=0;    %declares arrays regarding the proportional controller
desiredvalve=0.5823;

while time<endtime

    %RelError=SteamRelativeError(flowrate, setpoint);
    %calculates the Relative Error used in the rest of the function

    if (time <= delay)

        valveposition=0.75*valveposition+0.25*(desiredvalve-propconstant*RelError); 
        %deals with the valve position before the time exceeds the delay
        %valveaxis(time)=valveposition;

    else

        valveaxis(time-delay)=0.75*valveposition+0.25*(desiredvalve-propconstant*RelError); %calculates and stores valve position after the delay has been passed

    end

    RelError=SteamRelativeError(flowrate, setpoint); %calculates the Relative Error used in the rest of the function

    time=time+1; %increments time

    flowrate=ValvePerToFlowRate(valveposition); %calculates flow rate from valve position

    valveaxis(time)=valveposition; %stores temporary valve position
    steamaxis(time)=flowrate; %stores steam flow rate
    erroraxis(time)=RelError; %stores the Relative Error

end


subplot(3,1,2), plot(timeaxis, valveaxis, 'b'); axis([0 endtime 0.2 0.8]); 
xlabel('Time(min)'); ylabel('Valve%');
subplot(3,1,1), plot(timeaxis, steamaxis, 'b'); axis([0 endtime 2 
setpoint+2]); xlabel('Time(min)'); ylabel('Steam mass flow rate (lbm/s)');
title('Proportional Constant=0.25'); %graphs functions
subplot(3,1,3), plot(timeaxis, erroraxis, 'b'); axis([0 endtime -0.6 0.2]); 
xlabel('Time(min)'); ylabel('Error');

这是我们的图表:

Graphs

1 回答

  • 0

    由于您在两个不同的位置设置 valveaxis ,因此发生了下降 . 在 if else 块中,将其设置为:

    valveaxis(time-delay)=0.75*valveposition+0.25*(desiredvalve-propconstant*RelError);
    

    但是在此块之外,您将其设置为:

    valveaxis(time)=valveposition;
    

    在每个 time ,使用第二个等式设置 valveaxis ,仅稍后由第一个公式 delay 迭代覆盖 . 由于您在 time==60 处中断,因此最后的值不会被覆盖,因此 valveaxis(54) 将是第一个公式设置的最后一个值 . 这就是您在第54和第55个值之间出现下降的原因 .

相关问题