X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/8d336a6ef3b2aee3aa81de0fbedfaa9971b89fb3..6672758cce11400b8b7377e6e1d126365335093d:/src/surf/network_cm02.cpp diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index 883578bf6b..c99333ff4e 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -86,13 +86,18 @@ NetworkCm02Model::NetworkCm02Model(kernel::lmm::System* (*make_new_lmm_system)(b } set_maxmin_system(make_new_lmm_system(select)); - loopback_ = NetworkCm02Model::create_link("__loopback__", 498000000, 0.000015, s4u::Link::SharingPolicy::FATPIPE); + loopback_ = NetworkCm02Model::create_link("__loopback__", std::vector(1, 498000000), 0.000015, + s4u::Link::SharingPolicy::FATPIPE); } -LinkImpl* NetworkCm02Model::create_link(const std::string& name, double bandwidth, double latency, +LinkImpl* NetworkCm02Model::create_link(const std::string& name, const std::vector& bandwidths, double latency, s4u::Link::SharingPolicy policy) { - return new NetworkCm02Link(this, name, bandwidth, latency, policy, get_maxmin_system()); + if (policy == s4u::Link::SharingPolicy::WIFI) { + return (new NetworkWifiLink(this, name, bandwidths, policy, get_maxmin_system())); + } + xbt_assert(bandwidths.size() == 1, "Non WIFI links must use only 1 bandwidth."); + return new NetworkCm02Link(this, name, bandwidths[0], latency, policy, get_maxmin_system()); } void NetworkCm02Model::update_actions_state_lazy(double now, double /*delta*/) @@ -350,6 +355,20 @@ void NetworkCm02Link::set_latency(double value) } } +NetworkWifiLink::NetworkWifiLink(NetworkCm02Model* model, const std::string& name, std::vector bandwidths, + s4u::Link::SharingPolicy policy, lmm::System* system) + : NetworkCm02Link(model, name, 0, 0, policy, system) +{ + for (auto bandwith : bandwidths) { + bandwidths_.push_back({bandwith, 1.0, nullptr}); + } +} + +void NetworkWifiLink::set_host_rate(sg_host_t host, int rate_level) +{ + host_rates_.insert(std::make_pair(host->get_name(), rate_level)); +} + /********** * Action * **********/