Commit e9609ad1 authored by Stefan Dähling's avatar Stefan Dähling

added second voltage measurement to ensure message

parent ab777484
...@@ -50,6 +50,7 @@ public: ...@@ -50,6 +50,7 @@ public:
double *Q; //!< setpoint for reactive power double *Q; //!< setpoint for reactive power
int64_t *n; //!< set point for tap position int64_t *n; //!< set point for tap position
double *v; //!< voltage measurement value double *v; //!< voltage measurement value
double *v2; //!< second voltage measurement (for transformer)
double *SOC; //!< SOC measurement double *SOC; //!< SOC measurement
bool *connected; //!< connection status bool *connected; //!< connection status
int64_t *t_connected; //!< time until disconnection in seconds int64_t *t_connected; //!< time until disconnection in seconds
...@@ -65,6 +66,6 @@ public: ...@@ -65,6 +66,6 @@ public:
private: private:
void init_message(int _performative, int _agent_id, double _P, void init_message(int _performative, int _agent_id, double _P,
double _Q, int _n, double _v, double _SOC, bool _conn, int _t_conn); double _Q, int _n, double _v, double _v2, double _SOC, bool _conn, int _t_conn);
}; };
#endif //DISTAIX_ENSURE_MESSAGE_H #endif //DISTAIX_ENSURE_MESSAGE_H
...@@ -38,7 +38,7 @@ Ensure_msg::Ensure_msg() : Villas_message() { ...@@ -38,7 +38,7 @@ Ensure_msg::Ensure_msg() : Villas_message() {
connected = nullptr; connected = nullptr;
t_connected = nullptr; t_connected = nullptr;
init_message(0, 0, 0, 0.0, 0, 0.0, 0.0, false, 0); init_message(0, 0, 0, 0.0, 0, 0.0, 0.0, 0.0, false, 0);
} }
...@@ -60,7 +60,7 @@ Ensure_msg::Ensure_msg(int _performative, int _agent_id) { ...@@ -60,7 +60,7 @@ Ensure_msg::Ensure_msg(int _performative, int _agent_id) {
connected = nullptr; connected = nullptr;
t_connected = nullptr; t_connected = nullptr;
init_message(_performative, _agent_id, 0, 0.0, 0, 0.0, 0.0, false, 0); init_message(_performative, _agent_id, 0, 0.0, 0, 0.0, 0.0, 0.0, false, 0);
} }
void Ensure_msg::set_pointers() { void Ensure_msg::set_pointers() {
...@@ -78,7 +78,7 @@ void Ensure_msg::set_pointers() { ...@@ -78,7 +78,7 @@ void Ensure_msg::set_pointers() {
t_connected = &(data[8].i); t_connected = &(data[8].i);
} }
void Ensure_msg::init_message(int _performative, int _agent_id, double _P, double _Q, int _n, double _v, double _SOC, bool _conn, int _t_conn) { void Ensure_msg::init_message(int _performative, int _agent_id, double _P, double _Q, int _n, double _v, double _v2, double _SOC, bool _conn, int _t_conn) {
//add all data and meta elements of this message type //add all data and meta elements of this message type
Data_element perf_data; Data_element perf_data;
...@@ -105,6 +105,10 @@ void Ensure_msg::init_message(int _performative, int _agent_id, double _P, doubl ...@@ -105,6 +105,10 @@ void Ensure_msg::init_message(int _performative, int _agent_id, double _P, doubl
v_data.f = _v; v_data.f = _v;
add_element(v_data, VILLAS_DATA_TYPE_DOUBLE); add_element(v_data, VILLAS_DATA_TYPE_DOUBLE);
Data_element v2_data;
v2_data.f = _v2;
add_element(v2_data, VILLAS_DATA_TYPE_DOUBLE);
Data_element soc_data; Data_element soc_data;
soc_data.f = _SOC; soc_data.f = _SOC;
add_element(soc_data, VILLAS_DATA_TYPE_DOUBLE); add_element(soc_data, VILLAS_DATA_TYPE_DOUBLE);
...@@ -165,6 +169,12 @@ void Ensure_msg::init_meta() { ...@@ -165,6 +169,12 @@ void Ensure_msg::init_meta() {
v_meta.type = VILLAS_DATA_TYPE_DOUBLE; v_meta.type = VILLAS_DATA_TYPE_DOUBLE;
Ensure_msg::ensure_msg_meta.push_back(v_meta); Ensure_msg::ensure_msg_meta.push_back(v_meta);
Meta_infos v2_meta;
v2_meta.name = "v2";
v2_meta.unit = "V";
v2_meta.type = VILLAS_DATA_TYPE_DOUBLE;
Ensure_msg::ensure_msg_meta.push_back(v2_meta);
Meta_infos soc_meta; Meta_infos soc_meta;
soc_meta.name = "SOC"; soc_meta.name = "SOC";
soc_meta.unit = "state of charge"; soc_meta.unit = "state of charge";
...@@ -202,6 +212,7 @@ std::string Ensure_msg::get_message_output() ...@@ -202,6 +212,7 @@ std::string Ensure_msg::get_message_output()
<< " Q: " << *Q << " Q: " << *Q
<< " n: " << *n << " n: " << *n
<< " v: " << *v << " v: " << *v
<< " v2: " << *v2
<< " SOC: " << *SOC << " SOC: " << *SOC
<< " connected: " << *connected << " connected: " << *connected
<< " t_connected: " << *t_connected; << " t_connected: " << *t_connected;
......
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