This document discusses interfacing EMTP-RV with other software using C++. It describes how a DLL interface allows EMTP-RV to offer an API for implementing user models. It also discusses how a C++ interface maps EMTP's memory space and includes a skeleton that handles calls to and from EMTP. The document outlines how the interface can be used to link with control code from third-party software and for distributed simulation using the High Level Architecture standard.
2. Overview
> EMTP-RV DLL interface
> Interface implementation using C++
> Usage
• Simulink
• 3rd party software
• Distributed Simulation
> Future work
2 Groupe – Technologie
3. EMTP DLL Interface
> What is the DLL Interface ?
• DLL is an external, separate piece of code
linked to EMTP-RV at run-time
• EMTP-RV offers an API allowing the
implementation of user models
• API includes all functions necessary to
interact with computational engine
• API functions and structures are written in
FORTRAN 95
3 Groupe – Technologie
4. DLL Interface in C++
> Why C++ ?
• Interface with 3rd-party software
> C++ interface maps EMTP memory
space
> C++ skeleton that handles all calls
to/from EMTP
> User implements interface functions
4 Groupe – Technologie
5. Interface Usage
> Linking with control code
> Controllable and observable signals are
inputs/outputs to 3rd-party control
libraries
> No participation from user model in
system matrices
5 Groupe – Technologie
6. Using Simulink design in EMTP
> Protection relay algorithm developped
at IREQ using Simulink
> Impossible to duplicate design in EMTP
> Production code and model code stem
from single simulink design
6 Groupe – Technologie
7. Using Simulink design in EMTP
> Use existing Simulink designs
> Availability of Simulink extensive list of
toolboxes
> Complex Simulink models
• Multiple sample times
• C-language S-functions
> Simulink code is portable, compact, fast
and efficient
7 Groupe – Technologie
8. Using Simulink design in EMTP
> C++ code generated with Embedded
Real-Time toolbox
> User defines inputs, outputs, tunable
parameters
> Compiled design has 3 top-level
functions
• Initialise
• Step
• Terminate
8 Groupe – Technologie
9. Simulink DLL Interface Architecture
U se r M o d el
C + + DL L
E M T P -R V In sta nc e 1
L o ca l Da ta
Str u ct u res S im u link
Co de
In s ta nce 2
L o c al D a ta
S tru ctu re s
9 Groupe – Technologie
10. Generating Simulink DLL Interface
> Integrate Simulink code to interface
code and compile together
> Use observable and controllable signals
as input/output pins in EMTP
> Generate symbol in EMTP
10 Groupe – Technologie
11. Limitations
> If Simulink design is modified, must
regenerate and compile
> Each design requires customizing
interface code
> Matlab variable initialisation cannot be
compiled
> Fixed time step
11 Groupe – Technologie
12. Linking with 3rd party software
> Coupling with other C++ models
> 3rd party can provide black-box models
generated with their own software
> Example : HVDC controller model
generated by manufacturer, provided to
HQ as black-box model
12 Groupe – Technologie
13. Distributed Simulation
> High Level Architecture is IEEE
standard
> Federation controlled by RTI
> Distributed simulation can be
performed with any HLA compatible
software
> EMTP DLL interface acts as bridge
between EMTP and RTI
13 Groupe – Technologie
14. Distributed Simulation
> NS2 (telecom simulator) modified to
support HLA
> Co-simulation run with NS2 and EMTP
> Drawback : high overhead, not
necessary to share at each timestep
> Early steps of development
14 Groupe – Technologie
15. Future Work
> Get the process of generating a model
more user-friendly and generic
> Co-simulation with Simulink
> Development of HLA co-simulation
15 Groupe – Technologie