tank.m

来自「模型预测控制的一个小例子~Gravity Drained Water Tank」· M 代码 · 共 33 行

M
33
字号
% Simple Tank Model%% This is a model of the LabView control system that Lina set up
%   in the CPE Unit Ops Lab at UT Austin
function xdot = tank(t,x)global u
% Input (1):
% Inlet Valve State (% Open)
percent_open = u;

% State (1):
% Volume in the Tank (mL)
volume = x;

% Parameters
% Experimentally Determined Outflow Constant (mL^0.5/sec)c_outflow = 0.14;
% Experimentally Determined Inflow Constant (mL/sec)c_inflow = 0.25;

% Compute xdot
xdot(1,1) =  (c_inflow * percent_open) - (c_outflow * volume^0.5);

% Low Volume Constraint
low_volume = 265;
if (volume < low_volume) & (percent_open < (c_outflow * low_volume^0.5)/c_inflow),
   xdot(1,1) = 0;
end

   

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?