Seeking assistance with Process Flow logic using GlobalTable

Seeking assistance with Process Flow logic using GlobalTable

kentaro_banABGLD
Advocate Advocate
906 Views
14 Replies
Message 1 of 15

Seeking assistance with Process Flow logic using GlobalTable

kentaro_banABGLD
Advocate
Advocate

I am developing a model using a Process Flow that references a Global Table named "GlobalTable1." I previously approached this without Process Flow, but I am now transitioning to a Process Flow-based approach.

Model Logic: The simulation should follow this sequence for each row (starting from "Row 1"):

  1. Calculate the ChangeoverTime.

  2. Process 1 unit with a duration of ProcessTime, repeated for the amount specified in Quantity.

  3. Move to the next row and repeat the same steps (calculate ChangeoverTime, then process Quantity).

Questions:

  1. Error in Label Reference (ChangeoverTime): In the Schedule Source, I attempted to create a label to reference the ChangeoverTime using Table("GlobalTable1")[Row][4], but it triggers an error. Could you point out the mistake?

  2. Error in Label Reference (Quantity): In the "Create Object" activity, I used Table("GlobalTable1")[Row][2] to reference the Quantity column, but this also results in an error. What is the correct syntax?

  3. Timer Logic: I am unsure what expression to enter for the timer, or if a timer activity is even necessary for this logic.

Postscript: Even if these errors are resolved, I am concerned about whether the simulation will function correctly. I find it difficult to keep track of labels as they are scattered throughout the model. Despite reading the help pages, I still don't fully grasp how labels work and have been relying on intuition. Any guidance would be greatly appreciated.

0 Likes
Accepted solutions (2)
907 Views
14 Replies
Replies (14)
Message 2 of 15

FelixMoehlmann
Collaborator
Collaborator

The first three columns of the schedule table in the Schedule Source have fixed meanings: Time the token(s) are created, Name of the token, Quantity of tokens to create for that row. You can add further columns that will assign their values as labels to the tokens by increasing the "Label" count above the table. Essentially you would copy the global table to the source table, skipping the first column of the source table. Alternatively, you create as many tokens are there are rows in the global table and then assign the values as labels (see attached model).

Your syntax is correct but "row" is not a defined variable in either activity. To see what variables are available in any given edit field, open the code editor and look at what gets defined in the header rows. The example screenshot below shows the header of the "Quantity" field in the source table. The "rowNumber" variable refers to the row in the schedule table.

Screenshot 2026-05-08 115040.png

Labels are information stored on objects. There are three important characteristics:

- What object the label is stored on. To read the label value you must start from a reference to this object.

- The name of the label.

- The value of the label.

https://docs.flexsim.com/en/26.0/Reference/CodingInFlexSim/WritingLogic/WritingLogic.html

https://docs.flexsim.com/en/26.0/Reference/CodingInFlexSim/BasicModelingFunctions/BasicModelingFunct...

If the purpose of the Process Flow is to replace the 3D Source then I don't know why a timer would be necessary.

0 Likes
Message 3 of 15

kentaro_banABGLD
Advocate
Advocate

Thank you very much for your continued support. I have reviewed the simulation, and it is now behaving exactly as I intended. I also realized my misunderstanding regarding the timer; I was attempting to use "ChangeoverTime" as a delay, so please apologize for my previous comment on that.

However, there are several points I am still struggling to understand. I would appreciate it if you could clarify the following questions:

1. Global Table Calculation The value in Row 1 of "ChangeoverTime" in "GlobalTable1" was not being applied. While I know this can be fixed by entering 10800(s) in the Offset Time or by using a Time Table, I would prefer to handle this within the Global Table if possible. Is there a way to resolve this inside the table?

2. Quantity Logic In the Quantity field, you used the expression: Table("GlobalTable1").numRows. Does this mean that since there are 14 rows, the simulation is defining 14 different colors for the flow items accordingly?

3. Token Visibility Since the model is currently simple, I don't necessarily need to track every token, but I would like to know for my future reference: even though I entered the "numRows" expression in the Quantity field, why don't I see the green circles (tokens) appearing in the Process Flow?

4. CSV Import via Script I executed a script to reference a CSV file, but the Global Table did not update. It worked correctly in the "Sample2.fsm" file I initially attached. Did anything change in the logic? I have attached the CSV file I am referencing for your review.

5. Clarification on Previous Advice I couldn't quite grasp the following part of your previous answer: "Essentially you would copy the global table to the source table, skipping the first column of the source table. Alternatively, you create as many tokens are there are rows in the global table and then assign the values as labels." Could you please explain this in more detail?

6. Code vs. Auto-generation As I am not very familiar with coding, I have a question about the snippets in your screenshots (such as param(1), param(2)). Was this code manually typed in, or was it automatically generated by the software after you entered label names and values in the GUI?

7. Understanding "param" References Regarding the code "Object current = param(1);", I understand the syntax, but I don't know what the "param(1)" actually refers to. Is there a reference table or documentation that explains what these parameters point to depending on the context? Or is it something I need to learn by looking at existing scripts?

I apologize for the many questions, and I appreciate your patience and help.

0 Likes
Message 4 of 15

kentaro_banABGLD
Advocate
Advocate

Thank you for your continuous support. I have a more complex logic requirement that is critical for my client. I need to determine if FlexSim can handle the following scenario without manually updating Time Tables or CSV files.

1. Dynamic Changeover Logic (Avoiding Fixed Time Tables) I need to control the "ChangeoverTime" start based on when the previous process finishes.

  • Scenario A: If a process ends at 23:00 (outside working hours), the Changeover should NOT start immediately. It must wait and start at 08:30 the next morning when staff are available. I want to "pause" the logic for that specific processor during non-working hours.

  • Scenario B: However, if a process ends at 17:00 and the Changeover finishes by 20:00, the machine should then continue to run through the night (23:00 - 08:30) without stopping.

The Goal: Can I implement a logic where the simulation automatically decides whether to wait for the next morning or keep running, based on the process completion time, using the Global Table rather than a Time Table? I am open to using Task Executers if necessary. Since the machine itself can run unattended but the Changeover requires a human, a simple "Off-duty" schedule for the machine doesn't work.

2. Dashboard Issue (BatchID not displaying) I noticed a bug in my Dashboard Table Chart. The "BatchID" column has stopped appearing. It is supposed to show values from 1-A to 14-N. What steps should I take to make these IDs visible in the table chart again?

I understand this is a complex request, but it is a vital part of our project. Any guidance would be greatly appreciated.

0 Likes
Message 5 of 15

kentaro_banABGLD
Advocate
Advocate

I would like to provide some additional details regarding my previous post.

I am assuming the working hours are from 8:30:00 to 17:30:00.

Operational Logic:

  • If the completion time (the time when the processor stops + the ChangeoverTime from the Global Table) falls between 8:30:00 and 17:30:00, the processor should continue to run until the changeover is finished, even if it exceeds the scheduled shift end.

  • Conversely, if the completion time does not fall within the 8:30:00 to 17:30:00 window, the processor must be forced to stop.

Handling Long Changeovers: In cases where the ChangeoverTime is extremely long (for example, 51 hours in Row 11), it will not be completed within a single shift. Therefore, the ChangeoverTime must be split across shifts. It is essential to implement forced stops during the non-working periods (from 17:30:00 to 8:30:00 the following morning). Otherwise, the calculation for the ChangeoverTime duration will be incorrect.

0 Likes
Message 6 of 15

FelixMoehlmann
Collaborator
Collaborator

Questions/Clarifications:

1) Open the code editor for the Setup Time option on the processor and change the value that gets assigned in line 15 to something that is not a valid type. This will make the changeover time also apply to the first item entering the processor. This condition is otherwise meant to specifically exclude the very first item.

Screenshot 2026-05-11 130150.png

2) It does mean that, for that row in the source's schedule table, as many tokens as there are rows in the global table will be created. The colors are assigned in the On Entry trigger of the queue and are based on their "Type" label.

3) The item creation happens in zero simulation, so you never see the tokens before they enter the sink. You can remove the sink and they will remain in the Create Objects activity. For a small number of tokens that is fine. But generally you should always delete tokens that are not needed anymore by sending them to a sink.

4) I can only guess that either the file name or the directly doesn't match the code snippte anymore.

5) The difference between the "Arrival Sequence" and "Arrival Schedule" setting in the 3d source is that the schedule has a defined time for each row. The sequence creates all items immediately, you just don't see them before they exit the source. So what I meant is that you might use a schedule to control when items are created and thus processed. Essentially adding a time column to the front of your table. Now that I understand more about your goals this is not a useful alternative anymore.

6) Generally, every code field in FlexSim has a couple of predefined variables that are passed into the function as parameters. This is called a "header" and is what you see in the screenshot. It is automatically generated as soon as the object is created. Choosing options from the GUI then adds more code below these lines.

7) "param(N)" reads the Nth value that was passed into the function. As far as I know there is no documentation about this. But the variable names and types together with context of what code you are editing are most often enough information to guess their meaning. See also the documentation about user commands for an oberview of function parameters.

https://docs.flexsim.com/en/26.0/Reference/Tools/UserCommands/UserCommands.html 

 

Dynamic changeover

If a human worker is required for the setup and defines when the setup can take place then it makes sense to implement this in the model. Making the processor require an operator for setup is simple. Activate the corresponding option under the setup time setting and provide a reference to the operator you want to use. Either through a centerport connection or a direct reference with the sampling tool. Then create a time table for the operator that represents the working hours.

 

Dashboard

The "BatchID" label does not exist on the items created through Process Flow. Either add that label or use a different one in the Statistics Collector.

 

0 Likes
Message 7 of 15

kentaro_banABGLD
Advocate
Advocate

Thank you for your response. Creating the model has been incredibly helpful as it allows me to identify any discrepancies in my understanding.

Regarding point 2), is my understanding correct that the number of rows in the Global Table equals the number of tokens, and information from each label is assigned to these tokens?

Regarding point 3), when I removed the [Sink] activity, 14 tokens appeared in the [Create Object] activity. I understand that these 14 tokens were created according to the code defined in point 2). Since the "Time" in the Arrival Schedule is set to 0, I understand that the tokens are created in the [Create Object] activity instantaneously. However, why are the tokens destroyed instantly without remaining in the [Create Object] activity when a [Sink] activity is present? Also, is there a way to keep the tokens without them being destroyed instantly so that their information can be referenced during the simulation?

Regarding point 5), is it correct to assume that while the "Arrival Sequence" focuses on the flow of movement but cannot manage time, the "Arrival Schedule" is more appropriate to use because it allows for time management?

I have a clear understanding of points 1), 4), 6), and 7).

I was very surprised to see how much simpler the model became by assigning the Timetable to the Operator instead of the Processor to distribute the information. Is the reason the Processor stops when the Operator's Timetable is active due to the S-connection (center port connection) between the Operator and the Processor?

0 Likes
Message 8 of 15

FelixMoehlmann
Collaborator
Collaborator
Accepted solution

2) Yes, the number of created tokens is equal to the number of rows in the global table and each token is assigned the various column values from one of the rows.

3) That is what the sink is meant to do. Just like the sink in the 3d model destroys items, the Process Flow sink removes tokens. So you don't need to keep unnecessary tokens around that would only take up memory space. If you want to keep the tokens, simply don't place a sink activity.

5) In your case there is no clear defined arrival time, since it depends on changeover and process speed. But yes, the schedule option is generally more powerful.

The operator is given a "Utilize" task by the processor that references the item currently being processed. When the operator stops, the software knows that it should also stop the processor. The s-connection is just one option of how the processor can pass the task sequence to the operator. A direct reference using the sampling tool, the Model.find() function or pulling an operator from a list are also commonly used options. 

0 Likes
Message 9 of 15

kentaro_banABGLD
Advocate
Advocate

I have successfully built a simulation where one machine processes multiple part numbers. This alone is a great model, but my final goal is to simulate one operator managing multiple machines to optimize setup (changeover) times and ensure smooth production.

I have now added a second processor and connected the operator to both via S-connections. Regarding this setup, I have the following questions:

1. Is there a way to avoid manually renaming every object and label? To set up two machines, I felt I needed unique names, so I spent a lot of time renaming everything for Line 2: adding "_2" to 3D object names, changing names in the Global Table, and updating label names in the Process Flow ([Source] and [Create Object]). If I increase this to 3 or 4 machines, renaming everything manually will be very time-consuming and confusing. Is there a way to simulate this without changing names? For example, can I use the same object names as Line 1 for the data? Since multiple machines perform the same movements under one operator, should I be using Lists?

2. Are the Priority and Preempt settings correct? To manage two machines simultaneously, I changed the Processor's Priority from 0 to 1 and set Preempt to "Preempt Only." Is this correct? If so, I assume I should set the priority to 2 for a third machine. If there is a more efficient method, please let me know.

3. How can I inject an urgent "interrupt" order during the simulation? If a customer makes an urgent request that must be prioritized, where should I input that information? For example, if a job (Product: RA36_01_5, Qty: 60, Changeover: 5m, Process: 10m) needs to be inserted between two existing jobs, "RA36_01_3" and "RA36_02_1," on Line 1. Should I use a CSV file, or is there a way to do this without CSV?

It is a complex setup, but I feel I am very close to the goal. Please find the attached sample data for more details. Any advice would be greatly appreciated.

0 Likes
Message 10 of 15

FelixMoehlmann
Collaborator
Collaborator

1) Avoiding having the same name multiple times in the model is good practice, but not necessary when the objects with the same name do not exist on the same level in the model tree. To copy the same production line multiple times it makes sense to use the first one as a template.

https://docs.flexsim.com/en/26.0/Using3DObjects/WorkingWith3DObjects/UsingTemplates/UsingTemplates.h...

In practice, you move all queues and the processor into the plane beneath them, then create instances of that plane. The planes will be assigned numbered names by default. Their subnodes (the queues and processor) will retain their original name. But since they are subnodes of different objects they have unique paths in the tree and thus shouldn't cause issues.

Similarly, you can use an Object Process Flow and link it to the input queue of the first production line. Copies of that queue will also automatically be linked to the same Flow and run the same logic. Each linked object essentially runs a (mostly) independent copy of the same Process Flow. But since the Process Flow is very simple, just creating multiple copies of the same activity block and manually adjusting the table name and creation location would also be feasible here.

https://docs.flexsim.com/en/26.0/ModelLogic/ProcessFlowBasics/TypesOfProcessFlows/TypesOfProcessFlow...

With this approach you only need to make minor adjustments to each copy: Which global table is used for the item creation (I use a label on the input queue for this in the attached model) and possibly the priority value on the processor.

The same Statistics Collector can also be used for all lines. But it might make sense to adjust the "BatchID" so it contains information about which line the batch belongs to.

2) If your goal is for the operator to be able to interrupt the setup of the second line when a new setup is required at the first, then those settings are correct.

https://docs.flexsim.com/en/26.0/WorkingWithTasks/TaskPrioritiesPreemption/TaskPrioritiesPreemption....

3) Ultimately you will require data for those urgent requests. Whether those are imported from a CSV or added manually is up to you. The queues send items to the processor in the order in which are ranked as subnodes of the queue. So one option to inject a new batch is to create the items and then adjust their rank to place them after the currently active batch. A simpler option would probably be to change how the Process Flow works. By limiting the item creation to one batch at a time you can easily insert new ones by simply ignoring the limitations put on the 'base' tokens.

 

 

0 Likes
Message 11 of 15

kentaro_banABGLD
Advocate
Advocate

I am currently developing a manufacturing simulation model and would like to clarify a few technical points to ensure my logic is sound.

1. Object Uniqueness and Pathing In my model, I have a queue named QCPS0826_6_06 located within two different groups. In the properties, they are identified as Line1 / QCPS0826_6_06 and Line2 / QCPS0826_6_06. Does this hierarchical path ensure that FlexSim treats them as unique objects despite having the same name?

2. Scoping of Labels: 3D Objects vs. Tokens I want to confirm my understanding of label targets:

  • 3D Object Labels: These are stored on the physical objects (e.g., Queue, Processor).

  • Process Flow Labels: These are stored on the Token moving through the flow. Is this distinction correct?

3. Referencing Queue Labels as Variables In my Scheduled Source activity, I use the code: Table(current.TableName). The Queue object has a label named TableName with a value of GlobalTable1. Am I correct that the Process Flow is dynamically pulling the table name from the Queue label to use as a variable?

4. Minimum Requirements for Table(current.TableName) To make the Table(current.TableName) logic work, is it sufficient just to have the corresponding Label Name and Value defined on the object? Are there any other required settings in the model properties?

5. Definition of the current Keyword While current is very convenient, I’d like to understand its exact scope. Does current refer to any entity in the simulation, or is it specifically the object that "owns" the code or activity being executed?

6. Global Table Naming In my model, the Label Value GlobalTable1 on the Queue exactly matches the name of the Global Table. Is this an intentional requirement for the code to find the table, or just a naming convention?

7. Simulation Auto-Stop My simulation stops automatically at 2026/4/16 3:23:20. I assume this is because the Time in my Urgent Requests (Scheduled Source) is set to 500,000 seconds. Is it correct that the model stops once the schedule is completed?

8. Logical Branching for Urgent Orders Currently, urgent orders are mixed in the 7th queue. I need to modify this so that:

  • Urgent orders change color for visual distinction.

  • They are diverted to a separate, dedicated queue. How would you recommend implementing this "split" logic effectively?

9. The Purpose of Using Zones The manual states that a Zone is used for statistics on a group of activities. Could you explain the specific advantage of using a Zone in this model versus other methods?

0 Likes
Message 12 of 15

FelixMoehlmann
Collaborator
Collaborator

1) Objects are always 'unique'. Even having objects with the same name within the same scope is most often not a problem. The only problem you might run into is when you refer to objects by their path using "Model.find()". You would then always get a reference to first object with that name/path. One other potential issue where different names might be good to have are charts that plot data for multiple objects. Including the parent object in the legend can make it seem less 'clean'.

2) That is correct.

3/4/5) 'current' is almost always a variable that denotes the object the respective code is defined on (the 'owner' as you say). In the case of an Object Process Flow 'current' refers to the instance object. This is used in the model to allow the queues to use different tables for the material creation since each instance reads the label on 'their' queue.

6) The name must match exactly.

7) There are three cases where the model stops: The stop button is pressed, a stop time (defined in the Run Time settings) is reached or there are no more scheduled events (nothing left to do).

8) You could alter the "Type" label on the urgent items (for example "G_Urgent") and add another case to the Send to Port option to send them to a dedicated queue.

9) I mostly use zones as a convenient way to limit how many tokens may enter a section of a Process Flow. The same functionality could be achieved with a numerial resource. But the zone also offers the ability to create partitions depending on token labels and set a limit per partition rather than globally. So I mostly default to using zones for the purpose of limiting token throughput. In this simple case there is no distinct advantage.

0 Likes
Message 13 of 15

kentaro_banABGLD
Advocate
Advocate

Thank you for your previous answers. I would like to add the following questions:

10. I understand the reason for using zones. However, there is an "Event Wait" activity inserted within them. Could you please explain the reason for including this activity?

11. I am trying to create template instances for multiple objects at once, but when I follow the steps below, only a portion of the data is created. Could you tell me the correct procedure?

  • I select the 3D objects by holding Shift and dragging (the group of objects turns red).

  • I left-click one of the selected objects (in this case, a Plane).

  • In the right-hand Properties panel, I go to [Template] > [Instance] and left-click the [+] icon.

  • Result: Only the template instance for the Plane is created.

I believe these will be my final questions. Thank you for your continued support.

0 Likes
Message 14 of 15

FelixMoehlmann
Collaborator
Collaborator
Accepted solution

10) The Wait For Event activity keeps the token in the zone until the queue is empty again. This way the batches are created one-by-one, allowing you to interject urgent batches without needing to change the order of items in the queue.

11) An instance of the highlighted object (yellow outline) is created by the button. This is working as expected. I don't think there is a way to create instances from multiple templates at the same time. But you generally don't want to do this. Instead put all objects inside the plane (make them subnodes of the plane, you can do this in the "Edit Selected Objects" window that you open in the "View" menu). Then create an instance of the plane and all contents of it will be copied as well.

0 Likes
Message 15 of 15

kentaro_banABGLD
Advocate
Advocate

Thanks to your answers so far, I was able to complete the overall flow.
They were very helpful. Thank you very much.

If anything else comes up, I’ll reach out for advice again.

0 Likes