Customized reports
Previous (Resize windows) | Back to Start | Next (Batch Processings)
Customized reports with Python
Depending on where you work, your company might want you to export your IDA ICE simulation in different formats. In this exercise, you will try out how to customize your reports with Python. In this example, you will use two different Python scripts for custom results export: one for Excel and one for Word.
This exercise uses files from the
Step 1: Results export to Excel
- First, you need to set up the API. For this, you need to find the file util.py and set the variable path_to_ice to point to the bin folder in your IDA ICE installation (or another folder if you have IDA ICE installed elsewhere):
path_to_ice = "C:\\Program Files (x86)\\IDA ICE <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.



- Now you can either use our provided example_building.IDM or prepare an example building for the report yourself. For the latter, open IDA ICE and create a new building1. In “Simulation/Requested output”, add “Log sources” and “Log detailed sources” under Reports – Building Level – AHU energy. Save the building in a suitable location.
- Now you can open the script Excel_report.py. Find and set the variable file_path to point to the file example_building.IDM located in the same folder as the Python script.
file_path = "C:\\<USER DIR>\\example\\Customized reports\\example_building.IDM"
- Define where to save the customized Excel report. Set the variable save_path to point to where you want to save.
save_path = "C:\\<USER DIR>\\example\\Customized reports\\"
- To run the script, open the command prompt terminal by searching cmd in the Windows search bar.


- Then go to IDA ICE distributed python directory by typing:
>> cd "C:\\Program Files (x86)\\IDA ICE <YOUR IDA VERSION>\\bin\\python"
- Now you can run the Excel_report.py script by typing:
>> python.exe "C:\\<USER DIR>\\example\\Customized reports\\Excel_report.py"
- Let the script finish, then go to the folder where you specified the results, and have a look at output1.xlsx (which contains raw data) & output2.xlsx (which contains extra data extracted/added).
- Try out the same method on another building if you want!
- Is there more data that you want to export to Excel? Then, have a look at the Excel_report.py and modify it accordingly.
Step 2: Results export to Word
Now, we will try out our own results export to a Word document. You will use the same util.py, so no need to modify this file again.
- Open the template_ENG.docx. Have a look at it, it is the template for your report. Any keywords enclosed with %% e.g., %keywords% will be replaced by values extracted from example_building.IDM (you can also create a new building as in Step 1).
- Open the file Edit_docxs.py and change the following lines:
template = "C:\\<USER DIR>\\example\\Customized reports\\template_ENG.docx"
file_path = "C:\\<USER DIR>\\example\\Customized reports\\example_building.idm"
results = "C:\\<USER DIR>\\example\\Customized reports\\"
- Now we can run the Edits_docxs.py script following the procedures given in Step 1, i.e., search cmd, open terminal, then go to IDA ICE distributed python directory, etc.
- Have a look at the resulting Word file: output.docx. Depending on your IDM file, some results might be missing in the report.
- Are there other things you would like to report? Try to change the Edits_docxs.py script to make it appear in the resulting Word file.
Previous (Resize windows) | Back to Start | Next (Batch Processings)