Author Topic: How to Achieve an Exponential Curve from Linear Input  (Read 8217 times)

Offline GreaseMonkey

  • PLUS+1 Developer
  • ***
  • Posts: 22
  • Karma: +0/-0
  • The fastest way to do anything is once
How to Achieve an Exponential Curve from Linear Input
« on: August 11, 2023, 12:16:46 AM »
I'm using a J1939 joystick and a pair PWM Driver function blocks to control a bi-directional pump EDC using two output pins set to output mode 8 (Current control bidirectional).  I would like to filter the signal from the joystick to allow for extremely fine low-speed control for the first 3/4 of the joystick travel, then ramp up quickly in the last 1/4 to achieve full output speed at 100% input value.  This would allow the operator to have extremely fine control of the machine during operation(which only requires low speed), but then achieve full travel speed when moving the machine from one location to another.

My first thought was to map a curve into Microsoft Excel, then let Excel create a line of best fit to provide the corresponding equation.  I ended up with a 4th order polynomial equation that provides a nice smooth curve that fits my application, but the arithmetic blocks do not seem to have an exponential function that I could use to build that equation in GUIDE.

I feel like what I'm trying to achieve would be easy for an experienced programmer, but I'm just not sure how to go about it.  I could create categories using less than and greater than compare blocks and then adjust the multiplier in each condition to approximate the curve, but I'm guessing there's a better way to do it. 

Can anyone share a method that they've used for this type of control?  I've attached a picture of the curve I'm looking to achieve. I don't need to match this exact curve, but something close would be great. 

Thank you in advance,

Robbie


Offline deaks57

  • PLUS+1 Developer
  • ***
  • Posts: 24
  • Karma: +3/-0
Re: How to Achieve an Exponential Curve from Linear Input
« Reply #1 on: August 11, 2023, 01:00:26 AM »
Profile_8pt

Offline acmall

  • PLUS+1 Guru
  • *****
  • Posts: 201
  • Karma: +37/-1
Re: How to Achieve an Exponential Curve from Linear Input
« Reply #2 on: August 11, 2023, 08:54:08 AM »
Quote
Profile_8pt

This is in the Controls Library which can be found under the Function tab in the Selector Panel. If it is not there you will need to install it via the Update Centre.

Offline GreaseMonkey

  • PLUS+1 Developer
  • ***
  • Posts: 22
  • Karma: +0/-0
  • The fastest way to do anything is once
Re: How to Achieve an Exponential Curve from Linear Input
« Reply #3 on: August 11, 2023, 03:12:26 PM »
That's exactly what I need.  You guys rock!  Thank you for the help!

Offline Marbek_Elektronik

  • PLUS+1 Guru
  • *****
  • Posts: 352
  • Karma: +8/-0
    • Marbek Elektronik
Re: How to Achieve an Exponential Curve from Linear Input
« Reply #4 on: September 05, 2023, 05:06:30 PM »
Hi,
I use X2 curves. This is very good for joysticks.
And you can change from linear to X2 by a parameter.

Marbek Elektronik, Dipl.-Ing. Bernd Konrad
Dienstleistung, Entwicklung, Herstellung

Offline GreaseMonkey

  • PLUS+1 Developer
  • ***
  • Posts: 22
  • Karma: +0/-0
  • The fastest way to do anything is once
Re: How to Achieve an Exponential Curve from Linear Input
« Reply #5 on: September 06, 2023, 12:14:13 AM »
Hi,
I use X2 curves. This is very good for joysticks.
And you can change from linear to X2 by a parameter.

Thank you for the recommendation and for sharing your code!  I will give that a try.