- workstation_KCCFLN05_t workstation = xbt_new0(s_workstation_KCCFLN05_t, 1);
-
- workstation->resource = (surf_resource_t) surf_workstation_resource;
- workstation->name = xbt_strdup(name);
- workstation->id = nb_workstation++;
-
- workstation->power_scale = power_scale;
- workstation->power_current = power_initial;
- if (power_trace)
- workstation->power_event =
- tmgr_history_add_trace(history, power_trace, 0.0, 0, workstation);
+ int cpt;
+ surf_action_workstation_KCCFLN05_t action = NULL;
+ if ((!xbt_dynar_length(cpu->incomming_communications)) &&
+ (!xbt_dynar_length(cpu->outgoing_communications))) {
+ /* No communications */
+ lmm_update_constraint_bound(maxmin_system, cpu->constraint,
+ cpu->power_current * cpu->power_scale);
+ } else if ((!xbt_dynar_length(cpu->incomming_communications))
+ && (xbt_dynar_length(cpu->outgoing_communications))) {
+ /* Emission */
+ lmm_update_constraint_bound(maxmin_system, cpu->constraint,
+ cpu->power_current * cpu->power_scale *
+ cpu->interference_send);
+ xbt_dynar_foreach(cpu->outgoing_communications, cpt, action)
+ lmm_elem_set_value(maxmin_system, cpu->constraint,
+ action->variable,
+ cpu->power_current * cpu->power_scale *
+ ROUTE(action->src->id,
+ action->dst->id).impact_on_src);
+ } else if ((xbt_dynar_length(cpu->incomming_communications))
+ && (!xbt_dynar_length(cpu->outgoing_communications))) {
+ /* Reception */
+ lmm_update_constraint_bound(maxmin_system, cpu->constraint,
+ cpu->power_current * cpu->power_scale *
+ cpu->interference_recv);
+ xbt_dynar_foreach(cpu->incomming_communications, cpt, action)
+ lmm_elem_set_value(maxmin_system, cpu->constraint,
+ action->variable,
+ cpu->power_current * cpu->power_scale *
+ ROUTE(action->src->id,
+ action->dst->id).impact_on_dst);
+ } else {
+ /* Emission & Reception */
+ lmm_update_constraint_bound(maxmin_system, cpu->constraint,
+ cpu->power_current * cpu->power_scale *
+ cpu->interference_send_recv);
+ xbt_dynar_foreach(cpu->outgoing_communications, cpt, action)
+ lmm_elem_set_value(maxmin_system, cpu->constraint,
+ action->variable,
+ cpu->power_current * cpu->power_scale *
+ ROUTE(action->src->id,
+ action->dst->id).
+ impact_on_src_with_other_recv);
+ xbt_dynar_foreach(cpu->incomming_communications, cpt, action)
+ lmm_elem_set_value(maxmin_system, cpu->constraint,
+ action->variable,
+ cpu->power_current * cpu->power_scale *
+ ROUTE(action->src->id,
+ action->dst->id).
+ impact_on_dst_with_other_send);
+ }
+}