ATTENTIONThis 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 |
#1
|
|||
|
|||
A simple question about “block”
In my model source1 generate two kind of itemtype, then send to Queue1.
Source2 also generate two kind of itemtype but send to two different Queues: Itemtype1 send to Queue2 Itemtype2 send to Queue3. I want to write the logic is: If flowitems in Queue2 > 5 , Queue1’s port1 will block (at the same time, if Queue3 < 5 , Queue1 ‘s port2 still open.) If flowitems in Queue3 > 5 , Queue1’s port2 will block (at the same time, if Queue2 < 5 , Queue1 ‘s port1 still open.) I’ve tried to write the logic in Queue1’s trigger of “flow”, but I failed. Thank's for your help in advance. I uploaded the model. Last edited by Vic Li; 08-10-2009 at 01:14 AM. |
#2
|
||||
|
||||
Please have a look into the following thread which I found by searching the forum with the words 'close' and 'port':
http://www.flexsim.com/community/for...ead.php?t=1001 I guess, here you already get some help and hints.
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions." |
The Following User Says Thank You to Tom David For This Useful Post: | ||
Scott Mackay (10-08-2009) |
#3
|
|||
|
|||
Thanks Tom
In fact, I’ve already checked this~ I tried to do accord those method, but It seems doesn’t work ~ I really feel confused for a long time. Could you help me do a example? Thanks. |
#4
|
||||
|
||||
Vic Li,
As Brandon says it would be nice if you would fill out the "about me" section of your profile so that we could know who we are helping out I had a look into your model and would solve it in a total different way using more Flexsim Standard. I included two more queues in your model (behind Queue1). These Queues I control at the trigger on exit at Queue2 and Queue3. That’s in my eyes the simplest solution. It might be worse to think about if the on entry trigger might be better than the on exit trigger, depending on the real world situation. Because of the two queues there is a capacity increase at Queue1, so this should be taken into account if you want to examine the capacity for this queue. When I was writing my reply another idea came to my mind. If you do not want to use additional queues, you could use the Pull requirement on Processor 1 in combination with a label and by expression. I built this idea also into the model as Queue11 and Processor11. Anyway, have a look into the model and I hope it helps you with your task.
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions." |
The Following 2 Users Say Thank You to Tom David For This Useful Post: | ||
Vic Li (08-11-2009) |
#5
|
|||
|
|||
Quote:
But I still find some problem. About your first idea (increase two new Queues in the model) In your model, if Queue2’s content < = 5, ControlQueueA will open its input. The problem is when the itemtype waiting for processing in ControlQueueA , at the same time, Queue2’s content increase to bigger than 5. In the situation, the itemtype shouldn’t get into Processor1, but in your model it did. (this also happen in ControlQueueB) And about your second idea. I find it’s almost don’t follow the logic. The itemtype (1 or 2 ) will get into Processor11 when Content (Queue2 or Queue3) > 5 . I think I prefer the second idea, but it seems have much big problem. @@ |
#6
|
||||
|
||||
Vic,
It is really hard to know what the Queues are sending to based on your description and the lack of a sample model. I have assumed that Queue 1 is sending to 1 of 2 processors based on the item type and that Queue 2 sends to the first processor and Queue 3 sends to the second. With this in mind it is easier to control the flow of the items with the pull logic of the processors than it is to block specific ports based on the send to logic. I have included a sample model that uses the pull requirement on the processors to to just this. This would also work for a model set up like Tom's. You would just need to use a center port connection instead of the input connection to check for the content. You can use the send to port field to do this but it is much harder and you have to use the reevaluate send to. Good Luck, Brandon
__________________
thats not normal. |
The Following User Says Thank You to Brandon Peterson For This Useful Post: | ||
Vic Li (08-12-2009) |
#7
|
|||
|
|||
Quote:
I believe pull requirement can be a good idea than ”send to port” After some test, I still failed in my logic~ Could you try to build a model just follow my original model~ Thank you so much. Vic |
#8
|
||||
|
||||
Vic,
Your original model makes no sense to me. Why would you want to block either of two ports that go to the same processor? You don't have any code that would designate that particular item types go through one port of the other. The bottom line is that if I were to block one of the ports it wouldn't matter because any and all flowitems would just go through the other port. I modified your model to cover the two possible scenarios that I could think of. The processor attached to Queue 1a on the top will pull any item as long as one of Queue 2 or Queue 3 have a content <= 5. The processor attached to Queue 1b on the bottom will pull only items that have an itemtype that does not have a content > 5 in either Queue 2 or Queue 3. So, if Queue 2 is > 5 then it won't pull item types 1 any more and if Queue 3 is > 5 then it won't pull item types 2 any more. Hopefully this answers the queustion you had. Good Luck, Brandon
__________________
thats not normal. |
The Following User Says Thank You to Brandon Peterson For This Useful Post: | ||
Scott Mackay (10-08-2009) |
#9
|
|||
|
|||
Quote:
I've used the model you attached to solve my problem. according to your model, I build another model. in my model, if Queue4's content > 0 , Combiner2 will pull itemtype1; if Queue5's content > 0, Combiner2 will pull itemtype2. and the pull logic is " the longest waiting". I 've built the model, but not perfectly.Sometimes when Queue4's content not equal to zero, combiner2 still won't pull itemtype1.the same situation happened in Queue5's content. In addition, why the Queue2's content up to its max size (10), the combiner2 won't pull anything no longer. why? |
#10
|
|||
|
|||
Vic
I think you have the code in the pull rule confused with what Brandon did for you before. Brandon's code was just opening or closing the input to the Processors depending on the content of the speicifed queues. What you need to do is specify which item type to pull out of the queue depending on the content of the other queues. You also need to get the pull rule to refresh whenever a part arrives in the queues so I am sending a message to the combiner that refreshes the pull rule by opening the input of the combiner again. Please have a look at the attached model. I am not an expert like Brandon but I think this should help you on your way. Anthony |
The Following User Says Thank You to Anthony Timmiss For This Useful Post: | ||
Vic Li (08-26-2009) |
#11
|
||||
|
||||
Vic, Anthony,
Anthony did a very good job of modifying the model to do what you wanted. I would like to explain a few things about the way things work in Flexsim and show you a few things that would make this example a little more simple to set up and faser to execute. In this model speed is not a factor but I want to address it so that you will be aware of it later on. First, lets look at the way the Pull Requirement gets fired. The pull requirement is only fired for items that are in the object connected to the port that the combiner is pulling from. When the combiner first decides to pull from a port (On Exit of the items inside of it, or when openinput is called on it) it will fire the pull requirement for all of the items in the object that have been released (are ready to exit). If the Combiner did not have anything to pull and is waiting to pull an item. Then when new items are released from that object the pull requirement is only fired for that item. If you have the Reevaluate box checked then it is fired for all of the items that have been released. In our situation this is unnecssary so we should uncheck the reevaluate box so that we are not executing unnecessary code (which would slow the model down). Second, the reason we need to have the Combiner open its input each time an item enters Queue4 and Queue5 is a concequence of the way the pull requirement gets fired. Assume that we have at least one item of each item type in Queue2 but we don't have any items in Queue4 or Queue5. The pull requirement will not get fired when an item enters Queue4 or Queue5 because the Combiner is trying to Pull from Queue2. Because of this if an item did enter Queue4 or Queue5 we would have to wait until another item entered into Queue2 before the pull requirement would be fired and an item would enter the Combiner from Queue2 (We would also need to have the Reevaluate box checked). In order to avoid this delay we need to open the input of the Combiner when an item enters Queue4 or Queue5. Third, In order to simplify the building of the model I would not recommend using the center port connections in this model because there was already a direct connection to the objects through the input/output ports. I only use center port connections when the objects are not connected directly though a input/output port. Fourth, the number of events created in a model is one of the big factors in how fast a model will run. Currently when an item enters Queue4 or Queue5 we send a delayed message (this creates a new event) to the combiner to open its input. Because the pull requirement will be looking at Queue2 and not at the queue the item entered this is an unecessary step. It is more simple and it would execute faster to have the following code in the Entry Trigger of Queue4 and Queue5: openinput(outobject(current, 1)); Fifth, because the pull requirement is only necessary when we are looking at Queue2 and the code retrieves values from nodes it will speed up the trigger to include the following line of code at the start of the trigger: if(port != 1) return 1; Sixth, you should always return a value from a trigger that is expecting a value. In the code that is in the model there is the posibility that both queues will not have any content. This would result in the code being able to execute past the second if statement. As a rule of thumb it is wise to end triggers like this with the following line of code so that you know that you are always returning a value: return 0; Thanks again Anthony and I hope that this helped, Brandon
__________________
thats not normal. |
The Following 2 Users Say Thank You to Brandon Peterson For This Useful Post: | ||
Tom David (08-28-2009) |
Thread | Thread Starter | Forum | Replies | Last Post |
The "Simple Question" Thread | Xavier Jackson | Q&A | 202 | 08-10-2009 09:44 AM |
block a source ? | juan alberto | Q&A | 4 | 07-13-2009 02:50 AM |
simple pallet question (i think) | bsantens | Q&A | 2 | 03-23-2009 11:39 AM |
simple question about "Separator" | Vic Li | Q&A | 5 | 01-14-2009 09:45 PM |
simple question for operators | Kang Han | Q&A | 1 | 10-23-2008 08:35 AM |