two classes two stocks, two backorders

All topics on coding 4Dscript in Enterprise Dynamics.
Post Reply
deltroya
Posts: 21
Joined: Monday 26 December, 2011 - 15:11

two classes two stocks, two backorders

Post by deltroya »

Hello everyone (maybe special to Marvin),

For the sitaution, see please my last topic. It is going now about 2 producttypes, two queues and one machine. I want to store the average number of product in stock and the number of backorders.

We now that both products have a startstocklevel of 2 (see for this initiate table). thus S1 = 2 and S2 =2.

Now as a product of type 1 (Naam = 1) arrives, the number of stock decreases with 1, and if a product with Naam = 1 leaves the machine (and thus system) this wil increase the number of stock. Backordering is only possible if S is lower than zero, because then i will do the 'job, but in fact it is a backorder that i cant do right now, but it is for calculating the average backorder.

My question : the inlcuded file, is it programmed in the right way, because now I set naam = 1 and naam =2 , and for product1 i used the first row of the table and for producttype 2 the second row. Only by the machine, my script has an extra dimension, because now he has to look with product he has. Is it programmed well and if not, wat can i do with it or do you have a good suggestion?
Attachments
try5.mod
(33 KiB) Downloaded 287 times
MarvinH
Posts: 93
Joined: Tuesday 25 January, 2011 - 11:07
Contact:

Re: two classes two stocks, two backorders

Post by MarvinH »

Hello again!

As I am familiar with the previous models already, I will try to help you with this thread as well! :)
deltroya wrote:is it programmed in the right way, because now I set naam = 1 and naam =2 , and for product1 i used the first row of the table and for producttype 2 the second row.
You have modelled the arrivals of products correctly!
deltroya wrote:Only by the machine, my script has an extra dimension, because now he has to look with product he has. Is it programmed well and if not, wat can i do with it or do you have a good suggestion?
On the server, your code is working correctly, however it is possible to order your code even easier. As you mentioned before, the products have a label with either value 1 or 2. As you want to change the data or row 1 for product 1 and row 2 for product 2, you can use the label as row reference. So, for example:

Code: Select all

Cell(Label([Naam], i), 4, Refuitvoertabel) := Time
Finally, I noticed that there was still a small error in your model which I did not detect before. As you determine your averages based on the "corrected" stock levels, you should initialize these cells as well. So when the stock is set in column 1 in the Initialize atom, the values in columns 2 and 3 should be initialized as well!

Good luck!
deltroya
Posts: 21
Joined: Monday 26 December, 2011 - 15:11

Re: two classes two stocks, two backorders

Post by deltroya »

thank you, marvin. How do you exactly mean the inititialize part? because all other values should be equal to zero in the beginning instead of S1 and S2 of course, or is that what you mean? Otherwise, how should I inititiate them?
MarvinH
Posts: 93
Joined: Tuesday 25 January, 2011 - 11:07
Contact:

Re: two classes two stocks, two backorders

Post by MarvinH »

For your calculation of the average stock, you are using the "corrected" stock, i.e. the value in column 2. However, initially the value in column 2 should be set to Max( 0, Cell(1, 1, Refuitvoertabel) ) as well, just as on a "regular" change of the stock. In case you do not do this (as in your current model), the average stock over the first period (until the first product arrives) equals 0, which is not true because the stock is initialized on a value larger than zero. Note that the same holds for the average backorders.
Post Reply