-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfm_block.m
53 lines (42 loc) · 1.32 KB
/
fm_block.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
function fm_block
% FM_BLOCK change the mask properties of the current
% selected Simulink block
%
%see also FM_LIB, FM_SIM, FM_SIMDATA, FM_SIMSETT
%
%Author: Federico Milano
%Date: 11-Nov-2002
%Update: 01-Aug-2003
%Update: 13-Jul-2007
%
%E-mail: [email protected]
%Web-site: faraday1.ucd.ie/psat.html
%
% Copyright (C) 2002-2019 Federico Milano
fm_var
sys = get_param(0,'CurrentSystem');
cblock = get_param(sys,'CurrentBlock');
gg = get_param([sys,'/',cblock],'Selected');
mask = get_param([sys,'/',cblock],'MaskType');
Object = [sys,'/',cblock];
Values = get_param(Object,'MaskValues');
set_param(Object,'LinkStatus','none')
a = get_param(Object,'MaskEnables');
b = get_param(Object,'MaskPrompts');
switch mask
case {'Areas', 'Bus', 'Breaker', 'Exc', 'Hvdc', 'Ltc', 'Mn', ...
'Ind', 'Oxl', 'Pl', 'PQ', 'PQgen', 'Pss', 'Regions', ...
'Shunt', 'Sssc', 'Svc', 'SW', 'Syn', 'Tcsc', 'Tg'}
[a,b] = block(eval(mask),Object,Values,a,b);
end
set_param(Object,'MaskEnables',a);
set_param(Object,'MaskPrompts',b);
% set block status
if strcmp(mask,'Breaker'), return, end
if strcmp(mask,'Fault'), return, end
if Settings.hostver < 9.05
switch Values{end}
case 'off', set_param(Object,'ForegroundColor','orange');
otherwise, set_param(Object,'ForegroundColor','black');
end
end