Code covered by the BSD License  

Highlights from
Simultaneous Plant and Control Design of an Active Automotive Suspension Using Direct Transcription

image thumbnail

Simultaneous Plant and Control Design of an Active Automotive Suspension Using Direct Transcription

by

 

A toolbox for using Direct Transcription to perform combined plant and control design.

demo_qcar_sequential.m
% 
% Authors: James T. Allison, Assistant Professor, University of Illinois at Urbana-Champaign, Zhi Han, Tinghao Guo
% Date: 2/23/13
% Copyright 2013, James T. Allison
%%
% Prepare the road data
load IRI_737b
zdot = calc_zdot(road_x, road_z, 10); 
% Vehicle speed assumed to be 10

% open loop
xd = zeros(7,1);
xd(1) = 0.010;         % d: spring wire diameter (m)
xd(2) = 0.12;          % D: spring helix diameter (m)
xd(3) = 0.05;          % p: spring pitch (m)
xd(4) = 6;             % Na: number of active spring coils (3 <= Na <= 15 for
xd(5) = 0.0067;        % Do: orifice diameter (m)
xd(6) = 0.04;          % Dp: piston diameter (m)
xd(7) = 0.15;          % Ds: damper stroke (m)

ramp_in = 25/100 * 10;
%%
% Sequential solver
[system, objective, init, designCon, stateCon] = qcar_new_objective_open();

s = SequentialSolverWithInputs;
s.system = system;
s.objective = objective;
s.initCondition = init;
s.designConstraint = designCon;
s.stateConstraint = stateCon;
s.options = OptionFactory.getInstance.makeOption('Display');
s.options = optimset(s.options, 'TolFun', 1e-6);

%%
s.options = optimset(s.options, 'Algorithm', 'sqp', 'UseParallel','always');
s.options(2) = OptionFactory.getInstance.makeOption('Display');
s.options(2) = optimset(s.options, 'TolFun',1e-6);

s.n_control = 1;
% Step size for ramp 
t01 = [0:0.01:1, 1.02:0.02:2 ]; 
% Step size for rough road 
opt = odeset('RelTol', 1e-2, 'AbsTol', 1e-3);
[t02,~] = ode23(@(t,x)system.deriv(t,x,0, xd, @(t)lookup_u(zdot,t)), [0 2], init.fun(xd),opt);
s.t ={t01, t02};

s.input = {@(t)ramp_in, @(t)lookup_u(zdot, t)};
s.weight = {1e-2, 1};
s.lb = [0.005 0.05 0.02 3 0.003 0.03 0.1];
s.ub = [0.02 0.4 0.5 16 0.012 0.08 0.3];
s.llb = [];
s.uub = [];

s.pinit =xd; % initial parameterc
s.x0 = [];
fprintf('\nSequential\n');
starttime = cputime;
out2 = s.f_solve();
total_time = cputime -starttime;


Contact us