Hi!
I'm here again with a question I can not solve, and i'm sure it's not so difficult. It's related to another post i've made recently.
I have a robot with 3 possible outputs.I want it to send by channel 1 the atoms named 'mec' and other atoms by channels 2 and 3, but not in a random way, but to the first open channel of these two (channels 2 and 3), I mean to the one which has been longest waiting.
I don't know how to set that in 4DScript. I have this example but is the 'random case', and i would like to modify it.
If(
CompareText(Name(first(c)), [mec]) = true,
1,
IndexMax(NrOC(c)-1, OCReady(Count + 1,c)*Random(100000)) + 1
)
Can anyone help me?
Thanks a lot!!
Channel problem 2
- HarryBunnik
- Posts: 362
- Joined: Monday 07 February, 2011 - 11:22
Re: Channel problem 2
Ha Carnm92,
I've made a small example model in which every third product has the name "mec".
As you see I made a different type of SendTo statement (code below). After all I need the time at which the last product entered the atom behind the robot (in my case a simple server).
This time stamp I record with a label [LastEntryTime], which I set when a product leaves the server on the chosen conveyors behind (see the OnExit code of the server).
Additionally I've placed a initialize atom to reset the labels to 0 when the reset is pressed.
I hope this helps you further!
Cheers,
Harry
I've made a small example model in which every third product has the name "mec".
As you see I made a different type of SendTo statement (code below). After all I need the time at which the last product entered the atom behind the robot (in my case a simple server).
Code: Select all
Case(
WhichIsTrue(
CompareText(Name(first(c)), [mec]) = true,
Label([LastEntryTime], out(2, c)) <= Label([LastEntryTime], out(3, c)),
1=1
),
1,
2,
3
)
Code: Select all
Label([LastEntryTime], out(OC(c), c)) := Time
I hope this helps you further!
Cheers,
Harry