From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I handle a count overflow while running "end's" rotation drive in position control?

Hi everyone!

 

We run a direct drive in position control mode and normally do oscillating movements i.e. +-10°. The Signal we get is a TTL with 120 counts/°. And with those counts we do our control.
But now we want to run the motor permanent one direction for some days (or 4 ever :-). That means that we get sooner or later a overflow on the count variable. So I think we have a problem when the setpoint is on Overflow -32767 and the Position is 32767. ( I know that I can increase the Integer Value but that does not solve it at the end 🙂
How can I handle that?
Is there any programmatic approach?

 

Thanks for Help!

0 Kudos
Message 1 of 12
(4,116 Views)

Hi Petric,

 

usually you switch the drive from position to velocity control…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 12
(4,097 Views)

Hi GerdW,

 

Usually yes, but we ar not normal. We do the position control within the FPGA and the drive is in "Torquecontrol" and we don't want to change that!

 

Thanks Petric

0 Kudos
Message 3 of 12
(4,060 Views)

Hi Petric,

 

once you can detect such an numeric overflow you can handle it in software…

 

First step: detect the overflow. (Using the sign bit might be an option.)

Second step: adapt your counting math to those overflow detection condition! (IF overflow THEN add offset to count difference)

 

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 12
(4,048 Views)

Hi Gerd,

 

Ok, when I got it right, then I should to something like that:

 

IF overflow

THEN:

  Setpoint == Setpoint - (setpoint_Size - x);

  Actual Counts == Actual Counts  - (Actual Counts_Size - x);

  nr_of_overflow == nr_of_overflow + 1; 

END

 

_Size represents the Size of the Variable

I dont know if I have to use x to avount to many calculations when it toggels arrount the overflow!?

With nr_of_overflow, I still can calculate the absolute turns, right?

 

Kind Regards

Patric

0 Kudos
Message 5 of 12
(4,033 Views)

Hi Petric,

 

yes, something like that pseudocode.

And yes, you can always count the turns/overflows in a separate variable…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 12
(4,030 Views)

If all you really care about is how many spots you moved since the last check, you just need to subtract.  The overflow sort of just goes away when you do that.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 7 of 12
(4,023 Views)

Hi crossrulz,

 

I do not understand what you mean. That's probably because of my little english understanding... Can you please describe it in more details?

 

Thanks

Petric

0 Kudos
Message 8 of 12
(3,955 Views)

Hi Petric,

 

overflow is handled automatically when you subtract two signed integers…

 

Example: Two I16 numbers like +100 and -100. Subtracting them will result in (+100) - (-100) = +200…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 12
(3,943 Views)

Thanks for the patience with me!

 

I do see the math but that does not help when I have more then one overflow, right?

 

The second thing is thil that I got a big issue when the setpoint is jumping due to overflow! I have to handle that primarly.

 

 

0 Kudos
Message 10 of 12
(3,927 Views)