synchrophasor — Port 4712 IEEE C37.118 PMU Phasors & CRC-CCITT
- Default Port / Protocol
- TCP 4712 (or UDP 4712/4713 via transport udp)
- Host Endpoint Rule
- Dual-Stack IPv4/IPv6
- Wireshark Display Filter
- synphasor
- Standards & Specs
- IEEE C37.118.2-2011, IEC/IEEE 60255-118-1
What It Does on the Wire
Wide-area grid Phasor Measurement Units stream 50/60 Hz telemetry on port 4712: synchrophasor packs the 0xaa sync byte, id code, SOC timestamp, fracsec, station name, and trailing CRC-16-CCITT automatically.
IEEE C37.118.2 Synchrophasor (synchrophasor) streams GPS/PTP time-synchronized Phasor Measurement Unit (PMU) voltage/current phase angles, grid frequency (50/60 Hz), and Rate of Change of Frequency (ROCOF) to Phasor Data Concentrators (PDCs) at 30–120 frames per second on TCP port 4712 and UDP port 4713. Every frame starts with a 0xaa SYNC byte (Type | Version), 16-bit FRAMESIZE, 16-bit IDCODE (id), 32-bit UTC SOC (timestamp), 32-bit FRACSEC (Time Quality + Fraction of Second), frame body (Data 0, Header 1, CFG-2 2/3, or Command 4), and a trailing 16-bit CRC-CCITT (0x1021, init 0xffff).
FrameAssembly computes FRAMESIZE and the trailing IEEE C37.118 CRC-CCITT automatically across TCP or transport udp streams.
Wide-Area Situational Awareness (WAMS) PDC <-> PMU Command & Stream Labs
Script a PDC sending cmd "sendcfg2" (0x0005) and cmd "dataon" (0x0002) over TCP 4712, followed by 60 Hz (wait 16667us) msgtype "data" synchrophasor streams.
Hybrid TCP Command (4712) + High-Rate UDP Data (dstport 4713 transport udp)
Validate NERC CIP Electronic Security Perimeter firewalls configured for split C37.118 control (TCP 4712) and unidirectional UDP 4713 phasor streaming.
GPS Spoofing / Time-Quality & Corrupted CRC-CCITT Testing
Manipulate timestamp (SOC), fracsec time-quality flags, status unlocked-clock bits, or override crc to test OpenPDC / GridProtectionAlliance anomaly detectors.
RFC Wire Header Layout (synchrophasor)
Select any 32-bit wire word or field slice below to inspect which .frasm modifiers control those octets and what defaults the compiler writes.
Filter with synphasor on TCP/UDP 4712 to inspect the 0xaa sync word, Frame Size, ID Code, SOC UTC timestamp, FRACSEC, Station Name, and trailing CRC-16-CCITT.
Minimal Quickstart (synchrophasor_quickstart.frasm)
Select Preview Packets to compile in-browser and inspect timestamps + wire byte lengths, or open directly in the Playground.
host regional_pdc { ip 10.118.1.10 }
host sub_pmu_01 { ip 10.118.2.50 }
compile {
regional_pdc -> sub_pmu_01 tcp syn srcport 54712 dstport 4712 wait 1ms
regional_pdc <- sub_pmu_01 tcp syn ack wait 1ms
regional_pdc -> sub_pmu_01 tcp ack wait 1ms
regional_pdc -> sub_pmu_01 synchrophasor cmd "dataon" id 101 timestamp 1735689600 wait 3ms
regional_pdc <- sub_pmu_01 synchrophasor msgtype "data" id 101 timestamp 1735689600 fracsec 0 status 0x0000
}Handled Automatically on the Wire
- Defaults to stateful TCP port
4712(transport udpswitches to UDP4712, or pair withdstport 4713for spontaneous UDP data streams). - Encodes
SYNC = 0xaa00 | (FrameType << 4) | Version(0xaa01Data,0xaa11Header,0xaa31CFG-2,0xaa41Command) and exact 16-bitFRAMESIZE. - Calculates the big-endian 16-bit
CRC-CCITT(poly 0x1021,init 0xffff) over the entire frame unlesscrcis explicitly overridden.
PMU Configuration Handshake (CFG-2) + 60 Hz UDP 4713 Synchrophasor Stream
Requests PMU 101’s CFG-2 descriptor (station "SUB_WEST_500KV") and enables real-time transmission over TCP 4712, then streams consecutive 16.667 ms UDP 4713 phasor frames.
host openpdc_srv { ip 172.27.118.5 }
host pmu_500kv { ip 172.27.118.101 }
compile {
openpdc_srv -> pmu_500kv tcp syn srcport 51712 dstport 4712 wait 1ms
openpdc_srv <- pmu_500kv tcp syn ack wait 1ms
openpdc_srv -> pmu_500kv tcp ack wait 1ms
// 1. PDC requests CFG-2 (0x0005) -> PMU returns 16-byte padded STN "SUB_WEST_500KV"
openpdc_srv -> pmu_500kv synchrophasor cmd "sendcfg2" id 101 timestamp 1735689600 wait 2ms
openpdc_srv <- pmu_500kv synchrophasor msgtype "cfg2" id 101 station "SUB_WEST_500KV" timestamp 1735689600 wait 3ms
// 2. PDC sends Turn On Transmission (0x0002)
openpdc_srv -> pmu_500kv synchrophasor cmd "dataon" id 101 timestamp 1735689600 wait 2ms
// 3. PMU streams 60fps (16667us gap) synchrophasor data over UDP 4713 with DSCP EF (46)
pmu_500kv -> openpdc_srv synchrophasor msgtype "data" id 101 timestamp 1735689601 fracsec 0 status 0x0000 dstport 4713 dscp 46 transport udp wait 16667us
pmu_500kv -> openpdc_srv synchrophasor msgtype "data" id 101 timestamp 1735689601 fracsec 16667 status 0x0000 dstport 4713 dscp 46 transport udp
}# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show synchrophasor_pdc_pmu_stream.frasm
# 2. Compile .frasm -> classic .pcap, nanosecond .pcapng, or pipe via '-'
frameassembly synchrophasor_pdc_pmu_stream.frasm synchrophasor_pdc_pmu_stream.pcap
frameassembly synchrophasor_pdc_pmu_stream.frasm synchrophasor_pdc_pmu_stream.pcapng
# 3. Round-trip .pcap <-> .frasm whenever you want to scrub or tweak an existing capture
frameassembly reverse synchrophasor_pdc_pmu_stream.pcap synchrophasor_pdc_pmu_stream_edited.frasm
# 4. Verify dissected protocol fields in tshark
tshark -r synchrophasor_pdc_pmu_stream.pcap -Y "synphasor"All synchrophasor Keywords & Header Options
Every sub-keyword and header option is lowercase [a-z0-9]+ with zero underscores — mix and match them in any order after synchrophasor:
src_host -> dst_host synchrophasor [msgtype "<text>"] [version <1..2>] [id <0..65535>] [timestamp <number>] [fracsec <number>] [cmd "<text_or_num>"] [status <0..65535>] [station "<text>"] [crc <0..65535>] [transport <tcp|udp>]| Keyword / Option | Accepted Value | Default | Effect on Packet |
|---|---|---|---|
| msgtype "<text>" | cmd "<text_or_num>" | Frame Type ("data","header","cfg1","cfg2","cmd") or 16-bit PDC Command ("dataoff","dataon","sendhdr","sendcfg1","sendcfg2") | msgtype "data" (or "cmd" when cmd is set) | Selects C37.118 Frame Type (0 Data, 1 Header, 2 CFG-1, 3 CFG-2, 4 Command) and Command word (0x0001 Data Off, 0x0002 Data On, 0x0005 Send CFG-2). |
| version <1..2> | id <0..65535> | 4-bit C37.118 Version (1=2005, 2=2011) & 16-bit PMU/PDC IDCODE | version 1, id 1 | Writes the low nibble of SYNC byte 1 and bytes 4..5 (IDCODE). |
| timestamp <number> | fracsec <number> | 32-bit UTC Second-of-Century (SOC) & 32-bit FRACSEC (Time Quality + 24-bit fraction) | timestamp 1700000000, fracsec 0 | Writes bytes 6..13 (SOC and FRACSEC) used by PDCs to time-align phasors across substations. |
| status <0..65535> | station "<text>" | 16-bit Data Frame STAT bitmask & 16-char ASCII STN Station Name (on cfg1/cfg2) | status 0x0000 (Valid/Locked), station "PMU_STATION_01" | Writes PMU STAT flags in Data frames or the space-padded 16-byte STN field in Configuration frames. |
| crc <0..65535> | transport <tcp|udp> | Optional 16-bit CRC-CCITT override & L4 transport selector | Auto CRC-CCITT, transport tcp | Replaces the trailing 2-byte CRC-CCITT or switches between TCP and UDP. |
Cross-Layer Wrappers Valid with synchrophasor
802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol
15 options
Cross-Layer Wrappers Valid with synchrophasor
802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol
| Option | Range / Format | Default | Effect on Packet |
|---|---|---|---|
| wait <number><ns|us|ms|s|m> | Time gap (ns, us, ms, s, m) | 10ms | Advances the packet timestamp clock after sending this packet and before the next packet (wait 0ns sends back-to-back). |
| comment "<text>" | Quoted UTF-8 annotation | Omitted | Attaches an Enhanced Packet Block opt_comment annotation when compiling to .pcapng (Wireshark pkt_comment filter). |
| payload "<text>" | hexpayload "<hex>" | Quoted text or hex bytes (choose one) | Omitted | Appends or overrides raw payload bytes ("deadbeef", "de:ad:be:ef", or "\x01\x02") and updates packet lengths and checksums. |
| srcmac <mac> | dstmac <mac> | ethertype <0..65535> | Colon/hyphen/Cisco MAC · EtherType 0..65535 (e.g. 0x0800) | Host MAC / RFC multicast MAC / auto EtherType | Overrides the 14-byte Ethernet II source MAC, destination MAC, or standalone Layer 2 16-bit EtherType. |
| fcs | badfcs | Ethernet CRC-32 trailer flags (choose one) | Omitted | fcs appends a valid IEEE 802.3 4-byte CRC-32 Frame Check Sequence trailer; badfcs XOR-corrupts the CRC-32 for NIC/tap negative tests. |
| vlan <0..4095> [pcp <0..7>] [dei <0|1>] | VLAN ID 0..4095, PCP 0..7, DEI 0..1 | Untagged | Wraps the packet in an IEEE 802.1Q VLAN tag (0x8100) with optional 802.1p QoS priority. |
| qinq <0..4095> [innervlan <0..4095>] | Outer S-VLAN 0..4095, Inner C-VLAN 0..4095 | Untagged (innervlan 1 when qinq is set) | Double-tags the packet with outer IEEE 802.1ad S-Tag (0x88a8) plus inner IEEE 802.1Q C-Tag (0x8100). |
| mpls <0..1048575> [label <0..1048575>] [exp|tc <0..7>] [bos <0|1>] [mplsttl <0..255>] | Repeatable label stack (0..1048575, exp/tc 0..7, bos 0..1, ttl 0..255) | Unlabeled (auto bos=0 on outer labels, bos=1 on bottom) | Prepends one or more 32-bit MPLS label shims (0x8847, e.g. mpls 16000 mpls 24010) ahead of Layer 2 EoMPLS or Layer 3 payloads. |
| ttl <0..255> [dscp <0..63>] [ecn <0..3>] | TTL/Hop Limit 0..255, DSCP 0..63, ECN 0..3 | ttl 64, dscp 0, ecn 0 | Sets IPv4 TTL or IPv6 Hop Limit plus DiffServ (DSCP) and ECN QoS markings. |
| ipid <0..65535> [df] [mf] [fragoffset <0..8191>] [routeralert] [badipchecksum] | IPv4 ID, DF/MF flags, offset 0..8191, Router Alert & checksum fault | ipid 1, flags 0, fragoffset 0, valid RFC 1071 checksum | Sets IPv4 Identification/fragmentation, injects RFC 2113 Router Alert (20 04 00 00), or corrupts the 16-bit IPv4 header checksum (badipchecksum). |
| flowlabel <0..1048575> | 20-bit IPv6 Flow Label (0..1048575) | 0 | Sets the 20-bit IPv6 Flow Label for ECMP routing tests (valid on IPv6 endpoint pairs only). |
| srcport <0..65535> | dstport <0..65535> | Port number 0..65535 | srcport 49152 (remembered), TCP 4712 (or UDP 4712/4713 via transport udp) | Overrides source or destination port and remembers the port pair automatically on <- replies. |
| transport <tcp|udp|sctp> | tcp, udp, or sctp (dual TCP/UDP + universal L7 SCTP) | transport tcp | Switches Layer 4 transport between stateful TCP, connectionless UDP, or Castagnoli CRC-32c SCTP association. |
| badchecksum | nochecksum | L4 checksum fault or UDP zero-checksum flag | Valid RFC checksum / CRC-32c | badchecksum corrupts the L4 checksum for negative firewall/NIC offload tests; nochecksum writes 0x0000 in UDP headers. |
| seq <number> | acknum <number> | win|window <0..65535> | urgent <0..65535> | syn | ack | psh | fin | rst | urg | ece | cwr | TCP sequence/ack numbers, window, flags, SACK, TCP-MD5 & TFO options | psh ack, win 65535, automatic TCP seq/acknum | When using TCP (transport tcp or default TCP): overrides automatic TCP sequence tracking, flags, or mss/wscale/sackperm/sackblock/tsval/tsecr/tcpmd5/tfo. |
Gotchas & Quick Fixes
Include a CFG-2 Frame Before Data Frames So Wireshark Knows Phasor Counts
pdc <- pmu synchrophasor msgtype "cfg2" id 101 station "SUB_01"
pdc <- pmu synchrophasor msgtype "data" id 101Per IEEE C37.118.2, Data frames contain raw packed phasor/analog values whose layout is defined by the preceding CFG-2 frame for that id (IDCODE).
Omit crc for Valid Captures
pdc -> pmu synchrophasor cmd "dataon" id 101FrameAssembly computes the exact 0x1021 CRC-CCITT automatically unless crc is passed for negative testing.