Skip to content

Commit

Permalink
new logical nodes for wind turbine
Browse files Browse the repository at this point in the history
  • Loading branch information
activeshadow committed Apr 17, 2024
1 parent 1529c82 commit 6eb88b3
Show file tree
Hide file tree
Showing 11 changed files with 2,968 additions and 9 deletions.
7 changes: 7 additions & 0 deletions src/c/cmd/ot-sim-61850-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@ find_package(LibXml2 REQUIRED)
include_directories(
${JSON_INCLUDE_DIRS}
${LIBXML2_INCLUDE_DIR}
include
)

file(GLOB ot-sim-61850-module_SRC
"src/*.c"
)

add_executable(ot-sim-61850-module
${ot-sim-61850-module_SRC}
main.c
)

target_link_libraries(ot-sim-61850-module
czmq
iec61850
${LIBXML2_LIBRARIES}
json-c
pthread
Expand Down
52 changes: 52 additions & 0 deletions src/c/cmd/ot-sim-61850-module/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# IEC 61850 Module

## Initial Design Approach

Predefined OT devices
* WTG main controller, yaw controller, blade controller, etc
* Specific, hard-coded tags for each controller
* Enabled via specific elements in OT-sim XML config

Alternatively, the WTG main controller could provide a 61400-25 IED via MMS
externally, and still use Modbus internally.

## Future Design Goals

Fully composable and configurable devices using relevant portions of CID files
in OT-sim XML config.
* Shoot for fully dynamic creation of LDs, LNs, DOs, DAs, etc at runtime
* May require precompilation step at runtime (like examples are now)

## Predefined Devices

### WTG Blade Controller

* LD:
* LN:
* DO:
* DA:

### Wind Turbine (WTUR)

iec61400-25-2{ed2.0}b.pdf - pg 22

Inherits from "Wind Power Plant Common" - pg 19

> Does WTUR need NamPlt, Beh, Health, and Mod since LLN0 already has it? What
> would it be specific to for WTUR vs LLN0? Maybe for a plant-wide logical
> device that has multiple WTUR nodes?
> Turns out it just needs Beh. The others are only mandatory in LLN0 for the
> root LD. A physical device may have multiple logical devices if it's acting as
> a concentrator, for example.
* WTUR
* NamPlt - LPL (iec61850-7-3{ed2.1}en.pdf - pg 106)
* vendor - VisString255
* swRev - VisString255
* configRev - VisString255
* Beh - ENS (iec61850-7-3{ed2.1}en.pdf - pg 36)
* stVal - EnumDA (of type BehaviourModeKind)
* q - Quality
* t - Timestamp
* Health - ENS (iec61850-7-3{ed2.1}en.pdf - pg 36)
* Mod - ENC (iec61850-7-3{ed2.1}en.pdf - pg 70)
10 changes: 10 additions & 0 deletions src/c/cmd/ot-sim-61850-module/include/ied.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef IED_H
#define IED_H

#include <stdlib.h>
#include <libiec61850/iec61850_model.h>

extern IedModel iedModel;
extern LogicalDevice iedModel_WTG;

#endif // IED_H
36 changes: 36 additions & 0 deletions src/c/cmd/ot-sim-61850-module/include/lln0.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#ifndef LLN0_H
#define LLN0_H

#include <stdlib.h>
#include <libiec61850/iec61850_model.h>

extern LogicalNode iedModel_WTG_LLN0;
extern DataObject iedModel_WTG_LLN0_Mod;
extern DataAttribute iedModel_WTG_LLN0_Mod_Oper;
extern DataAttribute iedModel_WTG_LLN0_Mod_Oper_ctlVal;
extern DataAttribute iedModel_WTG_LLN0_Mod_Oper_operTm;
extern DataAttribute iedModel_WTG_LLN0_Mod_Oper_origin;
extern DataAttribute iedModel_WTG_LLN0_Mod_Oper_origin_orCat;
extern DataAttribute iedModel_WTG_LLN0_Mod_Oper_origin_orIdent;
extern DataAttribute iedModel_WTG_LLN0_Mod_Oper_ctlNum;
extern DataAttribute iedModel_WTG_LLN0_Mod_Oper_T;
extern DataAttribute iedModel_WTG_LLN0_Mod_Oper_Test;
extern DataAttribute iedModel_WTG_LLN0_Mod_Oper_Check;
extern DataAttribute iedModel_WTG_LLN0_Mod_stVal;
extern DataAttribute iedModel_WTG_LLN0_Mod_q;
extern DataAttribute iedModel_WTG_LLN0_Mod_t;
extern DataAttribute iedModel_WTG_LLN0_Mod_ctlModel;
extern DataObject iedModel_WTG_LLN0_Beh;
extern DataAttribute iedModel_WTG_LLN0_Beh_stVal;
extern DataAttribute iedModel_WTG_LLN0_Beh_q;
extern DataAttribute iedModel_WTG_LLN0_Beh_t;
extern DataObject iedModel_WTG_LLN0_Health;
extern DataAttribute iedModel_WTG_LLN0_Health_stVal;
extern DataAttribute iedModel_WTG_LLN0_Health_q;
extern DataAttribute iedModel_WTG_LLN0_Health_t;
extern DataObject iedModel_WTG_LLN0_NamPlt;
extern DataAttribute iedModel_WTG_LLN0_NamPlt_vendor;
extern DataAttribute iedModel_WTG_LLN0_NamPlt_swRev;
extern DataAttribute iedModel_WTG_LLN0_NamPlt_configRev;

#endif // LLN0_H
27 changes: 27 additions & 0 deletions src/c/cmd/ot-sim-61850-module/include/lphd.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef LPHD_H
#define LPHD_H

#include <stdlib.h>
#include <libiec61850/iec61850_model.h>

extern LogicalNode iedModel_WTG_LPHD1;
extern DataObject iedModel_WTG_LPHD1_NamPlt;
extern DataAttribute iedModel_WTG_LPHD1_NamPlt_vendor;
extern DataAttribute iedModel_WTG_LPHD1_NamPlt_swRev;
extern DataAttribute iedModel_WTG_LPHD1_NamPlt_configRev;
extern DataObject iedModel_WTG_LPHD1_PhyNam;
extern DataAttribute iedModel_WTG_LPHD1_PhyNam_vendor;
extern DataAttribute iedModel_WTG_LPHD1_PhyNam_hwRev;
extern DataAttribute iedModel_WTG_LPHD1_PhyNam_swRev;
extern DataAttribute iedModel_WTG_LPHD1_PhyNam_serNum;
extern DataAttribute iedModel_WTG_LPHD1_PhyNam_model;
extern DataObject iedModel_WTG_LPHD1_PhyHealth;
extern DataAttribute iedModel_WTG_LPHD1_PhyHealth_stVal;
extern DataAttribute iedModel_WTG_LPHD1_PhyHealth_q;
extern DataAttribute iedModel_WTG_LPHD1_PhyHealth_t;
extern DataObject iedModel_WTG_LPHD1_Proxy;
extern DataAttribute iedModel_WTG_LPHD1_Proxy_stVal;
extern DataAttribute iedModel_WTG_LPHD1_Proxy_q;
extern DataAttribute iedModel_WTG_LPHD1_Proxy_t;

#endif // LPHD_H
44 changes: 44 additions & 0 deletions src/c/cmd/ot-sim-61850-module/include/wtur.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#ifndef WTUR_H
#define WTUR_H

#include <stdlib.h>
#include <libiec61850/iec61850_model.h>

extern LogicalNode iedModel_WTG_WTUR1;

extern DataObject iedModel_WTG_WTUR1_Beh;
extern DataAttribute iedModel_WTG_WTUR1_Beh_stVal;
extern DataAttribute iedModel_WTG_WTUR1_Beh_q;
extern DataAttribute iedModel_WTG_WTUR1_Beh_t;

extern DataObject iedModel_WTG_WTUR1_TotWh;

extern DataObject iedModel_WTG_WTUR1_TotWh_cntVal;
extern DataAttribute iedModel_WTG_WTUR1_TotWh_cntVal_actVal;
extern DataAttribute iedModel_WTG_WTUR1_TotWh_cntVal_pulsQty;
extern DataAttribute iedModel_WTG_WTUR1_TotWh_cntVal_q;
extern DataAttribute iedModel_WTG_WTUR1_TotWh_cntVal_t;

extern DataObject iedModel_WTG_WTUR1_TurSt;

extern DataObject iedModel_WTG_WTUR1_TurSt_st;
extern DataAttribute iedModel_WTG_WTUR1_TurSt_st_stVal;
extern DataAttribute iedModel_WTG_WTUR1_TurSt_st_q;
extern DataAttribute iedModel_WTG_WTUR1_TurSt_st_t;

extern DataObject iedModel_WTG_WTUR1_W;

extern DataAttribute iedModel_WTG_WTUR1_W_mag;
extern DataAttribute iedModel_WTG_WTUR1_W_mag_i;
extern DataAttribute iedModel_WTG_WTUR1_W_mag_f;
extern DataAttribute iedModel_WTG_WTUR1_W_q;
extern DataAttribute iedModel_WTG_WTUR1_W_t;

extern DataObject iedModel_WTG_WTUR1_TurOp;

extern DataObject iedModel_WTG_WTUR1_TurOp_st;
extern DataAttribute iedModel_WTG_WTUR1_TurOp_st_stVal;
extern DataAttribute iedModel_WTG_WTUR1_TurOp_st_q;
extern DataAttribute iedModel_WTG_WTUR1_TurOp_st_t;

#endif // WTUR_H
20 changes: 11 additions & 9 deletions src/c/cmd/ot-sim-61850-module/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

#include <libiec61850/iec61850_server.h>

#include "ied.h"

// ---- BEGIN PUB/SUB STUFF
// ---- PUTTING THIS HERE SINCE HAVING IT IN A SEPARATE HEADER/SOURCE FILE
// ---- CAUSES "MULTIPLE DEFINITION" ERRORS WITH HELICS CONSTANTS
Expand Down Expand Up @@ -420,16 +422,16 @@ int main(int argc, char **argv) {
signal(SIGINT, trap);
running = 1;

IedServerConfig config = IedServerConfig_create();
IedServer server = IedServer_create(&iedModel);

/* MMS server will be instructed to start listening to client connections. */
IedServer_start(server, 102);

DataObject iedModel_GenericIO_GGIO1_SPCSO1 = {
DataObjectModelType,
"SPCSO1",
(ModelNode*) &iedModel_GenericIO_GGIO1,
(ModelNode*) &iedModel_GenericIO_GGIO1_SPCSO2,
(ModelNode*) &iedModel_GenericIO_GGIO1_SPCSO1_origin,
0
};
if (!IedServer_isRunning(server)) {
printf("Starting IEC 61850 server failed - exiting now.\n");
IedServer_destroy(server);
exit(-1);
}

while (running) {
// Use poller here so we can break out of this thread quickly if program is
Expand Down
25 changes: 25 additions & 0 deletions src/c/cmd/ot-sim-61850-module/src/ied.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include "ied.h"
#include "lln0.h"

static void initializeValues() {}

IedModel iedModel = {
"WIND",
&iedModel_WTG,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
initializeValues
};

LogicalDevice iedModel_WTG = {
LogicalDeviceModelType,
"WTG",
(ModelNode*) &iedModel,
NULL,
(ModelNode*) &iedModel_WTG_LLN0
};
Loading

0 comments on commit 6eb88b3

Please sign in to comment.