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 |
|
Downloads |
Q&A Using Flexsim and building models |
#1
|
|||
|
|||
How to set the process of two itemtypes by the MultiProcessor
There are two itemtypes. And their process time are different by exponential distribution. I set "Case By Value" and the code is
---------------------------------------------------------------- treenode current = ownerobject(c); treenode item = parnode(1) int value = getitemtype(item) switch(value) { case 1: return exponential(0,50,1); case 2: return exponential(0,100,1); default: return 0; } ------------------------------------------------------------------ Do I need to add "break" to each case? |
#2
|
|||
|
|||
Hi,
You may not need to use break, because you have return i the case statement. But I would suggest that you use break. The reason to that it is easy to get in to habit not use it and when you at a another time write code that requires break there is a risk that you forget to use break and your code will not work as you expect it to do. I would write the switch like this: Code:
switch(value) {case 1: return exponential(0,50,1); break; case 2: return exponential(0,100,1); break default: return 0;} |
#4
|
||||
|
||||
different item types.
While using the case by value, is there any way that I can run item 1 for say 10 hours or 1000 parts and then switch to run item 2 for 20 hours or 2500 parts.
Thanks Mohan |
#5
|
|||
|
|||
Hello Mohan,
You could use one source and on the OnCreation trigger make a distinction. If you look at the custom code you could define newtype as: double newtype = 1; if( getoutput( current ) > 1000 ) { newtype = 2; } This way the first 1000 will be type 1 and after that type 2 will be generated. If you want to make a change after 10 h you could use the following if statement: if( time() > 36000 ) Hope this will help you. Esther |
#6
|
||||
|
||||
Just one side note from me here.
If you use statements like time() > 36000 in discrete event simulation you should be aware of the fact, that if no event happens at this point in time the code will not be evaluated. If the next event e.g. happens at 37000 the condition will become true the first time at simulation time 37000. To be save I would use a User Event at 36000 because this is an event. In your describe task I guess everything is fine, because there will be an event when the next item gets created which will get the new type. So in this sense it does not matter if this item arrives at 36000 or 37000 because the type will be the new type. But I thought it is good for everybody to be aware of it.
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions." |
The Following 3 Users Say Thank You to Tom David For This Useful Post: | ||
zhang xin (11-06-2009) |
#7
|
|||
|
|||
taskexecuter deciding process times
Is there a way that the taskexecuter decide the process time on a multiprocessor. I am modeling an ED on standard flexsim and I want to show a junior doctor and a senior doctor. Multiprocessor acts as a BED on which various processes related to treatment can be modeled. Out of these their is a process that a doctor has to perform. Now I want to model that if a junior doc comes he takes more time doing so than senior doc. The Bed can get either of these randomly or on basis of availability.. Any suggestions ?
|
#8
|
||||
|
||||
first we should know, are the doctors flowitems ot taskexekuters?
If doctors are flowitems, then you can use cases by value in the process time. if you use taskexecuters as doctors then it is not easy anymore. The multiprocessor has to know which doctor is arriving. Therefore you write your own utilize tasksequence to call a taskexecuter to the multiprocessor. To get the tasktypes of such tasksequence execute the command profiletasksequence(..) on a taskexecuter when he is in support process on a processor. Write your own tasksequence in the pick operator code field. That tasquence should contain quite at the begining a sendmessage task with the parameter involved1 as reference to the processor (current) and involved2 as NULL. Now on message the multiprocessor receives with the command msgsendingobject the information which taskexecuter arrives and change a label of the experience of the doctor. But there is a small but. The first processtime is for the mutltiprocessor the same time for the two doctor types. Maybe you choose this time very small. Jörg |
#9
|
|||
|
|||
Hi everyone,
I want to create two type of product in one source, so for example after 100 outputs of product 1, it will be delayed for 15 mins and source will create product 2. And after 100 outputs of product 2, it will be delayed for 15 mins then source will create product 1 again and so on. Like it alternating two types of product in batches of 100. Can I use switch code to for that? double producttype = 1; if( getoutput( current ) > 100 ) { producttype = 2; } |
#10
|
||||
|
||||
Hello Rahel,
You choose the Arrival schedule from the source then add that delay time in the arrival time.In the schedule table you set the quantity of items and check the box Repeat schedule.This way the sequence will repeat itself until the model runtime is completed. |
#12
|
|||
|
|||
Hallo Hendry and Sagar,
Thanks for responding. @Hendry: From the sample model that you made, the source creates 100 boxes at once and wait for 900 seconds (15 mins) to produce the other products (and so on). But what I want to create is source only creates only 1 box at once. Until it produces 100 boxes, then it will stop the output for 15 mins (break time). After that "break time", source creates the other type of product and the rules are the same. Can you guys please help me? Thanks. Rahel |
#13
|
||||
|
||||
Hello Rahel,
If you want to create only one item at one time then you have to use interarrival time mode.It is the time between exit of one item and arrival of next item.You want to stop the source from producing the items for a certain amount of time and again resume the production. Place a Queue before the source , send a delayed message to itself for the delay of 15 min and then in the OnMessage trigger openoutput on message.Probably you want to write multiple if/else if statement somewhere to change the itemtype for the corresponding output. Last edited by sagar bolisetti; 07-22-2015 at 02:53 AM. Reason: attach sample model |
The Following User Says Thank You to sagar bolisetti For This Useful Post: | ||
Rahel Carolina (07-22-2015) |
Thread | Thread Starter | Forum | Replies | Last Post |
Picking process | Simon Farsah | Q&A | 9 | 03-23-2015 06:55 AM |
Can a combiner process multi items simultaneously? | KelvinHo | Q&A | 6 | 11-08-2010 11:29 AM |
Multiprocessor Frames | Simon Riopel | Q&A | 3 | 09-09-2008 01:19 AM |
Operator dependent process times | Unregistered | Pre-sales Questions | 7 | 05-23-2008 03:01 PM |
stopping the MultiProcessor | Pablo Concha | Q&A | 4 | 10-31-2007 07:34 PM |