Documentation Home Page RT-LAB Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

C37.118 Master Driver Help

This driver provides C37.118 Master functionalities to your simulation model.

What is C37.118?

The IEEE C37.118 streaming protocol is a standard for the exchange and communication of synchrophasors data (or PMU) that capture the steady state or the dynamic response of the power grid. The C37.118 protocol allows high-speed and real-time communication of a large amount of data with sampling rates ranging from 10 to 120 per second. The IEEE 37.118 protocol also addresses GPS time synchronization to associate GPS time stamp to each measurement performed on multiple units installed at various location of the grid.

OPAL-RT technologies support both master and slave protocol interface. The slave protocol is used to generate standard PMU data streams that contain synchrophasors that are measured in the simulated power grid. User can implement is own phasor estimation algorithm or phase-lock oscillator or use the default grid measurement. User can also time stamps synchrophasors using any of the standard GPS Time synchronization methods such as IEEE 1588, 1PSS or IRIG-B.

The master protocol is used to captures data stream from real physical PMU and PDC apparatus installed on the grid, and to deliver the data stream into the simulated model allowing the user to develop and prototype any control or protection algorithms. User can also prototype is own PDC devices.

The following diagram describes a setup involving three PMU (including two aggregated by a PDC) connected to the simulation model:


Glossary

NameDescription
DILData interchange layer. Communication subsystem of RT-LAB.
PDCPhasor data concentrator
PhasorRepresentation of a sinusoidal function such as current or voltage
PMUPhasor measurement unit
ROCOFRate of change of frequency


Supported Features

CategoryFeatureMasterSlave
CommunicationTCPOKOK

UDPOKOK

TCP+UDPOKOK

Serial


Encryption

ConfigurationConfiguration 1 & 2OKOK

Configuration 3


Header frameOKOK

Extended frame
OK
Phasors dataNominal frequencyOKOK

Frequency DeviationOKOK

Frequency deviation rate (ROCOF)OKOK

Polar notation (angle + magnitude)OKOK

Rectangular notation (real + imaginary)OKOK

Integer / Floating point encodingOKOK
Analogs dataValue + conversion factor supportOKOK

Integer / Floating point encodingOKOK
Digitals dataDigital value supportOKOK

Validation mask New!OK
Time & QualitySTAT word (clock sync, data validity...)OKpartial

Timestamp seconds (since EPOCH)OKOK

Timestamp fracsec (nanoseconds)OKOK

Checksum validationOKOK

Features of the Driver

Supported features of the protocol are listed in the feature table.

Additionally, it supports:

  • Multiple PMU/PDC per instances
  • Multiple streams per PDC
  • Import/export of PMU configuration for "not yet reachable" devices

Limitations of the Driver

  • Configuration 3 (CFG-3) not supported
  • SSL encrypted messages are not supported
  • Header frame is supported but not sent to Simulink as it does not accept strings.


Configuration of the Driver through the .config File

The list of PMU to connect to should be written in a text file sent next to the model on load. It is advised to take the configuration from the example model as a working basis.

Another example is given below:

OPAL-1.0 Object
C37118::Master::Configuration {
  autoRunAcq=0
  listeningTimeoutMs=30000	// timeout before declaring PMU "disconnected"
  pmuConnectionList {       	// List of "connection items"
    item {              	// PMU connection element (multiples possible)
      id=1              	// Identifier declared by the target PMU
      ip=127.0.0.1      	// IP address of the target PMU
      port=7200         	// Connection port of the target PMU
      protocol=TCP      	// Communication protocole: TCP, UDP ou TCP+UDP
      retryNbr=30       	// Number of connection attempts before giving up (1 second delay between each attempts)
      alias=EXAMPLE-MODEL	// Master's name
    }
  }
}


Warning: the role of "autoRunAcq" is important:
If it is set to 1, data acquisition will be started when loading the model, resulting in a possible loss of data.
If it is set to 0, data acquisition will have to be triggered manually in the console.



The following pictures show this console:



Warning: Please note that the parser is currently quite sensitive and does not accept blank lines nor comments. If you copy-paste the example above, please delete all comments (including the "//" sign).



If necessary, one can add the following optional elements:

OPAL-1.0 Object
C37118::Master::Configuration {
  specialAction = logToFile/c37118_master.log   // see "Special actions" section
  pmuConnectionList {       
    item {
      [...]             
    }
    item {
      [...]             
    }
  }
}

Connections in a .opal File

The C37.118 Master driver takes advantage of the new "DIL" subsystem. To bind Simulink variables (represented as opInput and opOutput blocks) to driver signals, we must define the connections in a text file named connections.opal (graphical editor will be available in a later release of RT-LAB):

OPAL-1.0 Object
List<SyncExchangerConnections> {
  item {
    id {
      C37118Master              			// name of the driver
      c37118_master_driver.config       		// configuration file associated
    }
    inputs {                    			// driver to model connection group
      item {                    			// connection 1
        dataInExchanger=EXAMPLE-MODEL/SOC  		// format: see below
        dataInProcess=OpInput:ts.seconds[0]    		// format: OpInput:<block alias>
      }
      item {                    			// connection 2
        dataInExchanger=EXAMPLE-MODEL/FracSec[0]
        dataInProcess=OpInput:ts.fracsec[0]
      }
      item {
        dataInExchanger=EXAMPLE-MODEL/ClockLocked[0]
        dataInProcess=OpInput:ts.locked[0]
      }
      item {
        dataInExchanger=EXAMPLE-MODEL/I1-PHASOR.magnitude[0]
        dataInProcess=OpInput:i.magnitude[0]
      }
      item {
        dataInExchanger=EXAMPLE-MODEL/I1-PHASOR.angle[0]
        dataInProcess=OpInput:i.angle[0]
      }
      item {
        dataInExchanger=EXAMPLE-MODEL/V1-PHASOR.magnitude[0]
        dataInProcess=OpInput:v.magnitude[0]
      }
      item {
        dataInExchanger=EXAMPLE-MODEL/V1-PHASOR.angle[0]
        dataInProcess=OpInput:v.angle[0]
      }
      item {
        dataInExchanger=EXAMPLE-MODEL/Freq[0]
        dataInProcess=OpInput:freq[0]
      }
      item {
        dataInExchanger=EXAMPLE-MODEL/ROCOF[0]
        dataInProcess=OpInput:rocof[0]
      }
      item {
        dataInExchanger=EXAMPLE-MODEL/AN-1[0]
        dataInProcess=OpInput:analog1[0]
      }
      item {
        dataInExchanger=EXAMPLE-MODEL/AN-2[0]
        dataInProcess=OpInput:analog2[0]
      }
    }
    outputs {
      item {
        dataInProcess=OpOutput:acquisitionEnable[0]
        dataInExchanger=startStopAcquisition[0]
      }
    }
  }
}

It is important to change both the .config and connections.opal files at the same time to avoid any connections problems. The most important thing is to check is if the alias in the .config file is written in all the data InExchanger lines in the connections.opal file.
In this example, the alias is "EXAMPLE-MODEL".

Format of the "dataInProcess" Connection Point

The format of the connection point in the Simulink model (dataInProcess line) is: <block type>:<identifier>

  • The block type is either OpInput for an incoming signal (driver to model) or OpOutput for an outgoing signal
  • The identifier is the id/alias of the block in Simulink :

Format of the "dataInExchanger" Connection Point

The format of the connection point in the driver (dataInExchanger line) is: <PMU alias>/name[0]

For phasors data, the name of the phasor must be completed with ".angle" and ".magnitude" (if polar notation) or ".real" and ".imaginary" to get the two components.

Examples:

  • Nanoseconds part ("FracSec") of the timestamp on PMU, PMU alias being "EXAMPLE-MODEL": EXAMPLE-MODEL/FracSec[0]
  • Time quality (clock locked to a reliable source) indicator of the previous PMU: EXAMPLE-MODEL/ClockLocked[0]
  • Magnitude of the Voltage phasor of the previous PMU: EXAMPLE-MODEL/V1-PHASOR.magnitude[0]
  • Analog 2 value of the previous PMU: EXAMPLE-MODEL/AN-2[0]

In order to help find the right connection points, a "special action" is available to write the exact list of available connection points into a text file. This file can then be retrieved or read via SSH or Telnet.

This information can also be displayed depending on the received frame type.

Example:

-  0. AN-1 at 0x982ade0 (F32)
-  1. AN-1.factor at 0x982a42c (U32)
-  2. AN-2 at 0x982ade4 (F32)
-  3. AN-2.factor at 0x982a434 (U32)
-  4. ClockLocked at 0x982b004 (F64)
-  5. DIG-1 00 at 0x98146d8 (PositionedBit<0>)
-  6. DIG-1 01 at 0x98146d8 (PositionedBit<1>)
-  7. DIG-1 02 at 0x98146d8 (PositionedBit<2>)
-  8. DIG-1 03 at 0x98146d8 (PositionedBit<3>)
-  9. DIG-1 04 at 0x98146d8 (PositionedBit<4>)
[...]
-  37. Error at 0x982af84 (I32)
-  38. FracSec at 0x982b010 (U32)
-  39. Freq at 0x982b140 (F32)
-  40. I1-PHASOR.angle at 0x982bcc4 (F32)
-  41. I1-PHASOR.magnitude at 0x982bcc0 (F32)
-  42. IA-PHASOR.angle at 0x982bcac (F32)
-  43. IA-PHASOR.magnitude at 0x982bca8 (F32)
-  44. IB-PHASOR.angle at 0x982bcb4 (F32)
-  45. IB-PHASOR.magnitude at 0x982bcb0 (F32)
-  46. IC-PHASOR.angle at 0x982bcbc (F32)
-  47. IC-PHASOR.magnitude at 0x982bcb8 (F32)
-  48. ROCOF at 0x982b144 (F32)
-  49. SOC at 0x982b00c (U32)
-  50. Stat.configChange at 0x982b12f (Boolean)
-  51. Stat.dataError at 0x982b128 (I32)
-  52. Stat.dataModified at 0x982b130 (Boolean)
-  53. Stat.dataSorting at 0x982b12d (Boolean)
-  54. Stat.inSync at 0x982b12c (Boolean)
-  55. Stat.timeQuality at 0x982b134 (I32)
-  56. Stat.triggerReason at 0x982b13c (I32)
-  57. Stat.unlockedTime at 0x982b138 (I32)
-  58. Status at 0x982af80 (I32)
-  59. Timebase at 0x982afd4 (U32)
-  60. V1-PHASOR.angle at 0x982bca4 (F32)
-  61. V1-PHASOR.magnitude at 0x982bca0 (F32)
-  62. VA-PHASOR.angle at 0x982bc8c (F32)
-  63. VA-PHASOR.magnitude at 0x982bc88 (F32)
-  64. VB-PHASOR.angle at 0x982bc94 (F32)
-  65. VB-PHASOR.magnitude at 0x982bc90 (F32)
-  66. VC-PHASOR.angle at 0x982bc9c (F32)
-  67. VC-PHASOR.magnitude at 0x982bc98 (F32)

Special Actions

Some special commands are available for debugging purpose. In most cases, the content of the files are intended to be read by support or development teams rather than end-users.

CommandFormatDescription
logToFilespecialAction=logToFile/filename.logWrite messages of the driver to filename.log
exportTreespecialAction=exportTree/filename.ptreeWrite the"property tree" of the driver to filename.ptree
exportConnectspecialAction=exportConnect/filename.logWrite the list of connection points available to filename.log
exportCfg2specialAction=exportCfg2Capture a configuration frame and write it to PMU-<host>-<port>-<id>.cfg2
importCfg2specialAction=importCfg2Read and use the configuration frame from PMU-<host>-<port>-<id>.cfg2

OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | opal-rt.com | +1 514-935-2323