Ada

Ada is a strongly typed object-oriented programming language suitable for use in safety-critical systems. Very recommeded to at least take a look at

Endnu en ubrugelig valgprognose

Som tidligere omtalt byggede vi på min tidligere uddannelse et stemmesystem med det formål at stille entry- og exitpolls tilgængelig ved et lokalt valgmøde.

Valgmødet foregik i Nykøbing F. og var primært rettet mod unge under 18. Det var altså rent teoretisk.

Vi gjorde os dengang følgende observationer:

Resultat før mødet

Man kan tydeligt se en tendes til en højredrejning i prognosen baseret på stemmer indsamlet ved indgangen.
Til gengæld bliver billedet markant anderledes ved udgangen. Det skal bemærkes at stemmeterminalerne først blev aktiveret ved mødets afslutning, og derfor kun repræsenterer meningsfordelingen hos de “vælgere” der deltog i hele mødet.

Resultat efter mødet

Ud over at en stor del (ca. 50%) af deltagerne har forladt mødet viser tallene også at der nu er en kraftig venstreskæv fordeling – især til Enhedslisten der er gået markant frem.

Både Venstre og Socialdemokratiet er gået tilbage. Dansk Folkeparti er det parti der har lidt størst tab under mødet; ud af de 114 stemmer de fik ved indgangen, er 100 vælgere enten udvandret eller har skiftet mening.

Jeg syntes observationene er interessante, men de har jo intet at gøre med det forestående valg. Måske andre kan hive flere spændende konklusioner ud fra disse tal?

Til de kodeinteresserede kan serverdelen og kommandolinje klienten hentes her:

valgsystem.tar.gz

MBUS and Ada

I recently got my hand on a OM13006 Power Plug meter development kit from NXP Semiconductors. The entire process of actually getting the kit was a quite cumbersome one, and tale left for another time. Though I would like to thank the people at Future Electronics for their invaluable help.

So, now I have a kit which i have spent €200+ on, and no idea how to program it or use it. The smart metering website at NXP has an SDK zip file which you can download. It contains some diagrams and a lot of C/C# source code respectively. More importantly, it contains the (windows) software also depicted on their website.

The software is pretty functional, but lacks an automated log function (besides raw bus data), so you can grab usages and use them in a software model.

A challenge, then!

As the kit consisted of the a meter to plug between your outlet and device, and a USB dongle, the first step was to figure out how to communicate with the device.

After some spent digging through the supplied source code, I realized that the device was interfacing as a serial device. A quick check with minicom confirmed this.

By then, it was just a matter of parsing the line (ASCII encoded) based protocol.

The sources can be found here, or by going to the projects page.

To build the test application, you need to use gnatmake which is part of GNAT. It is part of any respectable Linux distributions repository. When it is installed, just run

gnatmake -P mbus_logger

To build the sample application