Digital PID Controller: Windows OS, Processor Config/Software?

In summary, a standard laptop is capable of acting as a digital PID controller in a Windows operating system. The necessary hardware and software can be used to implement the PID control loop, as long as the system being controlled operates at a slower rate compared to the control system's average update rate. Special configurations may be necessary in terms of processor speed and I/O hardware, depending on the specific system being controlled.
  • #1
jaredokie
21
0
I am trying to understand the process of a digital pid controller that operates with/in a Windows operating system. By process I mean the sequence of steps a computer software system takes to adjust the output of the system whether the process be cruise control, temperature, pressure etc. So I'm asking if a standard laptop is capable of acting as a controller? I know transducers and sensors are usually analog and require a converter. So, my convoluted question is, is there any special configuration that a processor needs to be in order to act as a controller? Is software all that is needed?
 
Engineering news on Phys.org
  • #2
That's a vague question since you can implement a PID in different ways, but let me answer it this way.

A computer is the only thing that is needed if you have the right dumb sensors and drivers that provide input to the computer and output back to the thing being controlled.
 
  • #3
Control theory is not my best subject, but I'll throw in my $0.02 as well.
The processor necessary for a PID controller is very much controlled by speed. This speed includes speed of the computer processor and speed of the controlled system.
Let us consider a somewhat slow system (I am making up this; I do not actually know how this system is actually controlled; but for the sake of illustration - we will assume this is one possibility) where a digital sensor is used and a PWM (Pulse Width Modulated) output voltage can control our system motor (through a power control unit). An escalator where an optical sensor is monitoring a disk with slots attached to the chain drive of the steps. This system rotates slow enough such that our optical sensor should see pulses about once every 10 milliseconds, or 100 times a second - a desktop mouse is about this fast or faster. So we use the system clock and normalize and average say 20 pulses to determine the current speed. The PID system uses this information to calculate the correction necessary to the PWM signal to adjust the speed for the load of more or less people on the escalator at any given time. The PID algorithm usually has a bounding number of instructions/clock cycles of a particular processor that are required for the correction calculations at each new sensor update. Let's say it takes 500 clocks to calculate the correction output, so those 500 clocks must happen between the 10ms of our expected input pulses. And to provide headroom for other system related chores, you need to add in a factor that ensures time is available for your process. In a PC running windoes this is something that must be inside a device driver that can elevate its priority level to the highest available in the system. Back to our factor, let's say we want to provide at least as much free time as our anticipated calculations so in the 10ms, we need to be able to have 1000 clocks. If a clock is equal to our processor speed then in 10ms we need 1000 clocks or in 1 second we need 100 * 1000 = 100000 clocks or 0.1Mhz processor speed. Today's processors run at GHz levels, so no problem. Again, this is a made up example just to provide some feel, and I didn't go dig to find the actual clocks necessary, but it should provide a template of how to determine what speeds are necessary. Many analog to digital sensors and digital to analog converters/controllers exist now in USB, ethernet, RS422, etc form that connect to the PC. So you have to look at the update speeds for each involved sensor / output device as well as the computer/microcontroller and determine if the system has enough speed to operate correctly.
Hopefully someone with much more experience than me will provide a better answer, but again I hope this helps.
 
  • #4
One important point is how fast your controller can adjust the real-world system it is controlling. If you are talking about a physical system with servo motors etc, the answer is probably "very slowly" by computing standards. So there is not much sense collecting the input data and processing it, a lot faster than you can do anything with the results.

On the other hand if you are controlling something that is entirely electronic (for example adjusting a radio receiver to track a weak signal) everything might be operating in a timescale of microseconds or even nanoseconds, not seconds, and you might need something as powerful as a PC CPU to keep up.

For controlling a "mechanical" system, a laptop would be complete overkill. A single-chip computer with the minimum amount of hardware (e.g one of these: http://www.atmel.com/products/microcontrollers/avr/tinyAVR.aspx )would probably do the job at 1% of the cost. That system might have a PC interface (e.g. a USB cable) for monitoring the system and/or reprogramming it, but it wouldn't need the PC to operate.
 
Last edited:
  • #5
jaredokie said:
I am trying to understand the process of a digital pid controller that operates with/in a Windows operating system. By process I mean the sequence of steps a computer software system takes to adjust the output of the system whether the process be cruise control, temperature, pressure etc. So I'm asking if a standard laptop is capable of acting as a controller? I know transducers and sensors are usually analog and require a converter. So, my convoluted question is, is there any special configuration that a processor needs to be in order to act as a controller? Is software all that is needed?
Implementing a PID loop on Windows is not a problem if the process you're trying to control varies very slowly compared to the average update rate of your control system, i.e. how long, on average, does it take to acquire an input sample, process it and update the output of your system. For that you'd just need some suitable I/O hardware to go with your PC, e.g.:
"sine.ni.com/nips/cds/view/p/lang/en/nid/203223"

Though, that's typically not how you'd choose to implement a digital control system.

Windows is generally designed to provide you with the illusion of parallelism using multitasking. As such, it isn't a real-time operating system and provides no guarantee (unless you completely rewrite its kernel-level scheduler) that it can complete a task within a given period of time. Imagine what would happen if Windows decides you need an update in the midst of processing your PID algorithm.

Real-time operating systems also typically provide a framework for synchronization of events, like making sure your PID algorithm samples and updates the system input and output, respectively, at a fixed frequency. That's a big deal in digital control theory.

As an example, I'm currently working with a combination of a high-voltage inverter and a very low-inductance motor where the phase currents typically have a slope of around 200 kA/s. For this reason, I need to run my control algorithm deterministically in time at a very high update rate, which would be impossible to achieve on a Windows PC (I use a Texas Instruments DSP instead).
 
Last edited by a moderator:
  • #6
Is that similar to a field programmable gate array?
 
  • #7
jaredokie said:
Is that similar to a field programmable gate array?
Well, only in the sense that they're both typically used as a component in embedded systems.

A FPGA is an integrated circuit that you can configure to implement other integrated circuits. You could, for instance, use a FPGA to implement your PID algorithm directly in hardware, though, it might also need to have access to an analog-to-digital and digital-to-analog converter etc. depending on your application.

A DSP contains fixed hardware that you can quickly repurpose by loading new software on it. By comparison, a FPGA can take hours to reconfigure, depending on the complexity of your algorithm, since you first have to translate your algorithm into a hardware configuration of that specific FPGA (it's usually done automatically by software provided to you by the manufacturer).
 
  • #8
Ok. I just want to thank everyone for your help and knowledge. I'm a mechanical engineer. I realize now I should have become an electrical engineer. Again thanks for clearing up some stuff.
 
  • #9
jaredokie said:
Ok. I just want to thank everyone for your help and knowledge. I'm a mechanical engineer. I realize now I should have become an electrical engineer. Again thanks for clearing up some stuff.
Some of the best engineers I've met knew a bit of both :smile:
 
  • #10
Have you heard of Maple 18 Personal Edition?
 
  • #11
jaredokie said:
Have you heard of Maple 18 Personal Edition?
I've heard of it, sure.
 
  • #12
In your opinion is it useful as a learning tool to better understand signal processing and simulations?
 
  • #13
jaredokie said:
In your opinion is it useful as a learning tool to better understand signal processing and simulations?
Personally, I'd prefer MATLAB with Simulink. I have no doubt that you can do a lot with Maple, but I prefer the combination of environments offered by MATLAB and Simulink for experimentation.

MATLAB itself is a very solid tool for generating and manipulating numerical data, and Simulink offers a great way to visualize the inner workings of mathematical models.

I enjoy using Simulink, for instance, to analyze (and generally just play around with) hybrid continuous/discrete-time systems. It helps me out a great deal when I work with digital control systems and signal processing.

If both software packages, MATLAB/Simulink and Maple, are available to you, you should probably just try both and see what sticks.
 
  • #14
jaredokie said:
By process I mean the sequence of steps a computer software system takes to adjust the output of the system whether the process be cruise control, temperature, pressure etc.

Do you understand analog PID controllers?

They're just a summer.
They measure the process being controlled, be it speed or temperature or whatever, and compare it to desired value. The difference is called "error".
That "error" is what it performs its PID actions on.

So the controller multiplies present value of "error" by some gain, result is Proportional term.
It also performs a time integral of "error", result is Integral term.
It also differentiates "error", result is Derivative term.

It sums those three terms and result is output of controller.

It is the job of the user to connect controller's output to something that can physically affect the process, like a vacuum diaphragm that can alter throttle position for a cruise control , or the valve that admits water into your toilet storage tank.
It is user's job also to connect it in such a direction as to drive error toward zero,
and to figure out what gains to apply to P, I and D terms to get suitable system response when the loop is closed.. So yes, all that is needed is software, mental sweat and real world interface equipment.

Micromint site has sample controller programs for their PIC microcontrollers .

PID controllers date way back . The basic math was worked out by Descartes but of course he didn't have machinery to control..
In 1960's we used analog pneumatic ones that operated on compressed air - an orifice was the analog to a resistor, and volume chamber to a capacitor. They were nice because they were impervious to radio interference, power line glitches and lightning. By 1970's analog electronics were replacing them, and by 1990's embedded microcontrollers were sweeping the market.

So all your PC needs to do is mimic the steps above.
Since it includes an integrator you'll need to provide "Tie-Back" to define initial value of the integral term. Our pneumatic controllers had a pressure gage and knob for that purpose.
A limit on integral term is necessary in a computer because it can integrate to whatever is the limit of its math package(10^35 or so?). Our pneumatic integrators were limited by their supply pressure of 18 psi.
The derivative term is an approximate derivative, of form [itex]\tau[/itex]s/ ([itex]\tau[/itex]s+1) so as to keep it practical in presence of process noise..

I hope this helps.

old jim
 
Last edited:
  • #15
jim hardy said:
In 1960's we used analog pneumatic ones that operated on compressed air - an orifice was the analog to a resistor, and volume chamber to a capacitor. They were nice because they were impervious to radio interference, power line glitches and lightning. By 1970's analog electronics were replacing them, and by 1990's embedded microcontrollers were sweeping the market.

Hahaha wow...pneumatic PID controllers...that's just plain cool.
 

1. What is a Digital PID Controller?

A Digital PID Controller is a type of control system that uses a combination of proportional, integral, and derivative calculations to regulate a process or system. It uses a microprocessor to receive input signals, perform calculations, and output control signals to maintain a desired setpoint.

2. How does a Digital PID Controller work?

A Digital PID Controller continuously compares the setpoint with the process variable and calculates an error value. This error value is then used to adjust the control output. The controller uses three main components: the proportional, integral, and derivative terms, which are adjusted based on the characteristics of the system to achieve optimal control.

3. What are the advantages of using a Digital PID Controller?

Some advantages of using a Digital PID Controller include its accuracy, flexibility, and ability to handle complex systems. It can also be easily programmed and adjusted, and it is not affected by external disturbances. It also has a fast response time, making it suitable for systems that require precise control.

4. What are the processor configuration and software requirements for a Digital PID Controller on Windows OS?

The processor configuration and software requirements may vary depending on the specific controller and its manufacturer. However, in general, a Digital PID Controller on Windows OS would require a microprocessor with sufficient processing power and memory to handle the calculations and control tasks. It would also need software for programming, monitoring, and adjusting the controller settings.

5. How is a Digital PID Controller different from an analog PID Controller?

A Digital PID Controller differs from an analog PID Controller in that it uses a microprocessor to perform calculations and control the system, while an analog PID Controller uses electronic components such as resistors, capacitors, and op-amps. Digital controllers also have more flexibility and can handle more complex systems compared to analog controllers, which are limited by their hardware components.

Similar threads

  • Electrical Engineering
Replies
13
Views
4K
Replies
2
Views
1K
Replies
1
Views
999
  • General Engineering
Replies
2
Views
5K
Replies
8
Views
7K
  • Programming and Computer Science
Replies
10
Views
3K
  • Electrical Engineering
Replies
6
Views
4K
  • Electrical Engineering
Replies
12
Views
14K
  • STEM Academic Advising
Replies
7
Views
3K
Back
Top