megatec.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 VOLTRONIC_MODEL_LENGTH 15
  16. #define KSTAR_MODEL_LENGTH 10
  17. #define VOLTRONIC_VERSION_LENGTH 10
  18. #define VOLTRONIC_SN_LENGTH 14
  19. typedef enum{
  20. ups_status_req,
  21. ups_test_10sec,
  22. ups_test_low_bat,
  23. ups_test_time,
  24. ups_beep,
  25. ups_shutdown,
  26. ups_shutdown_restore,
  27. ups_cancel_shut_down,
  28. ups_cancel_test,
  29. ups_info,
  30. ups_rating_info,
  31. ups_remain_time_reg,
  32. ups_general_status_req,
  33. ups_akb_info,
  34. ups_model_req,
  35. ups_version_req,
  36. ups_version2_req,
  37. ups_serial_req,
  38. ups_protocol_id_req,
  39. ups_offline_status_req,
  40. ups_passw_req,
  41. MegaTec_cmd_max
  42. } cmdMegaTecEnums_t;
  43. typedef struct{
  44. float Freq_in;
  45. float VAC_in;
  46. float VAC_out;
  47. float Temp;
  48. float Vakb_curr;
  49. uint8_t Load;
  50. uint8_t SOC;
  51. uint16_t work_time;
  52. uint32_t akb_work_time;
  53. uint32_t Alarm;
  54. uint8_t Status;
  55. char model[16];
  56. char vertion[22];
  57. char serial[15];
  58. uint8_t cnt_err_ups;
  59. bool Present;
  60. bool Flag_Present;
  61. }UPS_value_t;
  62. extern UPS_value_t UPS;
  63. extern uint16_t TimeParam;
  64. extern uint16_t TimeParam2;
  65. extern float TimeParamFloat;
  66. int ups_metac_service_pdu(cmdMegaTecEnums_t command);
  67. void ups_megatec_init(void);
  68. #endif /* MEGATEC_H_ */