# QL on 2 models  \[PickMaster 3\]

**URL:** <https://tech-community.robotics.abb.com/t/ql-on-2-models-pickmaster-3/1384>\
**Category:** PickMaster\
**Created:** [August 13, 2007, 4:59pm UTC](https://tech-community.robotics.abb.com/t/ql-on-2-models-pickmaster-3/1384 "2007-08-13T16:59:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![createch](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@createch](https://tech-community.robotics.abb.com/u/createch)\
**Post date:** [August 13, 2007, 4:59pm UTC](https://tech-community.robotics.abb.com/t/ql-on-2-models-pickmaster-3/1384/1 "2007-08-13T16:59:40Z")

</div>

Hi,

We have a line of 10 pickers where we want to do some speed regulation using the QL functionnality.

We have try this by adding an extra encoder board (this encoder board is only used for the QL) and it works fine for one model.

My problem now is to do this with 2 models and 1 encoder board. The easy way is to add an extra encoder board but I want to know first if it is possible to do this with one encoder board. I have try some code but it gives uplink error.

This is the code that I am using for one model (It works OK):

TRAP iQueuelevelDI  
nQueueLevel:=GetQueueLevel(ItmSrcData{4}.itemsource);  
IF nQueueLevel \<255 THEN  
setGO GOQueueLevel,nQueueLevel;  
ELSE  
setGO GOQueueLevel,255;  
ENDIF  
If bDebug nTotal:=nTotal+nQueueLevel;  
If nQueueLevel\>0 PulseDO doReadOK;  
QStopItmSrc ItmSrcData{4}.itemsource;  
Flush\*tmSrc ItmSrcData{4}.itemsource;  
QStartItmSrc ItmSrcData{4}.itemsource;  
If bDebug THEN  
nCounter:=nCounter+1;  
TPWrite "Trap : "Num:=nCounter;  
TPWrite "Total : "Num:=nTotal;  
ENDIF  
ENDTRAP

This is the code that I have tried without succes :

TRAP iQueuelevelDI  
nQueueLevel1:=0;  
bNoItem:=FALSE;  
WHILE bNoItem=FALSE DO  
GetItmTgt ItmSrcData{4}.ItemSource,PickQLAUTOMaxTime:=0.05TimeFlag:= bNoItem;  
IF bNoItem=FALSE THEN  
Incr nQueueLevel1;  
AckItmTgt ItmSrcData{4}.ItemSource,PickQLAUTO,TRUE;  
ENDIF  
ENDWHILE  
IF nQueueLevel1 \<255 THEN  
setGO GOQueueLevel1,nQueueLevel1;  
ELSE  
setGO GOQueueLevel1,255;  
ENDIF  
If bDebug nTotal:=nTotal+nQueueLevel1;  
If nQueueLevel1\>0 PulseDO doReadOK;  
!QStopItmSrc ItmSrcData{4}.itemsource;  
!Flush\*tmSrc ItmSrcData{4}.itemsource;  
!QStartItmSrc ItmSrcData{4}.itemsource;  
If bDebug THEN  
nCounter:=nCounter+1;  
TPWrite "Trap : "Num:=nCounter;  
TPWrite "Total : "Num:=nTotal;  
ENDIF  
ENDTRAP

I think that the while loop give me some Uplink troubles.

How is the GetQueueLevel build up ? Is it also a loop ?

I need a GetQueueLevel for the 2 items, are there any possibility to link the GetQueueLevel to the item type ?

BR,

Fabrice

---

<div class="post-metadata">

**Author:** ![Mats\_W](https://avatars.discourse-cdn.com/v4/letter/m/df705f/32.png) [@Mats\_W](https://tech-community.robotics.abb.com/u/Mats_W)\
**Post date:** [August 15, 2007, 7:07am UTC](https://tech-community.robotics.abb.com/t/ql-on-2-models-pickmaster-3/1384/2 "2007-08-15T07:07:47Z")

</div>

Fabrice

I think you are giving the controller a hard time.  
Add a “WaitTime 0.05;” after the AckItmTgt instruction. This will give the system a little more time to consume all you acknowledgements.

BR

Mats
