Skip to content

Commit

Permalink
Merge pull request #2212 from lbl-srg/issue1129_energyPlus_zone
Browse files Browse the repository at this point in the history
Issue1129 energy plus zone
  • Loading branch information
mwetter authored Nov 3, 2020
2 parents 0823dd4 + e136ddf commit 8195ac0
Show file tree
Hide file tree
Showing 271 changed files with 138,189 additions and 14 deletions.
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
libModelicaBuildingsEnergyPlus*.* filter=lfs diff=lfs merge=lfs -text
ModelicaBuildingsEnergyPlus*.dll filter=lfs diff=lfs merge=lfs -text
ModelicaBuildingsEnergyPlus*.lib filter=lfs diff=lfs merge=lfs -text
libepfmi*.* filter=lfs diff=lfs merge=lfs -text
libfmilib*.* filter=lfs diff=lfs merge=lfs -text
fmilib_shared*.* filter=lfs diff=lfs merge=lfs -text
epfmi*.* filter=lfs diff=lfs merge=lfs -text
Buildings/Resources/src/ThermalZones/EnergyPlus/FMUs/Zones1.fmu filter=lfs diff=lfs merge=lfs -text
Buildings/Resources/src/ThermalZones/EnergyPlus/FMUs/Zones3.fmu filter=lfs diff=lfs merge=lfs -text
Buildings/Resources/bin/spawn-*/bin/spawn filter=lfs diff=lfs merge=lfs -text
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ funnel_comp
# CMake build directory
######################################
/build
Buildings/Resources/src/fmi-library/build


# Temporary files generated by emacs
Expand Down
15 changes: 9 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ env:
- TEST_ARG="make test-dymola PACKAGE=\"Buildings.{Air,Examples}\""
- TEST_ARG="make test-optimica PACKAGE=\"Buildings.{Air,Examples}\""
- TEST_ARG="make test-jmodelica PACKAGE=\"Buildings.{Air,Examples}\""
- TEST_ARG="make test-dymola PACKAGE=\"Buildings.ThermalZones.EnergyPlus\""
- TEST_ARG="make test-optimica PACKAGE=\"Buildings.ThermalZones.EnergyPlus\""
- TEST_ARG="make test-jmodelica PACKAGE=\"Buildings.ThermalZones.EnergyPlus\""
- TEST_ARG="make test-dymola PACKAGE=\"Buildings.ThermalZones.Detailed.{BaseClasses,Constructions,Examples}\""
- TEST_ARG="make test-optimica PACKAGE=\"Buildings.ThermalZones.Detailed.{BaseClasses,Constructions,Examples}\""
- TEST_ARG="make test-jmodelica PACKAGE=\"Buildings.ThermalZones.Detailed.{BaseClasses,Constructions,Examples}\""
Expand All @@ -49,6 +52,12 @@ env:
- TEST_ARG="make test-dymola PACKAGE=\"Buildings.ThermalZones.Detailed.Validation.{Initialization,LBNL_71T,TestConditionalConstructions}\""
- TEST_ARG="make test-optimica PACKAGE=\"Buildings.ThermalZones.Detailed.Validation.{Initialization,LBNL_71T,TestConditionalConstructions}\""
- TEST_ARG="make test-jmodelica PACKAGE=\"Buildings.ThermalZones.Detailed.Validation.{Initialization,LBNL_71T,TestConditionalConstructions}\""
- TEST_ARG="make test-dymola PACKAGE=\"Buildings.ThermalZones.Detailed.FLEXLAB\""
- TEST_ARG="make test-optimica PACKAGE=\"Buildings.ThermalZones.Detailed.FLEXLAB\""
- TEST_ARG="make test-jmodelica PACKAGE=\"Buildings.ThermalZones.Detailed.FLEXLAB\""
- TEST_ARG="make test-dymola PACKAGE=\"Buildings.ThermalZones.ReducedOrder\""
- TEST_ARG="make test-optimica PACKAGE=\"Buildings.ThermalZones.ReducedOrder\""
- TEST_ARG="make test-jmodelica PACKAGE=\"Buildings.ThermalZones.ReducedOrder\""
- TEST_ARG="make test-dymola PACKAGE=\"Buildings.{Applications,Experimental}\""
- TEST_ARG="make test-optimica PACKAGE=\"Buildings.{Applications,Experimental}\""
- TEST_ARG="make test-jmodelica PACKAGE=\"Buildings.{Applications,Experimental}\""
Expand All @@ -64,12 +73,6 @@ env:
- TEST_ARG="make test-dymola PACKAGE=\"Buildings.Fluid.{MassExchangers,MixingVolumes,Movers,Sensors,SolarCollectors,Sources,Storage,Utilities}\""
- TEST_ARG="make test-optimica PACKAGE=\"Buildings.Fluid.{MassExchangers,MixingVolumes,Movers,Sensors,SolarCollectors,Sources,Storage,Utilities}\""
- TEST_ARG="make test-jmodelica PACKAGE=\"Buildings.Fluid.{MassExchangers,MixingVolumes,Movers,Sensors,SolarCollectors,Sources,Storage,Utilities}\""
- TEST_ARG="make test-dymola PACKAGE=\"Buildings.ThermalZones.Detailed.FLEXLAB\""
- TEST_ARG="make test-optimica PACKAGE=\"Buildings.ThermalZones.Detailed.FLEXLAB\""
- TEST_ARG="make test-jmodelica PACKAGE=\"Buildings.ThermalZones.Detailed.FLEXLAB\""
- TEST_ARG="make test-dymola PACKAGE=\"Buildings.ThermalZones.ReducedOrder\""
- TEST_ARG="make test-optimica PACKAGE=\"Buildings.ThermalZones.ReducedOrder\""
- TEST_ARG="make test-jmodelica PACKAGE=\"Buildings.ThermalZones.ReducedOrder\""
- TEST_ARG="make test-dymola PACKAGE=\"Buildings.Electrical\""
- TEST_ARG="make test-optimica PACKAGE=\"Buildings.Electrical\""
- TEST_ARG="make test-jmodelica PACKAGE=\"Buildings.Electrical\""
Expand Down
6 changes: 4 additions & 2 deletions Buildings/Experimental/package.mo
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ package Experimental "Package with experimental models"
annotation (preferredView="info", Documentation(info="<html>
<p>
This package contains models that are experimental.
They may be included in the <code>Buildings</code> library
if they have been shown to be useful.
The models may change in non-backward compatible ways even
between minor releases of the <code>Buildings</code> library.
The models may be moved to other packages of the <code>Buildings</code> library
if they have been shown to be useful and their development is stable.
</p>
</html>"));
end Experimental;
3 changes: 3 additions & 0 deletions Buildings/Fluid/FixedResistances/PressureDrop.mo
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ model PressureDrop
Dialog(group = "Transition to laminar",
enable = not linearized));

// Below is a temporary fix for Dymola 2020x beta2. For release, replace
// if (dp_nominal_pos > Modelica.Constants.eps) then with
// if computeFlowResistance then
final parameter Real k = if computeFlowResistance then
m_flow_nominal_pos / sqrt(dp_nominal_pos) else 0
"Flow coefficient, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2)";
Expand Down
207 changes: 207 additions & 0 deletions Buildings/Resources/C-Sources/EnergyPlusWrapper.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
#ifndef _Spawn_declared
#define _Spawn_declared

#include <ModelicaUtilities.h>
#include "EnergyPlusWrapper.h"

/* *********************************************************
Wrapper functions that connect to the library which
generates and loads the EnergyPlus fmu.
Note that ModelicaMessage, ModelicaError,
ModelicaFormatMessage and ModelicaFormatError are passed
as function pointers. These functions are provided by,
and may differ among, the Modelica environments.
Using function pointers allows the library to load the
correct version provided by the Modelica simulation
environment that compiles the Modelica model.
/* ********************************************************* */
/* Thermal zone */
void* SpawnZoneAllocate(
const char* modelicaNameBuilding,
const char* modelicaNameThermalZone,
const char* idfName,
const char* weaName,
const char* zoneName,
int usePrecompiledFMU,
const char* fmuName,
const char* buildingsLibraryRoot,
const int logLevel){

return EnergyPlusZoneAllocate(
modelicaNameBuilding,
modelicaNameThermalZone,
idfName,
weaName,
zoneName,
usePrecompiledFMU,
fmuName,
buildingsLibraryRoot,
logLevel,
ModelicaMessage,
ModelicaError,
ModelicaFormatMessage,
ModelicaFormatError);
}

void SpawnZoneInstantiate(
void* object,
double startTime,
double* AFlo,
double* V,
double* mSenFac){

EnergyPlusZoneInstantiate(object, startTime, AFlo, V, mSenFac);
}

void SpawnZoneExchange(
void* object,
int initialCall,
double T,
double X,
double mInlets_flow,
double TAveInlet,
double QGaiRad_flow,
double AFlo,
double time,
double* TRad,
double* QConSen_flow,
double* dQConSen_flow,
double* QLat_flow,
double* QPeo_flow,
double* tNext){

EnergyPlusZoneExchange(
object,
initialCall,
T,
X,
mInlets_flow,
TAveInlet,
QGaiRad_flow,
AFlo,
time,
TRad,
QConSen_flow,
dQConSen_flow,
QLat_flow,
QPeo_flow,
tNext);
}

void SpawnZoneFree(void* object){

EnergyPlusZoneFree(object);
}

/* ********************************************************* */
/* Input variables */
void* SpawnInputVariableAllocate(
const int objectType,
const char* modelicaNameBuilding,
const char* modelicaNameInputVariable,
const char* idfName,
const char* weaName,
const char* name,
const char* componentType,
const char* controlType,
const char* unit,
int usePrecompiledFMU,
const char* fmuName,
const char* buildingsLibraryRoot,
const int logLevel){

return EnergyPlusInputVariableAllocate(
objectType,
modelicaNameBuilding,
modelicaNameInputVariable,
idfName,
weaName,
name,
componentType,
controlType,
unit,
usePrecompiledFMU,
fmuName,
buildingsLibraryRoot,
logLevel,
ModelicaMessage,
ModelicaError,
ModelicaFormatMessage,
ModelicaFormatError);
}

void SpawnInputVariableInstantiate(void* object, double t0){

EnergyPlusInputVariableInstantiate(object, t0);
}

void SpawnInputVariableExchange(
void* object,
int initialCall,
double u,
double time,
double* y){

EnergyPlusInputVariableExchange(object, initialCall, u, time, y);
}

void SpawnInputVariableFree(void* object){

EnergyPlusInputVariableFree(object);
}

/* ********************************************************* */
/* Output variables */
void* SpawnOutputVariableAllocate(
const char* modelicaNameBuilding,
const char* modelicaNameOutputVariable,
const char* idfName,
const char* weaName,
const char* variableName,
const char* componentKey,
int usePrecompiledFMU,
const char* fmuName,
const char* buildingsLibraryRoot,
const int logLevel,
int printUnit){

return EnergyPlusOutputVariableAllocate(
modelicaNameBuilding,
modelicaNameOutputVariable,
idfName,
weaName,
variableName,
componentKey,
usePrecompiledFMU,
fmuName,
buildingsLibraryRoot,
logLevel,
printUnit,
ModelicaMessage,
ModelicaError,
ModelicaFormatMessage,
ModelicaFormatError);
}

void SpawnOutputVariableInstantiate(void* object, double t0){
EnergyPlusOutputVariableInstantiate(object, t0);
}

void SpawnOutputVariableExchange(
void* object,
int initialCall,
double directDependency,
double time,
double* y,
double* tNext){

EnergyPlusOutputVariableExchange(object, initialCall, directDependency, time, y, tNext);
}

void SpawnOutputVariableFree(void* object){

EnergyPlusOutputVariableFree(object);
}

#endif
Loading

0 comments on commit 8195ac0

Please sign in to comment.