More than 1 item created at time 0?

More than 1 item created at time 0?

2101990
Participant Participant
58 Views
7 Replies
Message 1 of 8

More than 1 item created at time 0?

2101990
Participant
Participant

[ FlexSim 23.1.2 ]

1698733906918.png

I have a source which does batch creation. But I would like for the program to start with 3 arrivals at time 0 instead of 1, is this possible?

0 Likes
Accepted solutions (1)
59 Views
7 Replies
Replies (7)
Message 2 of 8

joerg_vogel_HsH
Mentor
Mentor

You can use an event conditionally to create 2 more items. This is a user defined logic. You can build it in process flow by a scheduled source activity and a create object activity. Or you do it by source code in an On Creation event in a source object by a command createobject. I suggest you take a look into the manual reference section for coding to find more needed commands, properties and methods.

0 Likes
Message 3 of 8

2101990
Participant
Participant

I would like to add it to my source code, but my on creation event already has a code in place. How do i add to it? At the same time there isn't a createobject command. 1698740203647.pngI was thinking of using a for loop
but I am unsure what to input on the inside of the for loop, could you advice the coding for that?

  1. for(int i = 1; i <= 3; i++)
  2. {
  3. }
0 Likes
Message 4 of 8

joerg_vogel_HsH
Mentor
Mentor

I think you should find a proper command or method yourself. Typically you need a function with a phrase of copy, create or insert. You find them in Flexscript Class or Command Reference. Learning works with a standard method called bottom up.

0 Likes
Message 5 of 8

chanykE2WUT
Explorer
Explorer

@night use three source.

David

Message 6 of 8

jason_lightfootVL7B4
Autodesk
Autodesk
Accepted solution

The batch trigger doesn't work when you have Arrival at time 0 checked. You can see from its code that it explicitly checks that the time is not zero. I would instead use a regular interarrival time and create item duplicates on the OnCreation trigger. This prevents creating multiple events at the source which you may/not want.

0 Likes
Message 7 of 8

jason_lightfootVL7B4
Autodesk
Autodesk
This can't be correct - you'll be using 3 objects, each sampling different arrival times - maybe I've misunderstood your answer. As a general concept it's not a good idea either - as you will have 3 objects you need to manage and even if you use templates to do that for you, you still have 3 objects for statistics and 3 objects creating events to which you might want to listen.
0 Likes
Message 8 of 8

jason_lightfootVL7B4
Autodesk
Autodesk

Hi @night, was one of David Chan's or Jason Lightfoot's or Joerg Vogel's answers helpful? If so, please click the "Accept" button at the bottom of the one that best answers your question. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes