<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to unexpected drive position (fActPosition) after SMC3_ReinitDrive</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/236dbc5c6c/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/236dbc5c6c/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/236dbc5c6c/</id><updated>2020-02-27T13:48:11.705000Z</updated><subtitle>Recent posts to unexpected drive position (fActPosition) after SMC3_ReinitDrive</subtitle><entry><title>unexpected drive position (fActPosition) after SMC3_ReinitDrive</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/236dbc5c6c/?limit=25#446b" rel="alternate"/><published>2020-02-27T13:48:11.705000Z</published><updated>2020-02-27T13:48:11.705000Z</updated><author><name>alejho</name><uri>https://forge.codesys.com/u/alejho/</uri></author><id>https://forge.codesys.com57a640d0ce276376bd4848dfe028a47cb9301a3f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;We found something that I hope will be useful for someone else.&lt;/p&gt;
&lt;p&gt;The "wrong" &lt;strong&gt;fActPosition isn't calculated according to the encoder master's position, but it always has a variation of 216°&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;This value is not causal, but it's due to the fact that &lt;strong&gt;the increments per output turn of the axis (in our application 65536*10 is equal to 360°) is NOT a power of two&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;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)&lt;/strong&gt;.&lt;br/&gt;
(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)&lt;/p&gt;
&lt;p&gt;This is not a problem when the machine is running (it just count the increments managing the overflow I suppose)...but &lt;strong&gt;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°)&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Now the question is...what's the best pratice to manage this problem?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I was thinking about counting the number of overflow and triggering an MC_Home after a reinit (to set fActPosition := fActPosition * 216 * numberOfOverflows)&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>unexpected drive position (fActPosition) after SMC3_ReinitDrive</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/236dbc5c6c/?limit=25#57cc" rel="alternate"/><published>2020-02-27T13:48:11.649000Z</published><updated>2020-02-27T13:48:11.649000Z</updated><author><name>alejho</name><uri>https://forge.codesys.com/u/alejho/</uri></author><id>https://forge.codesys.comfb1e63b0a279daca6b1a5fb7ec47d687519f1db1</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I have a slave drive attached to a master with &lt;strong&gt;MC_Phasing&lt;/strong&gt;.&lt;br/&gt;
When I call &lt;strong&gt;SMC3_ReinitDrive&lt;/strong&gt; is &lt;strong&gt;fActPosition is set to the variation of the Master position while the drive is re-initializing&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;This is quite strange because it happens also if the drive's position coming from the fieldbus is constant (the axis is not moving).&lt;br/&gt;
I expect fActPosition not changing before and after SMC3_ReinitDrive...since the axis is not moving!&lt;/p&gt;
&lt;p&gt;In attachment a picture of a trace what is happening...&lt;br/&gt;
&lt;strong&gt;Does anyone know what can cause such a strange behaviour?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Thank you for any kind of help!&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: codesys_forum.png" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=5163"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>