EnergyPlus C API  0.1
This is the EnergyPlus C API, which allows linking to EnergyPlus and reading and manipluating data during a simulation.
/eplus/repos/7eplus/src/EnergyPlus/api/datatransfer.h
Go to the documentation of this file.
1 // EnergyPlus, Copyright (c) 1996-2020, The Board of Trustees of the University of Illinois,
2 // The Regents of the University of California, through Lawrence Berkeley National Laboratory
3 // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
4 // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
5 // contributors. All rights reserved.
6 //
7 // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
8 // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
9 // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
10 // worldwide license in the Software to reproduce, distribute copies to the public, prepare
11 // derivative works, and perform publicly and display publicly, and to permit others to do so.
12 //
13 // Redistribution and use in source and binary forms, with or without modification, are permitted
14 // provided that the following conditions are met:
15 //
16 // (1) Redistributions of source code must retain the above copyright notice, this list of
17 // conditions and the following disclaimer.
18 //
19 // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
20 // conditions and the following disclaimer in the documentation and/or other materials
21 // provided with the distribution.
22 //
23 // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
24 // the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
25 // used to endorse or promote products derived from this software without specific prior
26 // written permission.
27 //
28 // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
29 // without changes from the version obtained under this License, or (ii) Licensee makes a
30 // reference solely to the software portion of its product, Licensee must refer to the
31 // software as "EnergyPlus version X" software, where "X" is the version number Licensee
32 // obtained under this License and may not use a different name for the software. Except as
33 // specifically required in this Section (4), Licensee shall not use in a company name, a
34 // product name, in advertising, publicity, or other promotional activities any name, trade
35 // name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
36 // similar designation, without the U.S. Department of Energy's prior written consent.
37 //
38 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
39 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
40 // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
41 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
43 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
44 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
45 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46 // POSSIBILITY OF SUCH DAMAGE.
47 
48 #ifndef EnergyPlusAPIDataTransfer_h_INCLUDED
49 #define EnergyPlusAPIDataTransfer_h_INCLUDED
50 
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
67 
68 // ----- GENERIC QUERY FUNCTIONS
69 
93 
94 // ----- FUNCTIONS RELATED TO VARIABLES
95 
102 ENERGYPLUSLIB_API void requestVariable(const char* type, const char* key);
115 ENERGYPLUSLIB_API int getVariableHandle(const char* type, const char* key);
123 
124 // ----- FUNCTIONS RELATED TO METERS
125 
133 ENERGYPLUSLIB_API int getMeterHandle(const char* meterName);
144 
145 // ----- FUNCTIONS RELATED TO ACTUATORS
146 
156 ENERGYPLUSLIB_API int getActuatorHandle(const char* componentType, const char* controlType, const char* uniqueKey);
168 ENERGYPLUSLIB_API void resetActuator(int handle);
187 ENERGYPLUSLIB_API void setActuatorValue(int handle, Real64 value);
201 
202 // ----- FUNCTIONS RELATED TO STATIC "INTERNAL VARIABLES"
203 
212 ENERGYPLUSLIB_API int getInternalVariableHandle(const char* type, const char* key);
220 
221 // ----- FUNCTIONS RELATED TO PYTHON PLUGIN GLOBAL VARIABLES (ONLY USED FOR PYTHON PLUGIN SYSTEM)
222 
255 
256 // ----- FUNCTIONS RELATED TO PYTHON PLUGIN TREND VARIABLES (ONLY USED FOR PYTHON PLUGIN SYSTEM)
257 
267 ENERGYPLUSLIB_API int getPluginTrendVariableHandle(const char* name);
278 ENERGYPLUSLIB_API Real64 getPluginTrendVariableValue(int handle, int timeIndex);
300 ENERGYPLUSLIB_API Real64 getPluginTrendVariableMin(int handle, int count);
311 ENERGYPLUSLIB_API Real64 getPluginTrendVariableMax(int handle, int count);
322 ENERGYPLUSLIB_API Real64 getPluginTrendVariableSum(int handle, int count);
336 
337 // ----- FUNCTIONS RELATED TO MISC CURRENT SIMULATION STATE
338 
344 ENERGYPLUSLIB_API int year();
345 
350 
355 
360 
365 
370 
375 ENERGYPLUSLIB_API int hour();
376 
384 
393 
400 
407 
413 
418 
423 
432 
447 
457 
465 ENERGYPLUSLIB_API int getConstructionHandle(const char* constructionName);
466 
473 
480 
481 #ifdef __cplusplus
482 }
483 #endif
484 
485 #endif // EnergyPlusAPIDataTransfer_h_INCLUDED
This file provides a define that enables exposing methods on the API. No client needs to directly imp...
int apiDataFullyReady()
Provides a user-facing check for whether API data is ready to be accessed.
int isRaining()
Returns 0 if it is not currently raining, or 1 if it is currently raining.
double Real64
Definition: TypeDefs.h:52
Real64 getVariableValue(int handle)
Gets the current value of a variable.
#define ENERGYPLUSLIB_API
Definition: EnergyPlusAPI.h:61
int getMeterHandle(const char *meterName)
Gets a handle to a meter.
void resetActuator(int handle)
Resets an actuator so EnergyPlus will calculate the value as normal.
int getConstructionHandle(const char *constructionName)
Returns an index to a construction in the simulation.
Real64 getPluginTrendVariableSum(int handle, int count)
Gets the summation of a Python Plugin "Trend" variable over a given number of history points...
Real64 getPluginTrendVariableDirection(int handle, int count)
Gets the average trajectory of a Python Plugin "Trend" variable over a given number of history points...
void setPluginGlobalVariableValue(int handle, Real64 value)
Sets the value of a Python Plugin "Global" variable.
Real64 currentTime()
Returns the current time of the simulation.
Real64 getInternalVariableValue(int handle)
Gets the current value of an internal variable.
int dayOfWeek()
Returns the current day of week of the simulation, from 1 for Sunday to 7 on Saturday.
int currentEnvironmentNum()
Returns the current environment number for a specific siulation.
Real64 getActuatorValue(int handle)
Gets the value of an actuator in EnergyPlus.
Real64 getPluginTrendVariableAverage(int handle, int count)
Gets the average value of a Python Plugin "Trend" variable over a given number of history points...
int getActuatorHandle(const char *componentType, const char *controlType, const char *uniqueKey)
Gets a handle to an actuator.
void setActuatorValue(int handle, Real64 value)
Sets the value of an actuator in EnergyPlus.
int month()
Returns the current month of the simulation, from 1 for January to 12 for December.
int getPluginTrendVariableHandle(const char *name)
Gets a handle to a Python Plugin "Trend" variable.
void resetErrorFlag()
Reset the API Error flag.
Real64 getPluginTrendVariableMin(int handle, int count)
Gets the minimum value of a Python Plugin "Trend" variable over a given number of history points...
int minutes()
Returns the minutes into the hour from 1 to 60.
char * listAllAPIDataCSV()
Gets available API data for the current simulation.
int hour()
Returns the current hour of the day in 0-23 form.
int kindOfSim()
Returns an integer indicator for the current simulation environment type.
int warmupFlag()
Returns the current warmup flag status, 0 if not warming up, 1 if warming up.
int dayOfMonth()
Returns the current day of month of the simulation, from 1 to 28, 29, 30, or 31, based on the month...
int dayOfYear()
Returns the current day of year of the simulation, from 1 for January 1 to 365 (or 366 for a leap yea...
int daylightSavingsTimeIndicator()
Returns the current daylight savings time status, which is 0 (zero) if DST is off, or 1 (one) if DST is on.
int year()
Returns the current year of the simulation.
int getInternalVariableHandle(const char *type, const char *key)
Gets a handle to an internal variable.
Real64 systemTimeStep()
Returns the duration of the current HVAC system simulation time step, in fractional hours...
int getVariableHandle(const char *type, const char *key)
Gets a handle to a variable.
int actualTime()
Returns a simple sum of the time part of the date/time function.
int sunIsUp()
Returns 0 if the sun is down, or 1 if the sun is up.
int apiErrorFlag()
Provides a user-facing check on the API error flag.
Real64 getPluginTrendVariableMax(int handle, int count)
Gets the maximum value of a Python Plugin "Trend" variable over a given number of history points...
int actualDateTime()
Returns a simple sum of the date/time function.
Real64 zoneTimeStep()
Returns the duration of the current zone simulation time step, in fractional hours.
Real64 getPluginTrendVariableValue(int handle, int timeIndex)
Gets the current value of a Python Plugin "Trend" variable at a specific history point.
Real64 getMeterValue(int handle)
Gets the current value of a meter.
void requestVariable(const char *type, const char *key)
Marks a variable as requested in a simulation.
Real64 getPluginGlobalVariableValue(int handle)
Gets the current value of a Python Plugin "Global" variable.
int holidayIndex()
Returns the holiday index for the current day of the simulation.
int getPluginGlobalVariableHandle(const char *name)
Gets a handle to a Python Plugin "Global" variable.