exponenta event banner

Использование масштабных коэффициентов для облегчения настройки веса

В этом примере показано, как задать масштабные коэффициенты в MPC-контроллере для упрощения настройки веса.

Определение модели завода

Дискретно-временная линейная модель установки «состояние-пространство» имеет 10 состояний, 5 входов и 3 выхода.

[plant,Ts] = mpcscalefactor_model;
[ny,nu] = size(plant.D);

Входные данные установки включают управляемую переменную (MV), измеренное возмущение (MD) и неизмеренное возмущение (UD). Выходы установки включают измеренные выходы (КО) и неизмеренные выходы (УО).

mvindex = [1, 3, 5];
mdindex = 4;
udindex = 2;
moindex = [1 3];
uoindex = 2;
plant = setmpcsignals(plant,'MV',mvindex,'MD',mdindex,'UD',udindex,'MO',moindex,'UO',uoindex);

Номинальные значения и рабочие диапазоны модели установки следующие:

  • Вход 1: номинальное значение 100, диапазон [50 150]

  • Вход 2: номинальное значение 10, диапазон [5 15]

  • Вход 3: номинальное значение 0,01, диапазон [0,005 0,015]

  • Вход 4: номинальное значение 0,1, диапазон [0,05 0,15]

  • Вход 5: номинальное значение 1, диапазон [0,5 1,5]

  • Выход 1: номинальное значение 0,01, диапазон [0,005 0,015]

  • Выход 2: номинальное значение - 1, диапазон - [0,5 1,5]

  • Выход 3: номинальное значение 100, диапазон [50 150]

Использовать lsim команда для выполнения линейного моделирования с разомкнутым контуром для проверки того, что выходы установки находятся в пределах диапазона и их среднее значение близко к номинальным значениям, когда входные сигналы случайным образом изменяются вокруг их номинальных значений.

Unominal = [100;10;0.01;0.1;1];
Ynominal = [0.01;1;100];
Uspan = Unominal;
Yspan = Ynominal;
t = (0:1000)'*Ts;
nt = length(t);
Uol = (rand(nt,nu)-0.5).*(ones(nt,1)*Uspan');   % design input signal
Yol = lsim(plant,Uol,t);                        % compute plant output
fprintf('The difference between average output values and the nominal values are %.2f%%, %.2f%%, %.2f%% respectively.\n',...
    abs(mean(Yol(:,1)))/Ynominal(1)*100,abs(mean(Yol(:,2)))/Ynominal(2)*100,abs(mean(Yol(:,3)))/Ynominal(3)*100);
The difference between average output values and the nominal values are 2.25%, 3.53%, 2.47% respectively.

Оценка MPC с весами MPC по умолчанию

Когда входные и выходные сигналы установки имеют разные порядки величины, настройки веса MPC по умолчанию часто дают плохую производительность.

Создайте контроллер MPC с весами по умолчанию:

  • Weight.MV = 0

  • Weight.MVRate = 0.1

  • Weight.OV = 1

C = mpc(plant);
-->The "PredictionHorizon" property of "mpc" object is empty. Trying PredictionHorizon = 10.
-->The "ControlHorizon" property of the "mpc" object is empty. Assuming 2.
-->The "Weights.ManipulatedVariables" property of "mpc" object is empty. Assuming default 0.00000.
-->The "Weights.ManipulatedVariablesRate" property of "mpc" object is empty. Assuming default 0.10000.
-->The "Weights.OutputVariables" property of "mpc" object is empty. Assuming default 1.00000.
Xnominal = zeros(10,1);
Unominal(udindex) = 0;  % Nominal values for unmeasured disturbance must be 0
C.Model.Nominal = struct('X',Xnominal,'DX',Xnominal,'Y',Ynominal,'U',Unominal);

Сначала проверьте последовательность ступенчатых изменений уставок в трех опорных сигналах.

nStepLen = 15;
T1 = nStepLen*ny;
r1 = ones(T1,1)*Ynominal(:)';
ii = 1;
for i = 1:ny
    r1(ii:end,i) = r1(ii:end,i) + Ynominal(i);
    ii = ii + nStepLen;
end
sim(C,T1,r1)
-->The "Model.Disturbance" property of "mpc" object is empty:
   Assuming unmeasured input disturbance #2 is integrated white noise.
-->Assuming output disturbance added to measured output channel #1 is integrated white noise.
   Assuming no disturbance added to measured output channel #3.
-->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel.

Figure contains 5 axes. Axes 1 contains an object of type line. These objects represent Driving inputs, MPC response1. Axes 2 contains an object of type line. These objects represent Driving inputs, MPC response1. Axes 3 contains an object of type line. These objects represent Driving inputs, MPC response1. Axes 4 contains an object of type line. These objects represent Driving inputs, MPC response1. Axes 5 contains an object of type line. These objects represent Driving inputs, MPC response1.

Figure contains 3 axes. Axes 1 contains 2 objects of type line. These objects represent Driving inputs, MPC response1. Axes 2 contains 2 objects of type line. These objects represent Driving inputs, MPC response1. Axes 3 contains 2 objects of type line. These objects represent Driving inputs, MPC response1.

Отклик на отслеживание первого выхода является плохим. Причина в том, что его диапазон невелик по сравнению с другими выходами. Если используются веса настройки контроллера по умолчанию, контроллер MPC не уделяет много внимания регулированию этого выхода, поскольку соответствующий штраф настолько мал по сравнению с другими выходами в целевой функции.

Во-вторых, проверьте неизмеренное отклонение возмущения.

SimOpt = mpcsimopt;
SimOpt.UnmeasuredDisturbance = Uspan(udindex)';
T2 = 100;
r2 = ones(T2,1)*Ynominal(:)';
sim(C,T2,r2,[],SimOpt)

Figure contains 3 axes. Axes 1 contains 2 objects of type line. These objects represent Driving inputs, MPC response1. Axes 2 contains 2 objects of type line. These objects represent Driving inputs, MPC response1. Axes 3 contains 2 objects of type line. These objects represent Driving inputs, MPC response1.

Figure contains 5 axes. Axes 1 contains an object of type line. These objects represent Driving inputs, MPC response1. Axes 2 contains an object of type line. These objects represent Driving inputs, MPC response1. Axes 3 contains an object of type line. These objects represent Driving inputs, MPC response1. Axes 4 contains an object of type line. These objects represent Driving inputs, MPC response1. Axes 5 contains an object of type line. These objects represent Driving inputs, MPC response1.

Реакция на отказ от нарушения также является плохой. Ни один из выходов не возвращается к своим уставкам.

Оценка MPC с весами MPC по умолчанию после указания масштабных коэффициентов

Задание коэффициентов масштаба ввода и вывода для контроллера MPC:

  • Улучшает численное качество вычислений оптимизации и оценки состояния.

  • Повышает вероятность того, что веса настройки по умолчанию достигнут хорошей производительности контроллера.

Скопируйте контроллер MPC с весами по умолчанию.

C2 = C;

Для определения масштабных коэффициентов рекомендуется использовать ожидаемый рабочий диапазон каждого входа и выхода.

for i = 1:length(mvindex)
    C2.MV(i).ScaleFactor = Uspan(mvindex(i));
end
nmd = length(mdindex);
for i = 1:nmd
    C2.D(i).ScaleFactor = Uspan(mdindex(i));
end
for i = 1:length(udindex)
    C2.D(i+nmd).ScaleFactor = Uspan(udindex(i));
end
for i = 1:ny
    C2.OV(i).ScaleFactor = Yspan(i);
end

Повторите первый тест, представляющий собой последовательность ступенчатых изменений уставок в трех опорных сигналах.

sim(C2,T1,r1)
-->The "Model.Disturbance" property of "mpc" object is empty:
   Assuming unmeasured input disturbance #2 is integrated white noise.
-->Assuming output disturbance added to measured output channel #1 is integrated white noise.
   Assuming no disturbance added to measured output channel #3.
-->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel.

Figure contains 3 axes. Axes 1 contains 2 objects of type line. These objects represent Driving inputs, MPC response1. Axes 2 contains 2 objects of type line. These objects represent Driving inputs, MPC response1. Axes 3 contains 2 objects of type line. These objects represent Driving inputs, MPC response1.

Figure contains 5 axes. Axes 1 contains an object of type line. These objects represent Driving inputs, MPC response1. Axes 2 contains an object of type line. These objects represent Driving inputs, MPC response1. Axes 3 contains an object of type line. These objects represent Driving inputs, MPC response1. Axes 4 contains an object of type line. These objects represent Driving inputs, MPC response1. Axes 5 contains an object of type line. These objects represent Driving inputs, MPC response1.

Повторите второй тест, который является неизмеренным нарушением.

sim(C2,T2,r2,[],SimOpt)

Figure contains 3 axes. Axes 1 contains 2 objects of type line. These objects represent Driving inputs, MPC response1. Axes 2 contains 2 objects of type line. These objects represent Driving inputs, MPC response1. Axes 3 contains 2 objects of type line. These objects represent Driving inputs, MPC response1.

Figure contains 5 axes. Axes 1 contains an object of type line. These objects represent Driving inputs, MPC response1. Axes 2 contains an object of type line. These objects represent Driving inputs, MPC response1. Axes 3 contains an object of type line. These objects represent Driving inputs, MPC response1. Axes 4 contains an object of type line. These objects represent Driving inputs, MPC response1. Axes 5 contains an object of type line. These objects represent Driving inputs, MPC response1.

И отслеживание уставок, и отклики на отклонение возмущений хороши даже без настройки веса MPC.

См. также

|

Связанные темы