Fire move
Previous (Introduction to Python) | Back to Start | Next (Customized reports)
Fire Move with Python
In this example, you will use the IDA Tunnel Python API to move fire.
This exercise uses files from the
Step 1: Setup the API
- First, you need to set up the API. For this, you need to find the file util.py and set the variable path_to_tunnel to point to the bin folder in your IDA Tunnel installation (or another folder if you have IDA Tunnel installed elsewhere):
path_to_tunnel = "C:\\Program Files (x86)\\IDA Tunnel <YOUR IDA VERSION>\\bin\\"
- Save the util.py after changing it.
- Second, you also need to go to Services in Windows and make sure that the IDAMessageBrokerService is running. You can find Services by simply searching it in the Windows search bar.
Step 2: Looking at an example Python script
Now, let's look at the example in Fire_Move.py. It automatically moves fire to desired locations.
- Before running the script, you can choose to either use our provided system named 1.IDM (in folder "example\\tunnels") or prepare an example system for the report yourself. For the latter, open IDA Tunnel and create a new system. Save the system in our provided folder, and make sure the system name is 1.IDM.
- Copy and paste the 1.IDM several times, rename them as 2.IDM, 3.IDM, etc. The number of copies depends on the number of tasks (Ntasks) you want to execute in parallel or in serial correspond to the number of cases for various fire location and entry traffic.
- Now you can open the script Fire_Move.py. Find and set the variable file_path to point to the folder as,
file_path = "C:\\<USER DIR>\\example\\Fire Move\\tunnels\\"
- Define file_paths which points to all the systems, i.e., 1.IDM, 2.IDM, 3.IDM, etc. The number of readings will depend on the number of tasks (Ntasks) you specify.
file_paths = [file_path + str(i ) + ".IDM" for i in range(1, Ntasks + 1)]
- Define result_paths that point to the systems you will be saving your results to. With the following line, the same file_path will be used for saving, but the names of the saved systems will be result1.IDM, result2.IDM, etc.
result_paths = [file_path + "result" + str(i ) + ".IDM" for i in range(1, Ntasks + 1)]
- To run the script, open the command prompt terminal by searching cmd.exe in the Windows search bar.
- Then go to IDA Tunnel distributed python directory by typing:
>> cd "C:\\Program Files (x86)\\IDA Tunnel <YOUR IDA VERSION>\\bin\\python"
- Now you can run the Fire_Move.py script by typing:
>> python.exe "C:\\<USER DIR>\\example\\Fire Move\\fire_move_example_util.py"
- Several simulations will be started, so be a bit patient.
- The given mode = "serial", Ntasks = 2 will start IDA Tunnel tasks in a consecutive (serial) manner. The task to perform in this example is (a) reading in systems one after another until all systems are opened; (b) starting changing the fire location and traffic entry, then saving and running the system.
- Let the script finish, then change mode = "parallel" and rerun the Fire_Move.py
- This time, 2 IDA Tunnel tasks will execute simultaneously (parallel) to read the systems, change the fire location and traffic entry, and then save the systems. (Note: If there is no pop-out IDA Tunnel window, the only workaround is to use The Conda Python Distribution, see Introduction to Python)
Previous (Introduction to Python) | Back to Start | Next (Customized reports)




