How to model the behavior of a closed loop position system?

In summary: PID controller gains using a quadratic error function.In summary, the project was to control the speed of a motorized machine with a proportional controller. I solved it by simulating the machine with a controller and then tuning the controller.
  • #1
pit34
3
2
Hello everyone,

I would need help to model a motorized system controlled in a closed loop. It is a personal project.

At first, I am looking to obtain the transfer function and simulate the system on computer. In a second step (not the aim of this thread), I would like to use this simulation to search for good PID coefficients for my corrector. I know there are practical ways to find them, but I would like to learn how to model mechanical systems. It will help me later for other personal project. It is an area that interests me. So I would need a boost, a direction to follow, to model this system.Here is the project situation:
I am currently making a motorized stop for a metal saw in my workshop. The system is functional.
A DC motor is controlled in PWM via a driver.
The displacement is measured by a relative rotary encoder sufficiently precise for this application (OMRON E6B2-CWZ6C 600P/R).
The engine moves a belt, itself fixed on a cart (stop) which slides on a linear rail.
The operation is simple: I enter a position (in mm) to be reached, the program calculates the gap with the current position, the number of driving turns to be carried out, and moves the cart to the desired position.
The PID corrector (error = difference between measured position and set position) allows me to have a slightly softer and precise reaction.

My situation
I am 33 years old. I did my studies in electronics, my last mechanics courses dates back to the high school in the science of the engineer.
I did research on the subject, and what I understand / suppose / deduced (correct me if I have false):
-If my system is order 1 or 2, I can get its transfer function. Otherwise, I have to decompose it in the subsystem of order 2.
- The current / couple relationship is a first order. The tension / speed relationship is a second order. The enslavement in a position is a third order. So I have to decompose my system in subsystems.
- On my position measurement, the traced curve looks like an order 2, which contradicts the previous point.
- On certain website, I see that it is recommended to make a loop for each order, to simulate each loop, and to define PID coefficients for each loop. It seems a little disproportionate to me.

It's a bit vague for me and I don't really see what end start.
Could you give me a track? A beginning of explanation? A website on which to find the solution?

Thanks in advance,
Have a good day.
 
Engineering news on Phys.org
  • #2
Welcome to PF. :smile:

Sounds like a pretty dangerous project (if you get any part of it wrong), but we'll try to keep the thread open for a bit to see how it goes.

Can you post links to similar systems that illustrate what you are trying to do? And what exactly is "a motorized stop for a metal saw in my workshop"? Why not just push the "Off" button? Or is this system supposed to sense some problem and stop the saw rotation more quickly than the "Off" button does? And could you give more details on what the feedback us used for? Thanks.
 
  • #3
Ok. My english is not very good, maybe "saw stop" is not the correct expression.
I am making this device :
https://www.proscale.com/media/cata...35074d0bca43668fbd9926d/1/7/17-06-27-005.jpeg
But with a motor, a pulley and a timing belt to move the carriage at the desired position. The position is measured via the rotary encoder that is linked to the second pulley (the free one). The aim is to have millimeter precision, to cut different bars length pretty fast. It would be a real upgarde in my work.
The system is already working, or near to work. I just need to tune my PID gains. But they are not bad for the moment.

As an opportunity to learn, or in case a change my linear rails so the frictions coefficients change, I would like to simulate the system, to be able to tune the PID gains easily. And finally to run a simulation loop with a genetic algorithm to find the best PID gains. I have already use genetic algorithm with other things. I just need to have the mathematical model of the system to go forward.

As I build other motorized things with closed loop as personnel hobby, those knowledge would be really interesting to have for me.

Is it more understandable?
 
  • #4
I once had a project with a very similar control loop. I solved it using the following steps:

1) Started up the machine using a proportional only controller with a guess for a gain. Adjusted gains until it worked.
2) Built a simulation using Matlab. Worked on the simulation until the simulation properly modeled the actual machine for a range of proportional gains.
3) Added an integrator to the machine controller. Adjusted P and I gains until it worked.
4) Added an integrator to the simulation. Worked on the simulation until the simulation properly modeled the actual machine.
5) Used the simulation to find the optimal control coefficients.
6) Tested those control coefficients in the machine. They worked well enough, and much better than the best coefficients from Step 3, that there was no point in adding a derivative function.

In other work at the time, I convinced myself that a PI controller was better than PID for a system with delays. This system had some delay in it, which was part of my reasons for not using PID.

A photo of that test machine:
Strip test machine.jpg
 
  • Like
Likes berkeman
  • #6
I'll second the suggestion to do some version of trial and error as @jrmichler and @anorlunda have suggested. It is the simplest and will work, even though you can't prove that it's optimum or robust.

Other than the "modeling first" approach, a pro way to do this is build the open loop system and measure its frequency response, then design a controller to add the feedback based on the poles/zeros you observe. I think it is important to have a basic understanding of what causes the dominant features of the frequency response (FR) you measure, so you'll know about the worst case scenarios for testing and modelling. Unfortunately, you'll need either a frequency response analyzer or lot of patience and skill with EE lab tools, to get the FR data. Alternatively, you can measure the step response and derive the dominant FR features from that, although it's less accurate.

The sort of process you describe (model and analyze first) is, frankly, only suited to EEs that know about control systems. It isn't simple enough to learn on social media IMO. I can give you some references, but they would be like university textbooks, not DIY stuff.
 
  • #7
Another approach is to determine the travel distance needed from present to new position, then:

1) choose a maximum speed for long distance moves
2) choose maximum acceleration and deceleration ramp
3) accelerate until either
A) max speed is reached
or
B) the acceleration ramps intersect
4) decelerateCheers,
Tom
 
  • #8
Another factor, often overlooked, are nonlinearities in the process. You can build a linearized model and optimize it, but the real life controller must deal with the nonlinear one.

You can also build a fully nonlinear simulation and use it to verify control performance, but then you need to define the full suite of evolutions, and upsets expected to occur.
 
  • #9
Thanks to all for your replies.

@jrmichler Thanks. I keep your procedure in case I can not model my system another way.
The fact that a PI controller is better than PID for a system with delays sounds good for me. I take note.

@Tom.G I know that a trapezoidal motion profile is working. But I want to try to learn more about closed loop system and simulate my own system ;)

@anorlunda From what I see on my results curves, there are no big non-linearity. I think I will keep a linear model to keep it as simple as possible.

I have seen a video of a French teacher on Youtube about a first order system. This system was a liquids level controller for tanks. From measured data (spreadsheet format), he found the delay, static gain and the time constant. With those parameters, he created a simulation that give very close results to reality.
That video made me thought that it maybe would be possible to define the order and parameters of the system from results graph and measured data.

Currently, with my PID controller running, the step response graph looks like a second order system. Here is what it looks like with different PID gains. The Y-axis is not in mm, but in rotary encoder pulsation. The X-axis is in seconds :
Screenshot-20220817-184940-Firefox.jpg

Screenshot-20220817-180357-Firefox.jpg

I will measure and make a graph from a P controller with a P gain = 1 only, to see what the curve looks like.Do you think it could be possible to get the parameters of my system from a more precise graph and measured data?

Curiosity question : My controller is running on a microcontroller with a C++ program. My treatment loop is pretty fast, about 1Khz. Do you think that increasing or decreasing a bit the speed of this loop could produce significant change on the system parameters ?

Thanks ;)
 
  • #10
pit34 said:
Do you think that increasing or decreasing a bit the speed of this loop could produce significant change on the system parameters ?
The integral and derivative gains are normally directly/inversely proportional to the sample rate, although this can depend on how people define things. Sometimes they adjust the gains for you by asking about the sample rate.
 

FAQ: How to model the behavior of a closed loop position system?

What is a closed loop position system?

A closed loop position system is a control system that uses feedback to adjust and maintain a desired position. It consists of a sensor to measure the position, a controller to process the feedback, and an actuator to make adjustments.

How do you model the behavior of a closed loop position system?

To model the behavior of a closed loop position system, you need to first understand the dynamics of the system, including the sensor, controller, and actuator. Then, you can use mathematical equations or computer simulations to simulate the system's response to different inputs and disturbances.

What factors should be considered when modeling a closed loop position system?

Some important factors to consider when modeling a closed loop position system include the type and accuracy of the sensor, the design and tuning of the controller, and the characteristics of the actuator. The system's environment and external disturbances should also be taken into account.

What are the benefits of modeling a closed loop position system?

Modeling a closed loop position system allows for a better understanding of the system's behavior and performance. It also enables engineers to optimize the system's design and parameters, identify potential issues, and test different control strategies before implementing them in the real system.

Are there any limitations to modeling a closed loop position system?

While modeling a closed loop position system can provide valuable insights, it is important to note that the model may not perfectly reflect the real-world system. Factors such as nonlinearities, external disturbances, and sensor inaccuracies may not be fully captured in the model. Therefore, it is important to validate the model through experimentation and make adjustments as needed.

Back
Top