DC Motor Speed Control simulation operation

Source: Internet
Author: User

The speed control simulation adopts PID adjustment. Firstly, the design parameters of PID are determined, and the approximate KP value is determined by the critical proportional degree method in the simulation process. In the process of several adjustments, it is found that the adjustment time increases slightly after adding the differential link, so the Pi adjustment is adopted. The adjustment parameters are determined to be kp=75,ki=22. The controller section of the program is shown in. Schematic diagram is as follows

Both the ASR and ACR regulators use PI controllers, which control the following

The code is as follows:

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"
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


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 pout;
Real Intu;
Parameter Real kp=70;
Parameter Real ki=20;

Equation

Error = Command.signal[1]-feedback.signal[1];
Error =der (intu);
Pout = Kp * ERROR+KI*INTU;
OUTPORT.SIGNAL[1] = pout;

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;


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;
Controller Con2;
Pwmvoltagesource PowerSource1;
Equation
Connect (Sg1.outport, Con1.command);
Connect (Con1.feedback, Motor1. sensorvelocity);
Connect (Con1.outport, Con2.command);
Connect (Motor1. Sensorcurrent,con2.feedback);
Connect (Con2.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;

Adjust the curve

DC Motor Speed Control 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.