Conversation
gh0st42
left a comment
There was a problem hiding this comment.
Thank you for your work!
I left some remarks..
maybe you can also add some central logging to indicate when a node goes out of power (once)
| def __repr__(self) -> str: | ||
| return str(self) | ||
|
|
||
| def on_receive(self): |
There was a problem hiding this comment.
the function name should match the one in node.py from where it is called, e.g., on_recv
| """handling message receive""" | ||
| self.energy -= self._receive | ||
|
|
||
| def on_forward(self): |
There was a problem hiding this comment.
the function name should match the one in node.py from where it is called, e.g., on_send
forwarding is something from the routing side, on the lower levels its just a transmission that consumes energy
|
|
||
| def on_receive(self): | ||
| """handling message receive""" | ||
| self.energy -= self._receive |
There was a problem hiding this comment.
where is the transmission time? sending costs a specific amount of energy per time. so a large chunk of data might need several minutes and thus should consume more power
|
|
||
| def on_forward(self): | ||
| """handling message forward""" | ||
| self.energy -= self._forward |
There was a problem hiding this comment.
where is the transmission time? sending costs a specific amount of energy per time. so a large chunk of data might need several minutes and thus should consume more power
| self.max_energy: float = max_energy | ||
| self._idle: float = idle | ||
| self._receive: float = receive | ||
| self._forward: float = forward |
| net = [] | ||
| if energy_model is None: | ||
| energy_model = pons.DefaultEnergyModel() | ||
| if isinstance(energy_model, pons.EnergyModel): |
There was a problem hiding this comment.
maybe some errorhandling here would be nice with user feedback
| self.store_add(msg) | ||
| if msg.dst == self.my_id: | ||
| # self.log("msg arrived", self.my_id) | ||
| # print("msg arrived", self.my_id) |
There was a problem hiding this comment.
why did you replace the central logging with a print statement?
| def scan(self): | ||
| while True: | ||
| node = self.netsim.nodes[self.my_id] | ||
| while node.energy_model.energy > 0: |
There was a problem hiding this comment.
why have this check here? isn't it enough to have an energy check in the send and receive functions of node.py so the router or any other upper layers are not relevant any more? ofc the scan loop can also contain the check to avoid some CPU cycles but deactivating the node functions is the safe bet to ensure that no further communication happens
| yield self.env.timeout(self.scan_interval) | ||
|
|
||
| def on_scan_received(self, msg: pons.Message, remote_id: int): | ||
| if self.netsim.nodes[self.my_id].energy_model.energy <= 0: |
There was a problem hiding this comment.
why have this check here? isn't it enough to have an energy check in the send and receive functions of node.py so the router or any other upper layers are not relevant any more? ofc the scan loop can also contain the check to avoid some CPU cycles but deactivating the node functions is the safe bet to ensure that no further communication happens
No description provided.