📄 fm_block.m
字号:
'[-0.45 -0.2 -0.45 -0.45],[1 1.5 2 1],[-0.2 -0.2],[2 1],[-0.3 -0.3],[1.7 2.2]), ', ... 'plot(-0.7+0.1*xc,4+yc,', ... '-1.15+0.175+0.125*yi,0.5+0.5*xi,', ... '-1.15-0.325+0.125*yi,0.5+0.5*xi,', ... '-1.15-0.075+0.125*yi,0.5+0.5*xi)']; end tipo = str2num(Values{2}); switch tipo case 1, b{5} = 'Xc_max and Xc_min [p.u. p.u.]'; a{6} = 'off'; set_param(object,'MaskDisplay',display1); case 2, b{5} = 'Alpha_max and Alpha_min [rad rad]'; a{6} = 'on'; set_param(object,'MaskDisplay',display2); end case 'Exc' tipo = str2num(Values{1}); idx1 = [4 5 6 7]; idx2 = [7 8 9 11]; switch tipo case 1 b(idx1) = {'Regulator Gain m0 [p.u./p.u.]'; .... 'First Regulator Pole T1 [s]'; ... 'First Regulator Zero T2 [s]'; ... 'Second Regulator Pole T3 [s]'}; a(idx2) = {'on'; 'on'; 'on'; 'on'}; case 2 b(idx1) = {'Amplifier Gain Ka [p.u./p.u.]'; ... 'Amplifier Time Constant Ta [s]'; ... 'Stabilizer Gain Kf [p.u./p.u.]'; ... 'Stabilizer Time Tf [s]'}; a(idx2) = {'on'; 'off'; 'on'; 'on'}; case 3 b(idx1) = {'Regulator Gain [p.u./p.u.]'; ... 'Regulator Pole T2 [s]'; ... 'Regulator Zero T1 [s]'; ... 'Second Regulator Pole T3 [s]'}; a(idx2) = {'off'; 'off'; 'off'; 'off'}; end case 'Tg' tipo = str2num(Values{1}); idx1 = [6 7]; idx2 = [8 9 10]; switch tipo case 1, b(idx1) = {'Governor Time Constant Ts [s]'; ... 'Servo Time Constant Ts [s]'}; a(idx2) = {'on'; 'on'; 'on'}; case 2, b(idx1) = {'Pole Time Constant Ts [s]'; ... 'Zero Time Constant Ts [s]'}; a(idx2) = {'off'; 'off'; 'off'}; end case 'PQ' tipo = Values{4}; switch tipo case 'on', a{3} = 'on'; case 'off', a{3} = 'off'; endcase 'Statcom' tipo = str2num(Values{2}); switch tipo case 3 b{8} = 'Phase regulator gain and time constant (Kp, T3) [p.u. s]'; otherwise b{8} = 'PI phase regulators gains (Kp, Ki) [p.u. p.u.]'; end case 'Sssc' tipo = str2num(Values{2}); switch tipo case 1 b{10} = 'Reference DC Voltage and AC Power Flow [p.u. p.u.]'; case 2 b{10} = 'Reference DC Voltage and AC Current Flow [p.u. p.u.]'; end case 'Ltc' inputs = [get_param(object,'Ports'), 0, 0, 0, 0, 0]; if inputs(6) display1 = ['plot(x,y,x+1.4,y,[2.4 2.8],[0 0],[3.1 3.5],[0 0],[-1 -2],[0 0],0,2), color(''green''), plot([2.95 2.95],', ... '[-0.15 -2],[2.95 -0.8],[-2 -2],[-0.8 -0.8],[-2 -1.2], [-0.8 0.7],[-1.2 1.2],', ... '[0.5 0.7],[1.1 1.2],[0.7 0.7], [1.0 1.2],[2.8 3.1 3.1 2.8 2.8],[-0.15 -0.15 0.15 0.15 -0.15]);']; display2 = ['plot(x,y,x+1.4,y,[2.4 3.5],[0 0],[-1 -2],[0 0],0,2-4*rot), color(''green''), plot([0.8 0.8],3*rot-[1.3 1.7],', ... '[0.65 0.95 0.95 0.65 0.65],[3.4*rot-1.7 3.4*rot-1.7 4*rot-2 4*rot-2 3.4*rot-1.7],', ... '[0.8 -0.8],[2.4*rot-1.2 1.3-2.6*rot],[-0.6 -0.8],[1.1-2.2*rot 1.2-2.4*rot],[-0.8 -0.8], [1-2*rot 1.2-2.4*rot]);']; else display1 = ['plot(x,y,x+1.4,y,[2.4 2.8],[0 0],[3.1 3.5],[0 0],[-1 -2],[0 0],0,2,[2.95 2.95],', ... '[-0.15 -2],[2.95 -0.8],[-2 -2],[-0.8 -0.8],[-2 -1.2], [-0.8 0.7],[-1.2 1.2],', ... '[0.5 0.7],[1.1 1.2],[0.7 0.7], [1.0 1.2],[2.8 3.1 3.1 2.8 2.8],[-0.15 -0.15 0.15 0.15 -0.15]);']; display2 = ['plot(x,y,x+1.4,y,[2.4 3.5],[0 0],[-1 -2],[0 0],0,2-4*rot,[0.8 0.8],3*rot-[1.3 1.7],', ... '[0.65 0.95 0.95 0.65 0.65],[3.4*rot-1.7 3.4*rot-1.7 4*rot-2 4*rot-2 3.4*rot-1.7],', ... '[0.8 -0.8],[2.4*rot-1.2 1.3-2.6*rot],[-0.6 -0.8],[1.1-2.2*rot 1.2-2.4*rot],[-0.8 -0.8], [1-2*rot 1.2-2.4*rot]);']; end inputs = inputs(3); tipo = str2num(Values{3}); switch tipo case 1 b{7} = 'Reference Voltage Vref [p.u.]'; set_param(object,'MaskDisplay',display1); if inputs, delete_block([object,'/in_2']); end case 2 b{7} = 'Reference Reactive Power Qref [p.u.]'; set_param(object,'MaskDisplay',display1); if inputs, delete_block([object,'/in_2']); end case 3 b{7} = 'Remote Reference Voltage Vref [p.u.]'; set_param(object,'MaskDisplay',display2); if ~inputs add_block('built-in/EnablePort',[object,'/in_2']) set_param([object,'/in_2'],'position',[65, 155, 85, 175]) end end case 'RLC' tipo = str2num(Values{2}); rx = '[0 30 30 38 53 68 83 98 113 120 120 150]'; ry = '[0 0 0 25 -25 25 -25 25 -25 0 0 0]'; lx = ['[0 23 23 24 28 34 40 47 52 55 56 54 51 51 47 46 ', ... '48 51 57 64 70 75 79 79 77 74 74 70 69 71 75 80 87 ', ... '93 99 102 103 101 97 97 94 93 94 98 104 110 117 ', ... '122 125 126 126 150]']; ly = ['[0 0 1 11 19 24 25 23 17 8 -2 -12 -18 -18 -9 1 11 ', ... '19 24 25 23 17 8 -2 -12 -18 -18 -9 1 11 19 24 25 ', ... '23 17 8 -2 -12 -18 -18 -9 1 11 19 24 25 23 17 8 0 0 0]']; cx1 = '[0 60 60 57 55 57 60 60 57 55]'; cy1 = '[0 0 8 16 25 16 8 -8 -16 -25]'; cx2 = '[90 90 90 150]'; cy2 = '[25 -25 0 0]'; switch tipo case 1 % RC series a{4} = 'off'; a{5} = 'on'; p1 = '0'; p2 = '-50'; p3 = '300'; p4 = '50'; p5 = rx; p6 = ry; p7 = [cx1,'+150']; p8 = cy1; p9 = [cx2,'+150']; p10 = cy2; display1 = ['plot(',p1,',',p2,',',p3,',',p4,',',p5,',',p6,',', ... p7,',',p8,',',p9,',',p10,')']; case 2 % RL series a{4} = 'on'; a{5} = 'off'; p1 = '0'; p2 = '-50'; p3 = '300'; p4 = '50'; p5 = rx; p6 = ry; p7 = [lx,'+150']; p8 = ly; display1 = ['plot(',p1,',',p2,',',p3,',',p4,',',p5,',',p6,',', ... p7,',',p8,')']; case 3 % RLC series a{4} = 'on'; a{5} = 'on'; p1 = '0'; p2 = '-50'; p3 = '450'; p4 = '50'; p5 = rx; p6 = ry; p7 = [lx,'+150']; p8 = ly; p9 = [cx1,'+300']; p10 = cy1; p11 = [cx2,'+300']; p12 = cy2; display1 = ['plot(',p1,',',p2,',',p3,',',p4,',',p5,',',p6,',', ... p7,',',p8,',',p9,',',p10,',',p11,',',p12,')']; end set_param(object,'MaskDisplay',display1); case 'Shunt' values = str2num(Values{2}); names = get_param(object,'MaskNames'); if strcmp(names{2},'p6q') tipo = values; else return end if tipo == 0 fm_choice('Shunt reactance should not be zero!',2) return end ground = ['[0 0],[-0.4 0.4],[0.075 0.075],[-0.25 0.25],[0.15' ... ' 0.15],[-0.1 0.1]']; if tipo < 0 % inductance lx = ['-[0 23 23 24 28 34 40 47 52 55 56 54 51 51 47 46 ', ... '48 51 57 64 70 75 79 79 77 74 74 70 69 71 75 80 87 ', ... '93 99 102 103 101 97 97 94 93 94 98 104 110 117 ', ... '122 125 126 126 150]/150']; ly = ['[0 0 1 11 19 24 25 23 17 8 -2 -12 -18 -18 -9 1 11 ', ... '19 24 25 23 17 8 -2 -12 -18 -18 -9 1 11 19 24 25 ', ... '23 17 8 -2 -12 -18 -18 -9 1 11 19 24 25 23 17 8 0 0 0]/45']; display1 = ['plot(',lx,',',ly,',',ground,',0,-0.5)']; elseif tipo > 0 % conductance cx1 = '-[0 60 60 55 53 55 60 60 55 53]/150'; cy1 = '[0 0 8 16 25 16 8 -8 -16 -25]/50'; cx2 = '-[80 80 80 150]/150'; cy2 = '[25 -25 0 0]/50'; display1 = ['plot(',cx1,',',cy1,',',cx2,',',cy2,',',ground,')']; end set_param(object,'MaskDisplay',display1);endset_param(object,'MaskEnables',a);set_param(object,'MaskPrompts',b);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -