Module_SmartBox.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Module_SmartBox.h
  3. *
  4. * Created on: 2022年5月3日
  5. * Author: 7564
  6. */
  7. #ifndef MODULE_SMARTBOX_H_
  8. #define MODULE_SMARTBOX_H_
  9. #include <sys/time.h>
  10. #include <sys/timeb.h>
  11. #include <sys/types.h>
  12. #include <sys/stat.h>
  13. #include <sys/types.h>
  14. #include <sys/ioctl.h>
  15. #include <sys/socket.h>
  16. #include <sys/ipc.h>
  17. #include <sys/shm.h>
  18. #include <sys/mman.h>
  19. #include <linux/wireless.h>
  20. #include <linux/can.h>
  21. #include <linux/can/raw.h>
  22. #include <arpa/inet.h>
  23. #include <netinet/in.h>
  24. #include <unistd.h>
  25. #include <stdarg.h>
  26. #include <stdio.h> /*標準輸入輸出定義*/
  27. #include <stdlib.h> /*標準函數庫定義*/
  28. #include <unistd.h> /*Unix 標準函數定義*/
  29. #include <fcntl.h> /*檔控制定義*/
  30. #include <termios.h> /*PPSIX 終端控制定義*/
  31. #include <errno.h> /*錯誤號定義*/
  32. #include <string.h>
  33. #include <time.h>
  34. #include <ctype.h>
  35. #include <ifaddrs.h>
  36. #include <math.h>
  37. #include "../../define.h"
  38. #include <stdbool.h>
  39. #define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0]))
  40. #define PASS 1
  41. #define FAIL -1
  42. #define YES 1
  43. #define NO 0
  44. #define NONE_GROUP_CAN_SELECTED 255
  45. #define NONE_RELAY_SELECTED 255
  46. #define PSU_MIN_VOL 500 // 0.1V
  47. #define PSU_MIN_CUR 20 // 0.1A
  48. #define CAP_GAP_FETCH 30 // 0.1kw
  49. #define CAP_GAP_RELEASE 50 // 0.1kw
  50. #define STABLE_CAP_GAP 10 // 0.1kw
  51. #define SMART_MODE 1 // 0 : FCFS, 1 : Average
  52. // Fetch Loop
  53. #define PSU_TG_VOL_GAP 100 // 0.1V
  54. #define PSU_TG_CUR_GAP 50 // 0.1A
  55. // Fetch Loop End
  56. // Release Loop
  57. #define PSU_LIMIT_CUR 50 // 0.1A
  58. // Release Loop End
  59. #define FETCH_SMART_CHK_TIME 5000 // 1ms
  60. #define FETCH_FINISH_WAIT_TIME 1000 // 1ms
  61. #define RELEASE_STABLE_CHK_TIME 5000 // 1ms
  62. #define RELEASE_SMART_CHK_TIME 2000 // 1ms
  63. #define WAIT_FOR_LIMIT_STABLE 2000 // 1ms
  64. #define RELEASE_FINISH_WAIT_TIME 1000 // 1ms
  65. #endif /* MODULE_SMARTBOX_H_ */