question

night avatar image
0 Likes"
night asked Jason Lightfoot commented

More than 1 item created at time 0?

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?

FlexSim 23.1.2
sourcesource control
1698733906918.png (16.8 KiB)
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jason Lightfoot avatar image Jason Lightfoot ♦♦ commented ·

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 0 ·
Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered

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.

5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

David Chan avatar image
1 Like"
David Chan answered Jason Lightfoot commented

@night use three source.

David

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jason Lightfoot avatar image Jason Lightfoot ♦♦ commented ·
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 0 ·
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Joerg Vogel commented

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.

· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

night avatar image night commented ·

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 0 ·
1698740203647.png (75.2 KiB)
Joerg Vogel avatar image Joerg Vogel night commented ·

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 0 ·