From 3a5a43949618b3f5535af593b08c56fee942a5dd Mon Sep 17 00:00:00 2001 From: Alain Klotz Date: Sat, 22 Dec 2018 08:09:08 +0100 Subject: [PATCH] Ajouts de doc pour le frame_model 1.2 --- src/utils/report/doc/user_guide_module_report.odt | Bin 24567 -> 0 bytes src/utils/report/status_json.py | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+), 0 deletions(-) diff --git a/src/utils/report/doc/user_guide_module_report.odt b/src/utils/report/doc/user_guide_module_report.odt index a123a33..d4c4165 100644 Binary files a/src/utils/report/doc/user_guide_module_report.odt and b/src/utils/report/doc/user_guide_module_report.odt differ diff --git a/src/utils/report/status_json.py b/src/utils/report/status_json.py index 0724f65..81875ab 100644 --- a/src/utils/report/status_json.py +++ b/src/utils/report/status_json.py @@ -436,6 +436,111 @@ https://github.com/hjson/hjson-py # === get/set methods # ======================================================== + def get_error_message(self, error_code): + """ Get the message of a given error code + + Inputs: + ------- + integer number corresponding to an error code. + + Outputs: + ------- + The string message of the error code. + + Usage: + ------ + >>> rep.get_error_message(102) + >>> 'Disk full' + + Related topics: + --------------- + """ + errs = [] + errs.append( {'code':0, 'message':"No error", 'version':"1.0"} ) + # errors + errs.append( {'code':1 , 'message':"Unreferenced error", 'version':"1.2"} ) + errs.append( {'code':2 , 'message':"System error", 'version':"1.2"} ) + errs.append( {'code':3 , 'message':"Device temperature too high", 'version':"1.2"} ) + errs.append( {'code':4 , 'message':"Device temperature too low", 'version':"1.2"} ) + errs.append( {'code':101 , 'message':"Disk not found", 'version':"1.2"} ) + errs.append( {'code':102 , 'message':"Disk full", 'version':"1.2"} ) + errs.append( {'code':111 , 'message':"File not found", 'version':"1.2"} ) + errs.append( {'code':112 , 'message':"File opening failure", 'version':"1.2"} ) + errs.append( {'code':113 , 'message':"File reading error", 'version':"1.2"} ) + errs.append( {'code':114 , 'message':"File writing error", 'version':"1.2"} ) + errs.append( {'code':1001 , 'message':"Power supply off", 'version':"1.2"} ) + errs.append( {'code':1002 , 'message':"Power supply over voltage", 'version':"1.2"} ) + errs.append( {'code':2001 , 'message':"Data connection failed", 'version':"1.2"} ) + errs.append( {'code':2002 , 'message':"Data checksum error", 'version':"1.2"} ) + errs.append( {'code':2003 , 'message':"Data value out of range", 'version':"1.2"} ) + errs.append( {'code':2004 , 'message':"No data", 'version':"1.2"} ) + errs.append( {'code':2005 , 'message':"No response after timeout", 'version':"1.2"} ) + errs.append( {'code':2006 , 'message':"Data raw frame error", 'version':"1.2"} ) + # warnings + errs.append( {'code':-3 , 'message':"Device temperature reaching high limit", 'version':"1.2"} ) + errs.append( {'code':-4 , 'message':"Device temperature reaching low limit", 'version':"1.2"} ) + errs.append( {'code':-102 , 'message':"Disk almost full", 'version':"1.2"} ) + errs.append( {'code':-2003, 'message':"Data value not consistent", 'version':"1.2"} ) + # find the message + messages = [err['message'] for err in errs if err['code']==error_code] + return messages[0] + + def get_monitoring_names(self, monitoring_name=""): + """ Get the list of available monitoring names + + Inputs: + ------- + Optional: A particular monitoring name + + Outputs: + ------- + List of dictionaries of available monitoring names. + If the optional particular monitoring name is specified as input then + return only the dictionary of that monitoring name. + + Usage: + ------ + >>> rep.get_monitoring_names("Wind_speed") + >>> [{'monitoring_name': 'Wind_speed', 'section': 'weather', 'description': '', 'version': '1.1'}] + + Related topics: + --------------- + """ + monitors = [] + # Weather + monitors .append( {'monitoring_name':"Temperature_outside", 'section':"weather", 'description':"Ambiant temperature", 'version':"1.1"} ) + monitors .append( {'monitoring_name':"Temperature_sky", 'section':"weather", 'description':"Cloud coverage", 'version':"1.1"} ) + monitors .append( {'monitoring_name':"Humidity_outside", 'section':"weather", 'description':"Ambiant humidity", 'version':"1.1"} ) + monitors .append( {'monitoring_name':"Pressure_outside", 'section':"weather", 'description':"Ambiant pressure (not corrected to sea level)", 'version':"1.1"} ) + monitors .append( {'monitoring_name':"Wind_speed", 'section':"weather", 'description':"", 'version':"1.1"} ) + monitors .append( {'monitoring_name':"Wind_direction", 'section':"weather", 'description':"0=N, 90=E", 'version':"1.1"} ) + monitors .append( {'monitoring_name':"Rain_boolean", 'section':"weather", 'description':"0=No rain, 1=Rain", 'version':"1.1"} ) + # Housing + monitors .append( {'monitoring_name':"State_dome_shutter_east", 'section':"housing", 'description':'0=Closed 1=Opened 2=Intermediate3=Closing, 4=Opening, 5=Undefined', 'version':"1.2"} ) + monitors .append( {'monitoring_name':"State_dome_shutter_west", 'section':"housing", 'description':'0=Closed 1=Opened 2=Intermediate3=Closing, 4=Opening, 5=Undefined', 'version':"1.2"} ) + monitors .append( {'monitoring_name':"Direction_dome_shutter", 'section':"housing", 'description':'0=N, 90=E', 'version':"1.2"} ) + monitors .append( {'monitoring_name':"State_roof", 'section':"housing", 'description':'0=Closed 1=Opened 2=Intermediate 3=Closing, 4=Opening, 5=Undefined', 'version':"1.2"} ) + monitors .append( {'monitoring_name':"State_roof_north", 'section':"housing", 'description':'0=Closed 1=Opened 2=Intermediate 3=Closing, 4=Opening, 5=Undefined', 'version':"1.2"} ) + monitors .append( {'monitoring_name':"State_roof_south", 'section':"housing", 'description':'0=Closed 1=Opened 2=Intermediate 3=Closing, 4=Opening, 5=Undefined', 'version':"1.2"} ) + # Power supply + monitors .append( {'monitoring_name':"Voltage_input", 'section':"powersupply", 'description':'', 'version':"1.2"} ) + monitors .append( {'monitoring_name':"Voltage_output", 'section':"powersupply", 'description':'', 'version':"1.2"} ) + # Instruments + monitors .append( {'monitoring_name':"Temperature_mirror", 'section':"Instruments", 'description':'Mirrors temperatures (M1, M2, etc)', 'version':"1.2"} ) + monitors .append( {'monitoring_name':"Position_filterwheel", 'section':"Instruments", 'description':'', 'version':"1.2"} ) + monitors .append( {'monitoring_name':"Position_focuser", 'section':"Instruments", 'description':'Positions of focusers (M2, channel1, etc.)', 'version':"1.2"} ) + monitors .append( {'monitoring_name':"Temperature_sensor", 'section':"Instruments", 'description':'', 'version':"1.2"} ) + # Image quality + monitors .append( {'monitoring_name':"PSF_FWHM", 'section':"Imagequality", 'description':'Image quality', 'version':"1.2"} ) + monitors .append( {'monitoring_name':"ZeroMag", 'section':"Imagequality", 'description':'Transparency', 'version':"1.2"} ) + monitors .append( {'monitoring_name':"SkyMag", 'section':"Imagequality", 'description':'Background brightness', 'version':"1.2"} ) + if monitoring_name!="": + # find the message + print("Etape 1") + dico = [monitor for monitor in monitors if monitor['monitoring_name']==monitoring_name] + return dico + return monitors + def get_entities(self): """ Get the current entities -- libgit2 0.21.2