Sunspec Test Tool and Reference Implementation John D. Blair jdb

Download Report

Transcript Sunspec Test Tool and Reference Implementation John D. Blair jdb

Sunspec Test Tool and Reference Implementation John D. Blair [email protected]

Power One, Inc: [email protected]

Features

 Command line application  Abstract definition of models in configuration files  Provides both a Modbus master and slave  TCP and RTU  Static device simulation  Includes a “museum” of tested devices  Multiple output formats (text, xml)  Open source, BSD License

Source Hosted on Github

https://github.com/jdblair/sunspec

Dependencies

 libmodbus (3.0.1)  GNU toolchain: gcc, flex, bison (yacc)  Tested on Ubuntu 10.4, 11.10

 Should work on other Linux and UNIX-like systems

Model Definition

 What is a model?

 Model id (did)     Description Data points  list of named data types with register offsets Data points are organized into blocks  Means of dealing with repeating blocks Simple assembler for cribbing static data

Data Types

 uint16, int16  uint32, int32  uint64, int64  float32, float64  acc16, acc32  enum16  bitfield16, bitfield32  sunssf (sunspec scale factor)  string (variable length)

Example: Common Model

} model suns { name "common" did 001 "common" datapoints { C_Manufacturer C_Model C_Options C_Version C_SerialNumber C_DeviceAddress } { string.32 } { string.32 } { string.16 } { string.16 } { string.32 } { uint16 }

Example: Common Model

 Offsets and length are implied by datatypes } model suns { did 001 "common" len 65 datapoints { C_Manufacturer { 3 C_Model { 19 string.32 } string.32 } C_Options { 35 C_Version { 43 string.16 } string.16 } C_SerialNumber { 51 C_DeviceAddress { 67 string.32 } uint16 } }

Example: Inverter Model

model suns { name "inverter" did 101 "single-phase inverter" did 102 "split-phase inverter" did 103 "three-phase inverter" datapoints { I_AC_Current I_AC_CurrentA I_AC_CurrentB I_AC_CurrentC I_AC_Current_SF I_AC_VoltageAB { uint16.I_AC_Current_SF u=amps } { uint16.I_AC_Current_SF u=amps } { uint16.I_AC_Current_SF u=amps } { uint16.I_AC_Current_SF u=amps } { sunssf } { uint16.I_AC_Voltage_SF u=volts } I_AC_VoltageBC I_AC_VoltageCA I_AC_VoltageAN I_AC_VoltageBN I_AC_VoltageCN I_AC_Voltage_SF { uint16.I_AC_Voltage_SF u=volts } { uint16.I_AC_Voltage_SF u=volts } { uint16.I_AC_Voltage_SF u=volts } { uint16.I_AC_Voltage_SF u=volts } { uint16.I_AC_Voltage_SF u=volts } { sunssf }

Example: Inverter Model

} I_Status I_Status_Vendor I_Event_1 I_Event_2 I_Event_1_Vendor I_Event_2_Vendor I_Event_3_Vendor I_Event_4_Vendor } define I_Status_Enum { I_STATUS_OFF I_STATUS_SLEEPING } } define T_bitfield16_BF { I_EVENT_GROUND_FAULT I_EVENT_DC_OVER_VOLT { enum16.I_Status_Enum } { enum16 } { bitfield32.I_Event_1_BF } { bitfield32 } { bitfield32 } { bitfield32 } { bitfield32 } { bitfield32 } { 1 "Off" } { 2 "Sleeping (auto-shutdown)" } { 0x00000001 "Ground fault" } { 0x00000002 "DC over voltage" }

Example: Inverter Model

model suns { name "inverter" did 101 "single-phase inverter" did 102 "split-phase inverter" did 103 "three-phase inverter" datapoints { I_AC_Current I_AC_CurrentA I_AC_CurrentB I_AC_CurrentC I_AC_Current_SF I_AC_VoltageAB { uint16.I_AC_Current_SF u=amps } { uint16.I_AC_Current_SF u=amps } { uint16.I_AC_Current_SF u=amps } { uint16.I_AC_Current_SF u=amps } { sunssf } { uint16.I_AC_Voltage_SF u=volts } I_AC_VoltageBC I_AC_VoltageCA I_AC_VoltageAN I_AC_VoltageBN I_AC_VoltageCN I_AC_Voltage_SF { uint16.I_AC_Voltage_SF u=volts } { uint16.I_AC_Voltage_SF u=volts } { uint16.I_AC_Voltage_SF u=volts } { uint16.I_AC_Voltage_SF u=volts } { uint16.I_AC_Voltage_SF u=volts } { sunssf }

Test Data

} data common_model_test { 001 65 string.32 : "Amalgamated Industries" # c_manufacturer string.32 : "Composite SuperDevice" # c_model string.16 : "Mark 2 <&'>" # c_options string.16 : "3.14.159" # c_version string.32 : "9876543210" # c_serialnumber uint16 : 99 # c_deviceaddress

Results

Timestamp: 2012-02-01T09:33:03-0800 data model: common(1) C_Manufacturer Amalgamated Industries C_Model Composite SuperDevice C_Options Mark 2 <&'> C_Version 3.14.159

C_SerialNumber 9876543210 C_DeviceAddress 99

Test Data

} data captured_1 { # did 1: common model 0x0001 0x0041 0x456e 0x6765 0x6e75 0x6974 0x7920 0x5379 # 001 - 008 0x7374 0x656d 0x732c 0x2049 0x6e63 0x2e00 0x0000 0x0000 # 009 - 016 0x0000 0x0000 0x456e 0x6765 0x6e75 0x6974 0x792d 0x434d # 017 - 024 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 # 025 - 032 0x0000 0x0000 0x3000 0x0000 0x0000 0x0000 0x0000 0x0000 # 033 - 040 0x0000 0x0000 0x3100 0x0000 0x0000 0x0000 0x0000 0x0000 # 041 - 048 0x0000 0x0000 0x5345 0x5249 0x414c 0x0000 0x0000 0x0000 # 049 - 056 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 # 057 - 064 0x0000 0x0000 0x003c # 065 - 067 } data captured_307 { # did 307: meteorological v1.1 model 0x0133 0x000b 0x00c6 0x003b 0x03eb 0x0000 0x00b4 0x0000 # 001 - 008 0x0000 0x8000 0x8000 0x8000 0x8000 # 009 - 013

Results

Timestamp: 2012-02-01T09:26:15-0800 data model: common(1) C_Manufacturer Engenuity Systems, Inc.

C_Model Engenuity-CM C_Options 0 C_Version 1 C_SerialNumber SERIAL C_DeviceAddress 60 data model: meteorological v1.1(307) E_BaseMet_AirTemperature 19.8 degrees_c E_BaseMet_RelativeHumidity 59 percent E_BaseMet_BarometricPressure 1003 HPa E_BaseMet_WindSpeed 0 m/s E_BaseMet_WindDirection 180 degrees E_BaseMet_Rain 0 mm E_BaseMet_Snow 0 mm

Logger XML Output

Engenuity Systems, Inc.

Engenuity-CM

0

1

SERIAL

60

198

59

1003

0

180

0

0

Development Roadmap

 Track all new models as developed and adopted  Logger Host Implementation  Complete Logger Implementation  Python implementation of modbus master  For readability and portability  Test of inverter control  Abstract Test Model  Documentation, Promotion  XML and CSV Model Definition

XML Model Description

CSV Model Description

5, 6, 7, 8, did 101 offset, size, 3, 4, name, 1, I_AC_Current_SF 1, 9, 10, 11, 1, 1, 1, 1, 1, 1, 1, 12, 13, 14, 1, 1, 1, type, I_AC_Current, I_AC_CurrentA, I_AC_CurrentB, I_AC_CurrentC, I_AC_Current_SF, I_AC_VoltageAB, I_AC_VoltageBC, I_AC_VoltageCA, I_AC_VoltageAN, I_AC_VoltageBN, I_AC_VoltageCN, I_AC_Voltage_SF, scale_factor uint16, uint16, I_AC_Current_SF uint16, I_AC_Current_SF uint16, I_AC_Current_SF sunssf, uint16, I_AC_Voltage_SF uint16, I_AC_Voltage_SF uint16, I_AC_Voltage_SF uint16, I_AC_Voltage_SF uint16, I_AC_Voltage_SF uint16, I_AC_Voltage_SF sunssf,

Questions?

John D. Blair [email protected]