直流电机调速仿真作业

  本次调速仿真采用PID调节。首先要确定PID中的各项设计参数,仿真过程中采用临界比例度法确定了大概的Kp值。在若干次调整的过程中,发现加入微分环节后调整时间略有上升,故采用PI调节。调整参数确定为Kp=75,Ki=22。控制器部分的程序如下图所示。原理图如下

 

 ASR和ACR调节器均使用PI控制器,控制程序如下

代码如下:

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 two 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 two electrical pins p and n and current i from p to n"
Voltage v "Voltage drop between the two 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;

 

调节出的曲线

 

转载于:https://www.cnblogs.com/lxhg/p/5600250.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/573420.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

mysql any 效率_关于mysql的性能优化

1.用 show status like value 查询mysql数据库性能2. 用 EXPLAIN select * from table 或 DESCRIBE select * from table 查看执行计划3.使用索引--使用 like关键字时 like %le索引不起作用&#xff0c;但 like le%索引可以起作用-- 使用关键字or时要求两个字段必须同为索引…

存储指针

- (void)addObserver:(__weak NSObject *)observer forContext:(void *)context { NSValue *valueContext [NSValue valueWithPointer:context]; dispatch_sync(self.queue, ^{ [self.trampolines setObject:observer forKey:valueContext]; }); }转载于:https://www.cnblogs.…

Java运算符优先级和表达式及数据类型转换

计算机程序在处理数据时会进行大量的计算&#xff0c;而数据的运算则需要借助运算符和表达式来完成。表达式是指由操作数和运算符组成的用于完成某种运算功能的语句子表达式Y X * ( Z 10 ) 表达式 其中Y、X、Z、10 称为操作数&#xff0c;、*、 称为运算符。 在…

Bugtags 2016-06-16 更新内容

增加版本管理功能 随着版本的增多&#xff0c;有些历史的版本不再使用&#xff0c;可将这些版本隐藏起来。操作步骤如下&#xff1a;点击设置 - 版本管理&#xff08;管理员可见&#xff09;- 取消勾选需要隐藏的版本即可。隐藏版本后&#xff0c;版本筛选中将不会显示&#xf…

MYSQL描述选课系统的问题与_mysql+php实现选课系统中遇到的问题及解决方法

首先是一些mysql 的基本命令删除表格 drop ;约束条件 :primary key 设置为主键unique 值唯一not null 非空foreighn key(key_name) references(key_name) 设置外键 default 设置默认值auto_increment 一般用于设置编号&#xff0c;随着…

Java 基础(条件结构)

Java 程序流程控制结构 顺序结构: 条件结构: 循环结构: 单分支if结构 选择 结构又称为分支结构 。 当 程序执行到分支判断的语句时&#xff0c;首先判断条件&#xff0c;然后根据条件表达式的结果选择相应的语句执行 。 分支 结构包括单分支、双分支和多分支三种形式。 语法…

直通车运营系统优化之账户结构设置

国庆期间&#xff0c;小2哥我好好的享受了好几天的日子&#xff0c;说实话&#xff0c;自从做了淘宝&#xff0c;就很少像这期间一样好好的享受了这段日子 。做淘宝有时候真的很苦逼&#xff0c;每天的工作时间比一个打工的还长&#xff0c;熬夜到凌晨才睡也是家常便饭&#xf…

mysql批量导入数据脚本_MySQL数据库批量导入脚本

//File: query.php//描述: 数据库批量导入脚本//功能: 可进行单行和批量插入.//作者: SworDs//QQ: 78623269//日期: 2005-1-21//其他:好老了啊&#xff0c;刚学PHP写的&#xff0c;连抄带查&#xff01;2006.5.19从仓库里翻出来,。。。error_reporting(7);if ( function_exists…

原生JS封装ajax方法

http://blog.sucaijiayuan.com/article/89 jquery框架的ajax方法固然好用&#xff0c;但是假如某天我们的项目不能引入jquery或项目需求很简单&#xff0c;没有很多交互功能&#xff0c;只需要ajax&#xff0c;这时引入jquery库会造成资源浪费&#xff0c;也会显得页面臃肿。这…

mysql 从库 问题_一篇文章帮你解决Mysql 中主从库不同步的问题

写这篇文章是因为之前有一次删库操作&#xff0c;需要进行批量删除数据&#xff0c;当时没有控制好删除速度&#xff0c;导致产生了主从延迟&#xff0c;出现了一点小事故。今天我们就来看看为什么会产生主从延迟以及主从延迟如何处理等相关问题。坐好了&#xff0c;准备发车&a…

深度学习代码练习

代码下载地址&#xff1a;https://github.com/daijifeng001/R-FCN 对应论文&#xff1a;Object Detection via Region-based Fully Convolutional Networks 1、代码里面给的数据库下载链接失效&#xff0c;需要去代码下载主页最下方给定的资源区下载。 2、按照要求一步一步运行…

rabbitmq 不同的消费者消费同一个队列_消息队列王者--rabbitMQ深入理解--工作过程、消费模式、持久化等...

概述之前已经对rabbitMQ的一些基本概念做了介绍和不同MQ之间的比较&#xff0c;今天主要对rabbitMQ的一些方面做扩展。01消息队列Broker&#xff1a;简单来说就是消息队列服务器实体。Exchange&#xff1a;消息交换机&#xff0c;它指定消息按什么规则&#xff0c;路由到哪个队…

BZOJ 2763: [JLOI2011]飞行路线 spfa dp

题目链接&#xff1a; http://www.lydsy.com/JudgeOnline/problem.php?id2763 题解&#xff1a; d[x][kk]表示从s到x用了kk次免费机会的最少花费。 代码&#xff1a; #include<iostream> #include<cstdio> #include<algorithm> #include<queue> #incl…

mysql快速删除大表数据部分数据_mysql删除大表的部分数据

mysql删除大表的部分数据好久没写博客。最近项目要上线。下班时间还得陪着老妈。实在没时间更新。今天有人提了一个问题&#xff0c; www.2cto.com一个表有1亿6000万的数据&#xff0c;有一个自增ID。最大值就是1亿6000万&#xff0c;需要删除大于250万以后的数据&#xff0c;…

读“硬件抽象层:HAL”的心得

1 HAL是建立在Linux驱动上的一套程序库&#xff0c;并不属于Linux内核&#xff0c;而是属于Linux内核层上的应用层。它的目的就是保护“私人财产”&#xff0c;避免应用程序直接访问Linux驱动。 2在Android系统中使用Linux驱动有两种方式。一种就是通过传统的方式直接与Linux交…

mysql所有版本介绍_mysql各个版本介绍

一、版本说明&#xff1a;MYSQL自从被ORCLE收购后&#xff0c;软件的版本也ORACLE化&#xff0c;整体的感觉就是服务的费用提高了很多&#xff0c;整体的软件的Supports也有相应的提高&#xff1b;MYSQL根据软件的功能可以分成三个版本&#xff1a;社区版、企业版、集群版。社区…

安装jdk源码

step1:打开选择Window->Preference step2:选择Java->Installed JREs step3:选中你所安装的jre&#xff0c;点击Edit&#xff0c;进入Edit JRE,如下所示 step4:选中rt.jar,点击Source Attachment step5:在对话框中&#xff0c;点击External Folder&#xff0c;选择你所安装…

d3js mysql_D3js技术文档 可视化展现

转载请注明http://www.cnblogs.com/juandx/articles/3885220.htmlD3js技术文档概述D3 allows you to bind arbitrary data to a Document Object Model (DOM), and then apply data-driven transformations to the document. For example, you can use D3 to generate an HTML …

text-indent的用法

一、text-indent应用于块级元素 <style type"text/css">*{margin:0;padding:0;}body{font-size:12px;color:#333;}p{text-indent:2em;background-color:#f00;color:#fff;}</style> </head> <body><p>携程旅行网携程旅行网携程旅行网携…

kettle连接mysql教程_kettle 连接 mysql8

kettle默认使用的是org.gjt.mm.mysql.Driver&#xff0c;而mysql 8.0以上connector已经不再支持这个包名;即使将mysql-connector-java-8.0.xx.jar包拷贝到data-integration/lib目录下&#xff0c;还是报错找不到驱动;所以要用jndi方法配置kettle&#xff0c;用com.mysql.cj.jdb…