Page 1 of 1

Block action by "If", "Then"?

Posted: Tuesday 28 July, 2015 - 13:42
by EvelineHermans
Hello,

I'm new here and I have a question, hope you can help me :)!

I'm modelling an assembler that needs 6 parts to produce the final product. I would like to set the maximum number of products in stock to 10, but I don't know how. Using a queue would not allow further processes to continue using one of the "stocked products". I think I need some sort of If", "Then" function. But if I need such a function, how do I then refer to these Atoms if is not the previous or next Atom (between my assembler and stock I use some servers that determine the product specifications and - if needed - adjust the product)?

I hope my question is clear to you! Thanks in advance for your answer,

Eveline

Re: Block action by "If", "Then"?

Posted: Tuesday 28 July, 2015 - 15:22
by HarryBunnik
Ha Eveline,

There are a few ways to do this. You can use an extra connection and link the queue (exit channel 2)to the end point (information channel) of your production process and refer to it that way {out(2, c)}. Then you can make a similar link the other way around.

Another (nicer) option is to use an initialize and create some global variables there and fill them when the model initializes (reset). Also then you can use connections between the initialize atom (1 to Queue and 2 to End point) and the atoms you want to refer to (preferably the information channel).

Code: Select all

Do(
  Dim([refQueue], vbAtom, in(1, c)), 
  Dim([refEndPoint], vbAtom, in(2, c))
) 
Then you can use these atom references anywhere within the model.

I hope this helps you a bit further

Cheers,

Harry

Re: Block action by "If", "Then"?

Posted: Tuesday 28 July, 2015 - 16:09
by EvelineHermans
Hi Harry,

Thanks for your fast reply. Unfortunately, as I am still a noob in ED, I do not fully understand your answer... :?
So far I implemented a InitalizeAtom and copied your initalize code, but I'm not sure if I do understand your explaination "use connections between the initialize atom (1 to Queue and 2 to End point)".

As there are 6 input-channels (all reservoirs) for the AssemblerAtom and only 1 output-channel, I don't want the assembler to start collecting products if I have 10 final products on stock. How, and where do I define the action that has to be taken if stock = 10? And what Queue do I connect the InitalizeAtom with? I assume the EndPoint you mentioned is the Atom that represents the stock?

Cheers,
Eveline

Re: Block action by "If", "Then"?

Posted: Tuesday 28 July, 2015 - 17:14
by HarryBunnik
Ha Eveline,

Is it possible for you to share your model? That way I can refer to the same names as you are using. I think that will prevent some misunderstandings ;-) And it will also make it easier to show you what I mean :-)

Regards,

Harry

Re: Block action by "If", "Then"?

Posted: Wednesday 29 July, 2015 - 09:55
by EvelineHermans
Hi Harry,

Thanks a lot. I attached my model now.
What I would like to do is:
*BLOCK connections [reservoir 1-6 to Assembler] if Voorraad1 has 10 products (in stock). If this number decreases, the production can start again, till 10 products are in stock again.
*BLOCK connections [reservoir 1-6 to Assembler] if product is in between Assember and voorraad1 (the whole process must end before the next can actually start)

Thanks a lot.

Eveline
Model_Eveline.mod
(80.28 KiB) Downloaded 279 times

Re: Block action by "If", "Then"?

Posted: Wednesday 29 July, 2015 - 18:39
by HarryBunnik
Ha Eveline,

What you can write is on the OnExit trigger of the Assember some code to close the output of the Reservoirs.

Code: Select all

  Repeat(
    NrIc(c), 
    CloseOutput(In(count, c))
  )
When you then write the opposite code (with some limitations regarding content of the queue and so on) on the OnEntry of the Queue, you can open it again. Additionally you have to ensure it can be opened as well when the queue was at 10, and a product moves out of the queue. But at the same time, you don't want to disturb the process when the assembled product is in one of the servers. This is why I try to overcome that problem with a label on the queue, which I set when I would want to open the assembler, but can't since the queue is filled to its max.

I've made something similar in your model and attached it to this message:
Model_Eveline_V01.mod
(80.51 KiB) Downloaded 275 times
I hope it gives you some idea how to do go on.

Cheers,

Harry