Установившаяся симуляция с основанным на проекции оптимизатором для обрезки

В этом примере показано, как найти установившуюся рабочую точку для модели Simscape™ Multibody™ с помощью findop с основанным на проекции оптимизатором. Результаты проверяются с помощью симуляции.

Открытая модель

Откройте модель Simulink.

mdl = 'scdbackhoeTRIM';
open_system(mdl)

Задайте спецификации рабочей точки

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

set_param(mdl,'LoadExternalInput','off')
set_param(mdl,'LoadInitialState','off')

Создайте объект спецификации рабочей точки по умолчанию.

ops = operspec(mdl);

Наложите ограничения на выходные параметры.

ops.Outputs(1).Known = true(10,1);
ops.Outputs(1).y(1) = 0;    % Bucket angle
ops.Outputs(1).y(3) = 50;   % Upper angle
ops.Outputs(1).y(5) = -50;  % Lower angle
ops.Outputs(1).y(7) = 0;    % Base angle
ops.Outputs(1).y(9) = -45;  % Support angle

Сконфигурируйте опции для обрезки

Сконфигурируйте опции оптимизатора для обрезки. Установите 'OptimizerType' опция к 'graddescent-proj', который является основанным на проекции оптимизатором для обрезки, который осуществляет непротиворечивость физических состояний модели. Чтобы отобразить прогресс для обрезки, установите 'DisplayReport' опция к 'iter'.

opt = findopOptions('OptimizerType','graddescent-proj',...
                    'DisplayReport','iter');
opt.OptimizationOptions.MaxFunEvals = 20000;

Модель для обрезки

Найдите установившуюся рабочую точку, которая соответствует этим спецификациям. Следующая команда занимает несколько минут.

[op,rpt] = findop(mdl,ops,opt);
Optimizing to solve for all desired dx/dt=0, x(k+1)-x(k)=0, and y=ydes.
 
(Maximum Error)  Block
 ---------------------------------------------------------
(4.50000e+01) scdbackhoeTRIM/Out1
(3.88972e+00) scdbackhoeTRIM/Plant/Mounting Assembly/Mounting Base and Support Arms/Support  Arm Right/Revolute Joint  Arm
(3.25130e+00) scdbackhoeTRIM/Plant/Backhoe Arm/Arm-Bucket Joint
(2.92756e+00) scdbackhoeTRIM/Plant/Mounting Assembly/Mounting Base and Support Arms/Support  Arm Left/Revolute Joint  Arm
(2.90835e+00) scdbackhoeTRIM/Plant/Mounting Assembly/Mounting Base and Support Arms/Support  Arm Left/Revolute Joint  Arm
(2.87033e+00) scdbackhoeTRIM/Plant/Mounting Assembly/Mounting Base and Support Arms/Support  Arm Left/Revolute Joint  Arm
(2.88039e+00) scdbackhoeTRIM/Plant/Mounting Assembly/Mounting Base and Support Arms/Support  Arm Left/Revolute Joint  Arm
(2.75915e+00) scdbackhoeTRIM/Plant/Mounting Assembly/Mounting Base and Support Arms/Support  Arm Left/Revolute Joint  Arm
(2.82770e+00) scdbackhoeTRIM/Plant/Mounting Assembly/Mounting Base and Support Arms/Support  Arm Left/Revolute Joint  Arm
(2.83204e+00) scdbackhoeTRIM/Plant/Mounting Assembly/Mounting Base and Support Arms/Support  Arm Left/Revolute Joint  Arm
(2.77134e+00) scdbackhoeTRIM/Plant/Mounting Assembly/Mounting Base and Support Arms/Support  Arm Left/Revolute Joint  Arm
(2.77170e+00) scdbackhoeTRIM/Plant/Mounting Assembly/Mounting Base and Support Arms/Support  Arm Left/Revolute Joint  Arm
(2.66093e+00) scdbackhoeTRIM/Plant/Mounting Assembly/Mounting Base and Support Arms/Support  Arm Left/Revolute Joint  Arm
(1.91196e+00) scdbackhoeTRIM/Plant/Mounting Assembly/Mounting Base and Support Arms/Support  Arm Left/Revolute Joint  Arm
(1.48418e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.48194e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.92844e+00) scdbackhoeTRIM/Out1
(1.47015e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.46951e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.47048e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.47087e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.47081e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.47072e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.47065e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.47067e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.47062e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.47044e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.47049e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.47044e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.47035e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.47009e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.46945e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.46915e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.46650e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.45218e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.43599e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.39092e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.32192e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.32141e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.34505e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.34732e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.34643e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.34590e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.34577e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.34579e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.34598e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.34609e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.34550e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.34208e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.33732e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(1.21415e+00) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(5.03874e-01) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(5.04915e-01) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(3.02028e-01) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(2.00116e-01) scdbackhoeTRIM/Out1
(2.80354e-01) scdbackhoeTRIM/Out1
(8.41676e-02) scdbackhoeTRIM/Plant/Lower Arm to Mounting Assembly
(9.96485e-02) scdbackhoeTRIM/Plant/Lower Arm to Mounting Assembly
(1.04079e-01) scdbackhoeTRIM/Plant/Lower Arm to Mounting Assembly
(9.08181e-02) scdbackhoeTRIM/Out1
(8.72986e-02) scdbackhoeTRIM/Out1
(2.96463e-02) scdbackhoeTRIM/Plant/Backhoe Arm/Upper-Lower Arm Joint
(9.04872e-03) scdbackhoeTRIM/Plant/Mounting Assembly/Mounting Base and Support Arms/Support  Arm Left/Revolute Joint  Arm
(2.39393e-03) scdbackhoeTRIM/Plant/Mounting Assembly/Mounting Base and Support Arms/Support  Arm Right/Revolute Joint  Arm
(1.28775e-03) scdbackhoeTRIM/Plant/Backhoe Arm/Hydraulic Actuator Lower - Upper Arm/Prismatic  Joint
(1.61736e-04) scdbackhoeTRIM/Plant/Mounting Assembly/Mounting Base and Support Arms/Support  Arm Left/Revolute Joint  Arm
(1.59106e-04) scdbackhoeTRIM/Plant/Hydraulic Actuator Mounting - Lower Arm/Prismatic  Joint
(1.70351e-05) scdbackhoeTRIM/Plant/Cylinder Base to Mounting Plate
(2.39957e-05) scdbackhoeTRIM/Plant/Hydraulic Actuator Mounting - Lower Arm/Prismatic  Joint
(1.49012e-05) scdbackhoeTRIM/Plant/Hydraulic Actuator Mounting - Lower Arm/Hydraulic Actuator/Simulink-PS Converter1
(7.45058e-06) scdbackhoeTRIM/Plant/Backhoe Arm/Hydraulic Actuator Lower - Upper Arm/Hydraulic Actuator/Simulink-PS Converter1
(7.45058e-06) scdbackhoeTRIM/Plant/Backhoe Arm/Hydraulic Actuator Lower - Upper Arm/Hydraulic Actuator/Simulink-PS Converter1

Operating point specifications were successfully met.

Симулируйте модель

Симулируйте модель от вычисленного устойчивого состояния.

set_param(mdl, 'LoadExternalInput','on')
set_param(mdl, 'ExternalInput','getinputstruct(op)')
set_param(mdl, 'LoadInitialState','on')
set_param(mdl, 'InitialState','getstatestruct(op)')
sim(mdl)

Открытый осциллограф, чтобы смотреть результаты.

open_system([mdl, '/Joint Angle Trajectories'])

Результаты симуляции показывают, что эти пять углов обрезаются к их ожидаемым значениям, однако траектория отклоняется немного в зависимости от времени из-за числового шума и нестабильности. Можно стабилизировать углы с помощью контроллеров обратной связи.

bdclose(mdl)

Смотрите также

Функции

Похожие темы