Control of Industrial Pneumatic & Hydraulic Systems using Serial Communicatio...
M-Bus Verification Tool
1. Thisis a program I wrote to simulate externalmeters(water,gas,heat,etc.) attachedtoan electric
meterviathe M-Bus protocol.The program ismine,fromconceptto final form.The onlycode thatis not
mine isa fewlinesregardingthe encryptionof datainthe M-Bus packets.I wrote thisbecause there was
no goodreadily-availablewaytotestthe M-Bus supportfor these smartmeters.
Thistool was developedtobe anautomatedaidto manual testingandas a tool for use by an automated
tcl-basedregressioninfrastructure.Itisalsocapable of performingextensive automatedtestsonits
own.Extensive logsare maintainednotonlyof everypacketsentorreceived(time,type,content,etc.)
but alsoof eventsthatoccurred duringtesting.Debuggingafailure andfilingabugreport wasusually
justa matterof examiningthe logfiles.
Thisis the mainpanel thatyou see whenstartingthisprogram, withsome featuresindicated.
If you clickon one of the fourdevice buttonsof the mainpanel,youget thisconfigurationpanel,below.
Note the abilitytoinjecterrorconditionsintopacketssenttothe meter,totestthe meter’shandlingof
those errors.I couldalsohave thisprogram droppowerto the meterwhenspecifiedconditionswere
metso that we couldtestrecoveryfrompoweroutagesat crucial times.
2. Since a tcl architecture wasused tomanage regressiontesting,Iaddedthe abilitytogenerate tcl code to
reproduce complex configurations,justclick,copy,andpaste.
From the device configurationyoucouldallow randomizedpacketpayloads,oryoucouldclickthe “DIF
VIFlist”buttonto specifyexactlywhatwastobe in the packetsof thisdevice. Thiswouldbringupthe
panel below.Explainingthatpanel wouldrequire detaileddiscussionof the M-Busprotocol,soI will let
it go unlessthere isaninterest.
4. ThisM-Bus spoofingprogramplayedamajorrole in testinganddebuggingthe M-Busportof those
smart meters.The verificationof the new M-Busfeature inthe meters washandedtome because the
interface wasnewandhardware related,andIwas the onlytestengineerinthe groupthatunderstood
the hardware aspectsof M-Bus.I became the M-Bus expertinthe groupand later,othertestengineers
learnedtouse thisprogram fortheirwork.I alsosetup the hardware and software forthisprogram for
the developersof the meters FW,sothat theycouldduplicate the bugsIfoundand monitorthe effects
of theirchanges.These metersprobablyhave the mostbug-freeM-Businterface inexistence.