Author Topic: PID control of two contradictory PWM signals  (Read 25359 times)

Hminx

  • Newbie
  • *
  • Posts: 6
    • View Profile
PID control of two contradictory PWM signals
« on: February 19, 2024, 01:08:18 AM »
Hi all

Been a few years since last used trilogi stuff but have a few up coming projects that I plan to use FMD1616-10s. The issue I'm stuck on is
how to control the  speed of an engine powering a large vacuum pump, the input signal uses two PWM signals acting together

   1.        Idle - full throttle           81 - 27 %  PWM     @ 5v  200 Hz
   2.        Idle - full throttle           17 - 73 %  PWM     @ 5v  200 Hz

The  vacuum pump is direct driven at engine speed, 1400 rpm and in this case, the speed signal at this speed is 23 Hz, and scoping the throttle signals while operating the throttle manually indicates signal 1 at about 53% and signal 2 at about 46%.  Ssooo.... what I need to do is work out some method of PID control over two control signals that move in opposite directions.

I would be quite willing to have a crack at sorting out a single channel control but the two opposing signal thing is a bit beyond me so any help would be greatly appreciated

Cheers Pete

Oh by the way, I assure you I'm not a student asking some one to do an assignment I should be doing myself  ;)





i

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re: PID control of two contradictory PWM signals
« Reply #1 on: February 20, 2024, 09:37:00 PM »
The PLC can provide the PWM signal using the SETPWM command. That should be the easy part and I don't think you have any trouble with that.

We have no knowledge of how a system you described would work. What device is currently providing the two PWM signals you mentioned to the engine.

If you fixed one PWM signal and vary the second signal you might be able to plot out a curve of speed vs PWM2. You can then increment the PWM1 duty cycle and repeat the above. In the end you may have a series of charts that could give you a better idea of how the engine speed changes with respect to each PWM signal.

Once you get a better idea of how the speed vary with respect to the PWM duty cycle of each signal you may be able to work out an algorithm for controlling the engine.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Hminx

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: PID control of two contradictory PWM signals
« Reply #2 on: February 22, 2024, 12:25:55 AM »
  Thanks for the feed back, I thought that this may be the case but was hoping for an easier work around, but such is life  :)
FYI the two PWM  signals is quite common on heavy automotive diesels, from the foot throttle to the engine ECU .   Normally we would use the auxiliary external throttle input for engine speed control, but this is not an option in this case.

garysdickinson

  • Hero Member
  • Posts: 502
  • Old PLC Coder
    • View Profile
Re: PID control of two contradictory PWM signals
« Reply #3 on: February 23, 2024, 01:13:40 PM »
The programming of the FMD PWM ouputs to meet your needs is not very difficult.

I've attached a .pdf file that shows the programming for 1 of the 2 PWM outputs that your application may need.

The programming for the 2nd PWM output is the same but uses the slope/incercept values for the other channel.

You still have to solve a host of other things.


Gary Dickinson
« Last Edit: February 24, 2024, 07:54:07 AM by garysdickinson »

Hminx

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: PID control of two contradictory PWM signals
« Reply #4 on: February 27, 2024, 11:49:17 PM »
Hi Gary
Thanks for that, what you suggest makes perfect sense and should do the trick.
i will try that as soon as my replacement FMD1616 turns up as yesterday when I turn the machine on the PLC refused to respond for a while
then powered up the first four outputs plus RTC, pause, and error LEDs   lit up, plus it would no longer communicate  :(   Unlike the old T100MD
series these aren't easy to plug in a replacement chip and get it back into service maybe a marketing strategy  ;)
 Cheers Pete

garysdickinson

  • Hero Member
  • Posts: 502
  • Old PLC Coder
    • View Profile
Re: PID control of two contradictory PWM signals
« Reply #5 on: March 01, 2024, 08:23:11 AM »
Pete,

I am glad you found something useful.

I have used several of the T100MD PLCs.  I had one run for 15 years with out a glitch.

If you have questions on algorithms and such just ask. I am happy to share.

Gary d

emerrryjones

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: PID control of two contradictory PWM signals
« Reply #6 on: May 24, 2024, 03:30:59 AM »
Controlling engine speed with dual PWM signals using PID in Trilogi FMD1616-10s involves:

1. Signal Conversion: Convert the two PWM signals (Signal 1 and Signal 2) into a single "combined signal" representing engine speed.

2. PID Control: Use the combined signal as the input for a PID control loop to adjust the engine speed.

3. Implementation: Implement the control logic using Trilogi's built-in functions and logic blocks, carefully tuning the PID parameters for optimal performance.