<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Tracking PieceID</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/6a053bb432/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/6a053bb432/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/6a053bb432/</id><updated>2022-04-13T02:01:37.182000Z</updated><subtitle>Recent posts to Tracking PieceID</subtitle><entry><title>Tracking PieceID</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/6a053bb432/?limit=25#4181" rel="alternate"/><published>2022-04-13T02:01:37.182000Z</published><updated>2022-04-13T02:01:37.182000Z</updated><author><name>dr3amwithyou</name><uri>https://forge.codesys.com/u/dr3amwithyou/</uri></author><id>https://forge.codesys.comfcd0bceee6627a8dcdc6902491617b624874d55f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;br/&gt;
I'm new to codesys and i'm currently leading with a problem which i couldn't find an efficient resolution yet. Basically all i wanted is to track a piece throughout the production line, and passing the Identifier of each piece between FBs (using SFC), in the runtime.&lt;br/&gt;
So, whenever a new piece comes in i was assigning ID to it, and then pass that ID to the next function_block whenever the piece reaches it. &lt;br/&gt;
For example between two conveyors:&lt;br/&gt;
when a conveyor is sending a piece to the next conveyor, at the same time, i call an action that copies the piece_ID to the input of the next conveyor. Then that same conveyor has to store that ID.&lt;br/&gt;
Furthermore, I thought in creating a global variable as array, where each position was a slot for each conveyor, and when a conveyor has a piece(detected by a sensor), i put the piece_ID in that corresponding slot. Thus, i only had to check the array to check where the piece was.&lt;/p&gt;
&lt;p&gt;Example between 2 conveyors:&lt;br/&gt;
&lt;img alt="" rel="nofollow" src="https://imgur.com/ktU7a58"/&gt;&lt;br/&gt;
&lt;img alt="" rel="nofollow" src="https://imgur.com/2HLC6yy"/&gt;&lt;/p&gt;
&lt;p&gt;when conveyor is sending piece i call a this action:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;gvl.piece_ID:=pieceID_O;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;simultaneously the next conveyor stores that ID with this action:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c"&gt;pieceID_I:=pieceID_O;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;and whenever the conveyor has a piece i had a POU in ST to test and store the IDs into the global array:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;IF&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PLANTA&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;L1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;full&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;THEN&lt;/span&gt;
    &lt;span class="n"&gt;gvl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Track_ID&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;PLANTA&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;L1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pieceID_O&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_IF&lt;/span&gt;


&lt;span class="k"&gt;IF&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PLANTA&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;L0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;full&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;THEN&lt;/span&gt;
    &lt;span class="n"&gt;gvl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Track_ID&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;PLANTA&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;L0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pieceID_O&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_IF&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The logic behind the idea looks fine, but for some reason isn't working. &lt;br/&gt;
Do you have any idea how i could flow that piece indentifier and store it effectively?&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>