Skip to content
Snippets Groups Projects

Add method to get remaining energy ratio

Needed for routing protocol v2

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
47 // Initialize router with energy model knowing about a certain communication bus.
48 ActiveRouter router = new EpidemicRouter(settings);
49 ModuleCommunicationBus communicationBus = new ModuleCommunicationBus();
50 List<NetworkInterface> interfaces = new ArrayList<>(1);
51 interfaces.add(new TestInterface(settings));
52 DTNHost host = new TestDTNHost(interfaces, communicationBus, settings);
53 router.init(host, new ArrayList<>());
54 router.update();
55
56 // Decrease energy.
57 communicationBus.updateProperty(EnergyModel.ENERGY_VALUE_ID, SOME_ENERGY_LEVEL);
58
59 // Test remaining energy ratio.
60 Assert.assertEquals("Expected different energy ratio.",
61 SOME_ENERGY_LEVEL / EnergyModelTest.MAX_ENERGY, router.remainingEnergyRatio(), DOUBLE_COMPARISON_DELTA);
62 }
  • added Needs Changes and removed Needs Review labels

  • Ghost User mentioned in merge request !101 (merged)

    mentioned in merge request !101 (merged)

  • Ghost User resolved all discussions

    resolved all discussions

  • merged

  • Ghost User mentioned in commit de2a3c64

    mentioned in commit de2a3c64

  • Please register or sign in to reply
    Loading