SunSpec is a fairly old standard (in context), but it is also one that many Chinese companies don’t care for because it is considered to be American. That means that many of the more affordable PV inverters come with their own implementation, which may or may not be documented, and which makes it hard to integrate with other systems.
SunSpec usually runs on top of Modbus-TCP, but it doesn’t have to. It can also run on Modbus-RTU, or essentially anything else if you wanted to, but usually it is modbus. I haven’t seen anything else.
It has a standard starting register, which is 40000 (but there are a few alternatives). If you read two registers from 40000, you will always get 0x53 0x75 0x6E 0x53, or ‘SunS’ in ascii. This indicates that the device supports sunspec.
Following from 40002 onwards, you have so called “models”. Each model has a standard number and length. Some models are mandatory (your device must have them), but most are optional. Each model starts with its number, and it’s length. So if you read register 40002 and will almost always return the value 1 (model 1), and register 40003 will return 66, because model 1 has a standard length of 66.
This way, where each model (or block of registers) has a number and a length, means that any algorithm can read two registers, decide whether it can do anything with this block, and if it cannot, it can simply use the length register to skip OVER that block and read the next one.
When you read 0xFFFF, you’re done. No more models.
This makes it extremely easy to extend with new models, and for your readers to skip over stuff they don’t understand.
With all that said, PV-inverters will usually publish model 1 (which is mandatory, that has the manufacturer name and serial number and all that stuff), model 120 (the nameplate ratings), and then a single phase inverter will publish model 101 (the voltage, current and power stuff), and a 3-phase inverter will publish model 103.
Additionally many values have scale factors, which allows you to specify what power of ten the value is scaled by. Essentially, you can say how far left or right the decimal comma moves in the published value.
The layout of these models are defined in a set of documents you can download from sunspec.org.
The job of a translator will basically be to present a basic sunspec map (with models 1, 120 and 101/103), and then fetch the register from the non-standard device, rescale it if necessary, and put it into the standard map.
With this in place, any sunspec compliant device can read that PV inverter without requiring anything special to be done. In a Victron system, it will simply be detected automatically (if the slave id is 126) and just work out of the box.
Edit: For example, here is a python script that traverses the models and prints out the model numbers.
import sys
from pymodbus.client.sync import ModbusTcpClient as ModbusClient
host = sys.argv[1]
unit = int(sys.argv[2]) if len(sys.argv) > 2 else 126
modbus = ModbusClient(host=host)
modbus.connect()
start = 40002 # Start at 40000, first two registers have 'Su' and 'nS'.
while True:
r = modbus.read_holding_registers(start, 2, unit=unit)
if r.registers[0] == 0xFFFF: break
print ("model {} length {} at {}".format(r.registers[0], r.registers[1], start))
start += r.registers[1] + 2