Commit 456ff5f0 authored by Gonzalo Belcredi's avatar Gonzalo Belcredi

5-6-20

parent fad94002
__pycache__
fig
temp
No preview for this file type
......@@ -9,7 +9,7 @@ SimulationTimeslots = int(t_end / step)
time = np.arange(t_start,t_end,step)
# NUMBER NODES AND GATEWAYS
NumberNodes = 500
NumberNodes = 1000
NumberGateways = NumberNodes / 20
# Problem data.
......
......@@ -59,11 +59,18 @@ def solve_ode(t_start,t_end,y0,alfa,lda,mu,c,k,k1,v,restrictions = False):
def phase_diagram(npl,ntx,nidle):
constante = gamma / (NumberNodes*(1 - epsilon_energy))
np_eq_energy = constante / (1 + (mu/(k*v))*(1/alfa-1))
nt_eq_energy = gamma / (NumberNodes*(1 - epsilon_energy)) - np_eq_energy
plt.figure(figsize = (12,10))
plt.plot(time,ntx,color='r',label='Transmitting',alpha=.5)
plt.plot(time,npl,color='g',label='Processing',alpha=.5)
plt.plot(time,nidle,color='b',label='Idle',alpha=.5)
plt.plot(time,ntx+npl+nidle,color='k',label='Total',alpha=.5)
plt.axhline(y = np_eq_energy, linestyle='dotted',color='green', label = 'Equilibrio en recta de energia (np)')
plt.axhline(y = nt_eq_energy, linestyle='dotted',color='red',label = 'Equilibrio en recta de energia (nt)')
plt.xlabel('Time (s)')
plt.legend()
plt.show()
......@@ -109,6 +116,9 @@ def phase_diagram(npl,ntx,nidle):
else:
dy[i][j] = (1-alfa)*lda*(1-X[i][j]-Y[i][j])-k*v*Y[i][j]
constante = gamma / (NumberNodes*(1 - epsilon_energy))
np_eq_energy = constante / (1 + (mu/(k*v))*(1/alfa-1))
fig, ax = plt.subplots(figsize=(14,14))
p = PatchCollection(patches, alpha=0.1)
p.set_color(['red','blue'])
......@@ -121,6 +131,7 @@ def phase_diagram(npl,ntx,nidle):
plt.plot(npl,ntx,'-',markersize=4,color='r',alpha=.5,label='Simulation Trajectory')
plt.plot(npl_t,ntx_t,linewidth=3,c='blue',label = 'Model Trajectory')
plt.plot(np.linspace(0,1,100),gamma / (NumberNodes*(1 - epsilon_energy)) - np.linspace(0,1,100),'-',label = 'Energetic Boundary')
plt.scatter(np_eq_energy,gamma / (NumberNodes*(1 - epsilon_energy)) - np_eq_energy,marker='*',c='green',s=150,label='Equilibrium Energy Boundary (Model)')
plt.scatter(np_lin_eq,nt_lin_eq,marker='x',c='green',s=150,label='Equilibrium Lin Point (Model)')
plt.scatter(np_sat_eq,nt_sat_eq,marker='+',c='orange',s=150,label='Equilibrium Sat Point (Model)')
plt.legend()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment