forked from zanderbowen/AAE560-SP2019
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CommunicationNetwork.m
66 lines (54 loc) · 2 KB
/
CommunicationNetwork.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
61
62
63
64
65
66
function [comm_net] = CommunicationNetwork(dir_vec,cust_vec,sup_vec, mach_vec, rec_vec, ven_vec)
%*** Abstracted Status Quo Network of a Typical Job Shop ***
%Input director, supervisor, machine, vendor, customer, and receiving
%object vectors/arrays. Generate the network topology used to communicate within
%the JS SoS.
%the node names will correspond to the objects created with similar
%notation
%Director
%Customer.unique_id
%Supervisor.functional_group
%Machine.functional_group.machine_number
% Assume there is only one director, this is the "seed" of the graph
%Initialize an empty undirected graph from which to build the network.
comm_net=graph({},{});
%add the director node
source={'Director'};
comm_net=addnode(comm_net,source);
%build the director-customer links
for i=1:length(cust_vec)
target={['Customer.',num2str(cust_vec(i).unique_id)]};
weight= 4;
comm_net=addedge(comm_net,source,target,weight);
end
%build the director-supervisor links
%assume there is only one supervisor per machine group
for i=1:length(sup_vec)
target={['Supervisor.',sup_vec(i).functional_group]};
weight = 3;
comm_net=addedge(comm_net,source,target,weight);
end
%build the supervisor-machine links
%assume there is only one supervisor per machine group
for i=1:length(mach_vec)
source={['Supervisor.',mach_vec(i).functional_group]};
target={['Machine.',mach_vec(i).functional_group,num2str(mach_vec(i).machine_number)]};
weight = 2;
comm_net=addedge(comm_net,source,target,weight);
end
%build the supervisor-receiving links
%assume there is only a single receiving node
target={'Receiving'};
for i=1:length(sup_vec)
source={['Supervisor.',sup_vec(i).functional_group]};
weight = 3;
comm_net=addedge(comm_net,source,target,weight);
end
%build the receiving-vendor links
%assume there is only a single receiving node
target={'Receiving'};
for i=1:length(ven_vec)
source={['Vendor.',num2str(ven_vec(i).unique_id)]};
weight = 4;
comm_net=addedge(comm_net,source,target,weight);
end