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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

106 lines
2.2 KiB
C++
Raw Permalink Normal View History

/* Some helpers to libiec61850.
*
2022-03-15 09:18:01 -04:00
* Author: Steffen Vogel <post@steffenvogel.de>
2022-03-15 09:28:57 -04:00
* SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
2022-07-04 18:20:03 +02:00
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <cstdint>
2022-03-14 19:37:29 -04:00
#include <netinet/ether.h>
#include <libiec61850/goose_receiver.h>
#include <libiec61850/hal_ethernet.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
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
BITSTRING
};
struct iec61850_type_descriptor {
const char *name;
enum IEC61850Type iec_type;
enum SignalType type;
unsigned size;
bool publisher;
bool subscriber;
};
struct iec61850_receiver {
char *interface;
EthernetSocket socket;
enum class Type { 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);
struct iec61850_receiver *
iec61850_receiver_lookup(enum iec61850_receiver::Type t, const char *intf);
struct iec61850_receiver *
iec61850_receiver_create(enum iec61850_receiver::Type t, const char *intf,
bool check_dst_address);
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