Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

I am using Energyplus for simulation, the question i am using EMS for custom variable want to convert its report format

asked 2020-09-19 05:17:48 -0600

Junaid Awan's avatar

updated 2020-09-20 08:47:11 -0600

I am using Energyplus for simulation, the question i am using EMS for custom variable generation like total daylight, electricity consumption, thermal comfort hour ....With custom names ,the problem is that the report generated by E+ is giving variable and value in vertical fashion while i need it shoud be in Horizontal fashion (value of variable followed by name of variables in csv format e.g TotalDaylight, xxxxxx ) In short i attach the two picture EMS generating in format in Picture 1 while i need format like in Picture 2

Picture 1

picture 1

Picture 2

Picture 2

Kindly tell solution

edit retag flag offensive close merge delete


@Junaid Awan are these annual output values? If so, why is it critical to flip the axes that the outputs are generated by EnergyPlus?

Aaron Boranian's avatar Aaron Boranian  ( 2020-09-19 16:54:55 -0600 )edit

yes these are annual output variables. It is important because i want to perform optimization algorithm on these results and my algorithm take these value as i.e TotalElectricity, xxxxxx. If it isnot in this format it create problem for me to take value from csv file... so kindly guide me ...i am using MOBO tool to pick up these values

Junaid Awan's avatar Junaid Awan  ( 2020-09-20 02:37:50 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2020-09-20 08:25:53 -0600

updated 2020-09-22 10:35:19 -0600

The CSV output file you're looking at is generated by converting the ESO output file and/or MTR output file using the ReadVars utility. Unfortunately, you cannot alter the CSV output file to contain values in a horizontal fashion -- even if you use EMS for custom outputs, it will only generate the CSV file in a vertical fashion because that is what ReadVars is programmed to do. You would have to alter the source code of ReadVars to generate the CSV in a horizontal fashion.

If you really need results in a horizontal fashion, then I suggest you use a Python or Ruby script to transpose the vertical results from EnergyPlus into horizontal results for your optimization algorithm. You could also change how you're using the MOBO tool to get values from the CSV file in a vertical fashion.


If you are trying to do something similar to the following example from the MOBO documentation, then you will need to flip the results from EnergyPlus in a vertical fashion into a horizontal fashion so that MOBO can read it correctly.

image description

This process of changing a table from horizontal to vertical is called "transposing". In Python, you can use the pandas library to do this.

import pandas as pd

df = pd.read_csv('data/src/energyplus_results.csv') # read EnergyPlus results into dataframe
df = df.T # alter dataframe to transpose rows and columns 
df.write_csv('data/src/mobo_inputs.csv' # write new transposed dataframe to separate CSV file to use as MOBO inputs

So, your workflow would be:

  1. Simulate the model in EnergyPlus
  2. Use a Ruby or Python script to transpose the annual results and write to a new CSV file
  3. Load the new CSV file into MOBO for optimization
edit flag offensive delete link more


Kindly tell how could I change MOBO to take value in vertical fashion?

Junaid Awan's avatar Junaid Awan  ( 2020-09-21 00:41:58 -0600 )edit

@Junaid Awan What is MOBO? An internet search is only turning up this as a short-hand word for "motherboard".

Aaron Boranian's avatar Aaron Boranian  ( 2020-09-21 10:16:22 -0600 )edit

MOBO is the optmization tool which has variety of algorithm for optimization... link is below

Junaid Awan's avatar Junaid Awan  ( 2020-09-21 22:36:41 -0600 )edit

@Junaid Awan It sounds like you can't change how MOBO takes inputs, so you will have to write a script or manually transpose the EnergyPlus annual outputs. I've updated my answer above to reflect this.

Aaron Boranian's avatar Aaron Boranian  ( 2020-09-22 10:36:00 -0600 )edit

Kindly tell the procedure of how to add python script to energyplus i didnot work on it i have zero experience of it ...can the above script is used as it is and where to put that code

Junaid Awan's avatar Junaid Awan  ( 2020-09-22 10:43:51 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2020-09-19 05:17:48 -0600

Seen: 428 times

Last updated: Sep 22 '20