-
Notifications
You must be signed in to change notification settings - Fork 0
/
switchInports.m
60 lines (57 loc) · 2.06 KB
/
switchInports.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
54
55
56
57
58
59
60
nonRealTimeAftBlock = [pTopModelName, '/FexAftWorkspace'];
nonRealTimeBowBlock = [pTopModelName, '/FexBowWorkspace'];
realTimeBlock = [pTopModelName, '/FexRealtime'];
% try/ catch - if line already deleted or added - throws errs
switch simulationType
case "NonRealTime"
%port 1 on realtime inports is AFT
try
delete_line(pTopModelName, 'FexRealtime/1', 'FexAftMult/1');
catch
end
%port 2 on realtime is BOW
try
delete_line(pTopModelName, 'FexRealtime/2', 'FexBowMult/1');
catch
end
% comment out realtime with root level inports
set_param(realTimeBlock, 'commented', 'on');
% un-comment from workspace blocks
set_param(nonRealTimeAftBlock, 'commented', 'off');
set_param(nonRealTimeBowBlock, 'commented', 'off');
% add lines from workspace to mult blocks
try
add_line(pTopModelName, 'FexAftWorkspace/1', 'FexAftMult/1', 'autorouting', 'on');
catch
end
try
add_line(pTopModelName, 'FexBowWorkspace/1', 'FexBowMult/1', 'autorouting', 'on');
catch
end
case "SingleSpeedgoat"
% delete lines from workspace to mult blocks
try
delete_line(pTopModelName, 'FexAftWorkspace/1', 'FexAftMult/1');
catch
end
try
delete_line(pTopModelName, 'FexBowWorkspace/1', 'FexBowMult/1');
catch
end
% un-comment realtime with root level inports
set_param(realTimeBlock, 'commented', 'off');
% comment out from workspace blocks
set_param(nonRealTimeAftBlock, 'commented', 'on');
set_param(nonRealTimeBowBlock, 'commented', 'on');
% add lines
%port 1 on realtime inports is AFT
try
add_line(pTopModelName, 'FexRealtime/1', 'FexAftMult/1', 'autorouting', 'on');
catch
end
%port 2 on realtime is BOW
try
add_line(pTopModelName, 'FexRealtime/2', 'FexBowMult/1', 'autorouting', 'on');
catch
end
end