Cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Skip not yet produced variants in delivery table when day changes

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello,

 

attached is the example without the generator, you can achieve the same behavior by recursively calling the method that was involved in the generator with methCall and the time that has to pass for it to get executed (here 86400 for one day). If I am not wrong there is still a periodicity in your table of 6 parts per day which has also been accounted for in the model.

Kind regards,

Igor
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution


Re: Skip not yet produced variants in delivery table when day changes

Pioneer
Pioneer

@IgorKunjavskij Thank you for your ExampleModel.

However, I understand the solution from @MarcusA better.

But I'm struggling to call the method every new day :/

Re: Skip not yet produced variants in delivery table when day changes

Siemens Phenom Siemens Phenom
Siemens Phenom

If you want to execute a method after a period of 24 hours has passed after this method has been called you can use 

&method_name.methCall(86400,Parameter1,Parameter2...)

So you can have an init method make this call and afterwards have the method that was called repeat this call at the end of its execution so that it gets called recursively at the beginning of every day.

Kind regards,

Igor
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution


Re: Skip not yet produced variants in delivery table when day changes

Pioneer
Pioneer

wow, it works now! A really big thank you to you guys!!!

 

To put everything together, How I got it working:

 

method init:

Prod_Sequence.deleteContents
Backup_Table.copyRangeTo({1,0}..{*,*}, Prod_Sequence, 1,0)
&NewDelivery.executeIn(86400)

method NewDelivery:

var DaysPassed : real
DaysPassed:=eventcontroller.SimTime/1:00:00:00
if Source_ZV.occupied
	Source_ZV.cont.delete
end
if Source_RSW.occupied
	Source_RSW.cont.delete
end

for var Row := 1 to Prod_Sequence.YDim --Go through whole table
if Prod_Sequence[1,Row] < DaysPassed --Reduce number of MU if they are created before SimTime
Prod_Sequence[3,Row] := 0
else
exitloop 1 --When all rows are reduced, exit the method
end
next
&NewDelivery.executeIn(86400)

I am really amazed by your effort!

@MarcusA Your cold caused a few errors but I managed to solve it Smiley Wink. Get well very soon!