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
FAQ Downloads Calendar Search Mark Forums Read

Q&A Using Flexsim and building models

Reply
 
Thread Tools Display Modes
  #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?p=14075.

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
Reply With Quote
  #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: 680
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()
Reply With Quote
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
Reply With Quote
  #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: 769
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.
Reply With Quote
The Following 2 Users Say Thank You to Jason Lightfoot For This Useful Post:
Axel Kohonen (07-21-2015), 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.
Reply With Quote
  #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
Reply With Quote
The Following User Says Thank You to Axel Kohonen For This Useful Post:
Jörg Vogel (08-07-2015)
Reply

Tags
queue, send to port, timing

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
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. The time now is 05:06 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.