"Electromechanical Drive Control"--DC motor speed Regulation simulation operation

Source: Internet
Author: User

By the original DC motor speed control example can be seen in the stability of the current is not good, to achieve a long time stability, overshoot is large, steady-state error is not small enough, the oscillation is obvious.

The original controller only proportional control, very coarse, when the gain is low, the steady state error is large, when the gain becomes larger, it will cause the motor current and acceleration oscillation.

After considering the decision with PID adjustment, three adjustment parameters for the proportional adjustment kp, integral Adjustment ki, differential regulation kd

KP increase will reduce the current value to achieve a stable time, but will increase the overshoot, reduce system stability;

Ki eliminates steady-state errors, but reduces system stability and slows dynamic response.

KD can reduce overshoot and adjust time;

The final selection parameter is kp=7.5 ki=0.1 kd=45

The resulting motor current and motor speed variation curves are as follows:

The visible overshoot is mp=7. 69% tp=0.0195s, more ideal.

Full code:

Type electricpotential = Real;

Type electriccurrent = Real (quantity = "Electriccurrent", unit = "A");

Type resistance = Real (quantity = "Resistance", unit = "Ohm", min = 0);

Type inductance = Real (quantity = "inductance", unit = "H", min = 0);

Type Voltage = electricpotential;

Type current = Electriccurrent;

Type force = Real (quantity = "force", unit = "N");

Type Angle = Real (quantity = "Angle", unit = "rad", DisplayUnit = "deg");

Type Torque = Real (quantity = "Torque", unit = "n.m");

Type angularvelocity = Real (quantity = "Angularvelocity", unit = "rad/s", DisplayUnit = "rev/min");

Type angularacceleration = Real (quantity = "Angularacceleration", unit = "rad/s2");

Type Momentofinertia = Real (quantity = "Momentofinertia", unit = "kg.m2");

Type time = Real (final quantity= "Time", Final unit= "s");

Connector rotflange_a "1D rotational flange (filled square)"

Angle Phi "Absolute rotational Angle of flange";

Flow Torque Tau "Torque in the flange";

End Rotflange_a; From Modelica.Mechanical.Rotational.Interfaces

Connector Rotflange_b "1D rotational flange (filled square)"

Angle Phi "Absolute rotational Angle of flange";

Flow Torque Tau "Torque in the flange";

End Rotflange_b; From Modelica.Mechanical.Rotational.Interfaces

Connector pin "pin of an electrical component"

Voltage V "potential at the pin";

Flow current I, current flowing into the pin;

End Pin; From Modelica.Electrical.Analog.Interfaces

Connector Positivepin "Positive pin of an electrical component"

Voltage V "potential at the pin";

Flow current I, current flowing into the pin;

End Positivepin; From Modelica.Electrical.Analog.Interfaces

Connector Negativepin "Negative pin of an electrical component"

Voltage V "potential at the pin";

Flow current I, current flowing into the pin;

End Negativepin; From Modelica.Electrical.Analog.Interfaces

Connector InPort "Connector with input signals of type Real"

Partial model Rigid//rotational class Rigid

"Base class for the rigid connection of rotational 1D flanges"

Angle Phi "Absolute rotation Angle of component";

Rotflange_a rotflange_a "(left) driving flange (axis directed into plane)";

Rotflange_b Rotflange_b "(right) driven flange (axis directed out of plane)";

Equation

Rotflange_a.phi = phi;

Rotflange_b.phi = phi;

End Rigid; From Modelica.Mechanics.Rotational.Interfaces

Model inertia "1D rotational component with inertia"

Extends Rigid;

Parameter Momentofinertia J = 1 "moment of inertia";

angularvelocity w "Absolute angular velocity of component";

Angularacceleration a "Absolute angular acceleration of component";

Equation

W = der (phi);

A = der (W);

J*a = Rotflange_a.tau + Rotflange_b.tau;

End inertia; From Modelica.Mechanics.Rotational

Partial model Twopin//Same as Oneport in Modelica.Electrical.Analog.Interfaces

"Component with II electrical pins p and N and current I from P to n"

Voltage V "Voltage drop between the pins (= p.v-n.v)";

Current I "current flowing from pin p to pin n";

Positivepin p;

Negativepin N;

Equation

v = p.v-n.v;

0 = p.i + n.i;

i = P.I;

End Twopin;

Model Dcmotor "DC Motor"

Extends Twopin;

Extends Rigid;

OutPort sensorvelocity (n=1);

OutPort sensorcurrent (n=1);

Parameter Momentofinertia J "total inertia";

Parameter resistance R "armature resistance";

Parameter inductance L "armature inductance";

Parameter Real Kt "Torque Constant";

Parameter Real Ke "EMF Constant";

angularvelocity W "Angular Velocity of motor";

Angularacceleration a "Absolute angular acceleration of motor";

Torque Tau_motor;

Rotflange_b Rotflange_b; Rotational Flange_b

Equation

W = der (Rotflange_b.phi);

A = der (W);

v = r*i+ke*w+l*der (i);

Tau_motor = Kt*i;

J*a = Tau_motor + Rotflange_b.tau;

SENSORVELOCITY.SIGNAL[1] = W;

SENSORCURRENT.SIGNAL[1] = i;

End Dcmotor;

Class resistor "Ideal linear electrical Resistor"

Extends Twopin; Same as Oneport

Parameter Real R (unit = "OHM") "resistance";

Equation

R*i = v;

End resistor; From Modelica.Electrical.Analog.Basic

Class inductor "Ideal linear electrical inductor"

Extends Twopin; Same as Oneport

Parameter Real L (unit = "H") "inductance";

Equation

v = l*der (i);

End inductor; From Modelica.Electrical.Analog.Basic

Class Ground "Ground node"

Pin p;

Equation

P.V = 0;

End Ground; From Modelica.Electrical.Analog.Basic

Model Pwmvoltagesource

Extends Twopin;

InPort Command (n=1);

Parameter time T = 0.003;

Parameter Voltage Vin = 200;

Equation

T*der (v) + v = VIN*COMMAND.SIGNAL[1]/10;

End Pwmvoltagesource;

Block Controller

InPort command (n=1);

InPort feedback (n=1);

OutPort OutPort (n=1);

Real error;

Real Error_i;

Real Error_d;

Real pout;

Parameter Real kp=7.5;

Parameter Real ki=0.1;

Parameter Real kd=45;

Parameter Real Max_output_pos = 10;

Parameter Real Max_output_neg =-10;

Algorithm

Error: = command.signal[1]-feedback.signal[1];

Error_i:=error_i+error;

Error_d:=error-pre (Error);

Pout: = Kp * ERROR+KI*ERROR_I+KD*ERROR_D;

If pout > Max_output_pos Then

OUTPORT.SIGNAL[1]: = Max_output_pos;

ElseIf Pout < Max_output_neg Then

OUTPORT.SIGNAL[1]: = Max_output_neg;

Else

OUTPORT.SIGNAL[1]: = pout;

End If;

End Controller;

Block Commandsignalgenerator

OutPort OutPort (n=1);

Real ACC;

Equation

If time <= 1 then

ACC = 60;

ElseIf Time <3 Then

ACC = 0;

ElseIf Time <4 Then

ACC =-60;

Else

ACC = 0;

End If;

Der (outport.signal[1]) = ACC;

End Commandsignalgenerator;

Parameter Integer n = 1 "Dimension of Signal vector";

Input real signal[n] "real input signals";

End InPort; From Modelica.Blocks.Interfaces

Connector OutPort "Connector with output signals of type Real"

Parameter Integer n = 1 "Dimension of Signal vector";

Output real signal[n] "real output signals";

End OutPort; From Modelica.Blocks.Interfaces

Model Dcmotorcontrolsystem

Ground Ground1;

Inertia inertia1 (J = 3, w (fixed = true));

Dcmotor Motor1 (J = 1,r = 0.6,l = 0.01,kt=1.8, ke= 1.8,rotflange_b (phi (fixed = true));

Commandsignalgenerator SG1;

Controller Con1;

Pwmvoltagesource PowerSource1;

Equation

Connect (Sg1.outport, Con1.command);

Connect (Con1.feedback, Motor1. sensorvelocity);

Connect (Con1.outport, Powersource1.command);

Connect (POWERSOURCE1.P, MOTOR1.P);

Connect (Motor1.rotflange_b, inertia1.rotflange_a);

Connect (POWERSOURCE1.N, GROUND1.P);

Connect (GROUND1.P, MOTOR1.N);

End Dcmotorcontrolsystem;

Simulate (Dcmotorcontrolsystem, stoptime=5)

Plot ({MOTOR1.I,MOTOR1.W})

"Electromechanical Drive Control"--DC motor speed Regulation simulation operation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.