Distribution atoms to workstations
Distribution atoms to workstations
Hi,
I'm working on a project where I have to distribute packages to different stores (servers). I connected 2 advanced transporters, 1 sink and 1 source and 3 servers to the network. The advanced transporters are programmed with dUniform(2,4) ,with 2, 3, 4 the stores so they will randomly bring packages to the different stores. After 5 minutes, another transporter picks up the package and brings it to the sink. Now I have the problem that, when a server is full, a transporter still brings a package to that server. Then I get a deadlock.
How do I adjust the script so they only bring a package when the server is free (server has capacity of 1) ?
Thanks in advance
I'm working on a project where I have to distribute packages to different stores (servers). I connected 2 advanced transporters, 1 sink and 1 source and 3 servers to the network. The advanced transporters are programmed with dUniform(2,4) ,with 2, 3, 4 the stores so they will randomly bring packages to the different stores. After 5 minutes, another transporter picks up the package and brings it to the sink. Now I have the problem that, when a server is full, a transporter still brings a package to that server. Then I get a deadlock.
How do I adjust the script so they only bring a package when the server is free (server has capacity of 1) ?
Thanks in advance
- HarryBunnik
- Posts: 362
- Joined: Monday 07 February, 2011 - 11:22
Re: Distribution atoms to workstations
Ha jastesem,
What you can do is create a table (ServerCapacity) with 3 rows (one for each server) and the moment a product is picked up to be brought to a server, the corresponding cell is incremented. And only once a product leaves the server, the cell is decremented again. Additionally, you can create a second column in the table with the allowed capacity (in your case 1).
Then expand the check that a new product is always brought to a server that has still space.
So instead of a dUniform more something like (note that this is no longer random, but has a preference for the first, than the second and than the thrid Server.):
Do(
var([valChannel], vbValue),
var([valCurrentRow], vbValue, 1),
LoopUntil(
valChannel > 0,
Do(
If(
Cell(valCurrentRow, 1 {Content}, refServerCapacity) < Cell(valCurrentRow, 2 {Capacity}, refServerCapacity),
valChannel := valCurrentRow + 1 {+ 1 as compensation}
),
Inc(valCurrentRow)
),
3 {Nr. of Servers}
)
)
Doing it this way has the advantage over directly comparing checking the Content of the server, that it is also working when there are more than one Transporters (also when an AT is on the way, it is directly registered).
Perhaps you may want to also control the offering of products to the AT's to be transported to the servers. This to ensure that not more products are offered than can be contained by the combination of the 3 Servers. Here you could play with Open- en CloseOutput of the source based on the summation of the first column in your Table.
I hope this helps you a bit further.
Regards,
Harry
What you can do is create a table (ServerCapacity) with 3 rows (one for each server) and the moment a product is picked up to be brought to a server, the corresponding cell is incremented. And only once a product leaves the server, the cell is decremented again. Additionally, you can create a second column in the table with the allowed capacity (in your case 1).
Then expand the check that a new product is always brought to a server that has still space.
So instead of a dUniform more something like (note that this is no longer random, but has a preference for the first, than the second and than the thrid Server.):
Do(
var([valChannel], vbValue),
var([valCurrentRow], vbValue, 1),
LoopUntil(
valChannel > 0,
Do(
If(
Cell(valCurrentRow, 1 {Content}, refServerCapacity) < Cell(valCurrentRow, 2 {Capacity}, refServerCapacity),
valChannel := valCurrentRow + 1 {+ 1 as compensation}
),
Inc(valCurrentRow)
),
3 {Nr. of Servers}
)
)
Doing it this way has the advantage over directly comparing checking the Content of the server, that it is also working when there are more than one Transporters (also when an AT is on the way, it is directly registered).
Perhaps you may want to also control the offering of products to the AT's to be transported to the servers. This to ensure that not more products are offered than can be contained by the combination of the 3 Servers. Here you could play with Open- en CloseOutput of the source based on the summation of the first column in your Table.
I hope this helps you a bit further.
Regards,
Harry
Re: Distribution atoms to workstations
Hi!
I still have a problem with this code. Now I get a deadlock immediately, because my second AT also goes to server 1, after my first AT brings an atom to server 1. Also I don't see my table updating, is this normal? I made a table with one column empty, and the other one full of 1's. I think it isn't working because of the table.
Thanks
I still have a problem with this code. Now I get a deadlock immediately, because my second AT also goes to server 1, after my first AT brings an atom to server 1. Also I don't see my table updating, is this normal? I made a table with one column empty, and the other one full of 1's. I think it isn't working because of the table.
Thanks
- HarryBunnik
- Posts: 362
- Joined: Monday 07 February, 2011 - 11:22
Re: Distribution atoms to workstations
Ha jastesem,
Can you share your model so I can have a look at it?
Regards,
Harry
Can you share your model so I can have a look at it?
Regards,
Harry
Re: Distribution atoms to workstations
Hi,
This is the project we're working on at the moment.
Thanks in advance !
This is the project we're working on at the moment.
Thanks in advance !
- Attachments
-
- EDproject.mod
- (84.27 KiB) Downloaded 314 times
- HarryBunnik
- Posts: 362
- Joined: Monday 07 February, 2011 - 11:22
Re: Distribution atoms to workstations
Ha jastesem,
In which version of ED are you working?
Regards,
Harry
In which version of ED are you working?
Regards,
Harry
Re: Distribution atoms to workstations
Hi!
In 10 Educational
In 10 Educational
- HarryBunnik
- Posts: 362
- Joined: Monday 07 February, 2011 - 11:22
Re: Distribution atoms to workstations
Ha jastesem,
I have the impression, when I see the model, that we are making it a bit too complicated.
You said in the beginning that one Advanced Transporter is dedicated to delivering the first step and one for the second step?
In that case, you must ensure that the products with label([Step] = 1 are sent to one transporter and all products which have value 2 are sent to the other Transporter. This you can arrange on the dispatcher. However, you have to ensure that the label [step] is already defined on the product when the request to have it picked up is made! I see that you now first define it on the on-exit trigger of the source.
Since you have dedicated transporters, the send to statement could also be simplified.
Because both processes are done by different Advanced Transporters, it should not be possible to get a deadlock, so the construction with the table is not needed here.
I hope this helps you further.
Regards,
Harry
I have the impression, when I see the model, that we are making it a bit too complicated.
You said in the beginning that one Advanced Transporter is dedicated to delivering the first step and one for the second step?
In that case, you must ensure that the products with label([Step] = 1 are sent to one transporter and all products which have value 2 are sent to the other Transporter. This you can arrange on the dispatcher. However, you have to ensure that the label [step] is already defined on the product when the request to have it picked up is made! I see that you now first define it on the on-exit trigger of the source.
Since you have dedicated transporters, the send to statement could also be simplified.
Because both processes are done by different Advanced Transporters, it should not be possible to get a deadlock, so the construction with the table is not needed here.
I hope this helps you further.
Regards,
Harry