Commit 3a5a43949618b3f5535af593b08c56fee942a5dd
1 parent
68484832
Exists in
dev
Ajouts de doc pour le frame_model 1.2
Showing
2 changed files
with
105 additions
and
0 deletions
Show diff stats
src/utils/report/doc/user_guide_module_report.odt
No preview for this file type
src/utils/report/status_json.py
... | ... | @@ -436,6 +436,111 @@ https://github.com/hjson/hjson-py |
436 | 436 | # === get/set methods |
437 | 437 | # ======================================================== |
438 | 438 | |
439 | + def get_error_message(self, error_code): | |
440 | + """ Get the message of a given error code | |
441 | + | |
442 | + Inputs: | |
443 | + ------- | |
444 | + integer number corresponding to an error code. | |
445 | + | |
446 | + Outputs: | |
447 | + ------- | |
448 | + The string message of the error code. | |
449 | + | |
450 | + Usage: | |
451 | + ------ | |
452 | + >>> rep.get_error_message(102) | |
453 | + >>> 'Disk full' | |
454 | + | |
455 | + Related topics: | |
456 | + --------------- | |
457 | + """ | |
458 | + errs = [] | |
459 | + errs.append( {'code':0, 'message':"No error", 'version':"1.0"} ) | |
460 | + # errors | |
461 | + errs.append( {'code':1 , 'message':"Unreferenced error", 'version':"1.2"} ) | |
462 | + errs.append( {'code':2 , 'message':"System error", 'version':"1.2"} ) | |
463 | + errs.append( {'code':3 , 'message':"Device temperature too high", 'version':"1.2"} ) | |
464 | + errs.append( {'code':4 , 'message':"Device temperature too low", 'version':"1.2"} ) | |
465 | + errs.append( {'code':101 , 'message':"Disk not found", 'version':"1.2"} ) | |
466 | + errs.append( {'code':102 , 'message':"Disk full", 'version':"1.2"} ) | |
467 | + errs.append( {'code':111 , 'message':"File not found", 'version':"1.2"} ) | |
468 | + errs.append( {'code':112 , 'message':"File opening failure", 'version':"1.2"} ) | |
469 | + errs.append( {'code':113 , 'message':"File reading error", 'version':"1.2"} ) | |
470 | + errs.append( {'code':114 , 'message':"File writing error", 'version':"1.2"} ) | |
471 | + errs.append( {'code':1001 , 'message':"Power supply off", 'version':"1.2"} ) | |
472 | + errs.append( {'code':1002 , 'message':"Power supply over voltage", 'version':"1.2"} ) | |
473 | + errs.append( {'code':2001 , 'message':"Data connection failed", 'version':"1.2"} ) | |
474 | + errs.append( {'code':2002 , 'message':"Data checksum error", 'version':"1.2"} ) | |
475 | + errs.append( {'code':2003 , 'message':"Data value out of range", 'version':"1.2"} ) | |
476 | + errs.append( {'code':2004 , 'message':"No data", 'version':"1.2"} ) | |
477 | + errs.append( {'code':2005 , 'message':"No response after timeout", 'version':"1.2"} ) | |
478 | + errs.append( {'code':2006 , 'message':"Data raw frame error", 'version':"1.2"} ) | |
479 | + # warnings | |
480 | + errs.append( {'code':-3 , 'message':"Device temperature reaching high limit", 'version':"1.2"} ) | |
481 | + errs.append( {'code':-4 , 'message':"Device temperature reaching low limit", 'version':"1.2"} ) | |
482 | + errs.append( {'code':-102 , 'message':"Disk almost full", 'version':"1.2"} ) | |
483 | + errs.append( {'code':-2003, 'message':"Data value not consistent", 'version':"1.2"} ) | |
484 | + # find the message | |
485 | + messages = [err['message'] for err in errs if err['code']==error_code] | |
486 | + return messages[0] | |
487 | + | |
488 | + def get_monitoring_names(self, monitoring_name=""): | |
489 | + """ Get the list of available monitoring names | |
490 | + | |
491 | + Inputs: | |
492 | + ------- | |
493 | + Optional: A particular monitoring name | |
494 | + | |
495 | + Outputs: | |
496 | + ------- | |
497 | + List of dictionaries of available monitoring names. | |
498 | + If the optional particular monitoring name is specified as input then | |
499 | + return only the dictionary of that monitoring name. | |
500 | + | |
501 | + Usage: | |
502 | + ------ | |
503 | + >>> rep.get_monitoring_names("Wind_speed") | |
504 | + >>> [{'monitoring_name': 'Wind_speed', 'section': 'weather', 'description': '', 'version': '1.1'}] | |
505 | + | |
506 | + Related topics: | |
507 | + --------------- | |
508 | + """ | |
509 | + monitors = [] | |
510 | + # Weather | |
511 | + monitors .append( {'monitoring_name':"Temperature_outside", 'section':"weather", 'description':"Ambiant temperature", 'version':"1.1"} ) | |
512 | + monitors .append( {'monitoring_name':"Temperature_sky", 'section':"weather", 'description':"Cloud coverage", 'version':"1.1"} ) | |
513 | + monitors .append( {'monitoring_name':"Humidity_outside", 'section':"weather", 'description':"Ambiant humidity", 'version':"1.1"} ) | |
514 | + monitors .append( {'monitoring_name':"Pressure_outside", 'section':"weather", 'description':"Ambiant pressure (not corrected to sea level)", 'version':"1.1"} ) | |
515 | + monitors .append( {'monitoring_name':"Wind_speed", 'section':"weather", 'description':"", 'version':"1.1"} ) | |
516 | + monitors .append( {'monitoring_name':"Wind_direction", 'section':"weather", 'description':"0=N, 90=E", 'version':"1.1"} ) | |
517 | + monitors .append( {'monitoring_name':"Rain_boolean", 'section':"weather", 'description':"0=No rain, 1=Rain", 'version':"1.1"} ) | |
518 | + # Housing | |
519 | + 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"} ) | |
520 | + 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"} ) | |
521 | + monitors .append( {'monitoring_name':"Direction_dome_shutter", 'section':"housing", 'description':'0=N, 90=E', 'version':"1.2"} ) | |
522 | + monitors .append( {'monitoring_name':"State_roof", 'section':"housing", 'description':'0=Closed 1=Opened 2=Intermediate 3=Closing, 4=Opening, 5=Undefined', 'version':"1.2"} ) | |
523 | + 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"} ) | |
524 | + 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"} ) | |
525 | + # Power supply | |
526 | + monitors .append( {'monitoring_name':"Voltage_input", 'section':"powersupply", 'description':'', 'version':"1.2"} ) | |
527 | + monitors .append( {'monitoring_name':"Voltage_output", 'section':"powersupply", 'description':'', 'version':"1.2"} ) | |
528 | + # Instruments | |
529 | + monitors .append( {'monitoring_name':"Temperature_mirror", 'section':"Instruments", 'description':'Mirrors temperatures (M1, M2, etc)', 'version':"1.2"} ) | |
530 | + monitors .append( {'monitoring_name':"Position_filterwheel", 'section':"Instruments", 'description':'', 'version':"1.2"} ) | |
531 | + monitors .append( {'monitoring_name':"Position_focuser", 'section':"Instruments", 'description':'Positions of focusers (M2, channel1, etc.)', 'version':"1.2"} ) | |
532 | + monitors .append( {'monitoring_name':"Temperature_sensor", 'section':"Instruments", 'description':'', 'version':"1.2"} ) | |
533 | + # Image quality | |
534 | + monitors .append( {'monitoring_name':"PSF_FWHM", 'section':"Imagequality", 'description':'Image quality', 'version':"1.2"} ) | |
535 | + monitors .append( {'monitoring_name':"ZeroMag", 'section':"Imagequality", 'description':'Transparency', 'version':"1.2"} ) | |
536 | + monitors .append( {'monitoring_name':"SkyMag", 'section':"Imagequality", 'description':'Background brightness', 'version':"1.2"} ) | |
537 | + if monitoring_name!="": | |
538 | + # find the message | |
539 | + print("Etape 1") | |
540 | + dico = [monitor for monitor in monitors if monitor['monitoring_name']==monitoring_name] | |
541 | + return dico | |
542 | + return monitors | |
543 | + | |
439 | 544 | def get_entities(self): |
440 | 545 | """ Get the current entities |
441 | 546 | ... | ... |