/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
void NetworkCm02Model::update_actions_state_lazy(double now, double /*delta*/)
{
while (not get_action_heap().empty() && double_equals(get_action_heap().top_date(), now, sg_surf_precision)) {
void NetworkCm02Model::update_actions_state_lazy(double now, double /*delta*/)
{
while (not get_action_heap().empty() && double_equals(get_action_heap().top_date(), now, sg_surf_precision)) {
auto* action = static_cast<NetworkCm02Action*>(get_action_heap().pop());
XBT_DEBUG("Something happened to action %p", action);
auto* action = static_cast<NetworkCm02Action*>(get_action_heap().pop());
XBT_DEBUG("Something happened to action %p", action);
if (action->latency_ > 0) {
action->set_variable(get_maxmin_system()->variable_new(action, 0.0, -1.0, constraints_per_variable));
if (action->latency_ > 0) {
action->set_variable(get_maxmin_system()->variable_new(action, 0.0, -1.0, constraints_per_variable));
// add to the heap the event when the latency is payed
double date = action->latency_ + action->get_last_update();
// add to the heap the event when the latency is payed
double date = action->latency_ + action->get_last_update();
if (link->get_sharing_policy() == s4u::Link::SharingPolicy::WIFI) {
NetworkWifiLink* wifi_link = static_cast<NetworkWifiLink*>(link);
if (link->get_sharing_policy() == s4u::Link::SharingPolicy::WIFI) {
NetworkWifiLink* wifi_link = static_cast<NetworkWifiLink*>(link);
- double rate = wifi_link->get_host_rate(src);
- if (rate == -1)
- rate = wifi_link->get_host_rate(dst);
- xbt_assert(rate != -1,
+ double wifi_rate = wifi_link->get_host_rate(src);
+ if (wifi_rate == -1.0)
+ wifi_rate = wifi_link->get_host_rate(dst);
+ xbt_assert(wifi_rate != -1.0,
"None of the source (%s) or destination (%s) is connected to the Access Point '%s'. "
"Please use set_host_rate() on all stations.",
src->get_cname(), dst->get_cname(), link->get_cname());
"None of the source (%s) or destination (%s) is connected to the Access Point '%s'. "
"Please use set_host_rate() on all stations.",
src->get_cname(), dst->get_cname(), link->get_cname());
if (sg_weight_S_parameter > 0) {
double delta = sg_weight_S_parameter / value - sg_weight_S_parameter / (bandwidth_.peak * bandwidth_.scale);
if (sg_weight_S_parameter > 0) {
double delta = sg_weight_S_parameter / value - sg_weight_S_parameter / (bandwidth_.peak * bandwidth_.scale);