David Jan Posted July 9 Share Posted July 9 I have now customized a few parameters, how can I graph their variations directly in the drawing function? For example global salm I can't add it manually in the plot, how can I do it? salm is located at p812. Quote Link to comment Share on other sites More sharing options...
DaveBarnett Posted July 9 Share Posted July 9 You can add global variables to the list of items to be plotted by opening the plot tool, then clicking on the "Detailed" tab... and selecting "UserGlobal" Quote Link to comment Share on other sites More sharing options...
David Jan Posted July 9 Author Share Posted July 9 Thanks, another question I have is what is the runtime cycle of plc0, is it sys.servoperiod? Or is it another other parameter, which parameter is the period for each command issued by the position ring in PMAC? For example: x100, the position ring will slice 100 into many parts and issue a command once per run cycle, so which parameter is this run cycle? Is the position ring motion cycle parameter related to the run cycle parameter of PLC0? plc0 run cycle parameter is the same as rticplc run cycle parameter, right? Quote Link to comment Share on other sites More sharing options...
MoMo Posted July 9 Share Posted July 9 13 minutes ago, David Jan said: Thanks, another question I have is what is the runtime cycle of plc0, is it sys.servoperiod? Or is it another other parameter, which parameter is the period for each command issued by the position ring in PMAC? For example: x100, the position ring will slice 100 into many parts and issue a command once per run cycle, so which parameter is this run cycle? Is the position ring motion cycle parameter related to the run cycle parameter of PLC0? plc0 run cycle parameter is the same as rticplc run cycle parameter, right? PLC0 and RTICPLC in PPMAC run in the RTI task, and their running cycle is controlled by Sys.RtIntPeriod Its maximum running frequency can be the same as the Servo task. The desired position of the motor is updated every Servo cycle. 1 Quote Link to comment Share on other sites More sharing options...
David Jan Posted July 10 Author Share Posted July 10 17 hours ago, MoMo said: PLC0 and RTICPLC in PPMAC run in the RTI task, and their running cycle is controlled by Sys.RtIntPeriod Its maximum running frequency can be the same as the Servo task. The desired position of the motor is updated every Servo cycle. Thanks,MoMo. So can I use the servo period parameter sys.servoperiod as the period for the motor position update? If not, how do I need to determine the motor position update period? Quote Link to comment Share on other sites More sharing options...
leandro.martins Posted July 10 Share Posted July 10 The PLC0 is executed at the Real-Time interruption that occurs every (Sys.RtIntPeriod+1) servo interruption Configuring Sys.RtIntPeriod=0 will make the PLC0 to be executed at the same rate of the Servo cycle. The Sys.ServoPeriod is the period between each servo interruption. In other words, the period between each update od servo-loop. 1 Quote Link to comment Share on other sites More sharing options...
MoMo Posted July 11 Share Posted July 11 On 7/9/2024 at 4:14 PM, David Jan said: Thanks, another question I have is what is the runtime cycle of plc0, is it sys.servoperiod? Or is it another other parameter, which parameter is the period for each command issued by the position ring in PMAC? For example: x100, the position ring will slice 100 into many parts and issue a command once per run cycle, so which parameter is this run cycle? Is the position ring motion cycle parameter related to the run cycle parameter of PLC0? plc0 run cycle parameter is the same as rticplc run cycle parameter, right? I think I need you to describe your needs in detail so that I can give you advice. The reason you use motion controllers is because they can do it for you. 1 Quote Link to comment Share on other sites More sharing options...
David Jan Posted July 11 Author Share Posted July 11 5 hours ago, MoMo said: I think I need you to describe your needs in detail so that I can give you advice. The reason you use motion controllers is because they can do it for you. My idea is that I want to implement digital PI control in PMAC, but in I control, the formula is shown below, T is the sampling period and Ti is the integration period, so I need to know the period of operation of PLC0 versus the period of each time the PMAC position ring sends the position information of a small segment of the line, so that I can calculate it by the following Formula. Quote Link to comment Share on other sites More sharing options...
leandro.martins Posted July 11 Share Posted July 11 (edited) As I said, if you set Sys.RtIntPeriod to 0, then your PLC0 will be executed at the same rate of the servo loop, which is the Sys.ServoPeriod. However, they are different interruptions, with different priorities. It's not clear for me how the PI implemented by the PLC0 will interact with the standard servo-loop, so that might cause some issues. I think the best approach for implementing a PI control by yourself would be creating a "user-written servo routine". In that way your T_i would be the Sys.ServoPeriod/(Motor[x].Stime +1). Of course, that depends on what are you trying to achieve. The procedure for doing that is described in the "Writing C Functions and Programs in Power PMAC" section of the Power PMAC Users Manual. Edited July 11 by leandro.martins 1 Quote Link to comment Share on other sites More sharing options...
MoMo Posted July 11 Share Posted July 11 5 hours ago, David Jan said: My idea is that I want to implement digital PI control in PMAC, but in I control, the formula is shown below, T is the sampling period and Ti is the integration period, so I need to know the period of operation of PLC0 versus the period of each time the PMAC position ring sends the position information of a small segment of the line, so that I can calculate it by the following Formula. I strongly agree with leandro.martins' suggestion. 1 Quote Link to comment Share on other sites More sharing options...
David Jan Posted July 12 Author Share Posted July 12 15 hours ago, leandro.martins said: As I said, if you set Sys.RtIntPeriod to 0, then your PLC0 will be executed at the same rate of the servo loop, which is the Sys.ServoPeriod. However, they are different interruptions, with different priorities. It's not clear for me how the PI implemented by the PLC0 will interact with the standard servo-loop, so that might cause some issues. I think the best approach for implementing a PI control by yourself would be creating a "user-written servo routine". In that way your T_i would be the Sys.ServoPeriod/(Motor[x].Stime +1). Of course, that depends on what are you trying to achieve. The procedure for doing that is described in the "Writing C Functions and Programs in Power PMAC" section of the Power PMAC Users Manual. I've tried writing custom servo algorithms in usecoder before, but this PI controller is not a controller in the servo loop, such as a speed controller or something like that, it's a compensating controller, his role can't be a substitute for the three loops in the servo, in other words I'm still going to use the servo algorithms servoctrl in the PMAC itself, that's why I thought of implementing it in PLC0, either implement it in rticplc. Can you give relative advice? After all, this is my first attempt. Quote Link to comment Share on other sites More sharing options...
MoMo Posted July 12 Share Posted July 12 16 hours ago, David Jan said: My idea is that I want to implement digital PI control in PMAC, but in I control, the formula is shown below, T is the sampling period and Ti is the integration period, so I need to know the period of operation of PLC0 versus the period of each time the PMAC position ring sends the position information of a small segment of the line, so that I can calculate it by the following Formula. 20 minutes ago, David Jan said: I've tried writing custom servo algorithms in usecoder before, but this PI controller is not a controller in the servo loop, such as a speed controller or something like that, it's a compensating controller, his role can't be a substitute for the three loops in the servo, in other words I'm still going to use the servo algorithms servoctrl in the PMAC itself, that's why I thought of implementing it in PLC0, either implement it in rticplc. Can you give relative advice? After all, this is my first attempt. I think there is a mistake in your understanding. ①PI controller is a kind of controller. Whether it can control stably is determined by the transfer function of the plant. ②Any controller that can be executed strictly on a fixed period can be used to execute the controller, including PI controllers. Therefore User Written Servo Rountin can be used to implement PI controller. ③No matter what controller it is, as long as it is linear, it can be implemented using the transfer function. Their programs are the same, but the parameters are different. The same transfer function can be a P controller, PID, PI or filter 1 Quote Link to comment Share on other sites More sharing options...
David Jan Posted July 12 Author Share Posted July 12 6 hours ago, MoMo said: I think there is a mistake in your understanding. ①PI controller is a kind of controller. Whether it can control stably is determined by the transfer function of the plant. ②Any controller that can be executed strictly on a fixed period can be used to execute the controller, including PI controllers. Therefore User Written Servo Rountin can be used to implement PI controller. ③No matter what controller it is, as long as it is linear, it can be implemented using the transfer function. Their programs are the same, but the parameters are different. The same transfer function can be a P controller, PID, PI or filter I understand what you mean, no matter what controller we can write it in usrcode.c under realtime routines and just declare it in the header file, except that customising the servo algorithm requires right clicking on realtime routines and selecting user servo settings, selecting motors and selecting servo algorithms, whereas this compensation controller of mine does not I don't need to do any of these things for this compensation controller. Do you think I understand correctly? Quote Link to comment Share on other sites More sharing options...
leandro.martins Posted July 12 Share Posted July 12 7 hours ago, David Jan said: it's a compensating controller, his role can't be a substitute for the three loops in the servo, in other words I'm still going to use the servo algorithms servoctrl in the PMAC itself, that's why I thought of implementing it in PLC0, either implement it in rticplc. You can run your custom PI controller in Motor[0], and make it write into some elements of a different motor, Motor[x].CompDac, for example. I should say that I can't see a reason for adding a different PI term. Perhaps cascading servo loops could be more appropriate for this. 1 Quote Link to comment Share on other sites More sharing options...
David Jan Posted July 12 Author Share Posted July 12 I understand what you mean, let me set the custom PI controller to Motor0's custom user algorithm didn't then write it to some parameters in the compensation table, here is the control schematic of how I want to implement the compensation controller, my idea is to write the compensation controller algorithm in usrcode.c and declare it in the header file, after building and downloading the project this way, does the compensation controller work when I normally After building and downloading the project, does the compensation controller work when running the motion programme normally? I don't understand this piece well enough, I hope you can give some advice. Quote Link to comment Share on other sites More sharing options...
David Jan Posted July 12 Author Share Posted July 12 8 minutes ago, David Jan said: I understand what you mean, let me set the custom PI controller to Motor0's custom user algorithm didn't then write it to some parameters in the compensation table, here is the control schematic of how I want to implement the compensation controller, my idea is to write the compensation controller algorithm in usrcode.c and declare it in the header file, after building and downloading the project this way, does the compensation controller work when I normally After building and downloading the project, does the compensation controller work when running the motion programme normally? I don't understand this piece well enough, I hope you can give some advice. As you can see from the diagram, I am still using the full PMAC 3-loop control algorithm, but I would like to add a compensation controller whose input is the difference between the motor current settings and whose output is the speed deviation. Quote Link to comment Share on other sites More sharing options...
MoMo Posted July 12 Share Posted July 12 (edited) 52 minutes ago, David Jan said: I understand what you mean, let me set the custom PI controller to Motor0's custom user algorithm didn't then write it to some parameters in the compensation table, here is the control schematic of how I want to implement the compensation controller, my idea is to write the compensation controller algorithm in usrcode.c and declare it in the header file, after building and downloading the project this way, does the compensation controller work when I normally After building and downloading the project, does the compensation controller work when running the motion programme normally? I don't understand this piece well enough, I hope you can give some advice. If you want to realize the cross-decoupling control of the gantry, you don’t need to write any code yourself. PMAC has this function internally. In addition, if you want to implement the content in your control block diagram, it cannot be implemented on the existing PMAC standard algorithm, because the PMAC standard algorithm cannot superimpose the velocity error. You should refer to the Multi-Motor Routines chapter in the "Power PMAC Reference Manual" to rewrite the control algorithm for the two motors. Edited July 12 by MoMo 1 Quote Link to comment Share on other sites More sharing options...
David Jan Posted July 12 Author Share Posted July 12 1 hour ago, MoMo said: If you want to realize the cross-decoupling control of the gantry, you don’t need to write any code yourself. PMAC has this function internally. In addition, if you want to implement the content in your control block diagram, it cannot be implemented on the existing PMAC standard algorithm, because the PMAC standard algorithm cannot superimpose the velocity error. You should refer to the Multi-Motor Routines chapter in the "Power PMAC Reference Manual" to rewrite the control algorithm for the two motors. That means if I want to write my own compensation controller, it can only be written in the custom servo algorithm, and the PID control in the custom servo algorithm is all done by me all by myself, I can understand it like that, right? Can you provide a demo of the custom servo pid control algorithm? I can refer to it to make it easier to implement. Quote Link to comment Share on other sites More sharing options...
leandro.martins Posted July 12 Share Posted July 12 1 hour ago, MoMo said: In addition, if you want to implement the content in your control block diagram, it cannot be implemented on the existing PMAC standard algorithm, because the PMAC standard algorithm cannot superimpose the velocity error. @MoMo, in this case, wouldn't be possible to run a custom servo-routine, that runs on Motor[0], writing into Motor[1].CompPos2? Quote Link to comment Share on other sites More sharing options...
MoMo Posted July 12 Share Posted July 12 2 hours ago, leandro.martins said: @MoMo, in this case, wouldn't be possible to run a custom servo-routine, that runs on Motor[0], writing into Motor[1].CompPos2? Motor[x].CompPos2 is velocity feedback, not velocity error. At least you can't assign values directly, you need to integrate them first, which is theoretically possible. But to be honest, I don't know much about its application. I guess it's gantry control. 1 Quote Link to comment Share on other sites More sharing options...
David Jan Posted July 13 Author Share Posted July 13 @MoMoDo you have a demo related to custom servo algorithms? I would like to refer to the implementation of PID control and compensation controller in usrcode.c. Quote Link to comment Share on other sites More sharing options...
David Jan Posted July 13 Author Share Posted July 13 MoMo, I am using CK3M to control the motor, the motor is in speed mode, now I want to add a compensation controller in plc0 by myself, I determine the input of the compensator through the PDO mapping value, and the output of the compensator is modified as a position variable to be added to the position loop setting value of the PMAC, this is feasible, right, because the setting value of the position loop of the PMAC is something that I can modify, and speed The setpoints of the PMAC position loop can be modified, and the setpoints of the speed and current controllers can be mapped to the PDO, so there is no problem in realizing this, right? Quote Link to comment Share on other sites More sharing options...
MoMo Posted July 13 Share Posted July 13 39 minutes ago, David Jan said: MoMo, I am using CK3M to control the motor, the motor is in speed mode, now I want to add a compensation controller in plc0 by myself, I determine the input of the compensator through the PDO mapping value, and the output of the compensator is modified as a position variable to be added to the position loop setting value of the PMAC, this is feasible, right, because the setting value of the position loop of the PMAC is something that I can modify, and speed The setpoints of the PMAC position loop can be modified, and the setpoints of the speed and current controllers can be mapped to the PDO, so there is no problem in realizing this, right? If you use EtherCAT motors, I feel like all you are doing is a waste of time because EtherCAT has a huge communication delay. Using EtherCAT for motor control in PMAC will have very poor performance. If you choose EtherCAT, all the control you want to do should be done within the drive. Quote Link to comment Share on other sites More sharing options...
David Jan Posted July 14 Author Share Posted July 14 16 hours ago, MoMo said: If you use EtherCAT motors, I feel like all you are doing is a waste of time because EtherCAT has a huge communication delay. Using EtherCAT for motor control in PMAC will have very poor performance. If you choose EtherCAT, all the control you want to do should be done within the drive. Then the only way I can implement a compensating controller is to build the 3-loop PID control successfully and add the compensating controller in a custom servo algorithm by myself. Then isn't the actual position and actual velocity in the plotting function in OMAC based on the values mapped back to the PDO? Wouldn't his communication delay be much different? I think I can live with it if the difference is not too big. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.