/alarm_view

Web application for viewing alarm controller simulations for Bucknell's CSCI320.

Primary LanguagePythonMIT LicenseMIT

alarm_view

Web application for viewing alarm controller simulations for Bucknell's CSCI320.

See: https://www.eg.bucknell.edu/~csci320/project-1-verilog-warm-up/

Trace format

The input files are line-based text files. Each line uses a fixed width format as shown below (more examples are in the examples folder).

              BUZZER
             ---------\
                       \
               ALARM   |
            ---------\ |
                     | |
           timestamp | |    Led1    Led2    Led3    Led4
|-------- 21 ------| | | |--7--| |--7--| |--7--| |--7--|
                   0 0 0 0000000 0000000 0000000 0000000

There is no format verificaiton and malformatted files will certainly crash the server.

Notes to run on Bucknell's Lab Machines

This application requires Flask to be installed. On the Bucknell machines, currently Flask is installed for Python 2.7 and Python 3.4. Either will work, but neither is the current default python interpreter.

To use python 2.7:

$ python2.7 showclock.py

To use python3.4:

$ source /usr/remote/python-3.4/setup.sh
$ python showclock.py

Running

Once you run showclock.py you should see the line below when the server starts.

INFO:werkzeug: * Running on http://0.0.0.0:5000/

To access the web interface, just point your web browser to http://localhost:5000/ (or insert the name of the machine running the server). You should see a page similar to the one below.

main screenshot

This is generated by listing all of the files in the FILE_PATH, it defaults to ./examples. You can modify showclock.py to use whatever path your want.

Clicking on a filename will load the visualization with the first line of the file. If the file is not a valid the server will likely crash.

count.out screenshot

At the top the current file, line, timestamp, alarm state, and buzzer state is shown. Below that is a rendering of the 7-segment display. All 127 possible digits have been generated by the makedigits.py script. Feel free to contribute a fancier set of digits.

Below the display are navigation icons. The house takes you back to the list of output files. The left and right arrows move to the previous/next timestep respectively. Moving to an arbitrary line is possible by modifying the url directly. The format is: http://localhost:5000/show/<filename>/<line_number>.

Additional Features:

In additional to displaying the current time, you can also display additional information by passing in more data to the input file. Here is the format for each line in the input file, if you want to enable this feature:

                                                           minus
              BUZZER                                  plus   |
             ---------\                               -----\ |  alarmButton
                       \                                   | | /---
               ALARM   |                            isAM   | | |
            ---------\ |                            -----\ | | |  alarmOff
                     | |                                 | | | | /-------
           timestamp | |    Led1    Led2    Led3    Led4 | | | | |
|-------- 21 ------| | | |--7--| |--7--| |--7--| |--7--| | | | | |
                   0 0 0 0000000 0000000 0000000 0000000 0 0 0 0 0

Note that all the buttons are active-low, meaning that 1 stands for button off and 0 stands for button on. If you want to enable this feature, you need to have all the additional bits present in your input file. If you don't want to include certain buttons, just use -1 for that bit. For example, if you don't want to have the "isAM" indicator, change that bit to -1(technically -1 is not 1 bit anymore, but it doesn't matter because the web interface doens't care).