DC motor, or any other motor controlling torque or speed? - Page 1
Forum section: electronics / general

author: nForce
author_rank: Frequent Contributor
timestamp: April 23, 2019, 04:26:45 pm
content: Are we controlling speed or torque of a motor in electric car. Or in petrol/diesel motor?Because if we control torque, how then we control speed or opposite? Because when we have a maximum torque we have a minimum speed.Thanks.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: April 23, 2019, 04:38:41 pm
content: Yes. (The inclusive-yes, both.)Torque or current is controlled primarily, so as to prevent destruction of the inverter, or to lesser extent, the motor or battery.The current setpoint is then controlled by the speed setting (cruise control), with hooks to enable/change/disable the setting, and anything else that feeds into it (collision avoidance, following, etc.).There's nothing that prevents you from hooking up one error amp to another! Indeed, there are very real advantages to a multistage control!Probably, in open loop (user controlled "throttle") mode, it's not just current or torque, because that would feel unnatural (an ICE's torque response varies with RPM as well as throttle position), but rather a mixture of current/torque and RPM/speed is used. This makes it easier to cruise at a fixed speed.Further, for induction and PMAC motors, it's not just current or voltage that's controlled, but frequency and phase sequence as well, which all need to be coordinated together. This involves a more complicated program of feedback paths that I don't need to go into here, but suffice it to say that, on a superficial level, it's managed in a similar way.Tim

author: Benta
author_rank: Super Contributor
timestamp: April 23, 2019, 07:23:08 pm
content: To clarify:You cannot "control torque" in a meaningful way.Torque is something that is demanded by your mechanical load, and your drive system should be able to deliver this torque within its design limits.Torque can be limited, of course.For a control strategy (normally position, speed, acceleration), torque is pretty useless.

author: Dave
author_rank: Super Contributor
timestamp: April 23, 2019, 08:37:45 pm
content: Quote from: Benta on April 23, 2019, 07:23:08 pmSpreading misinformationyet again, are we, Benta?Speed control of a vehicle is done by reading the speed from the output shaft and demanding a torque from the torque regulator to attempt to reduce the speed error to zero.Speed control loop -> Torque control loop -> Current control loop (with a couple of other things)

author: rrinker
author_rank: Super Contributor
timestamp: April 23, 2019, 08:39:39 pm
content: Tim's answer hints at why CVT's feel unnatural, at least before they started programming set 'gears' into them. The feedback did not match the user input. I remember test driving a car with one a number of years ago - to someone used to always driving manual transmission, it felt like the clutch was worn and slipping, far more so than a regular automatic. Just - weird.

author: max_torque
author_rank: Super Contributor
timestamp: April 23, 2019, 09:53:45 pm
content: All passenger cars, when driven by a human driver, are driving in a "torque demand" mode. The accelerator pedal position is monitored, and various "pedal maps" are applied to create a "driver demand flywheel torque". The Engine ecu is then responsible for setting the engine control actuators (throttle, injectors, ignition, turbo etc) to create that torque. Modern "torque based" engine management systems use torque as their primary control parameter, so as to be able to arbitrate between various torque sources, for example, gearbox request (to get a smooth change) or Stability control intervention (torque down or torque up etc)The "Human" driver closes the loop, by applying a suitable pedal input to accelerate the car at a rate that suits them, to a speed that suits them. To enable it to all feel nice, we (powertrain calibration engineers like myself) spend a huge amount of time mapping a vast number of calibratable parameters, over 50,000 in a modern engine ecu, to deliver a powertrain response that feels natural for the vehicle application (which depends on what the car is, and how it is likely to be driven, ie a big difference between say a sports car and a van for example)If the vehicle features cruse control, then a closed loop speed control loop is enabled to function in place of the driver demand (the driver no longer has to have their foot on the accelerator pedal), but that demand is cancelled by either the cruse control being switched off by the driver, or by the driver pressing the brake pedal, or by stability control intervention.In an ICE powertrain, driver demand is bi-directional, but the maximum negative torque is limited by the total frictional torque of the engine, as the engine cannot "absorb" any more torque than the torque required to drive it around when it is not firing. For an EV, which has a truely bi-directional powertrain and can fundamentally absorb as much torque as it can apply, then the maximum negative torque is limited by factors such as tyre adhesion and passenger comfort. Many current EVs feature "one pedal" driving where the vehicle can be controlled with just the accelerator alone unless an emergency stop (using the conventional friction brakes) is required.To make maneuvering easy, some EVs actually blend out of torque control into a very low gain speed control at ultra low speed (sub 1mph) where the accelerator demand actually becomes a speed demand input to a closed loop speed controller, the output of which is blended to the "torque demand" output to give a very smooth entry and exit into low speed driving (ie in heavy traffic etc) Because of this EVs can be driven a very low by stable speed without excessive jerk or shunt.

author: Whales
author_rank: Super Contributor
timestamp: April 23, 2019, 10:20:50 pm
content: > Are we controlling speed or torque of a motor in electric car. Or in petrol/diesel motor?We control neither directly. In an ICE: our pedalapproximatelytells the engine to do "more" power, not more speed or more torque.The exact torque and speed we get as a result is then determined by many things including the engine's characteristics, current velocity and the current load (vehicle weight, hill slope, transmission, etc).In most circumstances: pressing the pedal down further will lead to both increased speed and torque. In certain circumstances (eg over-revving) it can actually lead to one of these things being reduced.

author: langwadt
author_rank: Super Contributor
timestamp: April 23, 2019, 10:47:57 pm
content: Quote from: Whales on April 23, 2019, 10:20:50 pmI'd say in an ICE the pedal approximately tells the engine how much torque to produce

author: Circlotron
author_rank: Super Contributor
timestamp: April 23, 2019, 11:53:11 pm
content: Torque vs rpm is analogous to current mode vs voltage mode SMPS, or a constant current vs constant voltage PSU. You need to close the feedback loop to control voltage by controlling current, or or control rpm by controlling torque.

author: amyk
author_rank: Super Contributor
timestamp: April 24, 2019, 12:26:18 am
content: If you ever get a chance to, try driving a trolleybus and then a regular diesel bus, preferably within a short time of each other. They both have a very different acceleration characteristic compared to a normal petrol vehicle.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: April 24, 2019, 02:40:51 am
content: Quote from: Benta on April 23, 2019, 07:23:08 pmSo I cannot control current in a meaningful way? Current is something that is demanded by my electrical load, and my power supply should be able to deliver that current within its design limits?Or symmetrically:So I cannot control voltage in a meaningful way? Voltage is something that is produced by my electrical load, and my power supply should be able to deliver that voltage within its design limits?(The V/I analogy is directly applicable of course, as a PMDC motor for example has torque proportional to current (less windage losses), and RPM proportional to voltage (less DCR).)I'm guessing it's just a miscommunication, in the same way that we often speak about voltage source power supplies (the load sets the current) or current sources (the load sets the voltage). It's simply a matter of which control we are using, and the control used depends on the application.Tim

author: KC0PPH
author_rank: Unknown
timestamp: April 24, 2019, 06:23:24 am
content: Quote from: Benta on April 23, 2019, 07:23:08 pmIn the industrial world its pretty common to have torque control on servos... You really dont get any meaningful information from it as most torque values are given as a percent of full torque and not very accurate.

author: soldar
author_rank: Super Contributor
timestamp: April 24, 2019, 08:03:26 am
content: This is a bit of a philosophical question. It is like asking "What is the true nature of a triangle?"It is like newbies who ask "how can I put 10 volts and 10 amps through a 10 ohm resistor?"Everything is related to everything else.Speed is the result of forces acting on an object. You adjust speed by controlling force/torque.Like current is adjusted by controlling voltage. You can have a current source but ultimately voltage is what makes electrons move.Ultimately force is what makes objects move. Distance, speed, power, etc are all a result of force applied. No force no nothing.

author: GeorgeOfTheJungle
author_rank: Super Contributor
timestamp: April 24, 2019, 08:36:18 am
content: It seems to me that you're all saying ~ the same thing but with different words: power is torque times RPM. Press the accelerator and the amount of mixture that enters and burns into the cylinder increases, which in turn generates more power, which in turn pushes the piston with more force, which is turn means more torque, which in turn tends to accelerate the engine to higher RPMs. In an EV,the mixture is the current.

author: soldar
author_rank: Super Contributor
timestamp: April 24, 2019, 11:21:27 am
content: Quote from: GeorgeOfTheJungle on April 24, 2019, 08:36:18 amNo. Press the accelerator and the amount of mixture that enters and burns in the cylinder increases, which in turn produces more force/pressure on the pistons. If the piston moves there is work generated. If the piston is stalled there is no work generated. A small explosion inside a pressure vessel produces no useful mechanical energy. Work is the product of two things: force and distance. Power is work divided by time.An explosion produces pressure/force. An electrical current moving in a magnetic field produces force. Not work and not power.(Edited to correct work and power.)

author: max_torque
author_rank: Super Contributor
timestamp: April 24, 2019, 11:56:03 am
content: Quote from: Whales on April 23, 2019, 10:20:50 pmNo, well not for the last 25 years. All modern (produced since 1995 when bosch introduced them) Engine management systems run in "torque arbitration" mode. The system is finely calibrated because it is critical to get accurate engine torque control for functionality like stability control or gear shift control etc. By "finely" i mean a total allowable error of around +1Nm at low torques (<10Nm) and around +-10Nm at full torque (which these days is likely to be 300Nm or more on pretty much any turbo charged engine.The accelerator directly controls that torque, which is why modern engines are so smooth and nice to drive!(On an EV of course, the eMachine torque canbe controlled much more finely indeed, with errors expected to be less than 0.25Nm at all times, and torque control bandwidths of over 1Khz, allowing advanced chassis control systems to operate, for example, real time tyre slip control etc.)

author: soldar
author_rank: Super Contributor
timestamp: April 24, 2019, 12:33:31 pm
content: Quote from: max_torque on April 24, 2019, 11:56:03 amWith a name likemax_torqueI totally have to believe what he says!

author: GeorgeOfTheJungle
author_rank: Super Contributor
timestamp: April 24, 2019, 01:50:20 pm
content: Solder your logic is flawed, again. Where in Spain do you come from?Quote from: soldar on April 24, 2019, 11:21:27 amIf it burns there's power.Quote from: soldar on April 24, 2019, 11:21:27 amThat's not power that's work, work is energy, and power is energy/time.

author: soldar
author_rank: Super Contributor
timestamp: April 24, 2019, 01:53:02 pm
content: Ha! simulpost. I corrected my post and then saw yours. At least we agree on that.

author: langwadt
author_rank: Super Contributor
timestamp: April 24, 2019, 03:01:19 pm
content: Quote from: GeorgeOfTheJungle on April 24, 2019, 01:50:20 pmin the context of a car engine force and distance is useful power, the rest is just heat

author: nForce
author_rank: Frequent Contributor
timestamp: April 24, 2019, 03:19:09 pm
content: Quote from: Dave on April 23, 2019, 08:37:45 pmI think Dave and max_torque had answered correctly. But I still don't understand. If we control electric current then we control torque, if we control torque then we control speed. But why do we have then torque control loop and speed control loop if we said we control current, and with that, we control all of the other physical quantities?

author: GeorgeOfTheJungle
author_rank: Super Contributor
timestamp: April 24, 2019, 04:17:35 pm
content: Quote from: langwadt on April 24, 2019, 03:01:19 pmBut the same goes for an EV motor that's seized... more current = more heat. You wouldn't say then there's no power input, would you?

author: langwadt
author_rank: Super Contributor
timestamp: April 24, 2019, 04:26:10 pm
content: Quote from: GeorgeOfTheJungle on April 24, 2019, 04:17:35 pmit isn't making any mechanical power

author: GeorgeOfTheJungle
author_rank: Super Contributor
timestamp: April 24, 2019, 04:35:37 pm
content: Quote from: langwadt on April 24, 2019, 04:26:10 pmYou've made the same error as soldar BTW... you said "force and distance is useful power" but as time-1is missing there it's not power.

author: David Hess
author_rank: Super Contributor
timestamp: April 24, 2019, 05:32:47 pm
content: Quote from: langwadt on April 23, 2019, 10:47:57 pmOn a gasoline engine, the throttle position restricts the air intake. Under normal operating conditions, there is a high manifold vacuum so air volume is proportional to throttle position. For a given throttle position, as the engine RPM increases, there is less fuel-air volume available for each piston so torque decreases as RPM increases.Quote from: Benta on April 23, 2019, 07:23:08 pmSure you can control torque (usually through the current) and some systems only have torque control where only the drive current is adjusted. The torque is proportional to acceleration and can be integrated to get velocity which is common to stabilize the control loop. The rate of change of torque (or current) may be controlled to limit jerk or change in acceleration per unit time.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: April 24, 2019, 06:29:01 pm
content: Quote from: nForce on April 24, 2019, 03:19:09 pmYou can control one or another under a given condition, say under cruise, sure. But what happens when the grade changes, or you need to make a maneuver?It is the same with a power supply, as I alluded to earlier: we might want a constant-voltage characteristic, but also a constant-current characteristic. We can't control the load's ratio of voltage to current, but we can control one or the other as the opportunity arises.Multiple control loops also serves the purpose of abstraction. We don't have to worry about what load condition the motor is under, simply as long as it's delivering the torque commanded to it.Similarly, in the next loop up, we don't have to worry about anything, as long as the system delivers the speed it's commanded to.In the context of a traction control and collision avoidance system, there are many advantages.For cruise control, we might want the speed to change gradually -- it certainly doesn't need to command maximum torque just because we're going up or down a few kph -- and for that, we could simply apply a filter, or slew-rate limiter. But what, then, when we want to control it sharply, as we must for collision avoidance, or for certain user inputs? Do we just bypass the filter, and deal with the step change in response? (There are applications where conditional or piecewise loops are applicable, but that must be done cautiously, not carelessly!) Do we somehow speed it up? Or do we simply add more steps to our input, so it seems to change gradually in the first place?Likewise for traction control, we might have an adaptive limit set, that defaults to maximum under normal conditions, but is reduced sharply, then recovers gradually, when wheel slip is detected. It might even be stopped or reversed, momentarily, to allow the wheel to regain its grip. This can operate independently of everything else, so it pays to have independent control loops as well.Tim

author: langwadt
author_rank: Super Contributor
timestamp: April 24, 2019, 06:52:43 pm
content: Quote from: David Hess on April 24, 2019, 05:32:47 pmlook at any ICE torque curve, it increase with rpm at low rpm and then is roughly constant.each intake stroke gets a roughly similar amount of air and fuel

author: Dave
author_rank: Super Contributor
timestamp: April 24, 2019, 06:53:29 pm
content: Quote from: nForce on April 24, 2019, 03:19:09 pmI'm not going to go into too many details, but there is actually a lot more than just controlling the current in the case of an AC motor regulator. You control the current, but with respect to the rotor position and other things. Not only that, current itself is a vector in a three-phase (or more!) system.

author: max_torque
author_rank: Super Contributor
timestamp: April 24, 2019, 07:09:35 pm
content: Quote from: nForce on April 24, 2019, 03:19:09 pmFor a modern EV, with an inverter controlled brushless motor, then the inverter controls torque because it must control phase current to avoid damage.The reason a modern eMachine is so efficient (typically averaging 96% efficiency!) is because they are mostly an inductive load, rather than a resistive one. That means the eMachine phase current (NOT the DC current into the inverter) is proportional to the potential difference applied and the motors impedance. Here, the potential difference is set by the supply voltage (battery voltage) and the back emf of the motor (directly proportional to rotational speed). The impedance is made up from the DC resistance (around 0.5 milliohm for a typical machine) and the AC inductance of the stator windings.At low speed, there is little backEMF, and hence the inverter must be carefull i applying too much of the battery voltage to avoid a catastrohic over current, which could destroy the power silicon, or literally melt or demag the eMachine. And the motors impedance is also variable, due to saturation and saliency effects, so the rate of change of current is itself changable.For this reason, most modern motor control strategies have at their heart the control of machine air gap magnetic field strength via the direct control of statoor phase current. They measure the phase current (using current sensors) and the rotor position (using encoders or resolvers) and modulate the applied phase voltage (using space vector modulation) to drive the phase current to a target vector magnitude.Google "field oriented control" for a lot more info on how this basically works, it's actually pretty simple once you have got your head around the various frames of reference. Each control inverter is "mapped" (by people like me) so as to drive the eMachine tied to it with the correct phase current to make the machine produce the requested torque. That mapping exercise does lots of measurement on mapping rigs, that vary voltages, speeds, torques and temperatures so as to build up the internal (to the control inverter) calibration tables so when the inverter is requested to "provide +50Nm torque" then the motor does actually output +50Nm etcThat torque control functionality is wrapped up in the inverter, and normally a completely seperate higher level "system controller" is responsible for generating a suitable torque request, based on a hierarchy of torque sources that can request torque from it.For example the controls architecture for the BMW i3 is covered here in some detail:http://cdn.jack.sh/2014/08/06_I01-High-voltage-Components.pdfShowing multiple layers of command and control across several databuses!

author: David Hess
author_rank: Super Contributor
timestamp: April 24, 2019, 09:32:47 pm
content: Quote from: langwadt on April 24, 2019, 06:52:43 pmThere are other less significant factors involved. At low RPM, the vacuum is lower so more charge is available for each piston. At high RPM, valve timing among other things lowers torque but torque is already dropping before that point.If you were to control the throttle to maintain the same air flow as RPM increases, then up to a point, torque would fall linearly with RPM. This makes sense from the physics since torque times RPM is proportional to power and a constant flow of air (with fuel) provides constant power.In practice throttle position is held constant so air flow is proportional to vacuum but vacuum can only decrease to zero so the air flow becomes more and more constant as RPM increases.

author: rstofer
author_rank: Super Contributor
timestamp: April 24, 2019, 10:06:32 pm
content: Quote from: T3sl4co1l on April 24, 2019, 06:29:01 pmOn the electric cars I have driven (Chevy Spark EV and Chevy Bolt), when one wheel slips, the power is shifted to the other wheel. A lot like Posi-Trac differentials back in the day. The slightest chirp on a wheel results in the power being shifted.On the Spark EV, with 400 ft-lbs of torque, the shifting resulted in the car acting kind of squirrely. If you wanted to stand on it, you had to get up on the wheel and drive because the power was shifting back and forth a couple of times per second pulling left or right as it did. In recent years, Chevy has toned down the torque and the Bolt has only about 266 ft-lbs. It scoots, but not like the Spark. In fact, Chevy backed the Spark torque down to 327 ft-lbs after the 2014 model year (I had the 2014). That car was FUN to drive but, apparently, they had some complaints! Not from me...I have spent a lifetime treating the throttle as a binary input.

author: langwadt
author_rank: Super Contributor
timestamp: April 24, 2019, 11:52:19 pm
content: Quote from: David Hess on April 24, 2019, 09:32:47 pmhttps://www.researchgate.net/figure/Engine-Effective-Torque-Nm-as-a-function-of-Engine-Speed-RPM-and-Load-TPS-Runner_fig3_271700205

author: nForce
author_rank: Frequent Contributor
timestamp: April 28, 2019, 03:35:35 pm
content: Can someone write a pseudo-code of the control scheme for regulating speed and torque?Now I understand like this:Code:while true:#Torque controlif torque < ref_torque:torque += 1;else if torque > ref_torque:torque -= 1;#Speed controlif speed < ref_speed:speed += 1;else if speed > ref_speed:speed -= 1;end whileIs this Ok?

author: Vtile
author_rank: Super Contributor
timestamp: April 29, 2019, 06:17:07 pm
content: If you take your lab PSU as an example it does have constant current and constant tension/voltage modes, with limitations (compared to ideal voltage or current source) of course. Same can be thought to be the case with speed vs. torque control.Quote from: nForce on April 24, 2019, 03:19:09 pm

author: nForce
author_rank: Frequent Contributor
timestamp: April 29, 2019, 07:15:21 pm
content: QuoteVtile or anyone else can you update/change my pseudo-code? Because when I am looking at the control scheme for DC motor, I don't quite understand where are these loops for torque and speed.It can't be a while loop inside a while loop, the best code is one while loop, and inside if statements.

author: Dave
author_rank: Super Contributor
timestamp: April 29, 2019, 08:20:43 pm
content: Quote from: nForce on April 28, 2019, 03:35:35 pmNot really.Let's take the speed control loop for example.You have a reference speed and a measured speed. You look at the difference between the two and call that the error.If the measured speed is below the reference (positive error), you want it to catch up, therefore you increase the demanded torque and vice-versa.But you don't just randomly set the torque to a higher number, instead you put the error term into something like aPID algorithmand use the output of that to demand the torque.Bear in mind that there is no simple recipe to make a good control loop. You always have tradeoffs, usually it's response time vs stability.The only way to really master this subject is to dive deep into control loop theory and try and understand what's going on inside your system. If you're willing to dedicate the time for it, I'd recommend anexcellent youtube channelon the subject. Use Matlab or Octave and play around with them to put things to practice.

author: Vtile
author_rank: Super Contributor
timestamp: April 29, 2019, 08:31:41 pm
content: DC motors are my weak spot and in overall I'm much more (than I would want to) end user than designer of motor controllers.Are you familiar of cascade controllers? If not you can start with ie. this article:https://www.controleng.com/articles/fundamentals-of-cascade-control/Your pseudo code is describing what is known in the industry as a "Bang-Bang" controller (and rather poor on it without ie. hysteresis/limit handling), in other words thermostat-control. In fact with cycle time control your pseudo code end up to be basic slope generator. Are you familiar with PID (= Proportianal, Derivative, Integral)? If not then you might consider Dave2 lecture at:To be aware that the single P(ID) is only one step upward from Bang-Bang controller.Dave got it before me.PS. Bare in mind that control theory is its own (sub)discipline so you can happily spend a few lifetimes crawling on it.PPS. Brushless DC motors are actually closer (from my understanding, see 1st line) to permanent magnet synchronous motors than classic DC motors.Your pseudo code for poor cascade controller could be something like this. As seen at middle of the night and all the rust (a lot of it).Code:WHILE ControlEnable = True THENWAIT (SamplingTime)Result1 = PoorPI(Setpoint, MeasuredValue, Kp, ResetTime)ControlValue = PoorPI(Result1, MeasuredValue2, Kp, ResetTime)Define(PoorPI)error = setpoint - MeasuredValueUi = RunningAverage( Kp*SamplingTime/ResetTime * Error )Return = Kp*Error + KiEnd_defineNext

author: soldar
author_rank: Super Contributor
timestamp: April 29, 2019, 09:10:27 pm
content: Quote from: Dave on April 29, 2019, 08:20:43 pmI took a course in college, "Feedback Control Systems", and it was complicated and fascinating. I passed it but I came out with the feeling that I had barely scratched the surface and I really wanted to know much more about this topic. Then I went on to other things and never really took it up again. I remember the Nyquist plot and stability criterion, etc. It is a very complex subject but I found it interesting.

author: GeorgeOfTheJungle
author_rank: Super Contributor
timestamp: April 29, 2019, 09:15:56 pm
content: In an internal combustion car engine RPMs are a ƒ(torque), but in a synchronous (electric) motor torque and speed are (mostly) independent one of the other.

author: nForce
author_rank: Frequent Contributor
timestamp: April 30, 2019, 04:36:24 pm
content: Thanks, Vtile, now I understand better.Shouldn't be the definition of a function outside your while loop, so we don't define a function every cycle? I added speed and torque control for the motor, is this now flawless example of a cascade regulator for controlling torque and speed?Code:WHILE ControlEnable = True THENWAIT (SamplingTime)#Here we call PI function for controlling the speedspeed = PoorPI(Setpoint, MeasuredValue, Kp, ResetTime)#Here we call PI function for controlling the torque.torque = PoorPI(speed, MeasuredValue2, Kp, ResetTime)Next#Here we define a function outside the while loop for PI controller.Define(PoorPI)error = setpoint - MeasuredValueUi = RunningAverage( Kp*SamplingTime/ResetTime * Error )Return = Kp*Error + KiEnd_define

author: Vtile
author_rank: Super Contributor
timestamp: April 30, 2019, 07:19:29 pm
content: Quote from: nForce on April 30, 2019, 04:36:24 pmGood good, understanding is always a good point. You also were correct the function as is defined like this should be outside the while loop anyway if that is how the programming language is build (I would assume most all are).Code:I added speed and torque control for the motor, is this now flawless example of a cascade regulator for controlling torque and speed?Unfortunately it is not. The PI algorithm is really basic (from top of my head, so it might even have some silly mistake) and it do not have any crisis management parts (ie. anti wind-up) and also there should be some input filtering and output limiting and so called ramp-generators in proper places ie. input and propably also at output (these comes to my mind atm.) to keep everything in operation window that comes from the real world limitations.Best is that you implement first decent single PID-algorithm (there is a few popular variations of how it is implemented) with most of the real-life extras and get used to some PID-tuning and principles.. You can find PID algorithm for several languages by searching the net (ie. for Arduino:https://playground.arduino.cc/Code/PIDLibrary/look under the hood of that library, you will probably find something similar I did provide), some are better than others (this is not something you would call a new thing, as one of the first applications for operator amplifiers were PID-controllers). Some simple heater process (aka tube with light bulb, fan and heat sensor attached to bulb surface ) might be the good starting point.PWM output (if needed) can be just a "conversion function" at PID controller function output.On the other hand I do not understand what you are trying to control. I suppose you have already familiarized yourself to the fact that there is several types of "DC-motors" as are "AC-motors".

author: soldar
author_rank: Super Contributor
timestamp: April 30, 2019, 08:33:17 pm
content: Quote from: Vtile on April 30, 2019, 07:19:29 pmYup. Any control loop has to be taylored to the characteristics of the motor it is controlling. The first thing you need to study is the curves of the motor you will be using. Every motor is different.I suppose you could write a generic motor "driver" and have a section where you can input the characteristics of the specific motor.