Commit 0a6fb80a authored by Stefan Dähling's avatar Stefan Dähling

send trafo voltages

parent c138b38e
......@@ -41,6 +41,7 @@ protected:
private:
void apply_control_values();
void send_measurement_message();
Substation_data * substation_data; //!< pointer to equipment specific datastruct
Ensure_knowledge knowledge;
......
......@@ -51,6 +51,7 @@ void Ensure_substation_behavior::execute_agent_behavior()
IO->log_info("###### Process incoming messages");
process_incoming_messages();
send_measurement_message();
IO->log_info("###### Apply control values");
apply_control_values();
}
......@@ -76,6 +77,28 @@ void Ensure_substation_behavior::process_ensure_msg(Ensure_msg &msg)
send_villas_msg(new_msg);
}
void Ensure_substation_behavior::send_measurement_message()
{
if (t_next - knowledge.get_t_sent() > 10) {
double v1 = sqrt(substation_data->v1_re * substation_data->v1_re +
substation_data->v1_im * substation_data->v1_im);
double v2 = sqrt(substation_data->v2_re * substation_data->v2_re +
substation_data->v2_im * substation_data->v2_im);
Ensure_msg new_msg;
new_msg.time_sec = t_next;
*(new_msg.agent_id) = id;
*(new_msg.performative) = FIPA_PERF_INFORM;
*(new_msg.v) = v1;
*(new_msg.v2) = v2;
knowledge.set_v_meas(v1);
knowledge.set_v2_meas(v2);
IO->log_info("\tSend message: " + new_msg.get_message_output());
send_villas_msg(new_msg);
knowledge.set_t_sent(t_next);
}
return;
}
/*! \brief applies control value for tap changer according to secondary node voltage
* */
......
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