1 /* Copyright (c) 2019-2020. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #ifndef SURF_NETWORK_WIFI_HPP_
7 #define SURF_NETWORK_WIFI_HPP_
11 #include "network_cm02.hpp"
12 #include "xbt/string.hpp"
22 class NetworkWifiLink : public LinkImpl {
23 /** @brief Hold every rates association between host and links (host name, rates id) */
24 std::map<xbt::string, int> host_rates_;
26 /** @brief A link can have several bandwith attach to it (mostly use by wifi model) */
27 std::vector<Metric> bandwidths_;
29 /** @brief Should we use the decay model ? */
30 bool use_decay_model_=false;
31 /** @brief Wifi ns-3 802.11n average bit rate */
32 const double wifi_max_rate_=54*1e6 / 8;
33 /** @brief ns-3 802.11n minimum bit rate */
34 const double wifi_min_rate_=41.70837*1e6 / 8;
35 /** @brief Decay model calibration */
37 /** @brief Decay model calibration: bitrate when using model_n_ stations */
38 const double model_rate_=42.61438*1e6 / 8;
39 /** @brief Decay model bandwidths */
40 std::vector<Metric> decay_bandwidths_;
43 NetworkWifiLink(NetworkCm02Model* model, const std::string& name, std::vector<double> bandwidths,
46 void set_host_rate(const s4u::Host* host, int rate_level);
47 /** @brief Get the AP rate associated to the host (or -1 if not associated to the AP) */
48 double get_host_rate(const s4u::Host* host);
50 s4u::Link::SharingPolicy get_sharing_policy() override;
51 void apply_event(kernel::profile::Event*, double) override { THROW_UNIMPLEMENTED; }
52 void set_bandwidth(double) override { THROW_UNIMPLEMENTED; }
53 void set_latency(double) override { THROW_UNIMPLEMENTED; }
54 void refresh_decay_bandwidths();
55 bool toggle_decay_model();
58 } // namespace resource
60 } // namespace simgrid
61 #endif /* SURF_NETWORK_WIFI_HPP_ */