|On this page…|
The ssc_bipolar_nonlinearssc_bipolar_nonlinear model contains a nonlinear bipolar junction transistor circuit, equivalent to an Ebers-Moll circuit . A modified version of the model, ssc_bipolar_nonlinear_trimlin, is ready for linearization when you first open it and forms the basis for the following operating point and linearization examples.
The transistor acts between base-emitter voltage (ports B and E) and collector current (port C). The circuit is driven by an oscillating AC voltage source of 10 mV and 1 kHz, with a constant bias DC voltage of 10 V. The Nonlinear NPN Transistor is the essential component of the circuit and represents a bipolar transistor that amplifies the driving AC voltage. The Scope block displays the voltage coming off the collector.
Simulate ssc_bipolar_nonlinear with the Scope open to see the basic circuit behavior. The output transistor junction capacitances are set to be initially consistent with the bias subcircuit. The output is a steady sinusoid with zero average, its amplitude amplified by a factor 3 by the transistor and bias subcircuit.
To see the circuit relax from a nonsteady initial state, open the Solver Configuration block and clear the Start simulation from steady state check box. With the Scope open, simulate again. In this case, the output voltage starts at zero because the transistor junction capacitances start with zero charge. Then change the model back to starting at a steady state.
The steady-state collector voltage is controlled mainly by the R2 and R4 resistance values, while the amplification of the driving AC voltage is controlled mainly by the R1 and R3 resistance values. Experiment with changing these resistances to change the steady state and near-steady state behavior of the circuit. For example, change R1 from 47 to 15 kOhms. The collector voltage is now no longer amplified relative to the 10 mV AC source, but attenuated.
If you simulate without starting from a steady state, changing these resistance values also modifies the transient behavior.
To obtain a nontrivial linearized input-output model from the Simulink® model, you must specify model-level inputs and outputs. The modified ssc_bipolar_nonlinear_trimlinssc_bipolar_nonlinear_trimlin meets this requirement in two ways, depending on how you linearize.
Simulink Control Design™ software requires that you specify input and output signal lines with linearization points. ssc_bipolar_nonlinear_trimlin has such linearization points specified. The specified lines must be Simulink signal lines, not Simscape™ physical connection lines. For more information on using Simulink Control Design software for trimming and linearization, see documentation for this product.
Simulink requires top- or model-level input and output ports for linearization with linmod. ssc_bipolar_nonlinear_trimlin has such ports, marked u and y.
Open ssc_bipolar_nonlinear_trimlin. Open the AC voltage source subsystem. The AC Voltage source is now combined with an input port.
Right-click the two signal lines indicated, each of which is marked with a linearization point symbol. A context menu is displayed. Select Linear Analysis Points. A submenu is displayed, listing the different ways you can mark signal lines for control design analysis.
One signal line is inside the source subsystem and runs from the model-level input port u. In the submenu, Input Point is selected, indicating that this signal line is designated as an input.
The other signal line leads to the Scope and runs to a model-level output port y. In the submenu, Output Point is selected, indicating that this signal line is designated as an output.
Open and run this modified version of the model. The simulated behavior of this version is the same as the original model.
You can get a more comprehensive understanding of the circuit behavior and how it approaches the steady state by changing the simulation and Scope parameters in ssc_bipolar_nonlinear_trimlin.
Open Solver Configuration and clear the Start simulation from steady state check box. Click OK.
Open the Scope. From the Scope menu bar, open Parameters.
On the General pane, change Time range to 1.0. On the Data History pane, clear the Limit data points to last check box. Click OK.
Change the simulation time to 1.
Start the simulation. The circuit starts from its initial nonsteady state, and the transistor collector voltage approaches and eventually settles into steady sinusoidal oscillation.
Note: This example uses the Simscape steady-state solver. Save the results of this example (in particular, the initial steady state vector x0) for later use in Linearizing a Transistor Circuit with Simulink and Related Software. You should work through the later section after you follow this example.
For general information about the Simscape steady-state solver, see Finding Operating Points in Physical Models.
Simulate the modified ssc_bipolar_nonlinear_trimlinssc_bipolar_nonlinear_trimlin, with the Simscape steady-state solver enabled, as it is when you first open the model. This steady-state solution is an operating point suitable for linearization. With the simulation starting from this steady state, you can characterize this operating point by one of the following:
The initial time t = 0
The initial state vector x0. To capture state values during simulation:
Open the model Configuration Parameters dialog box.
Select the Data Import/Export pane.
Select the States check box under Save to workspace.
At the first time step, the state vector values represent the initial state.
After you simulate with an initial steady state, capture the initial state vector by entering:
x0 = xout(1,:);
Note: This example uses linmod and time-based linearization. Before attempting it, work through the preceding example, Finding Operating Points in a Transistor Circuit with the Simscape Solver. For this example, use the results of that example, including the steady state value, x0.
The nonlinear bipolar transistor model, ssc_bipolar_nonlinear_trimlinssc_bipolar_nonlinear_trimlin, introduced in the preceding example, has input and output ports that guarantee a nontrivial input-output LTI model after linearization.
For general information about linearizing with Simulink, see Linearizing a Physical Model.
The state vector x of ssc_bipolar_nonlinear_trimlin contains 16 components. The full model has one input and one output.
Thus, the LTI state-space models derived from linearization have the following matrix sizes: A is 16-by-16; B is 16-by-1; C is 1-by-16; and D is 1-by-1.
First, linearize the model at an initial steady state. In the Solver Configuration block, make sure that you have selected the Start simulation from steady state check box. To capture the LTI matrices, enter:
[a0,b0,c0,d0] = linmod('ssc_bipolar_nonlinear_trimlin');
The state has 16 components. The linmod function alone, without an output argument, generates a structure with states, inputs, and outputs, as well as the LTI model.
[a0_R1,b0_R1,c0_R1,d0_R1] = linmod('ssc_bipolar_nonlinear_trimlin');
Then change R1 back to 47 kOhms.
Second, linearize the model with the initial steady state captured as a state vector, x0. Clear the Start simulation from steady state check box in the Solver Configuration block. Then enter:
u = 0; [a1,b1,c1,d1] = linmod('ssc_bipolar_nonlinear_trimlin',x0,u);
Verify that the two matrix sets, a0, b0, c0, d0 and a1, b1, c1, d1, do not differ significantly. The operating point x0 was obtained from the Simscape steady-state solver. If you saved this state as a vector in your workspace, you do not need to invoke the steady-state solver again to solve for it.
In the Solver Configuration block, reselect the Start simulation from steady state check box.
Next, obtain a series of state vectors to linearize at multiple simulation times using the Timed-Based Linearization block. Sample a few times uniformly across one AC cycle near the steady state. The cycle period is 1 millisecond.
From the Simulink library, insert a Timed-Based Linearization block into your model.
Open the linearization block. Into the Linearization time field, enter [0 0.25e-3 0.5e-3 0.75e-3]. Click OK.
This series of times samples the simulation at four, evenly spaced points over one AC cycle.
In the Configuration Parameters dialog box, in the Data Import/Export pane, make sure that you have selected Time, States, and Output.
Simulate the model. Check your workspace for tout, xout, yout, and the structure called ssc_bipolar_nonlinear_trimlin_Timed_Based_Linearization.
The structure has a component for each of the four linearization times. Verify these times by entering:
and so on. Extract the LTI matrices for these four linearization times:
A1 = ssc_bipolar_nonlinear_trimlin_Timed_Based_Linearization(1).a; B1 = ssc_bipolar_nonlinear_trimlin_Timed_Based_Linearization(1).b; C1 = ssc_bipolar_nonlinear_trimlin_Timed_Based_Linearization(1).c; D1 = ssc_bipolar_nonlinear_trimlin_Timed_Based_Linearization(1).d;
Create A2, B2, C2, D2 from the second linearization time, and so on.
Of the four LTI models created by time-based linearization, one comes from the steady state itself and the other three from nearby states. If the steady state is a good operating point for linearization, these LTI models do not differ greatly from one another.
Verify this suitability by direct comparison of the components of A1, A2, A3, and A4. You can also derive and compare invariant scalar metrics from the A matrices, such as the traces, to make sure that the LTI models vary only slightly near the steady state.
Accuracy of Linear Approximation to Nonlinear Behavior. With different circuit parameters, you can make this steady state less suitable for linearization. The transistor collector current response to the base-emitter voltage is exponential:
IC = IS[exp(VBE/VT) – 1] ,
where IC is the collector current, IS is the temperature-dependent saturation current for the transistor, VBE is the base-emitter voltage, and VT is the normalized voltage = kBT/q = 25.3 mV at room temperature (T = 20 oC = 293 K; kB = Boltzmann's constant, q = electron charge) .
Adjusting the circuit characteristics can enhance this nonlinear character and degrade the accuracy of a linear approximation to the circuit's response near the steady state.
Not all the states of the LTI models derived in this example are independent. Confirm this by calculating the determinant of one of the A matrices; for example, det(a0). These determinants vanish and imply one or more zero eigenvalues.
[a2,b2,c2,d2] = minreal(a0,b0,c0,d0); 12 states removed.
Extracting the minimal realization eliminates 12 dependent states from the LTI model, leaving four independent states. Analyze the control characteristics of the reduced a2, b2, c2, d2 LTI model with a Bode plot:
bode(a2,b2,c2,d2) % Creates first Bode plot
Reducing and Analyzing a Second Steady State. The circuit with R1 changed from 47 to 15 kOhm has a different steady state and response. Reduce this LTI model to a minimal realization as well and analyze its control characteristics:
[a2_R1,b2_R1,c2_R1,d2_R1] = minreal(a0_R1,b0_R1,c0_R1,d0_R1); % 12 states removed. hold on % Keeps first Bode plot open bode(a2_R1,b2_R1,c2_R1,d2_R1) % Superposes second Bode plot on first
The second LTI model is reduced to four independent states.