CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Tue Feb 18, 2020 9:11 am

All times are UTC+01:00

Post new topic  Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu Jan 16, 2020 4:52 pm 

Joined: Tue Jun 04, 2019 4:53 pm
Posts: 8
I have a slave drive attached to a master with MC_Phasing.
When I call SMC3_ReinitDrive is fActPosition is set to the variation of the Master position while the drive is re-initializing.

This is quite strange because it happens also if the drive's position coming from the fieldbus is constant (the axis is not moving).
I expect fActPosition not changing before and after SMC3_ReinitDrive...since the axis is not moving!

In attachment a picture of a trace what is happening...
Does anyone know what can cause such a strange behaviour?

Thank you for any kind of help!

You do not have the required permissions to view the files attached to this post.

PostPosted: Fri Jan 17, 2020 11:52 am 

Joined: Tue Jun 04, 2019 4:53 pm
Posts: 8
We found something that I hope will be useful for someone else.

The "wrong" fActPosition isn't calculated according to the encoder master's position, but it always has a variation of 216°.

This value is not causal, but it's due to the fact that the increments per output turn of the axis (in our application 65536*10 is equal to 360°) is NOT a power of two.

For our application 216°=393216 increments that is exactly the number of increments "missing" from 655360 to reach the first power of two (2^20).
(It isn't easy to imagine...but try to draw a trivial example for a 4bit encoder where you get 360° every 3 increments and it will be clear)

This is not a problem when the machine is running (it just count the increments managing the overflow I suppose)...but when you reinit the drive after a drive encoder's overflow (32bit) you get an error in fActPosition of 216° equal to 393216 increments (216°)

Now the question is...what's the best pratice to manage this problem?

I was thinking about counting the number of overflow and triggering an MC_Home after a reinit (to set fActPosition := fActPosition * 216 * numberOfOverflows)

Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 2 posts ] 

All times are UTC+01:00

Who is online

Users browsing this forum: No registered users and 4 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited