How to get the date and time step from Energy Plus

242 views
Skip to first unread message

Christopher Pratt

unread,
Jul 27, 2011, 8:54:04 PM7/27/11
to bcvtb
Hello,

I need to grab both the current date and the timestep setting from
energy plus. However I don't know what to put in the "variables.cfg"
file in order to grab these variables from Energy Plus, or if I
specifically need to tell energy plus to output the timestep and
date. Simply put, what to I put in:

<variable source="EnergyPlus">
<EnergyPlus name="????????????" type="????????????"/>
</variable>

Or will I need to set the timestep and date to a variable within the
Energy Plus .idf file and then have it output those variables?

Thanks,
Chris

Christopher Pratt

unread,
Jul 27, 2011, 8:57:07 PM7/27/11
to bcvtb
I am using Windows 7, 32 bit Energy plus and 32 bit bcvtb.

Michael Wetter

unread,
Jul 28, 2011, 2:10:09 PM7/28/11
to bc...@googlegroups.com
I suggest you check how to assign current time and timestep to an EnergyPlus Output:Variable, or EnergyManagementSystem:OutputVariable. Then, you can send this variable to the BCVTB interface as described at http://simulationresearch.lbl.gov/bcvtb/releases/1.0.0/doc/manual/tit-EnePluCon.xhtml

Michael

Christopher Pratt

unread,
Jul 28, 2011, 7:00:01 PM7/28/11
to bcvtb
Thank you,

Sorry we forgot how to grab those variables.

Chris

Christopher Pratt

unread,
Aug 1, 2011, 12:04:55 PM8/1/11
to bcvtb
For those who would like the reference here is the code we used:

EnergyManagementSystem:GlobalVariable,
currentYear; !Year

EnergyManagementSystem:GlobalVariable,
currentMonth; !Month

EnergyManagementSystem:GlobalVariable,
currentDayOfMonth; !Day of month (1-31)

EnergyManagementSystem:GlobalVariable,
currentDayOfWeek; !Day of week (1=Sun, 2=Mon,...)

EnergyManagementSystem:GlobalVariable,
currentHour; !Hour (0-23)

EnergyManagementSystem:Program,
GetTimelag, !- Name
SET currentYear = Year,
SET currentMonth = Month,
SET currentDayOfMonth = DayOfMonth,
SET currentDayOfWeek = DayOfWeek,
Set currentHour = Hour;

EnergyManagementSystem:ProgramCallingManager,
GetTimelag_Manager, !- Name
AfterPredictorAfterHVACManagers, !- EnergyPlus Model Calling
Point
GetTimelag; !- Program Name 1

EnergyManagementSystem:OutputVariable,
currentYear, !- Name
currentYear, !- EMS Variable Name
Averaged, !- Type of Data in Variable
ZoneTimeStep; !- Update Frequency

EnergyManagementSystem:OutputVariable,
currentMonth, !- Name
currentMonth, !- EMS Variable Name
Averaged, !- Type of Data in Variable
ZoneTimeStep; !- Update Frequency

EnergyManagementSystem:OutputVariable,
currentDayOfMonth, !- Name
currentDayOfMonth, !- EMS Variable Name
Averaged, !- Type of Data in Variable
ZoneTimeStep; !- Update Frequency

EnergyManagementSystem:OutputVariable,
currentDayOfWeek, !- Name
currentDayOfWeek, !- EMS Variable Name
Averaged, !- Type of Data in Variable
ZoneTimeStep; !- Update Frequency

EnergyManagementSystem:OutputVariable,
currentHour, !- Name
currentHour, !- EMS Variable Name
Averaged, !- Type of Data in Variable
ZoneTimeStep; !- Update Frequency

Anxiao Zhang

unread,
Mar 31, 2019, 3:13:40 AM3/31/19
to bcvtb
Thank you. 

ps:   Output:Variable,*,currentMonth,timestep;   etc. can be added.

在 2011年8月2日星期二 UTC+8上午12:04:55,Christopher Pratt写道:

Max Marschall

unread,
May 22, 2019, 2:18:55 AM5/22/19
to bcvtb
Hi Christopher, 

So in your case, what were the keywords to be added to the variables.cfg file? I thought it should be
<EnergyPlus name="EMS" type="currentYear"/>

...but this is giving me the error:
Last severe error=ExternalInterface: Simulation model has no variable "CURRENTYEAR" with key "EMS".

Your code seems to be working because I can write 'currentYear' etc. as an Output:Variable (so it shows up in the results csv when I simulate the IDF in EnergyPlus without the ExternalInterface). I've tried reading the Output:Variable version of "currentYear" in the variables file, but have tried all kinds of combinations of "name" and "key" and none have worked.

I'm attaching my IDF and variables.cfg if that helps. Any help is much appreciated!
variables.cfg
WOM.idf
Reply all
Reply to author
Forward
0 new messages