From: Clément Courageux-Sudan Date: Wed, 2 Feb 2022 11:11:58 +0000 (+0100) Subject: zero wifi rate X-Git-Tag: v3.31~506^2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/ef19d0a41e041c4a9c54fe4bbfde1d599fcbd14b zero wifi rate --- diff --git a/include/simgrid/s4u/Link.hpp b/include/simgrid/s4u/Link.hpp index fec2d9a8d2..acb4092eeb 100644 --- a/include/simgrid/s4u/Link.hpp +++ b/include/simgrid/s4u/Link.hpp @@ -122,7 +122,10 @@ public: * current function to specify that a given host uses another level of bandwidth. This can be used to take the * location of hosts into account, or even to model mobility in your SimGrid simulation. * - * Note that this function asserts that the link is actually a wifi link */ + * Note that this function asserts that the link is actually a wifi link + * + * warning: in the case where a 0Mbps data rate should be used, set that rate only once during the + * experiment, and don't modify the bandwidth of that host later */ void set_host_wifi_rate(const s4u::Host* host, int level) const; /** @brief Returns the current load (in bytes per second) */ diff --git a/src/kernel/resource/WifiLinkImpl.cpp b/src/kernel/resource/WifiLinkImpl.cpp index 9ef1733d4e..f4c9b75d22 100644 --- a/src/kernel/resource/WifiLinkImpl.cpp +++ b/src/kernel/resource/WifiLinkImpl.cpp @@ -77,7 +77,7 @@ void WifiLinkImpl::refresh_decay_bandwidths() double min_bw = bandwidth.peak - (wifi_max_rate_ - wifi_min_rate_); double model_rate = bandwidth.peak - (wifi_max_rate_ - model_rate_); - xbt_assert(min_bw > 0, "Your WIFI link is using bandwidth(s) which is too low for the decay model."); + //xbt_assert(min_bw > 0, "Your WIFI link is using bandwidth(s) which is too low for the decay model."); double N0 = max_bw - min_bw; double lambda = (-log(model_rate - min_bw) + log(N0)) / model_n_; diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index 3c24efa961..29604a599f 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -221,12 +221,22 @@ void NetworkCm02Model::comm_action_expand_constraints(const s4u::Host* src, cons } /* WI-FI links needs special treatment, do it here */ - if (src_wifi_link != nullptr) - get_maxmin_system()->expand(src_wifi_link->get_constraint(), action->get_variable(), - 1.0 / src_wifi_link->get_host_rate(src)); - if (dst_wifi_link != nullptr) - get_maxmin_system()->expand(dst_wifi_link->get_constraint(), action->get_variable(), - 1.0 / dst_wifi_link->get_host_rate(dst)); + if (src_wifi_link != nullptr) { + /* In case of 0Mbps data rate, don't consider it in the LMM */ + if (src_wifi_link->get_host_rate(src) != 0) + get_maxmin_system()->expand(src_wifi_link->get_constraint(), action->get_variable(), + 1.0 / src_wifi_link->get_host_rate(src)); + else + get_maxmin_system()->update_variable_penalty(action->get_variable(), 0); + } + if (dst_wifi_link != nullptr) { + if (dst_wifi_link->get_host_rate(dst) != 0) + get_maxmin_system()->expand(dst_wifi_link->get_constraint(), action->get_variable(), + 1.0 / dst_wifi_link->get_host_rate(dst)); + else { + get_maxmin_system()->update_variable_penalty(action->get_variable(), 0); + } + } for (auto const* link : route) { if (link->get_sharing_policy() != s4u::Link::SharingPolicy::WIFI)