megatec.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * megatec.h
  3. *
  4. * Created on: 22.05.2017
  5. * Author: balbekova
  6. */
  7. #ifndef MEGATEC_H_
  8. #define MEGATEC_H_
  9. #include <stdbool.h>
  10. #include <stdint.h>
  11. #include <stdlib.h>
  12. #define K_EFFICIENCY 0.9
  13. #define AKB_VOLTAGE 12
  14. #define AKB_NUM_CELL 6
  15. #define MODEL_LENGTH 15
  16. typedef enum{
  17. ups_status_req,
  18. ups_test_10sec,
  19. ups_test_low_bat,
  20. ups_test_time,
  21. ups_beep,
  22. ups_shutdown,
  23. ups_shutdown_restore,
  24. ups_cancel_shut_down,
  25. ups_cancel_test,
  26. ups_info,
  27. ups_rating_info,
  28. ups_remain_time_reg,
  29. ups_general_status_req,
  30. ups_akb_info,
  31. ups_model_req,
  32. ups_version_req,
  33. ups_version2_req,
  34. ups_serial_req,
  35. ups_protocol_id_req,
  36. ups_offline_status_req,
  37. ups_passw_req,
  38. MegaTec_cmd_max
  39. } cmdMegaTecEnums_t;
  40. typedef struct{
  41. float Freq_in;
  42. float VAC_in;
  43. float VAC_out;
  44. float Temp;
  45. float Vakb_curr;
  46. uint8_t Load;
  47. uint8_t SOC;
  48. uint16_t work_time;
  49. uint32_t akb_work_time;
  50. uint32_t Alarm;
  51. uint8_t Status;
  52. char model[16];
  53. char vertion[18];
  54. char serial[15];
  55. uint8_t cnt_err_ups;
  56. bool Present;
  57. bool Flag_Present;
  58. }UPS_value_t;
  59. extern UPS_value_t UPS;
  60. extern uint16_t TimeParam;
  61. extern uint16_t TimeParam2;
  62. extern float TimeParamFloat;
  63. int ups_metac_service_pdu(cmdMegaTecEnums_t command);
  64. void ups_megatec_init(void);
  65. #endif /* MEGATEC_H_ */