This example shows how to linearize an engine speed model.
Open the model.
scdspeed
This example generates linear models of the output engine speed and between the inputs the Spark Advance and the Throttle Angle. The FINDOP command computes the operating points at steady state conditions at 2000, 3000, and 4000 rpm.
Create an operating point specification object using the command
opspec = operspec('scdspeed')
Operating point specification for the Model scdspeed. (Time-Varying Components Evaluated at time t=0) States: ---------- (1.) scdspeed/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar spec: dx = 0, initial guess: 0.543 (2.) scdspeed/Vehicle Dynamics/w = T//J w0 = 209 rad//s spec: dx = 0, initial guess: 209 Inputs: ---------- (1.) scdspeed/Throttle perturbation initial guess: 0 Outputs: None ----------
Next, specify the desired operating conditions. Fix the first output port of the Vehicle Dynamics to be 2000, 3000, and 4000 rpm. Use the command ADDOUTPUTSPEC to do this.
opspec = addoutputspec(opspec,'scdspeed/rad//s to rpm',1);
Set the first operating specification
opspec.Output.Known = 1; opspec.Outputs.y = 2000;
Search for the operating point that meets this specification
op(1) = findop('scdspeed',opspec);
Operating point search report: --------------------------------- Operating point search report for the Model scdspeed. (Time-Varying Components Evaluated at time t=0) Operating point specifications were successfully met. States: ---------- (1.) scdspeed/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar x: 0.544 dx: 2.66e-13 (0) (2.) scdspeed/Vehicle Dynamics/w = T//J w0 = 209 rad//s x: 209 dx: -8.48e-12 (0) Inputs: ---------- (1.) scdspeed/Throttle perturbation u: 0.00382 [-Inf Inf] Outputs: ---------- (1.) scdspeed/rad//s to rpm y: 2e+03 (2e+03)
Now, search for the remaining operating points at 3000 and 4000 rpm
opspec.Outputs.y = 3000; op(2) = findop('scdspeed',opspec); opspec.Outputs.y = 4000; op(3) = findop('scdspeed',opspec);
Operating point search report: --------------------------------- Operating point search report for the Model scdspeed. (Time-Varying Components Evaluated at time t=0) Operating point specifications were successfully met. States: ---------- (1.) scdspeed/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar x: 0.49 dx: -5.14e-15 (0) (2.) scdspeed/Vehicle Dynamics/w = T//J w0 = 209 rad//s x: 314 dx: 4.57e-13 (0) Inputs: ---------- (1.) scdspeed/Throttle perturbation u: 2.94 [-Inf Inf] Outputs: ---------- (1.) scdspeed/rad//s to rpm y: 3e+03 (3e+03) Operating point search report: --------------------------------- Operating point search report for the Model scdspeed. (Time-Varying Components Evaluated at time t=0) Operating point specifications were successfully met. States: ---------- (1.) scdspeed/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar x: 0.473 dx: 1.13e-11 (0) (2.) scdspeed/Vehicle Dynamics/w = T//J w0 = 209 rad//s x: 419 dx: -1.49e-10 (0) Inputs: ---------- (1.) scdspeed/Throttle perturbation u: 5.83 [-Inf Inf] Outputs: ---------- (1.) scdspeed/rad//s to rpm y: 4e+03 (4e+03)
The operating points are now ready for linearization. First specify the input and output points using the commands:
io(1) = linio('scdspeed/throttle (degrees)',1,'input'); io(2) = linio('scdspeed/Spark Advance',1,'input'); io(3) = linio('scdspeed/rad//s to rpm',1,'output');
Linearize the model and plot the Bode magnitude response for each condition.
sys = linearize('scdspeed',op,io);
bodemag(sys)
Close the model.
bdclose('scdspeed')