- double power_scale = 0.0;
- double power_initial = 0.0;
- tmgr_trace_t power_trace = NULL;
- e_surf_cpu_state_t state_initial = SURF_CPU_OFF;
- tmgr_trace_t state_trace = NULL;
- double interference_send = 0.0;
- double interference_recv = 0.0;
- double interference_send_recv = 0.0;
-
- surf_parse_get_double(&power_scale,A_cpu_power);
- surf_parse_get_double(&power_initial,A_cpu_availability);
- surf_parse_get_trace(&power_trace,A_cpu_availability_file);
-
- xbt_assert0((A_cpu_state==A_cpu_state_ON)||
- (A_cpu_state==A_cpu_state_OFF),
- "Invalid state")
- if (A_cpu_state==A_cpu_state_ON) state_initial = SURF_CPU_ON;
- if (A_cpu_state==A_cpu_state_OFF) state_initial = SURF_CPU_OFF;
- surf_parse_get_trace(&state_trace,A_cpu_state_file);
-
- surf_parse_get_double(&interference_send,A_cpu_interference_send);
- surf_parse_get_double(&interference_recv,A_cpu_interference_recv);
- surf_parse_get_double(&interference_send_recv,A_cpu_interference_send_recv);
-
- workstation_new(A_cpu_name, power_scale, power_initial, power_trace, state_initial,
- state_trace, interference_send, interference_recv,
- interference_send_recv);
+ 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);
+ }