question

Pieter Cecat avatar image
0 Likes"
Pieter Cecat asked Steven Hamoen commented

Custom source release quantity

I want to control the release quantities at the source. To do this I defined a global lookup table. Depending on the month, as well as scenario, a different quantity should be released. I know how to code this. The problem however is that the open/close output commands don't seem to work on a source.

How can I make sure the correct 'quantity' is released as some sort of release schedule at predefined times (monthly)? I have used the "Quantity" label in my triggers, as I thought it would refer to the label of my release schedule, but it created a label instead of defining the Quantity for my arrivals...

FlexSim 16.0.8
sourcesource schedule
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Steven Hamoen avatar image
0 Likes"
Steven Hamoen answered Steven Hamoen commented

@Pieter Cecat Can you post a small model to show what you are exactly doing? And why don't you use the Arrival Schedule option on the source? Then you can define exactly when and how much you want to release. And when you want to use different amounts or times you can copy them in or on reset copy a table or even read it in from Excel on reset..

· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Pieter Cecat avatar image Pieter Cecat commented ·

test.fsm

Hi @steven.hamoen

I attached an example model. Only difference is that the table with "Grading Scenario History" changes in my actual model (but the solution procedure should be similar for when its fixed) which is why the release quantities at the source are variable.

0 Likes 0 ·
test.fsm (19.7 KiB)
Steven Hamoen avatar image Steven Hamoen Pieter Cecat commented ·

@Pieter Cecat A few remarks:

First your "OR" function is not correct. You write:

if(getlabel(current,"Month") == 1 || 2 )

That should be:

if(getlabel(current,"Month") == 1 || getlabel(current,"Month") == 2 )

Further more you start the month label at 1. This means the first time you enter the code the month label is 2 and you look in the tabel external supply at column 2. But there are all 0 in there so there is never a batchsize set > 0

The 3rd point is that you open and close ports but you never generate flowitems. You expect the source to do that but on the arrival schedule your quantity is 0 everywhere.

So there are 2 ways to solve it. The fastest and easiest is by changing the arrival style back to Inter-Arrival Time and have an Inter-Arrival time of 0. That way the flowitems are generated immediately and everytime you open the output products come out.

Other option would be to generate the complete arrival schedule on reset. You can set the quantities on every line of the table. Example code would be:

treenode schedule = getvarnode(current,"schedule");
settablenum( schedule, 1,4, 10);

0 Likes 0 ·