ATTENTION

This FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices.


flexsim.com

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 07-17-2015
Axel Kohonen
Guest
 
Posts: n/a
Downloads: 22
Uploads: 0
Default Best way to send to the right port when also needing to take timing into account?

Hi, I am building a model where the flowitems are sent from a queue to multiple processors. Each flowitem has a label that says which processors it should go to and another one that has the time of the earliest allowable entry into that processor. In addition to this there is a general time limit that no flowitems may enter the processors before 7.45am on any given day.

I managed to build a model that uses send to port with the reevaluate on downstream availability checkbox ticked that send the flowitems to the right ports. However, when I try to add the timing I run into problems and do not know what to do.

Currently the model closes the queue output in the first iteration of send to port if the time has not passed 7.45am. The queue sends a message to itself that arrives at 7.45am which opens the output of the queue again. This works fine for all the flowitems that are allowed to enter at 7.45am. The problem is that the opening of the output triggers the send to port for all flowitems in the queue, which lets also items pass to ready output ports even if the earliest allowable time to enter the processor has not come for all flowitems yet. I tried to close the output of the queue and the input of the processors for the items that should not be allowed to be processed yet, but it does not work. Then I read that Jörg Vogel wrote “The Send To function expects, before releasing an item, that the input port is already available.” in this post https://healthcare.flexsim.com/commu...ad.php?t=3057.

What should I do to bypass this problem? I guess that sending a delayed message to self would work, but how do I get the flowitems to not leave the queue too early then? Passing -1 to the send to port makes it hard to resume action after the delay and I do not have a port that I am sure that is busy that I could send the item to make it reevaluate the send to port later.

Thank you!

Kind regards,
Axel
  #2  
Old 07-17-2015
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

Isn't it easier to use the pull mechanisme on the processors and just pull those items with the right labels and the right time? you can ask the time when an item entered the queue with getentrytime()
The Following User Says Thank You to Steven Hamoen For This Useful Post:
Axel Kohonen (07-21-2015)
  #3  
Old 07-17-2015
Axel Kohonen
Guest
 
Posts: n/a
Downloads: 22
Uploads: 0
Default

Hi Steven,

Thank you for your input! I first tried to do this, but noticed that since I have one queue but 16 processors the PullRequirement logic was executed very many times and made the simulation much slower (according to my quick profiling) than it is with the push that only needs to run once for each flowitem instead of each processor checking if each flowitem matches the requirement. Do you think this could become a problem as the amount of data increases?

But you might be right, it is possibly easier and maybe not that slow to use the pull requirement if I manage to make it work as I planned. Thanks!

Axel
  #4  
Old 07-17-2015
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

You could try scheduling each item's release when it enters the queue too early for the next process. Send a delayed message with the item as msgsendingobject (and maybe the port as msgparam(1) - see below) and return -1 to hold the item. Then in the message trigger use releaseitem(msgsendingobject) or releaseitem(msgsendingobject, <port>) if you don't want the sendtoport to fireagain.
The Following 2 Users Say Thank You to Jason Lightfoot For This Useful Post:
hendry teo (07-18-2015)
  #5  
Old 07-17-2015
Axel Kohonen
Guest
 
Posts: n/a
Downloads: 22
Uploads: 0
Default

Hi Jason,

Thank you! Your option sounds good as well. I managed to get the model working with the pull requirement in the meantime although it possibly is a bit slower. Partly though since I have not made my pull requirement as efficient as possible yet. Just a few improvements like not calling functions that have a static return during the execution of the program helped the execution time a lot already.

Will try your method if the pull seems to slow.
  #6  
Old 08-07-2015
Axel Kohonen
Guest
 
Posts: n/a
Downloads: 22
Uploads: 0
Default

Hi,

I finally changed my model to use the method outlined by Jason above as it made the model much easier to understand than when using the pull requirement (at least in my case). This means that I let sendToPort return -1 onEntry and send a message to release the item after the given delay has elapsed. But I had to use releaseitem with the port number, otherwise the port is still marked as -1 and the item does not exit although it is released. Since I did not use the port at first I did not get it to work when I first tried.

I found this solution and a few others to the same problem in the "Simple question"-thread found at: https://www.flexsim.com/community/fo...+thread&page=2

I used the solution described by Lars-Olof Leven as it seemed most simple to me.

Axel
The Following User Says Thank You to Axel Kohonen For This Useful Post:
Jörg Vogel (08-07-2015)

Tags
queue, send to port, timing


Thread Thread Starter Forum Replies Last Post
Send to Port By Percentage Herwina Richelle Andres Flexsim Student Forum 6 03-17-2015 09:58 PM
FlexTips: Send To Port By Label Markus Cueva FlexSim Media 0 09-09-2013 03:19 PM
FlexTips: Send To Port By Expression Markus Cueva FlexSim Media 0 09-05-2013 10:02 AM
Send To Port Liang Wen Yin Q&A 2 08-11-2012 03:20 AM
Problem with Send to Output Port Joe Allen Q&A 3 05-14-2009 02:38 PM


All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.