Monday, August 11, 2014

Hacking Niagara AX with Scala!

Integration can be a pain

 If you are in the automation world, you know how frustrating it can be to integrate to old systems. Last week I was given the project of cutting over an ALX system in a 10 story building. After exposing all of the points on the ALX system by hand, I had enough. I had recently discovered that all of Niagara's folders could be viewed as XML. This is super handy for making easy transformations like find "x" and replace with "y". Any basic text editor has this capability. However, I needed more power. In order to automate my task I needed complex transformations. The kind you need to write an algorithm for.



Enter Scala

   Scala is a functional language built on the JVM that has good XML support. You could do this in literally almost any language, but I happen to really like Scala. So, I proceeded to extract the points folder from Niagara as a .bog file(which is just another form of compression). I then unzipped it as XML and loaded the xml into Scala.

Now the magic happens

  For this particular algorithm I needed to locate each VAV and then re-address its each of its points, increasing each one by the magnitude of the box number times 100. This produced individualized points for each VAV that matched what had been exposed on the ALX system i.e. VAV1 will have 13 points that begin with 13100, and have successively different endings; VAV2 will have 13 points that begin with 13200 .. and so on

If your in automation then automate

  I see far too many techs doing these kinds of jobs by hand. This algorithm can save literally days of work. Learn a little code and it can pay off in the long run!

I posted my code up on github for this, if you have any questions email me. 

No comments:

Post a Comment