psnotch.sh 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/bin/sh
  2. # file: scripts/pibnotch.sh
  3. # This is an experimental script used to test dynamic PIB notching;
  4. # if you do not know what that is then you probably don't need this
  5. # script;
  6. # ====================================================================
  7. #
  8. # --------------------------------------------------------------------
  9. . /etc/environment
  10. . ${SCRIPTS}/hardware.sh
  11. . ${SCRIPTS}/firmware.sh
  12. # ====================================================================
  13. #
  14. # ETH1 is Host Interface for Device 1
  15. # ETH2 is Host Interface for Device 2
  16. #
  17. # PLD1 is MAC of Powerline Device 1
  18. # PLD2 is MAC of Powerline Device 2
  19. #
  20. # PIB the PIB file used to load prescalars
  21. # MAP the MAP file used to save tonemaps read from device
  22. # OLD the OLD prescalars (no notches)
  23. # NEW the NEW prescalars (with notches)
  24. #
  25. # --------------------------------------------------------------------
  26. PIB=abc.pib # the PIB file used to load prescalars
  27. MAP=tonemap # the MAP file used to save tonemaps read from device
  28. OLD=scalars # the OLD prescalars (no notches)
  29. NEW=notches # the NEW prescalars (with notches)
  30. # ====================================================================
  31. # 1. print message;
  32. # 2. load OLD prescalars into PIB
  33. # 3. download and flash PIB
  34. # --------------------------------------------------------------------
  35. echo
  36. echo Setup
  37. echo
  38. psout ../firmware/v3.3.6.pib > ${OLD}
  39. psin < ${OLD} ${PIB}
  40. int6k -i ${ETH2} -P ${PIB} ${PLD1} -C2
  41. # ====================================================================
  42. # 1. Increment loop counter and print message
  43. # 2. request tonemap between PLD1 and PLD2; save in MAP
  44. # 3. read OLD prescalars and write NEW prescalars based on MAP; only
  45. # notch prescalars 57 through 63 if tone threshold is below 3;
  46. # 4. load NEW prescalars into PIB;
  47. # 5. plot prescalars from PIB discarding unwanted lines;
  48. # 6. print a message
  49. # 7. download and flash PIB to apply changes;
  50. # 8. wait some time
  51. # 9. load OLD prescalars into PIB
  52. # 10. print a message
  53. # 11. download and flash PIB to sample changes;
  54. # 12. wait some time
  55. # 13. repeat forever;
  56. # --------------------------------------------------------------------
  57. while [ 1 ]; do
  58. echo
  59. echo Check $((++count))
  60. echo
  61. int6ktone -qhi ${ETH2} ${PLD1} ${PLD2} > ${MAP}
  62. psnotch -v -L 40 -U 66 -l 57 -u 62 -t 3 -f ${MAP} < ${OLD} > ${NEW}
  63. psin < ${NEW} ${PIB}
  64. psgraph ${PIB} | head -n 66 | tail -n 36
  65. echo
  66. echo blocking ...
  67. echo
  68. int6k -i ${ETH2} -P ${PIB} ${PLD1} -C2
  69. sleep 10
  70. psin < ${OLD} ${PIB}
  71. echo
  72. echo sampling ...
  73. echo
  74. int6k -i ${ETH2} -P ${PIB} ${PLD1} -C2
  75. sleep 60
  76. done