PMSM同步旋转坐标系下的数学模型及Simulink仿真
1.同步旋转坐标系下的数学模型
1.1 dq坐标系下的定子电压方程
1.2 dq坐标系下的定子磁链方程
1.3 定子电压方程变换式及等效电路
由上述两个方程,可以得到定子电压方程的新等式:
电压等效电路如下:
1.4 电磁转矩方程
1.5 相关重要关系式
其中,
ωe表示电角速度,ωm表示机械角速度,np表示极对数,Nr表示电机转速,r/min,ωm单位为rad/s。\omega_e 表示电角速度,\omega_m表示机械角速度,n_p表示极对数,N_r表示电机转速,r/min,\omega_m单位为rad/s。 ωe表示电角速度,ωm表示机械角速度,np表示极对数,Nr表示电机转速,r/min,ωm单位为rad/s。
1.6 电机的机械运动方程
2.三相PMSM矢量控制仿真模型
基于上述1.3的电压平衡方程,1.4的转矩方程,1.6的机械运动方程,可以构建矢量控制仿真模型,采用s-function形势,其中,Id,Iq,We为状态变量,仿真模型如下图所示:
仿真结果如下所示:
3.s-Function的运用
- 上述仿真过程中使用到了Simulink的S-function模块,S-Function可用来求解微分仿真,上述公式中,以Id,Iq,we作为微分方程的状态变量。
- S-Function的模板路径如下:…toolbox\simulink\blocks\sfuntmpl.m
- s-Function基于模板的编写过程,主要步骤为:
步骤一:初始化设置,定义摄入输出个数、系统状态变量个数
步骤二:相关参数设置以及微分仿真编写
步骤三:设定系统输出变量
function [sys,x0,str,ts,simStateCompliance] = sfuntmpl(t,x,u,flag)
%SFUNTMPL General MATLAB S-Function Template
% With MATLAB S-functions, you can define you own ordinary differential
% equations (ODEs), discrete system equations, and/or just about
% any type of algorithm to be used within a Simulink block diagram.
%
% The general form of an MATLAB S-function syntax is:
% [SYS,X0,STR,TS,SIMSTATECOMPLIANCE] = SFUNC(T,X,U,FLAG,P1,...,Pn)
%
% What is returned by SFUNC at a given point in time, T, depends on the
% value of the FLAG, the current state vector, X, and the current
% input vector, U.
%
% FLAG RESULT DESCRIPTION
% ----- ------ --------------------------------------------
% 0 [SIZES,X0,STR,TS] Initialization, return system sizes in SYS,
% initial state in X0, state ordering strings
% in STR, and sample times in TS.
% 1 DX Return continuous state derivatives in SYS.
% 2 DS Update discrete states SYS = X(n+1)
% 3 Y Return outputs in SYS.
% 4 TNEXT Return next time hit for variable step sample
% time in SYS.
% 5 Reserved for future (root finding).
% 9 [] Termination, perform any cleanup SYS=[].
%
%
% The state vectors, X and X0 consists of continuous states followed
% by discrete states.
%
% Optional parameters, P1,...,Pn can be provided to the S-function and
% used during any FLAG operation.
%
% When SFUNC is called with FLAG = 0, the following information
% should be returned:
%
% SYS(1) = Number of continuous states.
% SYS(2) = Number of discrete states.
% SYS(3) = Number of outputs.
% SYS(4) = Number of inputs.
% Any of the first four elements in SYS can be specified
% as -1 indicating that they are dynamically sized. The
% actual length for all other flags will be equal to the
% length of the input, U.
% SYS(5) = Reserved for root finding. Must be zero.
% SYS(6) = Direct feedthrough flag (1=yes, 0=no). The s-function
% has direct feedthrough if U is used during the FLAG=3
% call. Setting this to 0 is akin to making a promise that
% U will not be used during FLAG=3. If you break the promise
% then unpredictable results will occur.
% SYS(7) = Number of sample times. This is the number of rows in TS.
%
%
% X0 = Initial state conditions or [] if no states.
%
% STR = State ordering strings which is generally specified as [].
%
% TS = An m-by-2 matrix containing the sample time
% (period, offset) information. Where m = number of sample
% times. The ordering of the sample times must be:
%
% TS = [0 0, : Continuous sample time.
% 0 1, : Continuous, but fixed in minor step
% sample time.
% PERIOD OFFSET, : Discrete sample time where
% PERIOD > 0 & OFFSET < PERIOD.
% -2 0]; : Variable step discrete sample time
% where FLAG=4 is used to get time of
% next hit.
%
% There can be more than one sample time providing
% they are ordered such that they are monotonically
% increasing. Only the needed sample times should be
% specified in TS. When specifying more than one
% sample time, you must check for sample hits explicitly by
% seeing if
% abs(round((T-OFFSET)/PERIOD) - (T-OFFSET)/PERIOD)
% is within a specified tolerance, generally 1e-8. This
% tolerance is dependent upon your model's sampling times
% and simulation time.
%
% You can also specify that the sample time of the S-function
% is inherited from the driving block. For functions which
% change during minor steps, this is done by
% specifying SYS(7) = 1 and TS = [-1 0]. For functions which
% are held during minor steps, this is done by specifying
% SYS(7) = 1 and TS = [-1 1].
%
% SIMSTATECOMPLIANCE = Specifices how to handle this block when saving and
% restoring the complete simulation state of the
% model. The allowed values are: 'DefaultSimState',
% 'HasNoSimState' or 'DisallowSimState'. If this value
% is not speficified, then the block's compliance with
% simState feature is set to 'UknownSimState'.% Copyright 1990-2010 The MathWorks, Inc.%
% The following outlines the general structure of an S-function.
%
switch flag,%%%%%%%%%%%%%%%%%%% Initialization %%%%%%%%%%%%%%%%%%%case 0,[sys,x0,str,ts,simStateCompliance]=mdlInitializeSizes;%%%%%%%%%%%%%%%% Derivatives %%%%%%%%%%%%%%%%case 1,sys=mdlDerivatives(t,x,u);%%%%%%%%%%% Update %%%%%%%%%%%case {2,4,9}sys=[];%%%%%%%%%%%% Outputs %%%%%%%%%%%%case 3,sys=mdlOutputs(t,x,u);%%%%%%%%%%%%%%%%%%%%% Unexpected flags %%%%%%%%%%%%%%%%%%%%%otherwiseDAStudio.error('Simulink:blocks:unhandledFlag', num2str(flag));end% end sfuntmpl%
%=============================================================================
% mdlInitializeSizes
% Return the sizes, initial conditions, and sample times for the S-function.
%=============================================================================
%
function [sys,x0,str,ts,simStateCompliance]=mdlInitializeSizes%
% call simsizes for a sizes structure, fill it in and convert it to a
% sizes array.
%
% Note that in this example, the values are hard coded. This is not a
% recommended practice as the characteristics of the block are typically
% defined by the S-function parameters.
%
sizes = simsizes;sizes.NumContStates = 3;
sizes.NumDiscStates = 0;
sizes.NumOutputs = 3;
sizes.NumInputs = 3;
sizes.DirFeedthrough = 0;
sizes.NumSampleTimes = 1; % at least one sample time is neededsys = simsizes(sizes);%
% initialize the initial conditions
%
x0 = [0;0;0];%
% str is always an empty matrix
%
str = [];%
% initialize the array of sample times
%
ts = [0 0];% Specify the block simStateCompliance. The allowed values are:
% 'UnknownSimState', < The default setting; warn and assume DefaultSimState
% 'DefaultSimState', < Same sim state as a built-in block
% 'HasNoSimState', < No sim state
% 'DisallowSimState' < Error out when saving or restoring the model sim state
simStateCompliance = 'UnknownSimState';% end mdlInitializeSizes%
%=============================================================================
% mdlDerivatives
% Return the derivatives for the continuous states.
%=============================================================================
%
function sys=mdlDerivatives(t,x,u)% % % 电机参数设置
R = 2.875;
Ld = 8.5e-3;
Lq = 8.5e-3;
Pn = 4;
Phi = 0.175;
J = 0.001;
B = 0.008;
% x(1)、 x(2)、x(3)分别对应系统的3个状态变量id,iq,wm
%u(1)、u(2)、u(3)分别对应ud,uq和TLsys(1) = (1/Ld)*u(1) - (R/Ld)*x(1) + (Lq/Ld)*Pn*x(2)*x(3);
sys(2) = (1/Lq)*u(2) - (R/Lq)*x(2) - (Ld/Lq)* x(1)*x(3)*Pn - Phi*Pn*x(3)/Lq
sys(3) = (1/J)*(1.5*Pn*x(2)*((Ld-Lq)*x(1) + Phi) - u(3) - B*x(3))% end mdlDerivatives%
%=============================================================================
% mdlUpdate
% Handle discrete state updates, sample time hits, and major time step
% requirements.
%=============================================================================
%
function sys=mdlUpdate(t,x,u)sys = [];% end mdlUpdate%
%=============================================================================
% mdlOutputs
% Return the block outputs.
%=============================================================================
%
function sys=mdlOutputs(t,x,u)
sys(1) = x(1);
sys(2) = x(2);
sys(3) = x(3);% end mdlOutputs%
%=============================================================================
% mdlGetTimeOfNextVarHit
% Return the time of the next hit for this block. Note that the result is
% absolute time. Note that this function is only used when you specify a
% variable discrete-time sample time [-2 0] in the sample time array in
% mdlInitializeSizes.
%=============================================================================
%
function sys=mdlGetTimeOfNextVarHit(t,x,u)sampleTime = 1; % Example, set the next hit to be one second later.
sys = t + sampleTime;% end mdlGetTimeOfNextVarHit%
%=============================================================================
% mdlTerminate
% Perform any end of simulation tasks.
%=============================================================================
%
function sys=mdlTerminate(t,x,u)sys = [];% end mdlTerminate
PMSM同步旋转坐标系下的数学模型及Simulink仿真相关推荐
- 永磁同步电动机dq坐标系下的数学模型推导
今天看了篇关于永磁同步电动机矢量控制的论文,特别是数学模型这一块看了不少时间,由于线性代数学的太久有点忘了,在推导时花了不少时间. 首先是定子电压方程从abc静止三相坐标系到dq旋转坐标系下的推导步骤 ...
- SVPWM控制技术+Matlab/Simulink仿真详解
文章目录 前言 一.SVPWM的控制原理 二.空间矢量的概念 三.电压与磁链空间矢量的关系 四.三相逆变器的基本电压空间矢量 五.SVPWM 算法的合成原理 六.SVPWM 算法推导 6.1.七段式S ...
- 交流异步电机矢量控制(四)——simulink仿真搭建
前言:前面的三篇文章已将理论部分基本分析完了,下阶段就是对异步电机的矢量控制仿真模型进行搭建,结合前面梳理的理论知识看看矢量控制是不是那回事儿,能不能够实现这个转矩.电流和转速三个指标的控制,另外,验 ...
- matlab两轮自平衡小车,Simulink仿真
Simulink仿真 通过对两轮自平衡小车系统进行动力学分析和数学建模,在理论上设计出了控制方法.下面,调用 Matlab 软件的Simulink 仿真工具包对两轮自平衡小车的控制系统数学模型进行仿真 ...
- 学习记录3——PMSM数学建模——simulink内数学模型搭建以及仿真
目录 说明 1.搭建模块前的思路 2.搭建模块的方程 3.PMSM模块搭建 (1)d轴电流计算模块 (2)q轴电流计算模块 (3)耦合项计算模块 (4)角速度计算模块 (5)参数设置 4.仿真比较 总 ...
- Simulink仿真--PMSM模块参数设置
PMSM模块参数设置 目录 一.添加PMSM模块 二.参数设置 1.Configuration(配置) 2.Parameters(参数配置) 3.Advanced(高级设置) 一.添加PMSM模块 以 ...
- dq坐标系下无功功率表达式_基于瞬时电流分解的谐波电流检测方法研究
1 引言 有源电力滤波器(APF)是一种能动态抑制谐波和补偿无功的电力电子装置,相比传统的无源滤波器,无疑是一种更高效.更智能的改善电网环境的手段.谐波电流的检测直接影响到有源电力滤波器的补偿效果.基 ...
- 永磁同步电机(PMSM)最小损耗控制Simulink仿真
本篇文章主要进行永磁同步电机的最小损耗控制simulink仿真. 完整的阐述了最小损耗控制原理,考虑铁耗的永磁同步电机模型的搭建,FOC控制的整体搭建. 大家觉得本篇文章写得不错的话给博主点个赞和收藏 ...
- 柱坐标系下的ns方程_麦克斯韦方程组小结
一.▽ 算子.点积.叉积 l▽ 算子叫"del"算子,即<< span="">∂/∂x,∂/∂y,∂/∂z>,可以理解为一个符号向量,向 ...
最新文章
- Form_通过FND_FNDFLUPL标准功能上传CSV控件(案例)
- 谷歌提出“T5” 新NLP模型,突破迁移学习局限,多基准测试达SOTA!
- Linux之Redis的启动、使用和停止
- docwizard c++程序文档自动生成工具_工具用的好,老师下班早!老师的高效办公利器都在这!...
- randn函数加噪声_损失函数 (Loss Function)
- android 模拟器 相册里传照片_引力相册APP下载-引力相册下载v1.1 官方版
- mysql提示太多连接_mysql数据库提示连接太多怎么办
- python——函数 11、命名空间
- .net remoting与web service的区别
- Android:自定义标题栏
- if分支语句(JS)
- php 返回josn 中文,php返回json数据中文显示不友好的问题的解决办法
- JDK源码解析--ArrayList
- 关于css3的calc()
- JavaScript网页特效5则
- 杀毒软件之父 John McAfee 自杀
- 利用matlab信号带宽,测量均值频率、功率、带宽
- layui - 模板引擎
- PHP 中openssl_pkey_get_private函数获取私钥返回 FALSE 的问题
- Python课程设计《网络爬虫-中国大学排名课程设计》
热门文章
- 跨境电商独立站优缺点
- Redhawk APL - DI Flow
- 蓝屏无法开机问题(SrtTrail.txt、bootsafe64_ev.sys)
- 电脑计算机为什么不是有效程序,电脑无法运行程序提示“不是有效的Win32应用程序”如何解决...
- 构建datax、datax-web镜像并启动容器服务
- 什么是宇宙安全声明_为什么三体人不愿意告诉地球人宇宙安全声明的方法?
- mac多开屏幕_苹果电脑如何开启多个桌面?Mac电脑多桌面添加和使用技巧
- OpenSSL 概述
- k8s qos实现分析
- 转载:App Store生存法则:iOS开发者经验分享