2.1.2. Manufacturer-Supplier Dynamical Network Simulation.¶
This function simulates a Manufacturer-Supplier (MS) dynamical network.
-
dynamical_networks.simulate.MS_network.MS_network(A_MS, M_arr, S_arr, make_gif=False, make_graph_plot=False)[source]¶ This function takes system parameters to develop a time dependent adjacency matrix A(t).
- Parameters
A_MS (array) – Unweighted adjacency matrix for network.
M_arr (array) – Throughput array for manufacturers.
S_arr (array) – Throughput array for suppliers.
- Kwargs:
plotting (bool): Plotting for user interpretation. defaut is False.
- Returns
A, an n by n matrix A over time t.
- Return type
(matrix)
-
dynamical_networks.simulate.MS_network.MS_simulation(t, parameters)[source]¶ This function takes system parameters to develop a time dependent throughput simulation of manufacturers and suppliers.
- Parameters
parameter (float) – system parameter or parameters.
t (array) – time array for simulation.
- Kwargs:
plotting (bool): Plotting for user interpretation. defaut is False.
- Returns
Arrays of t for the throughput of manufacturers and suppliers.
- Return type
(M and S arrays)
The following is an example simulation of the supplier-manufacturer dynamical network:
from dynamical_networks.simulate.PG_network import PG_network
import matplotlib.pyplot as plt
import numpy as np
t = np.linspace(0,12, 5000)
P_gen = 1
P_con = 1
K_0 = 1.63
I_0 = 1
damping = 0.5
alpha = 0.6
V_gen = np.array([1, 4]) #vertices indices of generates and consumers
V_con = np.array([0, 2, 3])
A = np.array([[0, 1, 1, 0, 1],
[1, 0, 1, 1, 0],
[1, 1, 0, 1, 0],
[0, 1, 1, 0, 1],
[1, 0, 0, 1, 0]])
Fs, E = PG_network(A, t, V_gen, V_con, K_0, P_gen, P_con, alpha, I_0, damping, e_cut = (2,4))
#---------------PLOTTING-------------------
plt.figure(figsize = (10,5))
TextSize = 35
for i in range(len(Fs)):
plt.plot(t, Fs[i], label = '$('+str(E[i][0]+1)+','+str(E[i][1]+1)+')$')
plt.plot([0,max(t)], [alpha*K_0, alpha*K_0], 'k--')
plt.grid()
plt.xlim(0,max(t))
plt.ylim(0,)
plt.xticks(size = TextSize)
plt.yticks(size = TextSize)
plt.xlabel(r'$t$', size = TextSize)
plt.ylabel(r'$|F_{i,j}|$', size = TextSize)
plt.legend(loc = 'upper right', fontsize = TextSize-12, ncol = 1)
plt.show()
Where the output for this example is:
Figure results
