BankSim Simulator¶
Introduction¶
The BankSim example is a queue-based simulation designed to measure customer service time. It simulates the full process from customer arrival, waiting, service, and completion. The simulation is configured to analyze results based on various parameters such as the number of customers, service counters, and queue capacity.
Notably, it includes a what-if-question point where the number of models (generators) can be changed during simulation to explore different scenarios.
The simulation model consists of four core components: User Generator, Queue, Accountant, and Result. Customers are randomly generated by the generator, passed through a queue, and then processed by the accountant model. The simulation terminates once the target number of processed users is reached and outputs the result.
Scenario Explanation¶
``gen_num``: Number of
user_generatormodels. Each generator randomly creates users and sends them to the queue.``queue_size``: The size of the
BankQueue. If the queue is full, newly generated users are dropped.``proc_num``: Number of
Accountantmodels. Service time differs for each user.``max_user``: Total number of users to be processed by the
Accountant.``wiq_time``: The what-if-question time point. After this point, the number of generator models can be changed.
``wiq_gen_num``: The number of generator models after the what-if-question point.
Save and Restore Functionality¶
The simulator allows saving the simulation state at any point using the snapshot feature of pyjevsim.
Users can restore a saved state and adjust parameters such as generation speed, queue size, or number of processors to analyze the impact of changes.
This example includes: - Model-level save/restore:
banksim_model_snapshot.py,banksim_model_restore.py- Full simulation save/restore:banksim_snapshot.py,banksim_restore.py
Important Notes¶
The what-if-question functionality in this simulation only modifies the number of generator models.
The execution scripts (
banksim_classic.py,banksim_model_snapshot.py,banksim_model_restore.py,banksim_snapshot.py,banksim_restore.py) require two command-line arguments:wiq_timeandwiq_gen_num, in that order.The unified execution file
banksim.pyruns all related simulation files for a specified number of iterations and takeswiq_timeas its argument.