diff --git a/plugins/power_states.py b/plugins/power_states.py index c8e9d0e..be3d085 100644 --- a/plugins/power_states.py +++ b/plugins/power_states.py @@ -41,7 +41,7 @@ class PowerStates(NodePlugin): """ def __init__(self,node,power_init): self.node=node - self.clock=self.node.clock() + self.clock=self.node.read("clock") self.energy=0 self.power=power_init self.power_changes=dict() @@ -50,7 +50,7 @@ class PowerStates(NodePlugin): def set_power(self,power_watt): - cur_clock=self.node.clock() + cur_clock=self.node.read("clock") self.energy+=self.power*(cur_clock-self.clock) self.clock=cur_clock if self.power != power_watt: @@ -113,17 +113,17 @@ class PowerStatesComms(NodePlugin): self.energy_dynamic=0.0 # Store the dynamic part of the energy consumption self.power=dict() # Store the power states self.tx_clock=0 # Dynamic clock (store the time at which a the last tx starts - self.idle_clock=api.clock() # Store the start time (to compute the idle part of the energy consumption) + self.idle_clock=api.read("clock") # Store the start time (to compute the idle part of the energy consumption) def on_receive_return(self,interface,data,start_at,end_at): duration=float(end_at)-float(start_at) self.energy_dynamic+=self.power[interface]["rx"]*duration def on_send_call(self,interface,data,datasize,dst): - self.tx_clock=self.api.clock() + self.tx_clock=self.api.read("clock") def on_send_return(self,interface,data,datasize,dst,code): - clock=self.api.clock() + clock=self.api.read("clock") duration=(clock-float(self.tx_clock)) self.energy_dynamic+=self.power[interface]["tx"]*duration self.tx_clock=clock # Any value could be use here @@ -135,7 +135,7 @@ class PowerStatesComms(NodePlugin): self.power[interface]["tx"]=tx def get_idle(self): - clock=self.api.clock() + clock=self.api.read("clock") idle=0 for interface in self.power.keys(): idle+=(clock-self.idle_clock)*self.power[interface]["idle"] diff --git a/plugins/wireless_area.py b/plugins/wireless_area.py index b2e2432..958d4ba 100644 --- a/plugins/wireless_area.py +++ b/plugins/wireless_area.py @@ -1,6 +1,7 @@ import math import numpy as np +# This plugin is outdated class WirelessArea: def __init__(self):