diff --git a/simulators/config/#test.py# b/simulators/config/#test.py# new file mode 100644 index 0000000..8a5757e --- /dev/null +++ b/simulators/config/#test.py# @@ -0,0 +1,4 @@ +import json + +def main(): + with open with open('data.json') as \ No newline at end of file diff --git a/simulators/config/test.js b/simulators/config/test.js new file mode 100644 index 0000000..08e416c --- /dev/null +++ b/simulators/config/test.js @@ -0,0 +1,9 @@ +var fs = require("fs"); +var content = JSON.parse(fs.readFileSync("grammar.json")); +ip = content["Telescope"]["set"][0]["input_label"][0]; + +console.log(JSON.stringify(ip) + "\n\n"); + +for (var tmp in ip){ + console.log(ip[tmp][1] + '\n\n');} + diff --git a/simulators/config/test.js~ b/simulators/config/test.js~ new file mode 100644 index 0000000..e3885a0 --- /dev/null +++ b/simulators/config/test.js~ @@ -0,0 +1,9 @@ +var fs = require("fs"); +var content = JSON.parse(fs.readFileSync("grammar.json")); +ip = content["Telescope"]["set"][0]["input_label"][0]; + +console.log(ip + "\n\n"); + +for (var tmp in ip){ + console.log(ip[tmp][1] + '\n\n');} + diff --git a/simulators/config/test.py b/simulators/config/test.py new file mode 100644 index 0000000..bf357df --- /dev/null +++ b/simulators/config/test.py @@ -0,0 +1,14 @@ +import json + +def main(): + with open('grammar.json', 'r') as f: + #print(f) + content = json.load(f) + content = content["Telescope"]["set"][0]["input_label"][0]["R.A."][0] + print(content) + #for c in content: + #print (c["R.A."]) + #print("\n") + + +main() diff --git a/simulators/config/test.py~ b/simulators/config/test.py~ new file mode 100644 index 0000000..e2e0f64 --- /dev/null +++ b/simulators/config/test.py~ @@ -0,0 +1,14 @@ +import json + +def main(): + with open('grammar.json', 'r') as f: + #print(f) + content = json.load(f) + content = content["Telescope"]["set"][0]["input_label"][0]["R.A."] + print(content) + #for c in content: + #print (c["R.A."]) + #print("\n") + + +main() diff --git a/src/common/models.py b/src/common/models.py index 67cf006..5972ede 100644 --- a/src/common/models.py +++ b/src/common/models.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from django.contrib.auth.models import AbstractUser from django.db import models +from enum import Enum class Album(models.Model): sequence = models.ForeignKey( @@ -819,14 +820,18 @@ class WeatherWatchHistory(models.Model): return (str(self.datetime)) +class PyrosState(Enum): + START = 'Starting' + PA = 'Passive' + INI = "INIT" + STAND = "Standby" + SCHED_START = 'Scheduler startup' + SCHED = 'Scheduler' + SCHED_CLOSE = 'Scheduler closing' + class Config(models.Model): - SCHEDULER_STATE = ( - ('0', 'init'), - ('1', 'sleeping'), - ('2', 'startup'), - ('3', 'observing'), - ('4', 'shutdown'), - ) + SCHEDULER_STATE = ["Starting", 'Passive', "INIT", "Standby", 'Scheduler startup','Scheduler', 'Scheduler closing' ] + id = models.IntegerField(default='1', primary_key=True) latitude = models.FloatField(default=1) local_time_zone = models.FloatField(default=1) @@ -842,7 +847,7 @@ class Config(models.Model): global_mode = models.BooleanField(default='True') ack = models.BooleanField(default='False') bypass = models.BooleanField(default='True') - scheduler_state = models.CharField(max_length=1, choices=SCHEDULER_STATE, default=0) + pyros_state = models.CharField(max_length=25, default=SCHEDULER_STATE[0]) force_passive_mode = models.BooleanField(default='False') plc_timeout_seconds = models.PositiveIntegerField(default=60) diff --git a/src/dashboard/templates/dashboard/operator_state.html b/src/dashboard/templates/dashboard/operator_state.html index 0e4a0a8..c38ed2e 100644 --- a/src/dashboard/templates/dashboard/operator_state.html +++ b/src/dashboard/templates/dashboard/operator_state.html @@ -92,12 +92,8 @@


{% global_mode_state request %} -
{% ack request %} - {% if config.bypass == True %} -
{% bypass request %} - {% else %} -
{% bypass request %} - {% endif %} +
{% bypass request %} +
{% endblock %} \ No newline at end of file diff --git a/src/dashboard/templates/dashboard/send_command_telescope.html b/src/dashboard/templates/dashboard/send_command_telescope.html index a38e6d2..f213fa5 100644 --- a/src/dashboard/templates/dashboard/send_command_telescope.html +++ b/src/dashboard/templates/dashboard/send_command_telescope.html @@ -98,9 +98,11 @@ +