Commit 5efcc65e authored by Gonzalo Belcredi's avatar Gonzalo Belcredi

power grid condition tx / pl

parent 8cc8b538
......@@ -147,7 +147,7 @@ class IoTNode:
TimeEnd = TimeStart + int(np.round(1./(self.ProcessingRate)))
if self.Timestamp <= TimeEnd:
finished = 0
if StorageObj.Status == 'Charged' and StatsObj.energy_region(self.Timestamp):
if ((not(StorageObj.Grid) and StorageObj.Status == 'Charged') or (StorageObj.Grid)) and StatsObj.energy_region(self.Timestamp):
self.update_status('Processing')
StorageObj.storage_access(self.Timestamp,-self.EnergyProcessing)
StatsObj.add_processor(self.Timestamp)
......@@ -182,7 +182,7 @@ class IoTNode:
TxTime = self.TxTime
TimeEnd = TimeStart + int(np.round(TxTime))
if self.Timestamp <= TimeEnd:
if StorageObj.Status == 'Charged' and StatsObj.energy_region(self.Timestamp):
if ((not(StorageObj.Grid) and StorageObj.Status == 'Charged') or (StorageObj.Grid)) and StatsObj.energy_region(self.Timestamp):
self.update_status('Transmitting')
self.BitRate[self.Timestamp] = 1 / (config.v * TxTime)
ChannelObj.channel_access(self.NodeId,self.Timestamp)
......
......@@ -38,7 +38,7 @@ class Storage:
return self.Status
def update_state(self):
if self.Level >= self.MinLevel:
if self.Level > self.MinLevel:
self.Status = 'Charged'
else:
self.Status = 'Discharged'
\ No newline at end of file
......@@ -158,7 +158,7 @@ def phase_diagram(npl,ntx,nidle,params_s):
plt.plot(npl_t,ntx_t,linewidth=3,c='blue',label = 'Model Trajectory')
plt.plot(np.linspace(0,1,100),config.energy_max_per_node - np.linspace(0,1,100),'-',label = 'Energetic Boundary')
plt.scatter(np_eq_energy,nt_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_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()
plt.xlabel(config.get_config_string(params_s))
......
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