Modelling a multi variant pull system?

All topics specific to modeling questions in Enterprise Dynamics
User avatar
HarryBunnik
Posts: 362
Joined: Monday 07 February, 2011 - 11:22

Re: Modelling a multi variant pull system?

Post by HarryBunnik »

Ha Dominik,

I had a short look at your model and am wondering if the following might be a solution. The following code is placed on the "Queue74" OnEntry:

Code: Select all

if(
  and(
    Label([Pvariant], first(c)) = 1,
    content(in(2,c)) >= Label([t-curqty],Model) 
  ),
  Do(
    Label([t-curqty],In(2, c)) := Label([t-curqty],Model), 
    OpenOutput(in(2, c))
  )
)
Here I place a label on the queue that has to deliver the number of products I want to receive. Then I open this queue.
On the OnExit of the queue, I place the following code:

Code: Select all

Do(
  Dec(Label([t-curqty], c), 1), 
  If(
    Label([t-curqty], c) = 0, 
    CloseOutput(c)
  )
)
 
Here I decrement the label every time a product leaves the queue. When the label becomes 0, I close the queue again, since all products requested are delivered.

Would something like that do the trick?

And a few notes to the side.
  • You place a label on the model I see. Is that really necessary? Can't you place it on the order that arrives into the "Queue74"? For me that would seem a more logical place.
  • Is it necessary to check for the content of the queue? What do you want to do when the product queue doesn't contain enough products?
I hope it helps you a bit further and prevents you from getting (too) frustrated ;-) I know how it can be...

Cheers,

Harry
Dominik1982
Posts: 13
Joined: Wednesday 13 May, 2015 - 13:04

Re: Modelling a multi variant pull system?

Post by Dominik1982 »

Hi Harry and thank you very much for your fast reply.

Even that you replied helped a little.

However, your codes are not working the way I need it.

Yes, your first code opens the queues, but it is not the problem to open them. I achieved to do that a "thousand" ways before. The problem is, to close them after the the amount of needed products entered the process, referring to the random quantity in the arrival list (see arrival list rows...dUniform(1,5)).

In de ED HELP (of the arrival list) is written that if I want to query the current quantity of the the current product to be produced I can use Label([t-curqty]. By putting a lable on the ONexit (Label([current_batch], i) := Label([t-curqty], c)) of the arrivallist it should be possible to get the quantity value connected to the code. I tried to combine this with the method to modell a pull system of SimonvdW but it is still not working.

viewtopic.php?f=7&t=214&p=936&hilit=pull#p936

The code below is what I tried today:

Code: Select all

if(
  and(
    Label([Pvariant], first(c)) = 1,
    content(in(2,c)) >= Label([current_batch], i),
    content(in(3,c)) >= Label([current_batch], i),
    content(in(4,c)) >= Label([current_batch], i),
    content(in(5,c)) >= Label([current_batch], i)
  ),
  
  repeat(
         Label([current_batch], i),
         and(
             MoveAtom(first(in(2,c)), Out(1,in(2,c))),
             MoveAtom(first(in(3,c)), Out(1,in(2,c))),
             MoveAtom(first(in(4,c)), Out(1,in(2,c))),
             MoveAtom(first(in(5,c)), Out(1,in(2,c))) 
             )                
         )     
  )


Regarding to your notes:
-You place a label on the model I see. Is that really necessary? Can't you place it on the order that arrives into the "Queue74"? For me that would seem a more logical place.
Answer:
Well I put the label on the model to make it available in the whole model. It was just the last try before I went asleep last night. So you are right wehn you say that putting the label into the queue47 is more logic in this case.


-Is it necessary to check for the content of the queue? What do you want to do when the product queue doesn't contain enough products?
Answer:
Well, yes and no. In this case it depended on my decision how I want to modell the pull system. I decided to restrict the quantity of orderable products to a max. batch size of 5. Due to my assumption I will procure that the queues will always be full. Before that I wanted to realize that an almost endless amount of product variants per order can be done, starting from batch size one, up to, let´s say onehundred products. But I refused to go on with this strategy (or rather tragedy? :lol: )

I still miss something but I have no clue what it is. If I were able to bring the code above to live I would give me a little bit more confidence.

I think the problem is, that I am not able to connect the quantity value to my code. :?

Enclosed I you can finde the modified model. I delete the ingoing warehose because due to the queue discipline it caused some problems. Blanks got blocked and hence refused to enter the queus. This way I can make sure, that the blanks enter
the queues on an on again. So my queues are now the warehouse.

So please if you have some time left maybe you can take another look at my model.

Thank you.

Yours Dominik
Attachments
step2-4-no IW.mod
(118.34 KiB) Downloaded 251 times
User avatar
HarryBunnik
Posts: 362
Joined: Monday 07 February, 2011 - 11:22

Re: Modelling a multi variant pull system?

Post by HarryBunnik »

Ha Dominik,

Sorry, I'm a bit low on time, so first a short, initial reply.

What did you do with the second part of my code? Did you place it on the OnExit of the 12 Product Queues? Because this is where I do the counting of the number of products I let out of the product queue and when I've let enough free, I close it again. Since you say it's the closing that is the problem, I'm wondering if here something went wrong?

Otherwise I'll have a look later on in more detail.

Cheers,

Harry
Dominik1982
Posts: 13
Joined: Wednesday 13 May, 2015 - 13:04

Re: Modelling a multi variant pull system?

Post by Dominik1982 »

Hi Harry!

It was late at night again when I wrote the last post. I was mistaken by my thoughts, in the current model your second code isn´t written on the queues. Please give me some time (until 10 pm) to check my model and your code again.

Working 40hours plus and studying parttime makes me a littel bit confused.

Please bear with me.

I will check the model again before you invest to much effort and will report again later.

Thank you.

Yours Dominik
Dominik1982
Posts: 13
Joined: Wednesday 13 May, 2015 - 13:04

Re: Modelling a multi variant pull system?

Post by Dominik1982 »

Hi Harry!

Enclosed you can find the model where I integrated your code.

I the first code I added the all queues nessecary for product variant one. Furthermore I went on with your code for
variant 81 to show the difference. Variante 1 needs parts of Queues from Chout 11 to 14. Variant 81 needs
parts from 31 to 34.

This is the code I wroteh into Queue74.

Code: Select all

if(
  and(
    Label([Pvariant], first(c)) = 1,
    content(in(2,c)) >= Label([t-curqty],Model),
    content(in(3,c)) >= Label([t-curqty],Model),
    content(in(4,c)) >= Label([t-curqty],Model),
    content(in(5,c)) >= Label([t-curqty],Model)
    
  ),
  Do(
    Label([t-curqty],In(2, c)) := Label([t-curqty],Model),
    OpenOutput(in(2, c)),
    Label([t-curqty],In(3, c)) := Label([t-curqty],Model),
    OpenOutput(in(3, c)),
    Label([t-curqty],In(4, c)) := Label([t-curqty],Model),
    OpenOutput(in(4, c)),
    Label([t-curqty],In(5, c)) := Label([t-curqty],Model),
    OpenOutput(in(5, c))
    
  ),
  if(
  and(
    Label([Pvariant], first(c)) = 81,
    content(in(10,c)) >= Label([t-curqty],Model),
    content(in(11,c)) >= Label([t-curqty],Model),
    content(in(12,c)) >= Label([t-curqty],Model),
    content(in(13,c)) >= Label([t-curqty],Model)
    
  ),
  Do(
    Label([t-curqty],In(10, c)) := Label([t-curqty],Model),
    OpenOutput(in(10, c)),
    Label([t-curqty],In(11, c)) := Label([t-curqty],Model),
    OpenOutput(in(11, c)),
    Label([t-curqty],In(12, c)) := Label([t-curqty],Model),
    OpenOutput(in(12, c)),
    Label([t-curqty],In(13, c)) := Label([t-curqty],Model),
    OpenOutput(in(13, c))
    
  )
And hence this is the code that should close the queues after the particular amount of parts are passed throuhg.
I understand what you want to do with this code but I don´t know why it is not working. I copied it into th OnExit
of all of the 12 ChOUT queues.

Code: Select all

Do(
  Dec(Label([t-curqty], c), 1),
  If(
    Label([t-curqty], c) = 0,
    CloseOutput(c)
  )
)
At the beginning of the simulation it seems to be working but after the specific amount of products of variant one got assembled, the process gets floodened by blank 11 (circlebrown), and the outputchannels appear unclosed.


Maybe I am now a little clearer in my explanations.

Thank you very much for your patience and helpfulness.

Yours Dominik
Attachments
step2-4-no IW.mod
(119.01 KiB) Downloaded 244 times
User avatar
HarryBunnik
Posts: 362
Joined: Monday 07 February, 2011 - 11:22

Re: Modelling a multi variant pull system?

Post by HarryBunnik »

Ha Dominik,

Good that you're making some progress :-)

I have a few remarks, before I come to your problem.

When I see this code, I think you'll have to start to make a construction in which you use a table, in which you store per product which sources you'll need. If you have too many products and you'll have to code them all in a case-statement, it will be almost impossible to maintain. And I you create a table in which place one product variant per column and on the rows the different sources, you can indicate with a 0 or a 1 if they are needed or not.
Then you can simple loop over the rows, and perform a check on the content if the cell value is a 1. I think you even already have this table, so that would give something like (I didn't test the code, but only to give an idea):

Code: Select all

Do(
  var([valCol], vbValue), 
  
  valCol := InList(Label([pVariant], i), 1, 81, .......), 
  
  If(
    valCol = 0, 
    Error([Product variant is not found]), 
    Do(
      Repeat(
        nRows(refTable_ChState), 
        If(
          Cell(count, valCol, refTable_ChState) = 1, 
          {Part needed}
          If(
            Content(In(count, c)) >= Label([Quantity], i), 
            Do(
              Label([t-curqty], in(count, c)) := Label([CurrentBatch],i), {Perhaps you want to use a different label name, so you won't mix them up}
              OpenOutput(in(count, c))
            )
          )
        )
      )
    )
  )
)

You use dUniform in the Arrival List (Quantity). So this will create 5 orders to be created. Don't you want to use the dUniform to define how many parts you'll need of a certain type to create a product? I'm not entirely sure what your goal is here. But you might want to set this at the OnExit of the source.

And now the problem. I think the problem is that the label that you set on the Queue is of value 0. So the first product that leaves this queue, the label becomes -1, and the If statement is not true, so the queue is never closed again. You could use a "Trace" to check this:

Code: Select all

Do(
  Trace([Variant], Label([Pvariant], i), [Batch size:], Label([CurrentBatch],i)),

  Case(
    InList(Label([Pvariant], i), 1, 81) + 1,
    Do(
      {0: the chosen product variant doesn't exist.}
      Error([This variant], Label([Pvariant],i), [isn't recognized])
    ), 
    Do(
      {1: Variant 1}
      if(
        and(
          content(in(2,c)) >= Label([CurrentBatch],i),
          content(in(3,c)) >= Label([CurrentBatch],i),
          content(in(4,c)) >= Label([CurrentBatch],i),
          content(in(5,c)) >= Label([CurrentBatch],i)    
        ),
        Do(
          Label([t-curqty],In(2, c)) := Label([CurrentBatch],i),
          OpenOutput(in(2, c)),
          Label([t-curqty],In(3, c)) := Label([CurrentBatch],i),
          OpenOutput(in(3, c)),
          Label([t-curqty],In(4, c)) := Label([CurrentBatch],i),
          OpenOutput(in(4, c)),
          Label([t-curqty],In(5, c)) := Label([CurrentBatch],i),
          OpenOutput(in(5, c))
          
        )
      ) 
    ), 
    Do(
      {81: Variant 1}  
      if(
        and(
          content(in(10,c)) >= Label([CurrentBatch],i),
          content(in(11,c)) >= Label([CurrentBatch],i),
          content(in(12,c)) >= Label([CurrentBatch],i),
          content(in(13,c)) >= Label([CurrentBatch],i)
          
        ),
        Do(
          Label([t-curqty],In(10, c)) := Label([CurrentBatch],i),
          OpenOutput(in(10, c)),
          Label([t-curqty],In(11, c)) := Label([CurrentBatch],i),
          OpenOutput(in(11, c)),
          Label([t-curqty],In(12, c)) := Label([CurrentBatch],i),
          OpenOutput(in(12, c)),
          Label([t-curqty],In(13, c)) := Label([CurrentBatch],i),
          OpenOutput(in(13, c))
        )
      )
    )
  )
)
I hope this helps you a bit further to search what is going wrong.

Good luck,

Harry


P.S.

I saw some code on the initialize to close the output. An alternative is (in which I also reset the labels):

Code: Select all

do(
  Repeat(
    NrIc(c),
    Do( 
      CloseOutput(in(count, c)), 
      Label([t-curqty] , in(count, c)) := 0
    )
  )
)
Dominik1982
Posts: 13
Joined: Wednesday 13 May, 2015 - 13:04

Re: Modelling a multi variant pull system?

Post by Dominik1982 »

Hi Harry!

Currently I am working with your codes, more specifically I try to understand them and make ém work on my model. And yes I was looking forward to combine code and the chstate table to prevent an intense use of case statements.

But first of all I am wondering referring to this:
"You use dUniform in the Arrival List (Quantity). So this will create 5 orders to be created. Don't you want to use the dUniform to define how many parts you'll need of a certain type to create a product? I'm not entirely sure what your goal is here. But you might want to set this at the OnExit of the source. "

I thougt the QUANTITY column in the arrival list is used to determine the number of productvariants per order?! Is there any different possibility??

Thanky you Harry for your efforts.

Yours Dominik
User avatar
HarryBunnik
Posts: 362
Joined: Monday 07 February, 2011 - 11:22

Re: Modelling a multi variant pull system?

Post by HarryBunnik »

Ha Dominik,

The quantity used in the arrival list is to indicate how many time a product with the characteristics of the current row have to be produced.
Generates atoms based on a pre-defined list. In the list one can specify N records. The list can be repeated continually or with a specified repetitive time. Each record in the list contains an arrival time, a name, an arrival quantity and a channel through which they will be sent. At the specified time the specified number of atoms are created and given the specified name (for example an order number). The user can enter values as well as expressions for the arrival time and quantity.
So I think it is in your case, specifying the number of separate orders that are released. When you want to release one order, with a number of parts dUnifom 1 to 5, you'll have to place the code on the OnExit of the source and write it on the order:

Code: Select all

Label([Quantity], i) := dUniform(1,5)

Currently, you are producing dUniform 1 to 5 orders per line in the arrival list.

I hope this helps you.

Cheers,

Harry
Dominik1982
Posts: 13
Joined: Wednesday 13 May, 2015 - 13:04

Re: Modelling a multi variant pull system?

Post by Dominik1982 »

Hi Harry, Simon and everyone else!

I am almost done with my model.

Step 2 ist closed and working the way I want. It contains a deterministic order behavior and all of my productvariants can be produced by a batch size of quantity 1.

@Harry: Thanks for your Help. Your Hints and Considerations pushed my project further. Honestly I didn´t get it how to involve the table to realise the pull this way so I entered the code for every productvariant possible into the case statement.

But now I could need a little help again.

I am now working on step3, the last phase of my project.

What I want to to is to realise, based on step2-final, a stochastic order behavior.
This means, that for every order which is coming in, a random productvariant an a random quantity of the product can be requested. In one order only on variant can be requested.
For example:
Order 1,Variant: 6, Quantity: 4 (4 pieces of variant 6 are orderd in order 1)
.
.
.
Order 715, Variant: 41, Quantity: 2 (2 pieces of variant 41 are orderd in order 715)
and so on

In the model i added an information atom line, that creates the order informations. The Informations should be written into the table of the
arrival list. It works somehow but not exactly.

For example if an order is created in the information line, like [Order:1, Variant: 67, Quantity: 4], variant 67 is´t generated in this order and also the quantity isn´t correct.

Please give me some advice what to do.

The behavior of my model should be as follows:

An order is created, like: [Order:1, Variant: 67, Quantity: 4]
The information ist sent to the arrival list.
The arrival List atom opens the output and sets free 4 containers.
Eeach container stands for one product of variant 67.
The queue- process order also gtets the information from the order information line an opens only those queues which contain the parts for variant 67.
In this case i need the blankparts with the values 14 in IW-14, 22 in IW-22, 23 in IW-23 and 31 in IW-31.
The queues have to be opend, and closed after 4 blankparts of 14, 22, 23 and 31 have left the queue. (Every variant consist only of 4 different blankparts, maybe checking the bill of matierial in the assembler can help for better understanding.)

Enclosed you can find model step3-2.

I hope you can give me a further advice.

Thank you.

Yours Dominik
Attachments
step3-2.mod
(181.27 KiB) Downloaded 234 times
step2_final.mod
(175.71 KiB) Downloaded 237 times
User avatar
HarryBunnik
Posts: 362
Joined: Monday 07 February, 2011 - 11:22

Re: Modelling a multi variant pull system?

Post by HarryBunnik »

Ha Dominik,

I run into a few points.

First of all you use some global atom references, before you've actually created them. This causes a lot of error messages (327) when I open the model. It would be better to declare the references already on the first atom of your model on the OnInit (Table_Part_Data) and assign them on OnInit of the atom you want to refer to.

Secondly I see that you are defining on the OnCreationTrigger of the Source81 global variants that are of the type vbConstant. I would think they should be of the type vbValue, since you want to change them during time. And (if they are really needed globally) that you also already create them on the first atom in your model and only fill them on the OnCreation trigger.

I've adjusted this in the model that I've attached. Can you check if that helps with your problem?
step3-2 v01.mod
(180.78 KiB) Downloaded 256 times
Cheers,

Harry
Post Reply