MATLAB Examples

Computing Operating Point Snapshots at Triggered Events

This example shows how to generate operating points using triggered snapshots.

Generation of Operating Points Using Triggered Snapshots

Open the model.

```scdspeedtrigger ```

In this example the model will be linearized at steady state operating points of 2500, 3000, and 3500 rpm. To get these operating points, simulation is used to generate operating point snapshots of the steady state conditions. Since the exact time a system reaches a steady state value is not always known, blocks such as the subsystem - Generate settling time events can be built to generate settling events. The block in this example sends rising edge trigger signals when a model is near a settling condition. The mask shown below allows for multiple settling conditions to be entered. In this example the block is configured to fire the rising edge triggers when the engine speed settles near 2500, 3000, and 3500 rpm for a minimum of 5 seconds.

The output settling time events are then fed to an Operating Point Snapshot block. In this example, the block creates operating point snapshots in the event of a rising edge trigger.

Using the FINDOP command, the simulation is run for 60 seconds and returns the operating points when engine speed is near steady state.

```op = findop('scdspeedtrigger',60); ```

The first operating point is near the 2500 rpm (261.8 rad/s) settling condition.

```op(1) ```
``` Operating point for the Model scdspeedtrigger. (Time-Varying Components Evaluated at time t=10.63) States: ---------- (1.) scdspeedtrigger/PID Controller/Filter x: 0 (2.) scdspeedtrigger/PID Controller/Integrator x: 10.5 (3.) scdspeedtrigger/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar x: 0.511 (4.) scdspeedtrigger/Vehicle Dynamics/w = T//J w0 = 209 rad//s x: 262 Inputs: None ---------- ```

The second operating point is near the 3000 rpm (314.16 rad/s) settling condition.

```op(2) ```
``` Operating point for the Model scdspeedtrigger. (Time-Varying Components Evaluated at time t=28.3703) States: ---------- (1.) scdspeedtrigger/PID Controller/Filter x: 0 (2.) scdspeedtrigger/PID Controller/Integrator x: 11.9 (3.) scdspeedtrigger/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar x: 0.49 (4.) scdspeedtrigger/Vehicle Dynamics/w = T//J w0 = 209 rad//s x: 314 Inputs: None ---------- ```

The third operating point is near the 3500 rpm (366.52 rad/s) settling condition.

```op(3) ```
``` Operating point for the Model scdspeedtrigger. (Time-Varying Components Evaluated at time t=48.2688) States: ---------- (1.) scdspeedtrigger/PID Controller/Filter x: 0 (2.) scdspeedtrigger/PID Controller/Integrator x: 13.3 (3.) scdspeedtrigger/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar x: 0.478 (4.) scdspeedtrigger/Vehicle Dynamics/w = T//J w0 = 209 rad//s x: 367 Inputs: None ---------- ```

Model Linearization

The operating points are used for linearization. First specify the input and output points using the commands:

```io(1) = linio('scdspeedtrigger/Reference Steps',1,'input'); io(2) = linio('scdspeedtrigger/rad//s to rpm',1,'output'); ```

Linearize the model and plot the Bode plot for each of the closed loop transfer functions.

```sys = linearize('scdspeedtrigger',op(1:3),io); bode(sys) bdclose('scdspeedtrigger') ```