📄 fm_pmu.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: Time constant of the voltage measure [s]% col #5: Time constant of the angle measure [s]%%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-2006 Federico Milanoglobal 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 + -