1. Background of ConsiderationRecently, I used the Hechuan M500S to create a single-station hinge drill, and the results were quite good. This led me to wonder if I could continue using the M500S for a wired dual-station hinge drill.2. Detailed Analysis2.1 Hardware LevelThe single-station hinge drill used two EtherCAT servos, while the wired dual-station hinge drill has a total of 7 servos and 4 frequency converters.The M500S supports 4 EtherCAT servos and 4 pulse servos, with one RS232 port and one RS485 port. The hardware of the M500S meets the requirements, and the electrical topology can be arranged as follows:
Figure 2.12.2 Software Level
Figure 2.2.1 Compilation Results of the Single-Station Hinge Drill PLC ProgramFrom Figure 2.2.1, it can be seen that the biggest bottleneck at the software level is the program capacity and variable capacity space, which are not particularly sufficient.
Figure 2.2.2 Performance of M Series PLCsFrom Figure 2.2.2, we can see that the program capacity of the M500S, M501S, and M511S is all 512KBytes, and the variable capacity is 256KBytes. The M511, M512, M513, and M514 have a program capacity of 20MBytes and a variable capacity of 20MBytes. If we want to solve the issues of program capacity and variable capacity by upgrading the PLC, we need to upgrade the M500S to the M511, which is a significant upgrade and incurs additional costs.Therefore, we still choose to use the M500S for the wired dual-station hinge drill, but we need to optimize the code.3. Code Optimization(1) Reduce variable assignment statements by directly binding variables to inputs and outputs or assigning communication addresses to variables. This can improve program capacity usage by about 1%.(2) Encapsulate single-axis functions into function blocks, which also improves program capacity usage, but only slightly.(3) Simplify axis group functions, which can effectively reduce program capacity usage. Replacing MC_MoveLinearAbsolute with MC_MoveDirectAbsolute can further reduce program capacity usage to below 39%.(4) Merge variables to reduce variable capacity usage.4. ConclusionWith code optimization, the M500S can be used for the wired dual-station hinge drill, but the program capacity usage is estimated to reach 85%, and the variable capacity usage is expected to reach 90%.