You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

503 lines
36 KiB

8 years ago
8 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. # dt_ctrl.ctrl
  2. #
  3. # Controller network for Dwingeloo Telescope.
  4. #
  5. # This file contains the fixed part of the network and its parameters.
  6. # Other .ctrl files are used for those parts which are conditional,
  7. # such as the use of simulation networks or real servo drives.
  8. #
  9. # Frequency is limited by the stoeber drives.
  10. set frequency 250
  11. set delay 0.0
  12. trigger {
  13. # { "busyloop" }
  14. { "prestart", 0.000250 }
  15. }
  16. # dt_ctrl_el.ctrl Elevation with real servo drives
  17. # dt_ctrl_el_sim.ctrl Elevation with simulated network
  18. # dt_ctrl_az.ctrl Azimuth with real servo drives
  19. # dt_ctrl_az_sim.ctrl Azimuth with simulated network
  20. # dt_ctrl_ec_sim.ctrl Ethercat simulation block
  21. #
  22. # Uncomment either the real network, or the sim network.
  23. # But never both!
  24. #import "dt_ctrl_el.ctrl"
  25. import "dt_ctrl_el_sim.ctrl"
  26. #import "dt_ctrl_az.ctrl"
  27. import "dt_ctrl_az_sim.ctrl"
  28. import "dt_ctrl_ec_sim.ctrl"
  29. blocks ($(frequency), $(delay)) {
  30. # Profiling block, may be commented out.
  31. { "controller_profile", "profile" }
  32. { "setpoint_generator_3d", "azimuth_spg", "Azimuth_Setpoint", "rad" }
  33. { "servo_state", "azimuth_servo_state" }
  34. { "and4", "azimuth_safe_and" }
  35. { "subtract", "azimuth_setpoint_error" }
  36. { "subtract", "azimuth_error" }
  37. { "pid_aw", "azimuth_pid" }
  38. { "filter_iir", "azimuth_pid_filter" }
  39. { "limit_var", "azimuth_pid_limit" }
  40. { "add", "azimuth_speed_ff" }
  41. { "limit", "azimuth_speed_limit" }
  42. { "limit_switch", "azimuth_range_limit" }
  43. { "gain", "azimuth_speed_servo" }
  44. { "value", "azimuth_torque" }
  45. { "value", "azimuth_position_offset" }
  46. { "add", "azimuth_position_offset_sum" }
  47. { "gain", "azimuth_position_gain" }
  48. { "rangecheck", "azimuth_speed_warning" }
  49. { "log", "azimuth_safety_hw_pos" }
  50. { "log", "azimuth_safety_hw_neg" }
  51. { "rangecheck", "azimuth_speed_range_negative" }
  52. { "rangecheck", "azimuth_speed_range_positive" }
  53. { "or2", "azimuth_position_range" }
  54. { "command_bool", "azimuth_recover" }
  55. { "and2", "azimuth_position_safe" }
  56. { "log", "azimuth_position_range_log" }
  57. { "log", "azimuth_position_safe_log" }
  58. { "matrix_2x2", "elevation_input_matrix" }
  59. { "setpoint_generator_3d", "elevation_spg", "Elevation_Setpoint", "rad" }
  60. { "servo_state", "elevation_servo_state" }
  61. { "and5", "elevation_safe_and" }
  62. { "setpoint_generator_1d", "elevation_torsion_spg", "Elevation_Torsion_Setpoint", "rad" }
  63. { "subtract", "elevation_setpoint_error" }
  64. { "subtract", "elevation_error" }
  65. { "subtract", "elevation_torsion_error" }
  66. { "subtract", "elevation_torsion_setpoint_error" }
  67. { "subtract", "elevation_torsion_torque" }
  68. { "filter_lp", "elevation_torsion_torque_lp" }
  69. { "pid_aw", "elevation_pid" }
  70. { "pid_aw", "elevation_torsion_pid" }
  71. { "add", "elevation_speed_ff" }
  72. { "switch", "elevation_position_switch" }
  73. { "limit", "elevation_torsion_speed_limit" }
  74. { "limit", "elevation_speed_limit" }
  75. { "limit_switch", "elevation_range_limit_r" }
  76. { "limit_switch", "elevation_range_limit_l" }
  77. { "limit_2nd", "elevation_jerk_limit" }
  78. { "matrix_2x2", "elevation_output_matrix" }
  79. { "value", "elevation_torque_r" }
  80. { "value", "elevation_torque_l" }
  81. { "value", "elevation_position_offset_r" }
  82. { "value", "elevation_position_offset_l" }
  83. { "add", "elevation_position_offset_r_sum" }
  84. { "add", "elevation_position_offset_l_sum" }
  85. { "log", "elevation_safety_hw_top" }
  86. { "log", "elevation_safety_hw_bottom" }
  87. { "rangecheck", "elevation_speed_range_negative" }
  88. { "rangecheck", "elevation_speed_range_positive" }
  89. { "rangecheck", "elevation_torsion_range" }
  90. { "or2", "elevation_position_range" }
  91. { "command_bool", "elevation_recover" }
  92. { "and2", "elevation_position_safe" }
  93. { "log", "elevation_position_range_log" }
  94. { "log", "elevation_torsion_range_log" }
  95. { "log", "elevation_position_safe_log" }
  96. { "command_float", "focusbox_setpoint" }
  97. { "command_bool", "focusbox_enable" }
  98. { "ex2", "focusbox_exclusive" }
  99. { "subtract", "focusbox_error" }
  100. { "comparator", "focusbox_plus" }
  101. { "comparator", "focusbox_min" }
  102. { "and2", "focusbox_plus_enable" }
  103. { "and2", "focusbox_min_enable" }
  104. { "value_float", "focusbox_lim_plus", 0.25 }
  105. { "value_float", "focusbox_lim_min", -0.25 }
  106. { "value_bool", "false" }
  107. { "value_float", "zero" }
  108. }
  109. alias {
  110. { "Azimuth_Position", "azimuth_position_offset_sum", "out" }
  111. { "Azimuth_Drive_Safety_p270", "dt_az", "be4" }
  112. { "Azimuth_Drive_Safety_m270", "dt_az", "be2" }
  113. { "Elevation_Position", "elevation_input_matrix", "out0" }
  114. { "Elevation_Torsion", "elevation_input_matrix", "out1" }
  115. { "Elevation_Top_Safe", "dt_el_l", "be4" }
  116. { "Elevation_Bottom_Safe", "dt_el_l", "be2" }
  117. }
  118. links {
  119. { "dt_az", "position", "azimuth_position_gain", "in" , true }
  120. { "azimuth_position_gain", "out", "azimuth_position_offset_sum", "in0" , true }
  121. { "azimuth_position_offset", "value", "azimuth_position_offset_sum", "in1" , true }
  122. { $<Azimuth_Position>, "azimuth_error", "negative" , true }
  123. { "azimuth_servo_state", "reset", "azimuth_spg", "reset" , false }
  124. { $<Azimuth_Position>, "azimuth_spg", "reset_x" , true }
  125. { "zero", "value", "azimuth_spg", "track_x" , true }
  126. { "zero", "value", "azimuth_spg", "track_v" , true }
  127. { "false", "value", "azimuth_spg", "track_x_cmd" , true }
  128. { "false", "value", "azimuth_spg", "track_v_cmd" , true }
  129. { "azimuth_spg", "x", "azimuth_servo_state", "spg_x" , true }
  130. { "azimuth_spg", "v", "azimuth_servo_state", "spg_v" , true }
  131. { "azimuth_spg", "a", "azimuth_servo_state", "spg_a" , true }
  132. { "azimuth_position_range", "q", "azimuth_safe_and", "a" , true }
  133. { "ethercat", "operational","azimuth_safe_and", "b" , true }
  134. { $<Azimuth_Drive_Safety_p270>, "azimuth_safe_and", "c" , true }
  135. { $<Azimuth_Drive_Safety_m270>, "azimuth_safe_and", "d" , true }
  136. { "azimuth_safe_and", "q", "azimuth_servo_state", "safe" , true }
  137. { "azimuth_recover", "value", "azimuth_servo_state", "override" , true }
  138. { "azimuth_recover", "value", "azimuth_range_limit", "enable", true }
  139. { "azimuth_servo_state", "out_x", "azimuth_error", "positive" , true }
  140. { $<Azimuth_Position>, "azimuth_setpoint_error", "negative" , true }
  141. { "azimuth_spg", "setpoint", "azimuth_setpoint_error", "positive" , true }
  142. { "azimuth_servo_state", "out_v", "azimuth_speed_ff", "in0" , true }
  143. { "azimuth_error", "difference", "azimuth_pid", "in" , true }
  144. { "azimuth_servo_state", "enable", "azimuth_pid", "enable" , true }
  145. { "azimuth_pid", "out", "azimuth_pid_limit", "in" , true }
  146. { "azimuth_servo_state", "out_v", "azimuth_pid_limit", "limit" , true }
  147. { "azimuth_pid_limit", "out", "azimuth_pid_filter", "in" , true }
  148. { "azimuth_pid_filter", "out", "azimuth_speed_ff", "in1" , true }
  149. { "azimuth_speed_ff", "out", "azimuth_speed_limit", "in" , true }
  150. { "azimuth_speed_limit", "out", "azimuth_range_limit", "in" , true }
  151. { "azimuth_range_limit", "out", "azimuth_speed_servo", "in" , true }
  152. { "azimuth_speed_servo", "out", "dt_az", "speed" , true }
  153. { "azimuth_torque", "value", "dt_az", "torque" , true }
  154. { "azimuth_servo_state", "enable", "dt_az", "enable" , true }
  155. { "dt_az", "speed", "azimuth_speed_warning", "in" , true }
  156. { "azimuth_speed_warning", "invalid", "dt_az", "ba1" , true }
  157. { "false", "value", "dt_az", "ba2" , true }
  158. { $<Azimuth_Drive_Safety_p270>, "azimuth_safety_hw_pos", "condition", true }
  159. { $<Azimuth_Drive_Safety_m270>, "azimuth_safety_hw_neg", "condition", true }
  160. { $<Azimuth_Position>, "azimuth_speed_range_negative", "in", true }
  161. { $<Azimuth_Position>, "azimuth_speed_range_positive", "in", true }
  162. { "azimuth_speed_range_positive", "valid", "azimuth_position_range", "a", true }
  163. { "azimuth_speed_range_negative", "valid", "azimuth_position_range", "b", true }
  164. { "azimuth_position_range", "q", "azimuth_position_range_log", "condition", true }
  165. { "azimuth_speed_range_positive", "valid", "azimuth_position_safe", "a", true }
  166. { "azimuth_speed_range_negative", "valid", "azimuth_position_safe", "b", true }
  167. { "azimuth_position_safe", "q", "azimuth_position_safe_log", "condition", true }
  168. { "azimuth_speed_range_positive", "valid", "azimuth_range_limit", "enable_pos", true }
  169. { "azimuth_speed_range_negative", "valid", "azimuth_range_limit", "enable_neg", true }
  170. { "elevation_servo_state", "reset", "elevation_spg", "reset" , false }
  171. { $<Elevation_Position>, "elevation_spg", "reset_x" , true }
  172. { "zero", "value", "elevation_spg", "track_x" , true }
  173. { "zero", "value", "elevation_spg", "track_v" , true }
  174. { "false", "value", "elevation_spg", "track_x_cmd" , true }
  175. { "false", "value", "elevation_spg", "track_v_cmd" , true }
  176. { "elevation_spg", "x", "elevation_servo_state", "spg_x" , true }
  177. { "elevation_spg", "v", "elevation_servo_state", "spg_v" , true }
  178. { "elevation_spg", "a", "elevation_servo_state", "spg_a" , true }
  179. { "elevation_position_range", "q", "elevation_safe_and", "a" , true }
  180. { "ethercat", "operational","elevation_safe_and", "b" , true }
  181. { $<Elevation_Top_Safe>, "elevation_safe_and", "c", true }
  182. { $<Elevation_Bottom_Safe>, "elevation_safe_and", "d", true }
  183. { "elevation_torsion_range", "valid", "elevation_safe_and", "e", true }
  184. { "elevation_safe_and", "q", "elevation_servo_state", "safe" , true }
  185. { "elevation_recover", "value", "elevation_servo_state", "override" , true }
  186. { "elevation_recover", "value", "elevation_range_limit_r", "enable", true }
  187. { "elevation_recover", "value", "elevation_range_limit_l", "enable", true }
  188. { "elevation_servo_state", "out_x", "elevation_error", "positive" , true }
  189. { "elevation_servo_state", "out_v", "elevation_speed_ff", "in0" , true }
  190. { "dt_el_r", "position", "elevation_position_offset_r_sum", "in0" , true }
  191. { "dt_el_l", "position", "elevation_position_offset_l_sum", "in0" , true }
  192. { "elevation_position_offset_r", "value", "elevation_position_offset_r_sum", "in1" , true }
  193. { "elevation_position_offset_l", "value", "elevation_position_offset_l_sum", "in1" , true }
  194. { "elevation_position_offset_r_sum","out", "elevation_input_matrix", "in0" , true }
  195. { "elevation_position_offset_l_sum","out", "elevation_input_matrix", "in1" , true }
  196. { $<Elevation_Position>, "elevation_error", "negative" , true }
  197. { "elevation_spg", "setpoint", "elevation_setpoint_error", "positive" , true }
  198. { $<Elevation_Position>, "elevation_setpoint_error", "negative" , true }
  199. { "elevation_error", "difference", "elevation_pid", "in" , true }
  200. { "elevation_servo_state", "enable", "elevation_pid", "enable" , true }
  201. { "elevation_pid", "out", "elevation_speed_ff", "in1" , true }
  202. { "elevation_speed_ff", "out", "elevation_position_switch", "in" , true }
  203. { "elevation_servo_state", "enable", "elevation_position_switch", "on" , true }
  204. { "elevation_position_switch", "out", "elevation_speed_limit", "in" , true }
  205. { "elevation_servo_state", "enable", "elevation_jerk_limit", "enable" , true }
  206. { "elevation_speed_limit", "out", "elevation_jerk_limit", "in" , true }
  207. { "elevation_jerk_limit", "out", "elevation_output_matrix", "in0" , true }
  208. { "dt_el_r", "torque", "elevation_torsion_torque", "positive" , true }
  209. { "dt_el_l", "torque", "elevation_torsion_torque", "negative" , true }
  210. { "elevation_torsion_torque", "difference", "elevation_torsion_torque_lp", "in" , true }
  211. { "elevation_output_matrix", "out0", "elevation_range_limit_r", "in" , true }
  212. { "elevation_output_matrix", "out1", "elevation_range_limit_l", "in" , true }
  213. { "elevation_range_limit_r", "out", "dt_el_r", "speed" , true }
  214. { "elevation_range_limit_l", "out", "dt_el_l", "speed" , true }
  215. { "elevation_torque_r", "value", "dt_el_r", "torque" , true }
  216. { "elevation_torque_l", "value", "dt_el_l", "torque" , true }
  217. { "elevation_servo_state", "enable", "dt_el_r", "enable" , true }
  218. { "elevation_servo_state", "enable", "dt_el_l", "enable" , true }
  219. { "dt_az", "ae1", "focusbox_error", "negative" , true }
  220. { "focusbox_setpoint", "value", "focusbox_error", "positive" , true }
  221. { "focusbox_error", "difference", "focusbox_plus", "positive" , true }
  222. { "focusbox_lim_plus", "value", "focusbox_plus", "negative" , true }
  223. { "focusbox_lim_min", "value", "focusbox_min", "positive" , true }
  224. { "focusbox_error", "difference", "focusbox_min", "negative" , true }
  225. { "focusbox_plus", "out", "focusbox_plus_enable", "a" , true }
  226. { "focusbox_enable", "value", "focusbox_plus_enable", "b" , true }
  227. { "focusbox_min", "out", "focusbox_min_enable", "a" , true }
  228. { "focusbox_enable", "value", "focusbox_min_enable", "b" , true }
  229. { "focusbox_plus_enable", "q", "focusbox_exclusive", "a" , true }
  230. { "focusbox_min_enable", "q", "focusbox_exclusive", "b" , true }
  231. { "focusbox_exclusive", "qa", "dt_el_r", "ba1" , true }
  232. { "focusbox_exclusive", "qb", "dt_el_r", "ba2" , true }
  233. { "false", "value", "dt_el_l", "ba1" , true }
  234. { "false", "value", "dt_el_l", "ba2" , true }
  235. { "elevation_servo_state", "reset", "elevation_torsion_spg", "reset" , false }
  236. { "zero", "value", "elevation_torsion_spg", "reset_x" , true }
  237. { "elevation_torsion_spg", "x", "elevation_torsion_error", "positive" , true }
  238. { "elevation_input_matrix", "out1", "elevation_torsion_error", "negative" , true }
  239. { "elevation_torsion_spg", "setpoint", "elevation_torsion_setpoint_error", "positive" , true }
  240. { $<Elevation_Torsion>, "elevation_torsion_setpoint_error", "negative" , true }
  241. { "elevation_torsion_error", "difference", "elevation_torsion_pid", "in" , true }
  242. { "elevation_servo_state", "enable", "elevation_torsion_pid", "enable" , true }
  243. { "elevation_torsion_pid", "out", "elevation_torsion_speed_limit", "in" , true }
  244. { "elevation_torsion_speed_limit", "out", "elevation_output_matrix", "in1" , true }
  245. { $<Elevation_Top_Safe>, "elevation_safety_hw_top", "condition", true }
  246. { $<Elevation_Bottom_Safe>, "elevation_safety_hw_bottom", "condition", true }
  247. { $<Elevation_Torsion>, "elevation_torsion_range", "in", true }
  248. { $<Elevation_Position>, "elevation_speed_range_negative", "in", true }
  249. { $<Elevation_Position>, "elevation_speed_range_positive", "in", true }
  250. { "elevation_speed_range_positive", "valid", "elevation_position_range", "a", true }
  251. { "elevation_speed_range_negative", "valid", "elevation_position_range", "b", true }
  252. { "elevation_position_range", "q", "elevation_position_range_log", "condition", true }
  253. { "elevation_speed_range_positive", "valid", "elevation_position_safe", "a", true }
  254. { "elevation_speed_range_negative", "valid", "elevation_position_safe", "b", true }
  255. { "elevation_position_safe", "q", "elevation_position_safe_log", "condition", true }
  256. { "elevation_speed_range_positive", "valid", "elevation_range_limit_r", "enable_pos", true }
  257. { "elevation_speed_range_negative", "valid", "elevation_range_limit_r", "enable_neg", true }
  258. { "elevation_speed_range_positive", "valid", "elevation_range_limit_l", "enable_pos", true }
  259. { "elevation_speed_range_negative", "valid", "elevation_range_limit_l", "enable_neg", true }
  260. { "elevation_torsion_range", "valid", "elevation_torsion_range_log", "condition", true }
  261. }
  262. traces {
  263. { "Azimuth_Spg0", "rad", "azimuth_spg", "x" }
  264. { "Azimuth_Spg1", "rad/s", "azimuth_spg", "v" }
  265. { "Azimuth_Spg2", "rad/s/s", "azimuth_spg", "a" }
  266. { "Azimuth_Spg3", "rad/s/s/s", "azimuth_spg", "j" }
  267. { "Azimuth_Setpoint", "rad", "azimuth_spg", "setpoint" }
  268. { "Azimuth_Error", "rad", "azimuth_error", "difference" }
  269. { "Azimuth_Setpoint_Error", "rad", "azimuth_setpoint_error", "difference" }
  270. { "Azimuth_PID", "rad/s", "azimuth_pid", "out" }
  271. { "Azimuth_I", "rad/s", "azimuth_pid", "outi" }
  272. { "Azimuth_PID_filtered", "rad/s", "azimuth_pid_filter", "out" }
  273. { "Azimuth_Position", "rad", $<Azimuth_Position> }
  274. { "Azimuth_Speed", "rad/s", "dt_az", "speed" }
  275. { "Azimuth_Torque", "Nm", "dt_az", "torque" }
  276. { "Azimuth_Safe", "Boolean", "azimuth_safe_and", "q" }
  277. { "Azimuth_Enabled", "Boolean", "dt_az", "enabled" }
  278. { "Azimuth_Drive_Safety", "Boolean", "dt_az", "be1" }
  279. { "Azimuth_Drive_Safety_p270", "Boolean", $<Azimuth_Drive_Safety_p270> }
  280. { "Azimuth_Drive_Safety_m270", "Boolean", $<Azimuth_Drive_Safety_m270> }
  281. { "Azimuth_Override", "Boolean", "azimuth_recover", "value" }
  282. { "Focusbox_Position", "Volt", "dt_az", "ae1" }
  283. { "Elevation_Position", "rad", $<Elevation_Position> }
  284. { "Elevation_Torsion", "rad", "elevation_input_matrix", "out1" }
  285. { "Elevation_Setpoint", "rad", "elevation_spg", "setpoint" }
  286. { "Elevation_Spg0", "rad", "elevation_spg", "x" }
  287. { "Elevation_Spg1", "rad/s", "elevation_spg", "v" }
  288. { "Elevation_Spg2", "rad/s", "elevation_spg", "a" }
  289. { "Elevation_Spg3", "rad/s", "elevation_spg", "j" }
  290. { "Elevation_Error", "rad", "elevation_error", "difference" }
  291. { "Elevation_Setpoint_Error", "rad", "elevation_setpoint_error", "difference" }
  292. { "Elevation_PID", "rad/s", "elevation_pid", "out" }
  293. { "Elevation_Torsion_Error", "rad", "elevation_torsion_error", "difference" }
  294. { "Elevation_Torsion_Setpoint_Error", "rad", "elevation_torsion_setpoint_error", "difference" }
  295. { "Elevation_Torsion_PID", "rad/s", "elevation_torsion_pid", "out" }
  296. { "Elevation_Position_Right", "rad", "elevation_position_offset_r_sum", "out" }
  297. { "Elevation_Position_Left", "rad", "elevation_position_offset_l_sum", "out" }
  298. { "Elevation_Speed_Right", "rad/s", "dt_el_r", "speed" }
  299. { "Elevation_Speed_Left", "rad/s", "dt_el_l", "speed" }
  300. { "Elevation_Torque_Right", "Nm", "dt_el_r", "torque" }
  301. { "Elevation_Torque_Left", "Nm", "dt_el_l", "torque" }
  302. { "Elevation_Torsion_Torque", "Nm", "elevation_torsion_torque_lp", "out" }
  303. { "Elevation_Safe", "Boolean", "elevation_safe_and", "q" }
  304. { "Elevation_Enabled", "Boolean", "dt_el_l", "enabled" }
  305. { "Elevation_Drive_Safety_Right", "Boolean", "dt_el_r", "be1" }
  306. { "Elevation_Drive_Safety_Left", "Boolean", "dt_el_l", "be1" }
  307. { "Elevation_Top_Safe", "Boolean", $<Elevation_Top_Safe> }
  308. { "Elevation_Bottom_Safe", "Boolean", $<Elevation_Bottom_Safe> }
  309. { "Elevation_Override", "Boolean", "elevation_recover", "value" }
  310. }
  311. set azimuth_gear 15006.75
  312. set elevation_gear 44803.125
  313. params {
  314. { "azimuth_spg", "setpoint", (float) 0.0 }
  315. # maximum speed and position clients input is checked against
  316. { "azimuth_spg", "max_x", (float) deg2rad(270.0) }
  317. { "azimuth_spg", "min_x", (float) deg2rad(-270.0) }
  318. { "azimuth_spg", "max_v", (float) rpm2rads(3000.0)/$(azimuth_gear) }
  319. # acceleration and jerk we use to generate a profile
  320. { "azimuth_spg", "max_a", (float) 0.0002 }
  321. { "azimuth_spg", "max_j", (float) 0.00001 }
  322. # at which precision do we consider the values to be 'equal'
  323. { "azimuth_spg", "precision_x", (float) 0.000001 }
  324. { "azimuth_spg", "precision_a", (float) 0.000001 }
  325. { "azimuth_spg", "precision_v", (float) 0.000001 }
  326. # maximum values within we allow normal operation
  327. { "azimuth_servo_state", "max_x", (float) deg2rad(270.0) }
  328. { "azimuth_servo_state", "min_x", (float) deg2rad(-270.0) }
  329. { "azimuth_servo_state", "max_v", (float) rpm2rads(3000.0)/$(azimuth_gear) }
  330. { "azimuth_servo_state", "max_a", (float) 0.0002 }
  331. # controller factors
  332. { "azimuth_pid", "kp", (float) 0.20 }
  333. { "azimuth_pid", "ki", (float) 0.00 }
  334. { "azimuth_pid", "kd", (float) 0.0 }
  335. # the amount of 'wind-up' we allow in the integrator
  336. { "azimuth_pid", "maxw", (float) rpm2rads(0.005) }
  337. { "azimuth_pid", "minw", (float) rpm2rads(-0.005) }
  338. # second order filter to make sure we do not trigger the eigenfrequency of the DT
  339. { "azimuth_pid_filter", "transfer", (int) 2,
  340. (double) 6.343831259e+05,
  341. (float) { -0.9964520027, 1.9964456974 },
  342. (float) { 1.0, 2.0 }
  343. }
  344. { "azimuth_speed_warning", "max", (double) rpm2rads(200.0) }
  345. { "azimuth_speed_warning", "min", (double) rpm2rads(-200.0) }
  346. # Due to high vibrations observed at high speed it was decided to limit
  347. # the pid controller. At low speed the value is untouched, but the
  348. # output is limited when speed increases
  349. # limit = offset + gain * speed
  350. { "azimuth_pid_limit", "offset", (float) rpm2rads(100.0)/$(azimuth_gear) }
  351. { "azimuth_pid_limit", "gain", (float)-0.3 }
  352. # speed limit on spg + pid just before we send it to the drive
  353. { "azimuth_speed_limit", "min", (float) rpm2rads(-3000.0)/$(azimuth_gear) }
  354. { "azimuth_speed_limit", "max", (float) rpm2rads(3000.0)/$(azimuth_gear) }
  355. # gear ratio between DT and servodrive
  356. { "azimuth_speed_servo", "gain", (float)-$(azimuth_gear) }
  357. # torque we allow the servodrive to actuate on the DT
  358. { "azimuth_torque", "value", (float) 10.0 }
  359. # inverse gear ratio between DT and servodrive
  360. { "azimuth_position_gain", "gain", (float)-1.0/$(azimuth_gear) }
  361. # callibration value for position
  362. { "azimuth_position_offset","value", (float) 0.0 }
  363. { "azimuth_safety_hw_pos", "msg_up", 2, "Azimuth HW positive safety switch is closed" }
  364. { "azimuth_safety_hw_pos", "msg_down", 0, "Azimuth HW positive safety switch is open" }
  365. { "azimuth_safety_hw_pos", "init", true }
  366. { "azimuth_safety_hw_neg", "msg_up", 2, "Azimuth HW negative safety switch is closed" }
  367. { "azimuth_safety_hw_neg", "msg_down", 0, "Azimuth HW negative safety switch is open" }
  368. { "azimuth_safety_hw_neg", "init", true }
  369. # positions were we go into safe behavior
  370. # these must be outside the normal operating range
  371. # 'safe zone' is between the operating range and the absolute safety
  372. # value above
  373. { "azimuth_speed_range_negative", "max", deg2rad(290.0) }
  374. { "azimuth_speed_range_negative", "min", deg2rad(-280.0) }
  375. { "azimuth_speed_range_positive", "max", deg2rad(280.0) }
  376. { "azimuth_speed_range_positive", "min", deg2rad(-290.0) }
  377. { "azimuth_position_range_log", "msg_up", 1, "Azimuth position inside allowed range" }
  378. { "azimuth_position_range_log", "msg_down", 0, "Azimuth position outside allowed range" }
  379. { "azimuth_position_range_log", "init", true }
  380. { "azimuth_position_safe_log", "msg_up", 1, "Azimuth position left safe zone to normal operating range" }
  381. { "azimuth_position_safe_log", "msg_down", 1, "Azimuth position left normal operating range and is in safe zone" }
  382. { "azimuth_position_safe_log", "init", true }
  383. { "elevation_input_matrix", "constants", (float) { 0.5/$(elevation_gear), -0.5/$(elevation_gear) },
  384. (float) { 1.0/$(elevation_gear), 1.0/$(elevation_gear) } }
  385. { "elevation_output_matrix", "constants", (float) { $(elevation_gear), $(elevation_gear)/2.0 },
  386. (float) { -$(elevation_gear), $(elevation_gear)/2.0 } }
  387. { "elevation_spg", "setpoint", (float) 0.0 }
  388. { "elevation_spg", "max_x", (float) deg2rad(90.0) }
  389. { "elevation_spg", "min_x", (float) deg2rad(-0.055) }
  390. { "elevation_spg", "max_v", (float) rpm2rads(2100.0)/$(elevation_gear) }
  391. { "elevation_spg", "max_a", (float) 0.0003 }
  392. { "elevation_spg", "max_j", (float) 0.000016 }
  393. { "elevation_spg", "precision_x", (float) 0.000001 }
  394. { "elevation_spg", "precision_a", (float) 0.000001 }
  395. { "elevation_spg", "precision_v", (float) 0.000001 }
  396. { "elevation_servo_state", "max_x", (float) deg2rad(90.0) }
  397. { "elevation_servo_state", "min_x", (float) deg2rad(-0.05) }
  398. { "elevation_servo_state", "max_v", (float) rpm2rads(2100.0)/$(elevation_gear) }
  399. { "elevation_servo_state", "max_a", (float) 0.0003 }
  400. { "elevation_torsion_spg", "setpoint", (float) 0.0 }
  401. { "elevation_torsion_spg", "max_x", (float) 0.00 }
  402. { "elevation_torsion_spg", "min_x", (float)-0.00 }
  403. { "elevation_torsion_spg", "max_v", (float) rpm2rads(0.001) }
  404. { "elevation_pid", "kp", (float) 0.80 }
  405. { "elevation_pid", "ki", (float) 0.001 }
  406. { "elevation_pid", "kd", (float) 0.001 }
  407. { "elevation_pid", "maxw", (float) rpm2rads(0.002) }
  408. { "elevation_pid", "minw", (float) rpm2rads(-0.002) }
  409. { "elevation_speed_limit", "min", (float) rpm2rads(-0.08) }
  410. { "elevation_speed_limit", "max", (float) rpm2rads(0.08) }
  411. { "elevation_jerk_limit", "min", (float)-0.003 }
  412. { "elevation_jerk_limit", "max", (float) 0.003 }
  413. { "elevation_torsion_pid", "kp", (float) 20.0 }
  414. { "elevation_torsion_pid", "ki", (float) 0.0 }
  415. { "elevation_torsion_pid", "kd", (float) 0.0 }
  416. { "elevation_torsion_pid", "maxw", (float) 0.0001 }
  417. { "elevation_torsion_pid", "minw", (float)-0.0001 }
  418. { "elevation_torsion_speed_limit", "min", (float) rpm2rads(-0.01) }
  419. { "elevation_torsion_speed_limit", "max", (float) rpm2rads(0.01) }
  420. { "elevation_torsion_range", "max", (float) 0.0002 }
  421. { "elevation_torsion_range", "min", (float)-0.0002 }
  422. { "elevation_torque_r", "value", (float) 10.0 }
  423. { "elevation_torque_l", "value", (float) 10.0 }
  424. { "elevation_torsion_torque_lp", "tau", (float) 10.0 }
  425. { "elevation_position_offset_r","value", (float) 0.0 }
  426. { "elevation_position_offset_l","value", (float) 0.0 }
  427. # positions were we go into safe behavior
  428. # these must be outside the normal operating range
  429. # 'safe zone' is between the operating range and the absolute safety
  430. # value above
  431. { "elevation_speed_range_negative", "max", deg2rad(90.5) * $(elevation_gear) }
  432. { "elevation_speed_range_negative", "min", deg2rad(-0.09) * $(elevation_gear) }
  433. { "elevation_speed_range_positive", "max", deg2rad(90.4) * $(elevation_gear) }
  434. { "elevation_speed_range_positive", "min", deg2rad(-0.1) * $(elevation_gear) }
  435. { "elevation_position_range_log", "msg_up", 1, "Elevation position inside allowed range" }
  436. { "elevation_position_range_log", "msg_down", 0, "Elevation position outside allowed range" }
  437. { "elevation_position_range_log", "init", true }
  438. { "elevation_position_safe_log", "msg_up", 1, "Elevation position left safe zone to normal operating range" }
  439. { "elevation_position_safe_log", "msg_down", 1, "Elevation position left normal operating range and is in safe zone" }
  440. { "elevation_position_safe_log", "init", true }
  441. { "elevation_torsion_range_log", "msg_up", 1, "Elevation torsion inside allowed range" }
  442. { "elevation_torsion_range_log", "msg_down", 0, "Elevation torsion outside allowed range" }
  443. { "elevation_torsion_range_log", "init", true }
  444. { "elevation_safety_hw_top", "msg_up", 2, "Elevation HW top safety switch is closed" }
  445. { "elevation_safety_hw_top", "msg_down", 0, "Elevation HW top safety switch is open" }
  446. { "elevation_safety_hw_top", "init", true }
  447. { "elevation_safety_hw_bottom", "msg_up", 2, "Elevation HW bottom safety switch is closed" }
  448. { "elevation_safety_hw_bottom", "msg_down", 0, "Elevation HW bottom safety switch is open" }
  449. { "elevation_safety_hw_bottom", "init", true }
  450. }
  451. set shell true
  452. set shell_intro "Dwingeloo Telescope controller"
  453. set shell_prompt "DT>"
  454. # Load file with calibration parameters.
  455. # All parameters above should not be subject to calibration.
  456. include "dt_ctrl.param"