Visual Logic - Examples

Visual Logic is Simul8’s scripting language and lets you customise the settings of your simulation in more detail. The following examples present the applicability of different Visual Logic Commands.

Logical Flow

  • If.s8 This example makes use of an IF condition to direct Work Items to different Queues depedning on the day of the week
  • While.s8 This example uses a WHILE loop to search for a value in a spreadsheet.
  • Loop_Object.s8 Using Loop Object, this example shows how to cycle through all the Activities in this simulation and change their Operation Time.

Functional Commands

  • Add_to_Pool.s8 Shows how to automate the addition of Resources to a Pool.
  • Block_current_Routing.s8 Blocks Routing in to an Activity when there are fewer than 2 items in the subsequent Activity.
  • Breakdown.s8 Here, using the Breakdown command, Visual Logic is forcing a breakdown to a set of Activities when one of these Activities is experiencing a Breakdown.
  • Copy_KPIs_to_Sheet.s8 Shows how to copy KPIs to an internal spreadsheet at the end of each Run.
  • Copy_selected_Objects.s8 Shows how to count the number of all Activities in a simulation.
  • Create_&_Erase_Global_Data_Item.s8 This example shows how to use the “Create Global Data Item” and “Erase Global Data Item” commands to erase and re-create 5 numeric global variables on Reset.
  • Create_Simulation_Object.s8 Shows how to create a Resource Object and how to also erase it on every Reset. This example is helpful if you want to create Objects during a Run.
  • Find_Resource_from_Pool.s8 Shows how to use this command to find which Resources in this simulation are Pooled Resources.
  • Get_Current_Object.s8 Shows how to use one Visual Logic section to calculate results corresponding to multiple Activities in the simulation
  • Get_from_EXCEL.s8 Shows how to use the Get from EXCEL command
  • Get_PC_Clock.s8 This example makes use of Get PC Clock to calculate the real time required for running the simulation.
  • Get_Shift_Status.s8 This example shows how to create a log of the Resource's Shift Status using the Get Shift Status command.
  • Link_Logic_to_Objects.s8 This example shows how to link Visual Logic to a Visual Logic Section of multiple activities in the simulation, all at once, using the Link Logic to Objects command.
  • Link_&_Unlink_Simulation_Objects.s8 This example shows how to link and un-link Simulation Objects depending on the Contents of an Activity in the simulation.
  • Match_Text_in_Sheet_Area.s8 This example presents how this command is used to search through a text value on a spreadsheet in order to define the Call Centre should be directed to.
  • Results_to_Sheet.s8 Shows the use of Results to Sheet on End Run.
  • Schedule_Event_on_Simulation_Object.s8 Shows how use this command to trigger a Visual Logic section on the Object currently in focus.
  • Set_Clock_Properties.s8 Here this is used to set the Clock's properties using variables instead of constant values.
  • Set_Collect_Number.s8 Uses Set Collect Number to change the collect number for each collection.
  • Set_Object_Location.s8 This example shows how to set an Object's location in relation to another Object.
  • Set_Prob_Profile_Distrib_Column.s8 This shows how to set the probabilities of a Probability Profile Distribution using spreadsheet values.
  • Set_Resource_Label.s8 Shows how to use the command in order to change the Label that defines the selection of the Resource Object.
  • Set_Resource_Travel_Time.s8 Shows how to set a Resource's Travel time using Visual Logic
  • Set_Route_out_Percent.s8 Shows how to set Route out Percent using Visual Logic
  • Set_Travel_Times_using_Labels.s8 Shows how to make Travel times vary depending on a Label value.
  • Sheet_to_File.s8 Shows how to export an internal spreadsheet to a .csv file using this command.
  • Unformat_Local_Time.s8 Shows how to convert a date to Simulation time, in order to use this to define the Simulation's start time using the Set Simulation Start Date command.
  • Get_Trial_Run_Number_with_MDA.s8 This example shows how to record results from each trial run to the respective sheet in a Multi-Dimensional Array.