Commit 1e3624e7 authored by Stefan Dähling's avatar Stefan Dähling
Browse files

modifications in q behavior

parent d792e274
......@@ -1019,11 +1019,11 @@ void Swarm_prosumer_behavior::determine_q_operation_range(double v_norm, double
else if (v_norm < prosumer_data->v_setpoint) {
/* voltage is low -> behave as producer */
prosumer_data->Q_min = -q_a;
prosumer_data->Q_max = 0;
if (prosumer_data->Q_max > q_max_old) {
/* hysteresis to prevent oscillations */
prosumer_data->Q_max = q_max_old;
}
prosumer_data->Q_max = q_a;
//if (prosumer_data->Q_max > q_max_old) {
// /* hysteresis to prevent oscillations */
// prosumer_data->Q_max = q_max_old;
//}
}
//else if (v_norm < prosumer_data->v_setpoint) {
// /* voltage is low -> behave as producer */
......@@ -1038,11 +1038,11 @@ void Swarm_prosumer_behavior::determine_q_operation_range(double v_norm, double
else if (v_norm < prosumer_data->v_setpoint + 0.025) {
/* voltage is high -> behave as consumer */
prosumer_data->Q_max = q_a;
prosumer_data->Q_min = 0;
if (prosumer_data->Q_min < q_min_old) {
/* hysteresis to prevent oscillations */
prosumer_data->Q_min = q_min_old;
}
prosumer_data->Q_min = -q_a;
//if (prosumer_data->Q_min < q_min_old) {
// /* hysteresis to prevent oscillations */
// prosumer_data->Q_min = q_min_old;
//}
}
else {
/* voltage is very high -> increase Q_min towards q_a at 1.075 */
......@@ -1065,6 +1065,12 @@ void Swarm_prosumer_behavior::determine_q_operation_range(double v_norm, double
if (prosumer_data->Q_min < -q_a) {
prosumer_data->Q_min = -q_a;
}
if (prosumer_data->Q_optimal > prosumer_data->Q_max) {
prosumer_data->Q_optimal = prosumer_data->Q_max;
}
else if (prosumer_data->Q_optimal < prosumer_data->Q_min) {
prosumer_data->Q_optimal = prosumer_data->Q_min;
}
return;
}
......
......@@ -420,8 +420,8 @@ void Swarm_substation_behavior::apply_control_values()
* ((100.0*substation_data->N) / substation_data->range));
}
else if (knowledge_comm.get_slack_agent() != 0
&& slack_svc.needed_max < substation_data->Vnom1*NEGOTIATION_THRESHOLD_FACTOR
&& sub_svc.needed_max < 2*substation_data->Vnom1*NEGOTIATION_THRESHOLD_FACTOR) {
&& slack_svc.needed_max < substation_data->Vnom1*NEGOTIATION_THRESHOLD_FACTOR) {
//&& sub_svc.needed_max < 10*substation_data->Vnom1*NEGOTIATION_THRESHOLD_FACTOR) {
/* slack cannot be provided with reactive power -> decrease voltage as much as possible
* in order to have reactive power flexibility */
n_delta = floor(-0.9 * ((100.0*substation_data->N) / substation_data->range) - 1.0 + v_min
......@@ -429,6 +429,11 @@ void Swarm_substation_behavior::apply_control_values()
if (n_delta > 1) {
n_delta = 1;
}
else if (n_delta < 0) {
if (v_min > 0.9125) {
n_delta = 0;
}
}
substation_data->v1_setpoint = 1.0 + (substation_data->range / (100.0 * substation_data->N));
}
else if (knowledge_comm.get_slack_agent() != 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment