1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-23 00:00:01 +01:00
VILLASnode/include/villas/nodes/iec61850.hpp

106 lines
2.2 KiB
C++
Raw Normal View History

/** Some helpers to libiec61850
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
2022-03-15 09:28:57 -04:00
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
2022-07-04 18:20:03 +02:00
* @license Apache 2.0
*********************************************************************************/
#pragma once
#include <cstdint>
2022-03-14 19:37:29 -04:00
#include <netinet/ether.h>
#include <libiec61850/hal_ethernet.h>
#include <libiec61850/goose_receiver.h>
#include <libiec61850/sv_subscriber.h>
#include <villas/list.hpp>
#include <villas/signal.hpp>
#include <villas/signal_list.hpp>
#ifndef CONFIG_GOOSE_DEFAULT_DST_ADDRESS
#define CONFIG_GOOSE_DEFAULT_DST_ADDRESS {0x01, 0x0c, 0xcd, 0x01, 0x00, 0x01}
#endif
namespace villas {
namespace node {
2021-06-21 16:11:42 -04:00
/* Forward declarations */
class NodeCompat;
2021-06-21 16:11:42 -04:00
2019-06-23 16:13:23 +02:00
enum class IEC61850Type {
/* According to IEC 61850-7-2 */
2019-04-22 23:43:46 +02:00
BOOLEAN,
INT8,
INT16,
INT32,
INT64,
INT8U,
INT16U,
INT32U,
INT64U,
FLOAT32,
FLOAT64,
ENUMERATED,
CODED_ENUM,
OCTET_STRING,
VISIBLE_STRING,
OBJECTNAME,
OBJECTREFERENCE,
TIMESTAMP,
ENTRYTIME,
/* According to IEC 61850-8-1 */
2019-04-22 23:43:46 +02:00
BITSTRING
};
struct iec61850_type_descriptor {
const char *name;
2019-06-23 16:13:23 +02:00
enum IEC61850Type iec_type;
enum SignalType type;
unsigned size;
bool publisher;
bool subscriber;
};
struct iec61850_receiver {
char *interface;
EthernetSocket socket;
2019-06-23 16:13:23 +02:00
enum class Type {
2019-04-22 23:43:46 +02:00
GOOSE,
SAMPLED_VALUES
} type;
union {
SVReceiver sv;
GooseReceiver goose;
};
};
2019-04-23 13:14:47 +02:00
int iec61850_type_start(villas::node::SuperNode *sn);
int iec61850_type_stop();
const struct iec61850_type_descriptor * iec61850_lookup_type(const char *name);
int iec61850_parse_signals(json_t *json_signals, struct List *signals, SignalList::Ptr node_signals);
2019-06-23 16:13:23 +02:00
struct iec61850_receiver * iec61850_receiver_lookup(enum iec61850_receiver::Type t, const char *intf);
2019-06-23 16:13:23 +02:00
struct iec61850_receiver * iec61850_receiver_create(enum iec61850_receiver::Type t, const char *intf);
int iec61850_receiver_start(struct iec61850_receiver *r);
int iec61850_receiver_stop(struct iec61850_receiver *r);
int iec61850_receiver_destroy(struct iec61850_receiver *r);
const struct iec61850_type_descriptor * iec61850_lookup_type(const char *name);
} /* namespace node */
} /* namespace villas */