Skip to content

Instantly share code, notes, and snippets.

@robidev
robidev / smv9-2-moongen_send+receive.lua
Created March 17, 2021 21:59
A lua script for MoonGen that generates IEC 61850 9-2LE packets every 250 us, and checks for interrupted samplecount on reception
local mg = require "moongen"
local memory = require "memory"
local device = require "device"
local ts = require "timestamping"
local stats = require "stats"
local hist = require "histogram"
local ffi = require "ffi"
local timer = require "timer"
local libmoon = require "libmoon"
@robidev
robidev / smv_subscriber.ino
Created February 11, 2021 20:56
IEC 61850 SMV 9-2LE subscriber - this code uses the whiznet w5100 with interrupt-pin to accurately timestamp the moment a packet arrives, and allows to measure latency
/*
SMV receive
This sketch receives sampled values, and timestamps them
This code is in the public domain.
*/
#include <Ethernet.h>
#include <utility/w5100.h>
@robidev
robidev / pdump_sw.lua
Last active February 11, 2021 11:56
IEC 61850 SMV 9-2LE packet capture script using dpdk and MoonGen, this version uses software timestamping
--- Software timestamping precision test.
local mg = require "moongen"
local ts = require "timestamping"
local device = require "device"
local hist = require "histogram"
local memory = require "memory"
local stats = require "stats"
local timer = require "timer"
local ffi = require "ffi"
local log = require "log"
@robidev
robidev / pdump_hw.lua
Last active February 11, 2021 11:57
IEC 61850 SMV 9-2LE packet capture script using dpdk and MoonGen, this version uses hardware timestamping such as supported in the intel I350 NIC
--- Hardware timestamping precision test.
local mg = require "moongen"
local ts = require "timestamping"
local device = require "device"
local hist = require "histogram"
local memory = require "memory"
local stats = require "stats"
local timer = require "timer"
local ffi = require "ffi"
local log = require "log"
@robidev
robidev / smv_publisher.ino
Last active August 5, 2025 00:56
An IEC 61850 sampled value publisher using an arduino mega and ehternet shield 2 for testing purposes. Period=250us, standard deviation is 3us max=10us
/*
SMV transmit:
This sketch sends sampled values
This code is in the public domain.
*/
#include <Ethernet.h>
#include <utility/w5100.h>