Problem with 4Dscript

All topics on coding 4Dscript in Enterprise Dynamics.
dawikra405
Posts: 18
Joined: Tuesday 20 March, 2012 - 19:10

Problem with 4Dscript

Post by dawikra405 »

Hi,

I have script Sendto but I don't understand it. Someone help me and gives comments for commends :)

if(Label([Where],i)=0,
Do(Min(NrOC(c), NrOC(c) + 1 - IndexMatch(NrOC(c), 1, OCReady(NrOC(c) + 1 - Count, c)))),
If(|(Label([Where],i)=1,Label([Where],i)=4),3,
if(|(Label([Where],i)=3,Label([Where],i)=6),4,
if(Label([Where],i)=2,1,
if(Label([Where],i)=5,2)
)
)
)
)

and else:

content(in(1,in(1,c)))+content(in(1,in(2,c)))+content(in(1,in(3,c)))+content(in(4,c))>=2

Thank you
dawikra405
Posts: 18
Joined: Tuesday 20 March, 2012 - 19:10

Re: Problem with 4Dscript

Post by dawikra405 »

hi,

My problem is: I have 2 routines Adnaced Robot. First routine was assigned to first product and then second routine for other 99 products. I would like to realize first routine for first product fom source. Second routine for rest products from source. How can i silve it ?

Regard
vincent1989
Posts: 15
Joined: Friday 19 October, 2012 - 15:18

Re: Problem with 4Dscript

Post by vincent1989 »

Hello,

I will first consider your script statements:

From what I understand your first script is placed into Sendto. If true, then this script is not correct, since i does not refer to the product in the Sendto. Change to c (atom) or first(c) (product) to solve this problem.

content(in(1,in(1,c))) gives the contents of the atom connected to inputchannel 1 of an atom which again is connected to inputchannel 1 of your currently selected atom.

So: Content( atom ) -- inputchannel 1 --> atom -- inputchannel 1 --> Your currently selected atom.

The conditional statement sums these statements and checks whether these are equal or larger than 2.


Now for your question: The context of the question and the question itself are quite unclear. Can you reformulate?

Regards,

Vincent.
dawikra405
Posts: 18
Joined: Tuesday 20 March, 2012 - 19:10

Re: Problem with 4Dscript

Post by dawikra405 »

Hello Vincent,

Look at my model which I've attached. Could you explain me your view once again using this model :)

I will try explain it clearly. I would like to realize this sequence motion robot with Advanced Articulated Robot. I have to determine 2 Routines.
First routine: Conveyor-> Server3

Second routine: Conveyor-> Server4-> Server3-> Turntable-> Server3-> Server4-> Turntable-> Server4-> Server3-> Conveyor(out)-> Conveyor(in)->Server3-> Server4-> Conveyor(out) and this sequence is repeated for next products on the conveyor.

So I have 2 routines. First is dedicated for first product on the conveyor- ONLY
Second routine is assigned to the rest products on the conveyor. As you see the first routine is triggered when the Advanced Robot starts working in system( for first product). For 2,3,4 ... infinite products I have to use second routine.

And third question: What kind of syntax I should use when the server stopped working and robot automatically go to server and pick the product. That same situation with turntable atom.

I hope i've explained it clearly :)

Regards
David
Attachments
parallel.mod
(27.97 KiB) Downloaded 284 times
vincent1989
Posts: 15
Joined: Friday 19 October, 2012 - 15:18

Re: Problem with 4Dscript

Post by vincent1989 »

Hello David,

Consider:
if(Label([Where],i)=0,
Do(Min(NrOC(c), NrOC(c) + 1 - IndexMatch(NrOC(c), 1, OCReady(NrOC(c) + 1 - Count, c)))),
If(|(Label([Where],i)=1,Label([Where],i)=4),3,
if(|(Label([Where],i)=3,Label([Where],i)=6),4,
if(Label([Where],i)=2,1,
if(Label([Where],i)=5,2)
)
)
)
)

This segment of code lets the crane know where he should send the product next.

The first line of code is relevant for a completely new product. It simply says: An open channel: First channel first.

The other lines:
1 to 3 are linked to products which go through the first server, and 4 to 6 are linked to the products that go through the second server. So product 1 goes from 0 -> 1 -> 2 -> 3 for each of his steps and product 2: 0 -> 4 -> 5 -> 6. Label [Where] contains these numbers and on the basis of these the robot determines where the products should go next. The above code is this 'determination' code in the robot.

Of course, if a product is in server3 and a product is in server4 the robot might be inclined to pick the first product from an open channel, which might be the conveyor. Since the robot cannot unload this product (server3 and server4 are full), the system gets stuck, hence there can only be a maximum of 2 products in the system. This creates your second line of code:

content(in(1,in(1,c)))+content(in(1,in(2,c)))+content(in(1,in(3,c)))+content(in(4,c))>=2

So in each of the servers and the turntable there should be a trigger that increases the [where] label.

Does this answer your questions?

Regards,

Vincent.
Last edited by vincent1989 on Wednesday 24 October, 2012 - 15:39, edited 1 time in total.
dawikra405
Posts: 18
Joined: Tuesday 20 March, 2012 - 19:10

Re: Problem with 4Dscript

Post by dawikra405 »

Hi,

Vincent your answer is perfect. Now I understand it :)
What do you think about my second problem with Routines. I described it above.

Regards
David
vincent1989
Posts: 15
Joined: Friday 19 October, 2012 - 15:18

Re: Problem with 4Dscript

Post by vincent1989 »

Hello David,

I'm not exactly sure what you are referring to with your 'second' problem.

Your third question:
"What kind of syntax I should use when the server stopped working and robot automatically go to server and pick the product. That same situation with turntable atom."

So the server (or turntable) is done with it's process and the robot automatically picks up the finished product and takes it to the next location. What syntax are you referring to? What is the goal you wish to achieve?

Doesn't the model you provided already contain the sequence (routines) you described?

Please elaborate.

Regards,

Vincent.
dawikra405
Posts: 18
Joined: Tuesday 20 March, 2012 - 19:10

Re: Problem with 4Dscript

Post by dawikra405 »

Hello Vincent,

I would like to realize process ( parallel ) using Advanced Robot. Sequences motions Advanced Robot I plan achieve using teach-in (no 4Dscript). So in my opinion I have to create 2 Routines:
First routine: Conveyor-> Server3
Second routine: Conveyor-> Server4-> Server3-> Turntable-> Server3-> Server4-> Turntable-> Server4-> Server3-> Conveyor(out)-> Conveyor(in)->Server3-> Server4-> Conveyor(out).
I want to create first routine using following commands:
MoveTo: go to conveyor
Load: load product on the conveyor
MoveTo: up
MoveTo: temporary position
MoveTo: unload position
MoveTo: down
Unload: unload to server3
MoveTo: up
MoveTo: go to default position
End

Second Routines I will achieve that same way.

So I have to assign a First Routine to first product on the conveyor.
For others products on the conveyor I will use Second Routine.
In this way I will achieve the desired sequences motions like in model parallel but with Advanced Robot and moreover without 4Dscript (this is my goal).

Do I think correctly? If not give me advices,please.
Vincent i'm so sorry for the vague problem description and I hope that you understand it now :)

Regards
David
vincent1989
Posts: 15
Joined: Friday 19 October, 2012 - 15:18

Re: Problem with 4Dscript

Post by vincent1989 »

Hello David,

I must say I'm not familiar with teach-in, but I can tell you the following:

By utilizing the 'Advanced Scara Robot' (Library Tree: Library -> Transport -> Robots -> Advanced Scara Robot) routines can be implemented. (In the model you sent me you were using the standard Robot)

Double click on the 'Advanced Scara Robot' and proceed to routines. You can click 'New Routine' to create the routines you want. (or create motion examples).

To make sure the first routine is only applied on the first product, one can assign an ever increasing label to the product and tell the 'Advanced Scara Robot' to use routine_1 if label value < 1 and to use routine_2 if label value >=1 (if you start with 0).

Does this aswer your questions?

Regards,

Vincent.
dawikra405
Posts: 18
Joined: Tuesday 20 March, 2012 - 19:10

Re: Problem with 4Dscript

Post by dawikra405 »

Hello Vincent,

Thanks a lot for your all answers. I know how create routines but I think about what you wrote: routine_1 if label value < 1 and to use routine_2 if label value >=1.

I think that proper script I have to implement to Pick and Place selection rule in Define selection rule ( Edit routines). I have a problem with correct syntax this trigger to routine_1 or routine_2.

I have Label in Source:

Label([Where],i)=0
I don't know how I can extend this script to achieve what you said.

I hope I don't interrupt you :)


Regards
David
Post Reply