⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fm_pmu.m

📁 电力系统的psat
💻 M
字号:
function  fm_pmu(flag)%FM_PMU defines Phasor measurement unit%%Data Format Pmu.con:%  col #1: Bus 1 number%  col #2: Bus 1 Voltage Rate [kV]%  col #3: Frequency rate [Hz]%  col #4: Tv Time constant of the low pass filter of the voltage measure [Second]%  col #5: Ta Time constant of the low pass filter for the angle measure [Second]% %Data Structure: Pmu.dat:% %FM_PMU(FLAG)%   FLAG = 1 -> algebraic equations%   FLAG = 2 -> algebraic Jacobians%   FLAG = 3 -> differential equations%   FLAG = 4 -> state Jacobians%%Author:    Federico Milano%Date:      24-Mar-2005%Version:   1.0.0%%E-mail:    fmilano@thunderbox.uwaterloo.ca%Web-site:  http://thunderbox.uwaterloo.ca/~fmilano%% Copyright (C) 2002-2005 Federico Milano%% This toolbox is free software; you can redistribute it and/or modify% it under the terms of the GNU General Public License as published by% the Free Software Foundation; either version 2.0 of the License, or% (at your option) any later version.%% This toolbox is distributed in the hope that it will be useful, but% WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANDABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU% General Public License for more details.%% You should have received a copy of the GNU General Public License% along with this toolbox; if not, write to the Free Software% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,% USA.global Pmu DAE Bus Settingsvm = DAE.x(Pmu.vm);thetam = DAE.x(Pmu.thetam);V1 = DAE.V(Pmu.bus);theta1 = DAE.a(Pmu.bus);%Tv = Pmu.con(:,4);%Ta = Pmu.con(:,5);switch flag   case 0 % initialization    DAE.x(Pmu.vm) = V1;  DAE.x(Pmu.thetam) = theta1;  idx = find(Pmu.con(:,4) == 0);  if ~isempty(idx)    pmuwarn(idx, [' Time constant Tv cannot be 0. Tv = 0.05 will be ' ...                  'used.'])    Pmu.con(idx,4) = 0.05;  end  idx = find(Pmu.con(:,5) == 0);  if ~isempty(idx)    pmuwarn(idx, ' Time constant Ta cannot be 0. Ta = 0.05 will be used.')    Pmu.con(idx,5) = 0.05;  end  Pmu.dat = [1./Pmu.con(:,4), 1./Pmu.con(:,5)];  fm_disp('Initialization of PMUs completed.')   case 1 % algebraic equations case 2 % algebraic Jacobians case 3 % differential equations  DAE.f(Pmu.vm) = (V1-vm).*Pmu.dat(:,1);  DAE.f(Pmu.thetam) = (theta1-thetam).*Pmu.dat(:,2); case 4 % state variable Jacobians  % DAE.Fx  DAE.Fx = DAE.Fx + sparse(Pmu.vm,Pmu.vm,-Pmu.dat(:,1),DAE.n,DAE.n);  DAE.Fx = DAE.Fx + sparse(Pmu.thetam,Pmu.thetam,-Pmu.dat(:,2),DAE.n,DAE.n);  % DAE.Fy  DAE.Fy = DAE.Fy + sparse(Pmu.vm,Pmu.bus+Bus.n,Pmu.dat(:,1),DAE.n,2*Bus.n);  DAE.Fy = DAE.Fy + sparse(Pmu.thetam,Pmu.bus,Pmu.dat(:,2),DAE.n,2*Bus.n);end% -------------------------------------------------------------------% function for creating warning messagesfunction pmuwarn(idx, msg)fm_disp(strcat('Warning: PMU #',int2str(idx),msg))

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -