Permalink
Browse files

Added static data-file

  • Loading branch information...
1 parent ec65b53 commit 3f4dd779b4b029b12efe7e133168b9b15f90fed8 @technocake technocake committed Mar 24, 2013
Showing with 49 additions and 0 deletions.
  1. BIN nms-simulator/.DS_Store
  2. +30 −0 nms-simulator/README.md
  3. +19 −0 nms-simulator/make-switches.py
View
Binary file not shown.
View
@@ -0,0 +1,30 @@
+## switch simulator.
+
+The simplest form of simulating the nms provided switch status list, is to have a static
+file with switch status. It is made by make-switches.py and with logic cut from planning.cpp and transformed to python.
+
+To make a static file, run:
+
+shellprompt > ./make-switches.py > switchlist.txt
+
+This will give a txtfile of the format:
+...
+e69-2 on
+e69-3 on
+e69-4 on
+e71-1 on
+e71-2 on
+e71-3 on
+e71-4 on
+e73-1 off
+e73-2 off
+e73-3 off
+e73-4 off
+e75-1 on
+e75-2 on
+e77-1 on
+e77-2 on
+...
+
+
+This is the same as will be given from the nms perl script.
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+# coding: utf-8
+
+off = [13,37,1,3]
+switches =[]
+
+def sw(i, num):
+ return "e%u-%u %s" % (i*2-1, num+1, 'off' if i in off else 'on')
+
+for i in range(42 + 1):
+ if not ( i >= 1 and i <= 5 ) :
+ switches.append(sw(i, 0))
+ switches.append(sw(i, 1))
+
+ if not (i >= 14 and i <= 21) and not (i >= 38):
+ switches.append(sw(i, 2))
+ switches.append(sw(i, 3))
+
+print ( '\n'.join(switches))

0 comments on commit 3f4dd77

Please sign in to comment.