Linear models Typically, control engineers begin by developing a mathematical description of the dynamical system that they want to control. This to-be-controlled system is called a plant. As an example of a plant, this section uses the DC motor. Thi section develops the differential equations that describe the electromechanical properties of a DC motor with an inertial load. It then shows you how to use the Control System Toolbox to build linear models based on these equations Linear Model Representations The Control System Toolbox supports the following model representations State-space models(SS)of the form where A, B, C, and D are matrices of appropriate dimensions, x is the state vector, and u and y are the input and output vectors Transfer functions (TF), for example, H(s) +2 +S+10 Zero-pole-gain(ZPK) models, for example, (z+1+(2+1-n (z+0.2)(z+0.1) Frequency response data(FRD)models, which consist of sampled measurements of a systems frequency response. For example, you can store experimentally collected frequency response data in an FRD model. Note The design of FRD models is a specialized subject that this guide does not address. See"Frequency Response Data(FRD) Models"under"Creating and Manipulating Models"in the online documentation for a discussion of this topic
Linear Models 2-3 Linear Models Typically, control engineers begin by developing a mathematical description of the dynamical system that they want to control. This to-be-controlled system is called a plant. As an example of a plant, this section uses the DC motor. This section develops the differential equations that describe the electromechanical properties of a DC motor with an inertial load. It then shows you how to use the Control System Toolbox to build linear models based on these equations. Linear Model Representations The Control System Toolbox supports the following model representations: • State-space models (SS) of the form where A, B, C, and D are matrices of appropriate dimensions, x is the state vector, and u and y are the input and output vectors. • Transfer functions (TF), for example, • Zero-pole-gain (ZPK) models, for example, • Frequency response data (FRD) models, which consist of sampled measurements of a system’s frequency response. For example, you can store experimentally collected frequency response data in an FRD model. Note The design of FRD models is a specialized subject that this guide does not address. See “Frequency Response Data (FRD) Models” under “Creating and Manipulating Models” in the online documentation for a discussion of this topic. dx dt ------ = Ax Bu + y Cx Du = + H s( ) s + 2 s2 + +s 10 = --------------------------- H z( ) 3( ) z + + 1 j ( ) z + 1 – j ( ) z + 0.2 ( ) z + 0.1 = --------------------------------------------------
2 Building Models SISO Example: the DC Motor A simple model of a dC motor driving an inertial load shows the angular rate of the load, o(t), as the output and applied voltage vann(t), as the input. The ultimate goal of this example is to control the angular rate by varying the applied voltage. This picture shows a simple model of the dc motor. R KO(t) friction DC Motor Inertial (t) Angular rate Figure 2-1: A Simple Model of a DC Motor Driving an Inertial Load In this model, the dynamics of the motor itself are idealized; for instance, the magnetic field is assumed to be constant. The resistance of the circuit is denoted by r and the self-inductance of the armature by L. If you are unfamiliar with the basics of DC motor modeling, consult any basic text or physical modeling. The important thing here is that with this simple model and basic laws of physics, it is possible to develop differential equations that describe the behavior of this electromechanical system. In this example, the relationships between electric potential and mechanical force are Faraday's law of induction and Ampere's law for the force on a conductor moving through a magnetic field
2 Building Models 2-4 SISO Example: the DC Motor A simple model of a DC motor driving an inertial load shows the angular rate of the load, , as the output and applied voltage, , as the input. The ultimate goal of this example is to control the angular rate by varying the applied voltage. This picture shows a simple model of the DC motor. Figure 2-1: A Simple Model of a DC Motor Driving an Inertial Load In this model, the dynamics of the motor itself are idealized; for instance, the magnetic field is assumed to be constant. The resistance of the circuit is denoted by R and the self-inductance of the armature by L. If you are unfamiliar with the basics of DC motor modeling, consult any basic text on physical modeling. The important thing here is that with this simple model and basic laws of physics, it is possible to develop differential equations that describe the behavior of this electromechanical system. In this example, the relationships between electric potential and mechanical force are Faraday’s law of induction and Ampère’s law for the force on a conductor moving through a magnetic field. ω( )t vapp( )t DC Motor + - vemf(t) ω(t) R L I Inertial Load L Load J vapp(t) - + τ(t) Kf ω(τ) Torque Angular rate Viscous friction i(t)
Mathematical derivation The torque t seen at the shaft of the motor is proportional to the current i induced by the applied voltage τ(t) where Km, the armature constant, is related to physical properties of the motor, such as magnetic field strength, the number of turns of wire around the onductor coil, and so on. The back (induced)electromotive force, vemf, is a tional to the angular rat en at the shaft t)=Kbo(t where K, the emf constant, also depends on certain physical properties of the The mechanical part of the motor equations is derived using Newtons law which states that the inertial load J times the derivative of angular rate equals the sum of all the torques about the motor shaft. The result is this equati 架一∑y=-8O+m0 where Kois a linear approximation for viscous fricti Finally, the electrical part of the motor equations can be described by vap2()-vm0)=+R(0 or, solving for the applied voltage and substituting for the back emf, vapp(t=latt Ri(o+ Kbo(D This sequence of equations leads to a set of two differential equations that describe the behavior of the motor, the first for the induced current, K o(t+ivapp(t)
Linear Models 2-5 Mathematical Derivation The torque seen at the shaft of the motor is proportional to the current i induced by the applied voltage, where Km, the armature constant, is related to physical properties of the motor, such as magnetic field strength, the number of turns of wire around the conductor coil, and so on. The back (induced) electromotive force, , is a voltage proportional to the angular rate seen at the shaft, where Kb, the emf constant, also depends on certain physical properties of the motor. The mechanical part of the motor equations is derived using Newton’s law, which states that the inertial load J times the derivative of angular rate equals the sum of all the torques about the motor shaft. The result is this equation, where is a linear approximation for viscous friction. Finally, the electrical part of the motor equations can be described by or, solving for the applied voltage and substituting for the back emf, This sequence of equations leads to a set of two differential equations that describe the behavior of the motor, the first for the induced current, τ τ( )t = Kmi t( ) vemf ω vemf( )t = Kbω( )t Jdt dω τ = = i – Kf ω( )t + Kmi t( ) Kf ω vapp( )t vemf – ( )t Ldt di = + Ri t( ) vapp( )t Ldt di = + + Ri t( ) Kbω( )t dt di R L– ----i t( ) Kb L – ------ω( )t 1 L ---vapp = + ( )t
2 Building Models and the second for the resulting angular rate. ar=-3o(o+3m10 State-Space Equations for the DC Motor Given the two differential equations derived in the last section, you can now develop a state-space representation of the DC motor as a dynamical system The current i and the angular rate o are the two states of the system. The applied voltage, vapp, is the input to the system, and the angular velocity o is the output. L dto Km kr Lol o ·vnn(t) -0|+(o1vap Figure 2-2: State-Space Representation of the DC Motor Example Constructing SISO Models Once you have a set of differential equations that describe your plant, you can construct SISO models using simple commands in the Control System Toolbox The following sections discuss: Constructing a state-space model of the DC motor Converting between model representations Creating transfer function and zero/pole/gain models directly LTI objects, the data containers for linear models 2-6
2 Building Models 2-6 and the second for the resulting angular rate. State-Space Equations for the DC Motor Given the two differential equations derived in the last section, you can now develop a state-space representation of the DC motor as a dynamical system. The current i and the angular rate are the two states of the system. The applied voltage, , is the input to the system, and the angular velocity is the output. Figure 2-2: State-Space Representation of the DC Motor Example Constructing SISO Models Once you have a set of differential equations that describe your plant, you can construct SISO models using simple commands in the Control System Toolbox. The following sections discuss: • Constructing a state-space model of the DC motor • Converting between model representations • Creating transfer function and zero/pole/gain models directly • LTI objects, the data containers for linear models dt dω 1 J – ---Kf ω( )t 1 J = + ---Kmi t( ) ω vapp ω dt d i ω R L –---- Kb L –------ Km J -------- Kf J –----- i ω ⋅ 1 L --- 0 vapp = + ⋅ ( )t y t( ) 0 1 i ω ⋅ [ ] 0 vapp = + ⋅ ( )t
Constructing a State-Space Model of the DC Motor Listed below are nominal values for the various parameters of a DC motor R=2.0%0hm L= 0.5%Henrys Km =.015 Torque constant Kb =.015 emf constant Kf =0.2% Nms Given these values, you can construct the numerical state-space representation using the ss function A =[R/L-Kb/L: Km/J-Kf/JI B=[1/L;0 C=[01 D=[O] S(A, B, C, D) This is the output of the last command. 0.75 2-7
Linear Models 2-7 Constructing a State-Space Model of the DC Motor Listed below are nominal values for the various parameters of a DC motor. R= 2.0 % Ohms L= 0.5 % Henrys Km = .015 % Torque constant Kb = .015 % emf constant Kf = 0.2 % Nms J= 0.02 % kg.m^2/s^2 Given these values, you can construct the numerical state-space representation using the ss function. A = [-R/L -Kb/L; Km/J -Kf/J] B = [1/L; 0]; C = [0 1]; D = [0]; sys_dc = ss(A,B,C,D) This is the output of the last command. a = x1 x2 x1 -4 -0.03 x2 0.75 -10 b = u1 x1 2 x2 0 c = x1 x2 y1 0 1 d = u1 y1 0