ot-ns icon indicating copy to clipboard operation
ot-ns copied to clipboard

[Collision] Add collision detection and CCA support - Part 7 of RTEA

Open Vinggui opened this issue 3 years ago • 3 comments

Contribution description

This PR is part of the process of breaking PR #235 into small steps, a process nominated "Road to Energy Analysis" (RTEA). These small modifications will lead to the whole improvement started on March 2022. At the end of these steps, OT-NS will be capable of precisely estimating energy consumption, collision events (channel aware), and plot all the data in real-time as the simulation progress.

At the moment, OT-NS can not estimate energy, collisions, nor transmission energy. Also, even though OT is working well in simulation, many of its recovery properties are not correctly simulated as they would happen in real devices due to its incorrect timing events at the simulated radio part.

This PR adds functions to handle the radio-timed events (e.g., transmissions) by each simulated device. It is still compatible to the current implementation of the OT.

Main modifications

  • New event type eventTypeChannelActivity to support CCA procedures;
  • New variables to handle collision detection and CCA requests;

This PR keeps all previous commits to reduce future rebase efforts. However, relative to the timeline of RTEA, it addresses only the following files:

  • /ot-ns/dispatcher/dispatcher.go
  • /ot-ns/dispatcher/event.go
  • /ot-ns/dispatcher/Node.go

Requirements

None (if intended to be used with current Openthread repository). But, this is a walk to the road of PR #7500 in Openthread repository that will allow all the new features in the simulation to work.

Testing procedure

Just install OTNS the same way as before, using the "OTNS=1" for the building parameter.

Roadmap

This is part 7 of the RTEA (Road to Energy Analysis) steps to PR #235 and PR #7500.

Part 1: PR #357; Part 2: PR #8144; Part 3: PR #359; Part 4: PR #8152; Part 5: PR #362; Part 6: PR #8165; Part 7: This PR; Part 8: PR #8173; Part 9: PR #365; Part 10: PR #366; Part 11: PR #367.

Vinggui avatar Sep 15 '22 01:09 Vinggui

Codecov Report

Merging #363 (b2055e9) into main (c616148) will decrease coverage by 3.10%. The diff coverage is 11.54%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #363      +/-   ##
==========================================
- Coverage   49.97%   46.86%   -3.11%     
==========================================
  Files          38       40       +2     
  Lines        4608     4950     +342     
==========================================
+ Hits         2303     2320      +17     
- Misses       2123     2441     +318     
- Partials      182      189       +7     
Impacted Files Coverage Δ
cli/CmdRunner.go 22.62% <0.00%> (-0.51%) :arrow_down:
cli/ast.go 66.66% <ø> (ø)
types/types.go 65.38% <ø> (ø)
web/site/bindata.go 99.00% <ø> (-0.01%) :arrow_down:
visualize/grpc/pb/visualize_grpc.pb.go 18.77% <3.63%> (-0.66%) :arrow_down:
dispatcher/dispatcher.go 48.40% <3.84%> (-8.70%) :arrow_down:
energy/core.go 7.31% <7.31%> (ø)
dispatcher/Node.go 22.22% <24.00%> (-8.06%) :arrow_down:
energy/node.go 40.00% <40.00%> (ø)
simulation/simulation.go 57.94% <50.00%> (-0.31%) :arrow_down:
... and 5 more

codecov-commenter avatar Sep 15 '22 01:09 codecov-commenter

Just noting the intended change is in the 3rd commit (building upon other PRs), and mainly the dispatcher with some supporting fields/methods in Node.go. For the proposed design, the same comment I gave on PR #362 applies.

EskoDijk avatar Sep 15 '22 07:09 EskoDijk

Hi @bukepo , I saw the you last edited the GetRssi(uint16_t aChannel) function. With this PR that provides a CCA communication with OTNS, do you think we can link this function with the simulator to better provide an RSSI value?

Vinggui avatar Sep 15 '22 23:09 Vinggui