mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
iec61850-9-2: added type descriptors
This commit is contained in:
parent
2be839eae0
commit
6ce9b47f04
2 changed files with 62 additions and 0 deletions
|
@ -37,6 +37,7 @@
|
|||
#include "list.h"
|
||||
|
||||
enum {
|
||||
/* According to IEC 61850-7-2 */
|
||||
IEC61850_TYPE_BOOLEAN,
|
||||
IEC61850_TYPE_INT8,
|
||||
IEC61850_TYPE_INT16,
|
||||
|
@ -52,11 +53,25 @@ enum {
|
|||
IEC61850_TYPE_CODED_ENUM,
|
||||
IEC61850_TYPE_OCTET_STRING,
|
||||
IEC61850_TYPE_VISIBLE_STRING,
|
||||
IEC61850_TYPE_OBJECTNAME,
|
||||
IEC61850_TYPE_OBJECTREFERENCE,
|
||||
IEC61850_TYPE_TIMESTAMP,
|
||||
IEC61850_TYPE_ENTRYTIME,
|
||||
/* According to IEC 61850-8-1 */
|
||||
IEC61850_TYPE_BITSTRING
|
||||
} type;
|
||||
|
||||
struct iec61850_type_descriptor {
|
||||
enum iec61850_type type;
|
||||
const char *name;
|
||||
unsigned size;
|
||||
|
||||
/* Functions pointers */
|
||||
double (*subscriber_get)(SVClientASDU self, int index);
|
||||
int (*publisher_add)(SV_ASDU self);
|
||||
void (*publisher_set)(SV_ASDU self, int index, int8_t value);
|
||||
};
|
||||
|
||||
struct iec61850_sv_mapping {
|
||||
SV_ASDU *asdu;
|
||||
|
||||
|
|
|
@ -25,6 +25,39 @@
|
|||
#include "nodes/iec61850_sv.h"
|
||||
#include "plugin.h"
|
||||
|
||||
struct iec61850_type_descriptor type_descrptors[] = {
|
||||
[ IEC61850_TYPE_BOOLEAN ] = { "boolean", 1, NULL, NULL, NULL },
|
||||
[ IEC61850_TYPE_INT8 ] = { "int8", 1, SVClientASDU_getINT8, SV_ASDU_addINT8, SV_ASDU_setINT8 },
|
||||
[ IEC61850_TYPE_INT16 ] = { "int16", 2, SVClientASDU_getINT16, NULL, NULL },
|
||||
[ IEC61850_TYPE_INT32 ] = { "int32", 4, SVClientASDU_getINT32, SV_ASDU_addINT32, SV_ASDU_setINT32 },
|
||||
[ IEC61850_TYPE_INT64 ] = { "int64", 8, NULL, NULL, NULL },
|
||||
[ IEC61850_TYPE_INT8U ] = { "int8u", 1, SVClientASDU_getINT8U, NULL, NULL },
|
||||
[ IEC61850_TYPE_INT16U ] = { "int16u", 2, NULL, NULL, NULL },
|
||||
[ IEC61850_TYPE_INT24U ] = { "int24u", 3, NULL, NULL, NULL },
|
||||
[ IEC61850_TYPE_INT32U ] = { "int32u", 4, SVClientASDU_getINT32U, NULL, NULL },
|
||||
[ IEC61850_TYPE_FLOAT32 ] = { "float32", 4, SVClientASDU_getFLOAT32, SV_ASDU_addFLOAT, SV_ASDU_setFLOAT },
|
||||
[ IEC61850_TYPE_FLOAT64 ] = { "float64", 8, SVClientASDU_getFLOAT64, SV_ASDU_addFLOAT64, SV_ASDU_setFLOAT64 },
|
||||
[ IEC61850_TYPE_ENUMERATED ] = { "enumerated", 4, NULL, NULL, NULL },
|
||||
[ IEC61850_TYPE_CODED_ENUM ] = { "coded_enum", 4, NULL, NULL, NULL },
|
||||
[ IEC61850_TYPE_OCTET_STRING ] = { "octect_string", 20, NULL, NULL, NULL },
|
||||
[ IEC61850_TYPE_VISIBLE_STRING ] = { "visible_string", 35, NULL, NULL, NULL },
|
||||
[ IEC61850_TYPE_OBJECTNAME ] = { "objectname" 20, NULL, NULL, NULL },
|
||||
[ IEC61850_TYPE_OBJECTREFERENCE ] = { "objectreference", 20, NULL, NULL, NULL },
|
||||
[ IEC61850_TYPE_TIMESTAMP ] = { "timestamp", 8, NULL, NULL, NULL },
|
||||
[ IEC61850_TYPE_ENTRYTIME ] = { "entrytime", 6, NULL, NULL, NULL },
|
||||
[ IEC61850_TYPE_BITSTRING ] = { "bitstring", 4, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
struct iec61850_type_descriptor * iec61850_type_lookup(const char *name)
|
||||
{
|
||||
for (int i = 0; i < ARRAY_LEN(type_descriptors); i++) {
|
||||
if (!strcmp(name, type_descriptors[i].name))
|
||||
return &type_descriptors[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int iec61850_sv_reverse(struct node *n)
|
||||
{
|
||||
struct iec61850_sv *i __attribute__((unused)) = n->_vd;
|
||||
|
@ -35,6 +68,20 @@ int iec61850_sv_reverse(struct node *n)
|
|||
int iec61850_sv_parse(struct node *n, config_setting_t *cfg)
|
||||
{
|
||||
struct iec61850_sv *i __attribute__((unused)) = n->_vd;
|
||||
|
||||
config_setting_t *cfg_in, *cfg_out;
|
||||
|
||||
cfg_in = config_setting_get_member(cfg, "in");
|
||||
if (cfg_in) {
|
||||
if ()
|
||||
cerror(cfg_out, "Failed to parse input for node %s", node_name(n));
|
||||
}
|
||||
|
||||
cfg_out = config_setting_get_member(cfg, "out");
|
||||
if (cfg_out) {
|
||||
if ()
|
||||
cerror(cfg_out, "Failed to parse output for node %s", node_name(n));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue