Linearize Event-Based Subsystems (Externally Scheduled Subsystems)

Linearizing Event-Based Subsystems

Event-based subsystems (triggered subsystems) and other event-based models require special handling during linearization.

Executing a triggered subsystem depends on previous signal events, such as zero crossings. However, because linearization occurs at a specific moment in time, the trigger event never happens.

An example of an event-based subsystem is an internal combustion (IC) engine. When an engine piston approaches the top of a compression stroke, a spark causes combustion. The timing of the spark for combustion is dependent on the speed and the position of the engine crankshaft.

In the scdspeed model, triggered subsystems generate events when the pistons reach both the top and bottom of the compression stroke. Linearization in the presence of such triggered subsystems is not meaningful.

Approaches for Linearizing Event-Based Subsystems

You can obtain a meaningful linearization of triggered subsystems, while still preserving the simulation behavior, by recasting the event-based dynamics as one of the following:

  • Lumped average model that approximates the event-based behavior over time.

  • Periodic function call subsystem, with Normal simulation mode.

    In the case of periodical function call subsystems, the subsystem linearizes to the sampling at which the subsystem is periodically executed.

    In many control applications, the controller is implemented as a discrete controller, but the execution of the controller is driven by an external scheduler. You can use such linearized plant models when the controller subsystem is marked as a Periodic Function call subsystem.

If recasting event-based dynamics does not produce good linearization results, try frequency response estimation. See Estimate Frequency Response Using Linear Analysis Tool.

Note

If a triggered subsystem is disabled at the current operating condition and has at least one direct passthrough I/O pair, then the subsystem will break the linearization path curing linearization. In such a case, specify a block substitution or ensure that the subsystem does not have a passthrough I/O pair.

Periodic Function Call Subsystems for Modeling Event-Based Subsystems

This example shows how to use periodic function call subsystems to approximate event-based dynamics for linearization.

  1. Open Simulink® model.

    sys = 'scdPeriodicFcnCall';
    open_system(sys)
  2. Linearize model at the model operating point.

    io = getlinio(sys);
    linsys = linearize(sys,io)

    The linearization is zero because the subsystem is not a periodic function call.

    D = 
                     Desired  Wat
       Water-Tank S             0
     Static gain.

    Now, specify the Externally Scheduled Controller block as a Periodic Function Call Subsystem.

  3. Double-click the Externally Scheduled Controller (Function-Call Subsystem) block.

    Double-click the function block to open the Block Parameters dialog box.

  4. Set Sample time type to be periodic.

    Leave the Sample time value as 0.01, which represents the sample time of the function call.

  5. Linearize the model.

    linsys2 = linearize(sys,io)
    A = 
                            H  Integrator
       H               0.9956    0.002499
       Integrator  -0.0007774           1
     
    B = 
                   Desired  Wat
       H               0.003886
       Integrator     0.0007774
     
    C = 
                              H  Integrator
       Water-Tank S           1           0
     
    D = 
                     Desired  Wat
       Water-Tank S             0
     
    Sampling time: 0.01
    Discrete-time model.
  6. Plot step response.

    step(linsys2)

  7. Close the model.

    bdclose(sys);

Approximating Event-Based Subsystems Using Curve Fitting (Lump-Average Model)

This example shows how to use curve fitting to approximate event-based dynamics of an engine.

The scdspeed model linearizes to zero because scdspeed/Throttle & Manifold/Intake Manifold is an event-triggered subsystem.

You can approximate the event-based dynamics of the scdspeed/Throttle & Manifold/Intake Manifold subsystem by adding the Convert to mass charge block inside the subsystem.

The Convert to mass charge block approximates the relationship between Air Charge, Manifold Pressure, and Engine Speed as a quadratic polynomial.

Air Charge = p1×Engine Speed + p2×Manifold Pressure + p3×(Manifold Pressure)2+ p4×Manifold Pressure×Engine Speed + p5

If measured data for internal signals is not available, use simulation data from the original model to compute the unknown parameters p1, p2, p3, p4, and p5 using a least squares fitting technique.

When you have measured data for internal signals, you can use the Simulink Design Optimization™ software to compute the unknown parameters. See Engine Speed Model Parameter Estimation (Simulink Design Optimization) to learn more about computing model parameters, linearizing this approximated model, and designing a feedback controlled for the linear model.

The next figure compares the simulations of the original event-based model and the approximated model. Each of the pulses corresponds to a step change in the engine speed. The size of the step change is between 1500 and 5500. Thus, you can use the approximated model to accurately simulate and linearize the engine between 1500 RPM and 5500 RPM.

Related Topics