question

sylvain DAMOIS avatar image
0 Likes"
sylvain DAMOIS asked Sam Stubbs commented

How to keep the Exit transfer on the Exit Edgeof a conveyor

Dear all,

I use a code to change my conveyor length when I click "on Reset"Here is my code:

Lconv is a global variable for my conveyor length.

My issue is when the new length is more than twice the previous length, my Exit Transfer move to the conveyor inlet edge. How, can I keep it on the Exit Edge or do we have a code to move it on at the rigth place? I have try the Setloc funtion without success.

Thank you for your help.

Sylvain

FlexSim 16.2.0
codeexit transfer
capture.jpg (23.5 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
Clair A avatar image
3 Likes"
Clair A answered Sam Stubbs commented

Hello Sylvain,

In the attached model, I added 2 lines of code in the reset trigger:

int ExitPointRank = 2;
settablenum(getvarnode(current, "conveyorPoints"), ExitPointRank, 1, Lconv);

If you look inside the tree, there is a node called conveyorPoints in the conveyor variables.

You can also explore this node as a table (right click on the node conveyorPoints, Explore > As Table).

So that's why I use the command settablenum to change the value distAlong of the second point in this table, which is the ExitTransfer. Be careful though, if you have more conveyor points in your own model the exit transfer rank might be different.

As a side note, if I were in your shoes I would prefer to store the value of Lconv in a label or a global table instead of a global variable.

Hope this helps.


· 5
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Mischa Spelt avatar image Mischa Spelt commented ·

If you have a direct reference to the exit transfer, you can also call an event function to set the distance along the conveyor (and update all the graphics and internal stuff accordingly):

treenode exitPoint = model.find("/ExitTransferXXX");
function_s( exitPoint, "setDistAlongConveyor", conveyorLength );
0 Likes 0 ·
sylvain DAMOIS avatar image sylvain DAMOIS commented ·

Thank you so much for your help.

I have implement the Clair's solution and it works. :-)

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.