Skip to content

Commit

Permalink
Merge pull request #2282 from NREL/jmarrec_merge
Browse files Browse the repository at this point in the history
Monster merge of work done by @jmarrec 

Adding objects:
OS:Generator:MicroTurbine
OS:Generator:MicroTurbine:HeatRecovery
OS:ElectricLoadCenter:Storage:Simple
OS:ElectricLoadCenter:Storage:Converter
OS:Meter:Custom
OS:Meter:CustomDecrement

Renaming object OS:Meter -> OS:Output:Meter, OS:Meter name remains supported in Ruby bindings
  • Loading branch information
macumber authored Jul 6, 2016
2 parents ce7a0d6 + 42a7787 commit 7d1634e
Show file tree
Hide file tree
Showing 94 changed files with 10,562 additions and 1,083 deletions.
Binary file modified doc/Adding_Model_Object_to_OpenStudio.docx
Binary file not shown.
2 changes: 2 additions & 0 deletions openstudiocore/resources/energyplus/ProposedEnergy+.idd
Original file line number Diff line number Diff line change
Expand Up @@ -52456,6 +52456,8 @@ ElectricLoadCenter:Distribution,
\note Controls timing and magnitude of discharging storage
\note Required field if Storage Operation Scheme is set to TrackChargeDischargeSchedules.
\note Schedule values should be fractions from 0.0 to 1.0, inclusive.
\type object-list
\object-list ScheduleNames
N6, \field Storage Control Utility Demand Target
\note Target utility service demand power for discharge control. Storage draws are adjusted upwards for conversion losses.
\note Required field for FacilityDemandLeveling storage operation scheme
Expand Down
556 changes: 545 additions & 11 deletions openstudiocore/resources/model/OpenStudio.idd

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions openstudiocore/ruby/openstudio.rb
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,38 @@

# "typedefs" for backwards compatibility
module OpenStudio

# support for deprecated names
class IdfObject
def to_Meter
return to_OutputMeter
end
end

module Model

# support for deprecated names
class Model
def getMeter(handle)
return getOutputMeter(handle)
end
def getMeters
return getOutputMeters
end
def getMeterByName(name)
return getOutputMeterByName(name)
end
def getMetersByName(name)
return getOutputMetersByName(name)
end
end

# support for name deprecated as of 1.12.1
class Meter < OutputMeter
end

end # module Model

module Ruleset

# support for name deprecated as of 0.10.1
Expand Down
33 changes: 32 additions & 1 deletion openstudiocore/ruby/openstudio_dev.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@
require 'openstudiomodeleditor'
require 'openstudioanalysis'
require 'openstudiolib'
require 'openstudioosversion'
require 'openstudioisomodel'
require 'openstudiosdd'

Expand Down Expand Up @@ -182,6 +181,38 @@

# "typedefs" for backwards compatibility
module OpenStudio

# support for deprecated names
class IdfObject
def to_Meter
return to_OutputMeter
end
end

module Model

# support for deprecated names
class Model
def getMeter(handle)
return getOutputMeter(handle)
end
def getMeters
return getOutputMeters
end
def getMeterByName(name)
return getOutputMeterByName(name)
end
def getMetersByName(name)
return getOutputMetersByName(name)
end
end

# support for name deprecated as of 1.12.1
class Meter < OutputMeter
end

end # module Model

module Ruleset

# support for name deprecated as of 0.10.1
Expand Down
10 changes: 9 additions & 1 deletion openstudiocore/src/energyplus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ set(${target_name}_src
ForwardTranslator/ForwardTranslateElectricLoadCenterDistribution.cpp
ForwardTranslator/ForwardTranslateElectricLoadCenterInverterLookUpTable.cpp
ForwardTranslator/ForwardTranslateElectricLoadCenterInverterSimple.cpp
ForwardTranslator/ForwardTranslateElectricLoadCenterStorageSimple.cpp
ForwardTranslator/ForwardTranslateEvaporativeCoolerDirectResearchSpecial.cpp
ForwardTranslator/ForwardTranslateEvaporativeCoolerIndirectResearchSpecial.cpp
ForwardTranslator/ForwardTranslateEvaporativeFluidCoolerSingleSpeed.cpp
Expand All @@ -134,6 +135,7 @@ set(${target_name}_src
ForwardTranslator/ForwardTranslateGasEquipment.cpp
ForwardTranslator/ForwardTranslateGasMixture.cpp
ForwardTranslator/ForwardTranslateGeneratorPhotovoltaic.cpp
ForwardTranslator/ForwardTranslateGeneratorMicroTurbine.cpp
ForwardTranslator/ForwardTranslateGroundHeatExchangerHorizontalTrench.cpp
ForwardTranslator/ForwardTranslateGroundHeatExchangerVertical.cpp
ForwardTranslator/ForwardTranslateHeaderedPumpsConstantSpeed.cpp
Expand All @@ -158,11 +160,13 @@ set(${target_name}_src
ForwardTranslator/ForwardTranslateLuminaire.cpp
ForwardTranslator/ForwardTranslateMaterialPropertyGlazingSpectralData.cpp
ForwardTranslator/ForwardTranslateMasslessOpaqueMaterial.cpp
ForwardTranslator/ForwardTranslateMeter.cpp
ForwardTranslator/ForwardTranslateMeterCustom.cpp
ForwardTranslator/ForwardTranslateMeterCustomDecrement.cpp
ForwardTranslator/ForwardTranslateNode.cpp
ForwardTranslator/ForwardTranslateOtherEquipment.cpp
ForwardTranslator/ForwardTranslateOutsideSurfaceConvectionAlgorithm.cpp
ForwardTranslator/ForwardTranslateOutputControlReportingTolerances.cpp
ForwardTranslator/ForwardTranslateOutputMeter.cpp
ForwardTranslator/ForwardTranslateOutputVariable.cpp
ForwardTranslator/ForwardTranslatePeople.cpp
ForwardTranslator/ForwardTranslatePhotovoltaicPerformanceEquivalentOneDiode.cpp
Expand Down Expand Up @@ -354,12 +358,14 @@ set(${target_name}_src
ReverseTranslator/ReverseTranslateDaylightingControls.cpp
ReverseTranslator/ReverseTranslateDesignSpecificationOutdoorAir.cpp
ReverseTranslator/ReverseTranslateElectricEquipment.cpp
ReverseTranslator/ReverseTranslateElectricLoadCenterStorageSimple.cpp
ReverseTranslator/ReverseTranslateEvaporativeCoolerDirectResearchSpecial.cpp
ReverseTranslator/ReverseTranslateEvaporativeFluidCoolerSingleSpeed.cpp
ReverseTranslator/ReverseTranslateExteriorLights.cpp
ReverseTranslator/ReverseTranslateFanConstantVolume.cpp
ReverseTranslator/ReverseTranslateFenestrationSurfaceDetailed.cpp
ReverseTranslator/ReverseTranslateGasEquipment.cpp
ReverseTranslator/ReverseTranslateGeneratorMicroTurbine.cpp
ReverseTranslator/ReverseTranslateGroundHeatExchangerVertical.cpp
ReverseTranslator/ReverseTranslateHeatBalanceAlgorithm.cpp
ReverseTranslator/ReverseTranslateHotWaterEquipment.cpp
Expand All @@ -368,6 +374,8 @@ set(${target_name}_src
ReverseTranslator/ReverseTranslateMaterial.cpp
ReverseTranslator/ReverseTranslateMaterialAirGap.cpp
ReverseTranslator/ReverseTranslateMaterialNoMass.cpp
ReverseTranslator/ReverseTranslateMeterCustom.cpp
ReverseTranslator/ReverseTranslateMeterCustomDecrement.cpp
ReverseTranslator/ReverseTranslateOtherEquipment.cpp
ReverseTranslator/ReverseTranslateOutputIlluminanceMap.cpp
ReverseTranslator/ReverseTranslateOutputMeter.cpp
Expand Down
51 changes: 45 additions & 6 deletions openstudiocore/src/energyplus/ForwardTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,16 @@ Workspace ForwardTranslator::translateModelPrivate( model::Model & model, bool f
}
}
}

// remove orphan Generator:MicroTurbine
for (auto& chp : model.getConcreteModelObjects<GeneratorMicroTurbine>()){
if (!chp.electricLoadCenterDistribution()){
LOG(Warn, "GeneratorMicroTurbine " << chp.name().get() << " is not referenced by any ElectricLoadCenterDistribution, it will not be translated.");
chp.remove();
continue;
}
}


// remove orphan photovoltaics
for (auto& pv : model.getConcreteModelObjects<GeneratorPhotovoltaic>()){
Expand Down Expand Up @@ -369,8 +379,8 @@ Workspace ForwardTranslator::translateModelPrivate( model::Model & model, bool f
std::vector<UtilityBill> utilityBills = model.getConcreteModelObjects<UtilityBill>();
for (UtilityBill utilityBill : utilityBills){
// these meters and variables will be translated later
Meter consumptionMeter = utilityBill.consumptionMeter();
boost::optional<Meter> peakDemandMeter = utilityBill.peakDemandMeter();
OutputMeter consumptionMeter = utilityBill.consumptionMeter();
boost::optional<OutputMeter> peakDemandMeter = utilityBill.peakDemandMeter();
}
}

Expand Down Expand Up @@ -1307,6 +1317,12 @@ boost::optional<IdfObject> ForwardTranslator::translateAndMapModelObject(ModelOb
retVal = translateElectricLoadCenterInverterSimple(temp);
break;
}
case openstudio::IddObjectType::OS_ElectricLoadCenter_Storage_Simple:
{
model::ElectricLoadCenterStorageSimple temp = modelObject.cast<ElectricLoadCenterStorageSimple>();
retVal = translateElectricLoadCenterStorageSimple(temp);
break;
}
case openstudio::IddObjectType::OS_EvaporativeCooler_Direct_ResearchSpecial :
{
model::EvaporativeCoolerDirectResearchSpecial evap = modelObject.cast<EvaporativeCoolerDirectResearchSpecial>();
Expand Down Expand Up @@ -1384,6 +1400,13 @@ boost::optional<IdfObject> ForwardTranslator::translateAndMapModelObject(ModelOb
retVal = translateFluidCoolerTwoSpeed(fluidCoolerTwoSpeed);
break;
}
case openstudio::IddObjectType::OS_Generator_MicroTurbine:
{
// Will also translate the Generator:MicroTurbine:HeatRecovery if there is one
model::GeneratorMicroTurbine temp = modelObject.cast<GeneratorMicroTurbine>();
retVal = translateGeneratorMicroTurbine(temp);
break;
}
case openstudio::IddObjectType::OS_Generator_Photovoltaic:
{
model::GeneratorPhotovoltaic temp = modelObject.cast<GeneratorPhotovoltaic>();
Expand Down Expand Up @@ -1650,10 +1673,16 @@ boost::optional<IdfObject> ForwardTranslator::translateAndMapModelObject(ModelOb
retVal = translateRoofVegetation(material);
break;
}
case openstudio::IddObjectType::OS_Meter :
case openstudio::IddObjectType::OS_Meter_Custom :
{
model::MeterCustom meterCustom = modelObject.cast<MeterCustom>();
retVal = translateMeterCustom(meterCustom);
break;
}
case openstudio::IddObjectType::OS_Meter_CustomDecrement :
{
model::Meter meter = modelObject.cast<Meter>();
retVal = translateMeter(meter);
model::MeterCustomDecrement meterCustomDecrement = modelObject.cast<MeterCustomDecrement>();
retVal = translateMeterCustomDecrement(meterCustomDecrement);
break;
}
case openstudio::IddObjectType::OS_ModelObjectList :
Expand Down Expand Up @@ -1774,6 +1803,12 @@ boost::optional<IdfObject> ForwardTranslator::translateAndMapModelObject(ModelOb
retVal = translateOutputControlReportingTolerances(outputControl);
break;
}
case openstudio::IddObjectType::OS_Output_Meter :
{
model::OutputMeter meter = modelObject.cast<OutputMeter>();
retVal = translateOutputMeter(meter);
break;
}
case openstudio::IddObjectType::OS_Output_Variable :
{
model::OutputVariable outputVariable = modelObject.cast<OutputVariable>();
Expand Down Expand Up @@ -2879,16 +2914,20 @@ std::vector<IddObjectType> ForwardTranslator::iddObjectsToTranslateInitializer()
result.push_back(IddObjectType::OS_Refrigeration_TranscriticalSystem);

result.push_back(IddObjectType::OS_ElectricLoadCenter_Distribution);
result.push_back(IddObjectType::OS_Generator_MicroTurbine);
result.push_back(IddObjectType::OS_Generator_Photovoltaic);
result.push_back(IddObjectType::OS_PhotovoltaicPerformance_EquivalentOneDiode);
result.push_back(IddObjectType::OS_PhotovoltaicPerformance_Simple);
result.push_back(IddObjectType::OS_ElectricLoadCenter_Inverter_LookUpTable);
result.push_back(IddObjectType::OS_ElectricLoadCenter_Inverter_Simple);
result.push_back(IddObjectType::OS_ElectricLoadCenter_Storage_Simple);

// put these down here so they have a chance to be translated with their "parent"
result.push_back(IddObjectType::OS_LifeCycleCost);

result.push_back(IddObjectType::OS_Meter);
result.push_back(IddObjectType::OS_Output_Meter);
result.push_back(IddObjectType::OS_Meter_Custom);
result.push_back(IddObjectType::OS_Meter_CustomDecrement);
result.push_back(IddObjectType::OS_Output_Variable);

return result;
Expand Down
18 changes: 15 additions & 3 deletions openstudiocore/src/energyplus/ForwardTranslator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class ElectricEquipment;
class ElectricLoadCenterDistribution;
class ElectricLoadCenterInverterLookUpTable;
class ElectricLoadCenterInverterSimple;
class ElectricLoadCenterStorageSimple;
class EvaporativeCoolerDirectResearchSpecial;
class EvaporativeCoolerIndirectResearchSpecial;
class EvaporativeFluidCoolerSingleSpeed;
Expand All @@ -157,6 +158,7 @@ class FluidCoolerTwoSpeed;
class Gas;
class GasEquipment;
class GasMixture;
class GeneratorMicroTurbine;
class GeneratorPhotovoltaic;
class GroundHeatExchangerHorizontalTrench;
class GroundHeatExchangerVertical;
Expand All @@ -182,11 +184,13 @@ class Lights;
class Luminaire;
class MaterialPropertyGlazingSpectralData;
class MasslessOpaqueMaterial;
class Meter;
class MeterCustom;
class MeterCustomDecrement;
class Node;
class OtherEquipment;
class OutsideSurfaceConvectionAlgorithm;
class OutputControlReportingTolerances;
class OutputMeter;
class OutputVariable;
class People;
class PhotovoltaicPerformanceEquivalentOneDiode;
Expand Down Expand Up @@ -633,6 +637,8 @@ class ENERGYPLUS_API ForwardTranslator {
boost::optional<IdfObject> translateElectricLoadCenterInverterLookUpTable( model::ElectricLoadCenterInverterLookUpTable & modelObject );

boost::optional<IdfObject> translateElectricLoadCenterInverterSimple( model::ElectricLoadCenterInverterSimple & modelObject );

boost::optional<IdfObject> translateElectricLoadCenterStorageSimple( model::ElectricLoadCenterStorageSimple & modelObject );

boost::optional<IdfObject> translateEvaporativeFluidCoolerSingleSpeed( model::EvaporativeFluidCoolerSingleSpeed & modelObject );

Expand Down Expand Up @@ -664,6 +670,8 @@ class ENERGYPLUS_API ForwardTranslator {

boost::optional<IdfObject> translateGasMixture( model::GasMixture & modelObject );

boost::optional<IdfObject> translateGeneratorMicroTurbine( model::GeneratorMicroTurbine & modelObject );

boost::optional<IdfObject> translateGeneratorPhotovoltaic( model::GeneratorPhotovoltaic & modelObject );

boost::optional<IdfObject> translateGroundHeatExchangerHorizontalTrench( model::GroundHeatExchangerHorizontalTrench & modelObject );
Expand Down Expand Up @@ -713,8 +721,10 @@ class ENERGYPLUS_API ForwardTranslator {
boost::optional<IdfObject> translateMaterialPropertyGlazingSpectralData( model::MaterialPropertyGlazingSpectralData & modelObject );

boost::optional<IdfObject> translateMasslessOpaqueMaterial( model::MasslessOpaqueMaterial & modelObject );

boost::optional<IdfObject> translateMeter( model::Meter & modelObject );

boost::optional<IdfObject> translateMeterCustom( model::MeterCustom & modelObject );

boost::optional<IdfObject> translateMeterCustomDecrement( model::MeterCustomDecrement & modelObject );

boost::optional<IdfObject> translateNode( model::Node & modelObject );

Expand All @@ -724,6 +734,8 @@ class ENERGYPLUS_API ForwardTranslator {

boost::optional<IdfObject> translateOutputControlReportingTolerances( model::OutputControlReportingTolerances & modelObject );

boost::optional<IdfObject> translateOutputMeter( model::OutputMeter & modelObject );

boost::optional<IdfObject> translateOutputVariable( model::OutputVariable & modelObject );

boost::optional<IdfObject> translatePeople( model::People & modelObject );
Expand Down
Loading

8 comments on commit 7d1634e

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (macumber) - x86_64-MacOS-10.10-clang: OK (2405 of 2447 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (macumber) - x86_64-Linux-Ubuntu-14.04-clang-3.5: OK (2380 of 2447 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (macumber) - x86_64-Linux-Ubuntu-14.04-cppcheck-1.61: OK (0 of 0 tests passed, 0 test warnings)

Build Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iteration (macumber) - x86_64-MacOS-10.10-clang: OK (2406 of 2447 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iteration (macumber) - x86_64-Linux-Ubuntu-14.04-clang-3.5: OK (2379 of 2447 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iteration (macumber) - x86_64-Linux-Ubuntu-14.04-cppcheck-1.61: OK (0 of 0 tests passed, 0 test warnings)

Build Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iteration (macumber) - i386-Windows-7-VisualStudio-12: OK (2425 of 2447 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iteration (macumber) - Win64-Windows-7-VisualStudio-12: OK (2421 of 2447 tests passed, 0 test warnings)

Build Badge Test Badge

Please sign in to comment.