本文整理汇总了C++中IdfExtensibleGroup::setString方法的典型用法代码示例。如果您正苦于以下问题:C++ IdfExtensibleGroup::setString方法的具体用法?C++ IdfExtensibleGroup::setString怎么用?C++ IdfExtensibleGroup::setString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IdfExtensibleGroup
的用法示例。
在下文中一共展示了IdfExtensibleGroup::setString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: supplyPathIdf
boost::optional<IdfObject> ForwardTranslator::createAirLoopHVACSupplyPath( AirLoopHVAC & airLoopHVAC )
{
std::string s;
IdfObject supplyPathIdf(openstudio::IddObjectType::AirLoopHVAC_SupplyPath);
m_idfObjects.push_back(supplyPathIdf);
supplyPathIdf.setName(airLoopHVAC.name().get() + " Supply Path");
model::Node node = airLoopHVAC.demandInletNode();
supplyPathIdf.setString(openstudio::AirLoopHVAC_SupplyPathFields::SupplyAirPathInletNodeName,node.name().get());
model::AirLoopHVACZoneSplitter zoneSplitter = airLoopHVAC.zoneSplitter();
boost::optional<IdfObject> _zoneSplitter = translateAndMapModelObject(zoneSplitter);
OS_ASSERT(_zoneSplitter);
IdfExtensibleGroup eg = supplyPathIdf.pushExtensibleGroup();
eg.setString(AirLoopHVAC_SupplyPathExtensibleFields::ComponentObjectType,_zoneSplitter->iddObject().name());
eg.setString(AirLoopHVAC_SupplyPathExtensibleFields::ComponentName,_zoneSplitter->name().get());
std::vector<ModelObject> supplyPlenums = airLoopHVAC.demandComponents(AirLoopHVACSupplyPlenum::iddObjectType());
for( std::vector<ModelObject>::iterator it = supplyPlenums.begin();
it != supplyPlenums.end();
it++ )
{
eg = supplyPathIdf.pushExtensibleGroup();
boost::optional<IdfObject> _supplyPlenum = translateAndMapModelObject(*it);
OS_ASSERT(_supplyPlenum);
eg.setString(AirLoopHVAC_SupplyPathExtensibleFields::ComponentObjectType,_supplyPlenum->iddObject().name());
eg.setString(AirLoopHVAC_SupplyPathExtensibleFields::ComponentName,_supplyPlenum->name().get());
}
return boost::optional<IdfObject>(supplyPathIdf);
}
示例2: supplyPathIdf
boost::optional<IdfObject> ForwardTranslator::createAirLoopHVACSupplyPath( const Node & demandInletNode )
{
boost::optional<IdfObject> supplyPathIdf;
if( auto t_airLoopHVAC = demandInletNode.airLoopHVAC() ) {
IdfObject supplyPathIdf(openstudio::IddObjectType::AirLoopHVAC_SupplyPath);
m_idfObjects.push_back(supplyPathIdf);
supplyPathIdf.setName(t_airLoopHVAC->name().get() + " " + demandInletNode.name().get() + " Supply Path");
supplyPathIdf.setString(openstudio::AirLoopHVAC_SupplyPathFields::SupplyAirPathInletNodeName,demandInletNode.name().get());
auto t_comps = t_airLoopHVAC->demandComponents(demandInletNode,t_airLoopHVAC->demandOutletNode());
auto splitters = subsetCastVector<model::AirLoopHVACZoneSplitter>(t_comps);
OS_ASSERT(splitters.size() == 1u);
boost::optional<IdfObject> _zoneSplitter = translateAndMapModelObject(splitters.front());
OS_ASSERT(_zoneSplitter);
IdfExtensibleGroup eg = supplyPathIdf.pushExtensibleGroup();
eg.setString(AirLoopHVAC_SupplyPathExtensibleFields::ComponentObjectType,_zoneSplitter->iddObject().name());
eg.setString(AirLoopHVAC_SupplyPathExtensibleFields::ComponentName,_zoneSplitter->name().get());
std::vector<ModelObject> supplyPlenums = t_airLoopHVAC->demandComponents(demandInletNode,t_airLoopHVAC->demandOutletNode(),AirLoopHVACSupplyPlenum::iddObjectType());
for( auto & supplyPlenum : supplyPlenums )
{
eg = supplyPathIdf.pushExtensibleGroup();
boost::optional<IdfObject> _supplyPlenum = translateAndMapModelObject(supplyPlenum);
OS_ASSERT(_supplyPlenum);
eg.setString(AirLoopHVAC_SupplyPathExtensibleFields::ComponentObjectType,_supplyPlenum->iddObject().name());
eg.setString(AirLoopHVAC_SupplyPathExtensibleFields::ComponentName,_supplyPlenum->name().get());
}
}
return supplyPathIdf;
}
示例3: returnPathIdf
boost::optional<IdfObject> ForwardTranslator::createAirLoopHVACReturnPath( AirLoopHVAC & airLoopHVAC )
{
IdfObject returnPathIdf(openstudio::IddObjectType::AirLoopHVAC_ReturnPath);
m_idfObjects.push_back(returnPathIdf);
returnPathIdf.setName(airLoopHVAC.name().get() + " Return Path");
Node node = airLoopHVAC.demandOutletNode();
returnPathIdf.setString(openstudio::AirLoopHVAC_ReturnPathFields::ReturnAirPathOutletNodeName,node.name().get());
std::vector<ModelObject> returnPlenums = airLoopHVAC.demandComponents(AirLoopHVACReturnPlenum::iddObjectType());
for( auto & returnPlenum : returnPlenums )
{
IdfExtensibleGroup eg = returnPathIdf.pushExtensibleGroup();
boost::optional<IdfObject> _returnPlenum = translateAndMapModelObject(returnPlenum);
OS_ASSERT(_returnPlenum);
eg.setString(AirLoopHVAC_ReturnPathExtensibleFields::ComponentObjectType,_returnPlenum->iddObject().name());
eg.setString(AirLoopHVAC_ReturnPathExtensibleFields::ComponentName,_returnPlenum->name().get());
}
AirLoopHVACZoneMixer zoneMixer = airLoopHVAC.zoneMixer();
boost::optional<IdfObject> _zoneMixer = translateAndMapModelObject(zoneMixer);
OS_ASSERT(_zoneMixer);
IdfExtensibleGroup eg = returnPathIdf.pushExtensibleGroup();
eg.setString(AirLoopHVAC_ReturnPathExtensibleFields::ComponentObjectType,_zoneMixer->iddObject().name());
eg.setString(AirLoopHVAC_ReturnPathExtensibleFields::ComponentName,_zoneMixer->name().get());
return boost::optional<IdfObject>(returnPathIdf);
}
示例4: designDay
TEST_F(ModelFixture, ComponentWatcher_InComponent) {
// create Component. ComponentWatcher should work here too (since Component is Model)
Model model;
DesignDay designDay(model);
EXPECT_EQ(1u,model.numObjects());
Component designDayComponent = designDay.createComponent();
EXPECT_EQ(2u,designDayComponent.numObjects());
ComponentData cd = designDayComponent.componentData();
UUID versionUUID = cd.versionUUID();
designDay = designDayComponent.primaryObject().cast<DesignDay>();
// data changes ok--changes version
EXPECT_TRUE(designDay.setName("My Design Day"));
EXPECT_NE(versionUUID,cd.versionUUID());
versionUUID = cd.versionUUID();
// trying to assign contents results in refresh of contents
IdfExtensibleGroup eg = cd.getExtensibleGroup(0);
ASSERT_FALSE(eg.empty());
std::string originalValue = eg.getString(0).get();
EXPECT_FALSE(eg.setString(0,"Material"));
EXPECT_TRUE(cd.initialized());
EXPECT_EQ(2u,designDayComponent.numObjects());
EXPECT_EQ(originalValue,eg.getString(0).get());
}
示例5: idfObject
boost::optional<IdfObject> ForwardTranslator::translateZoneHVACEquipmentList( ZoneHVACEquipmentList & modelObject )
{
OptionalString s;
OptionalDouble d;
OptionalModelObject temp;
std::vector<ModelObject> objects = modelObject.equipment();
if (objects.empty()){
// do not write out this object
return boost::none;
}
IdfObject idfObject(IddObjectType::ZoneHVAC_EquipmentList);
// Name
s = modelObject.name();
if(s)
{
idfObject.setName(*s);
}
for( std::vector<ModelObject>::iterator it = objects.begin();
it != objects.end();
it++ )
{
unsigned coolingPriority = modelObject.coolingPriority(*it);
unsigned heatingPriority = modelObject.heatingPriority(*it);
boost::optional<IdfObject> _equipment = translateAndMapModelObject(*it);
if( _equipment )
{
IdfExtensibleGroup eg = idfObject.pushExtensibleGroup();
eg.setString(ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentObjectType,_equipment->iddObject().name());
eg.setString(ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentName,_equipment->name().get());
eg.setUnsigned(ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentCoolingSequence,coolingPriority);
eg.setUnsigned(ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentHeatingorNoLoadSequence,heatingPriority);
}
}
m_idfObjects.push_back(idfObject);
return idfObject;
}
示例6: setComputeStep
bool UtilityCost_Computation_Impl::setComputeStep(unsigned index, const std::string& str) {
IdfExtensibleGroup eg = getExtensibleGroup(index);
if (!eg.empty()) {
return eg.setString(OS_UtilityCost_ComputationExtensibleFields::ComputeStep,str);
}
else {
StringVector values(1u,str);
return !insertExtensibleGroup(index,values).empty();
}
OS_ASSERT(false);
return false;
}
示例7: createRegisterAndNameIdfObject
boost::optional<IdfObject> ForwardTranslator::translateScheduleDay( ScheduleDay & modelObject )
{
IdfObject scheduleDay = createRegisterAndNameIdfObject(openstudio::IddObjectType::Schedule_Day_Interval,
modelObject);
boost::optional<ScheduleTypeLimits> scheduleTypeLimits = modelObject.scheduleTypeLimits();
if (scheduleTypeLimits){
boost::optional<IdfObject> idfScheduleTypeLimits = translateAndMapModelObject(*scheduleTypeLimits);
if (idfScheduleTypeLimits){
scheduleDay.setString(Schedule_Day_IntervalFields::ScheduleTypeLimitsName, idfScheduleTypeLimits->name().get());
}
}
if (modelObject.interpolatetoTimestep()){
scheduleDay.setString(Schedule_Day_IntervalFields::InterpolatetoTimestep, "Yes");
}else{
scheduleDay.setString(Schedule_Day_IntervalFields::InterpolatetoTimestep, "No");
}
std::vector<double> values = modelObject.values();
std::vector<openstudio::Time> times = modelObject.times();
unsigned N = values.size();
OS_ASSERT(N == times.size());
scheduleDay.clearExtensibleGroups();
for (unsigned i = 0; i < N; ++i){
IdfExtensibleGroup group = scheduleDay.pushExtensibleGroup();
std::string hourPrefix;
std::string minutePrefix;
int hours = times[i].hours() + 24*times[i].days();
if (hours < 10){
hourPrefix = "0";
}
int minutes = times[i].minutes() + floor((times[i].seconds()/60.0) + 0.5);
if (minutes < 10){
minutePrefix = "0";
}
std::stringstream ss;
ss << hourPrefix << hours << ":" << minutePrefix << minutes;
group.setString(Schedule_Day_IntervalExtensibleFields::Time, ss.str());
group.setDouble(Schedule_Day_IntervalExtensibleFields::ValueUntilTime, values[i]);
}
return scheduleDay;
}
示例8: setBlockCostPerUnitValueOrVariableName
bool UtilityCost_Charge_Block_Impl::setBlockCostPerUnitValueOrVariableName(unsigned index, const std::string& str) {
IdfExtensibleGroup eg = getExtensibleGroup(index);
if (!eg.empty()) {
return eg.setString(OS_UtilityCost_Charge_BlockExtensibleFields::BlockCostperUnitValueorVariableName,str);
}
else {
StringVector values(2u);
values[OS_UtilityCost_Charge_BlockExtensibleFields::BlockCostperUnitValueorVariableName] = str;
return !insertExtensibleGroup(index,values).empty();
}
OS_ASSERT(false);
return false;
}
示例9: setThermalComfortModelType
bool PeopleDefinition_Impl::setThermalComfortModelType(
int i, const std::string& thermalComfortModelType)
{
int n = numThermalComfortModelTypes();
if (i == n) {
return pushThermalComfortModelType(thermalComfortModelType);
}
if (i < n) {
IdfExtensibleGroup eg = getExtensibleGroup(i);
OS_ASSERT(!eg.empty());
return eg.setString(OS_People_DefinitionExtensibleFields::ThermalComfortModelType,
thermalComfortModelType);
}
return false;
}
示例10: startDate
boost::optional<IdfObject> ForwardTranslator::translateScheduleYear( ScheduleYear & modelObject )
{
IdfObject scheduleYear = createRegisterAndNameIdfObject(openstudio::IddObjectType::Schedule_Year,
modelObject);
std::vector<ScheduleWeek> scheduleWeeks = modelObject.scheduleWeeks();
std::vector<openstudio::Date> dates = modelObject.dates();
unsigned N = scheduleWeeks.size();
if( N != dates.size() )
{
LOG(Error,"Could not translate " << modelObject.briefDescription() << ", because the number of week schedules does not match the number of dates.");
return boost::none;
}
boost::optional<ScheduleTypeLimits> scheduleTypeLimits = modelObject.scheduleTypeLimits();
if (scheduleTypeLimits){
boost::optional<IdfObject> idfScheduleTypeLimits = translateAndMapModelObject(*scheduleTypeLimits);
if (idfScheduleTypeLimits){
scheduleYear.setString(Schedule_YearFields::ScheduleTypeLimitsName, idfScheduleTypeLimits->name().get());
}
}
openstudio::Date startDate(MonthOfYear::Jan, 1);
scheduleYear.clearExtensibleGroups();
for (unsigned i = 0; i < N; ++i){
IdfExtensibleGroup group = scheduleYear.pushExtensibleGroup();
boost::optional<IdfObject> idfScheduleWeek = translateAndMapModelObject(scheduleWeeks[i]);
if (idfScheduleWeek){
group.setString(Schedule_YearExtensibleFields::Schedule_WeekName, idfScheduleWeek->name().get());
}
group.setInt(Schedule_YearExtensibleFields::StartMonth, startDate.monthOfYear().value());
group.setUnsigned(Schedule_YearExtensibleFields::StartDay, startDate.dayOfMonth());
group.setInt(Schedule_YearExtensibleFields::EndMonth, dates[i].monthOfYear().value());
group.setUnsigned(Schedule_YearExtensibleFields::EndDay, dates[i].dayOfMonth());
startDate = dates[i] + openstudio::Time(1,0,0);
}
return scheduleYear;
}
示例11: idfObject
boost::optional<IdfObject> ForwardTranslator::translatePortList( PortList & modelObject )
{
OptionalString s;
OptionalDouble d;
OptionalModelObject temp;
// Create a new IddObjectType::NodeList
// If you don't want a node list based on the port list, don't use this translator
std::vector<ModelObject> modelObjects = modelObject.modelObjects();
if (modelObjects.empty()){
// do not write out this object
return boost::none;
}
IdfObject idfObject(IddObjectType::NodeList);
// Name
s = modelObject.name();
if(s)
{
idfObject.setName(*s);
}
for( std::vector<ModelObject>::iterator it = modelObjects.begin();
it != modelObjects.end();
it++ )
{
if( boost::optional<Node> node = it->optionalCast<Node>() )
{
IdfExtensibleGroup group = idfObject.pushExtensibleGroup();
group.setString(NodeListExtensibleFields::NodeName,node->name().get());
}
}
m_idfObjects.push_back(idfObject);
return idfObject;
}
示例12: object
TEST_F(IdfFixture,WorkspaceObjectWatcher_RelationshipFieldChanges)
{
IdfObject object(IddObjectType::DaylightingDevice_Tubular);
Workspace workspace(StrictnessLevel::Draft, IddFileType::EnergyPlus);
OptionalWorkspaceObject owo = workspace.addObject(object);
ASSERT_TRUE(owo);
WorkspaceObject tdd = *owo;
WorkspaceObjectWatcher watcher(tdd);
EXPECT_FALSE(watcher.dirty());
// add zone objects
object = IdfObject(IddObjectType::Zone);
owo = workspace.addObject(object);
ASSERT_TRUE(owo);
EXPECT_EQ("Zone 1",owo->name().get());
owo = workspace.addObject(object);
ASSERT_TRUE(owo);
EXPECT_EQ("Zone 2",owo->name().get());
owo = workspace.addObject(object);
ASSERT_TRUE(owo);
EXPECT_EQ("Zone 3",owo->name().get());
EXPECT_FALSE(watcher.dirty());
vector<string> vals;
vals.push_back("Zone 1");
vals.push_back("1.0");
IdfExtensibleGroup eg = tdd.pushExtensibleGroup(vals);
ASSERT_FALSE(eg.empty());
EXPECT_TRUE(watcher.dirty());
EXPECT_TRUE(watcher.dataChanged());
EXPECT_FALSE(watcher.nameChanged());
EXPECT_TRUE(watcher.relationshipChanged());
watcher.clearState();
EXPECT_FALSE(watcher.dirty());
EXPECT_FALSE(watcher.dataChanged());
EXPECT_FALSE(watcher.nameChanged());
EXPECT_FALSE(watcher.relationshipChanged());
EXPECT_TRUE(eg.setString(0,"Zone 2"));
EXPECT_TRUE(watcher.dirty());
EXPECT_FALSE(watcher.dataChanged());
EXPECT_FALSE(watcher.nameChanged());
EXPECT_TRUE(watcher.relationshipChanged());
watcher.clearState();
EXPECT_FALSE(watcher.dirty());
EXPECT_FALSE(watcher.dataChanged());
EXPECT_FALSE(watcher.nameChanged());
EXPECT_FALSE(watcher.relationshipChanged());
EXPECT_TRUE(eg.setDouble(1,2.0));
EXPECT_TRUE(watcher.dirty());
EXPECT_TRUE(watcher.dataChanged());
EXPECT_FALSE(watcher.nameChanged());
EXPECT_FALSE(watcher.relationshipChanged());
watcher.clearState();
EXPECT_FALSE(watcher.dirty());
EXPECT_FALSE(watcher.dataChanged());
EXPECT_FALSE(watcher.nameChanged());
EXPECT_FALSE(watcher.relationshipChanged());
}
示例13: idfObject
boost::optional<IdfObject> ForwardTranslator::translateWaterUseConnections(
WaterUseConnections& modelObject)
{
boost::optional<std::string> s;
boost::optional<double> value;
OptionalSchedule schedule;
IdfObject idfObject(IddObjectType::WaterUse_Connections);
m_idfObjects.push_back(idfObject);
// Name
s = modelObject.name();
if( s )
{
idfObject.setName(*s);
}
// InletNodeName
if( boost::optional<ModelObject> mo = modelObject.inletModelObject() )
{
if( boost::optional<Node> node = mo->optionalCast<Node>() )
{
idfObject.setString(WaterUse_ConnectionsFields::InletNodeName,node->name().get());
}
}
// OutletNodeName
if( boost::optional<ModelObject> mo = modelObject.outletModelObject() )
{
if( boost::optional<Node> node = mo->optionalCast<Node>() )
{
idfObject.setString(WaterUse_ConnectionsFields::OutletNodeName,node->name().get());
}
}
// Hot Water Supply Temperature Schedule Name
if( boost::optional<Schedule> s = modelObject.hotWaterSupplyTemperatureSchedule() )
{
translateAndMapModelObject(s.get());
idfObject.setString(WaterUse_ConnectionsFields::HotWaterSupplyTemperatureScheduleName,s->name().get());
}
// Cold Water Supply Temperature Schedule Name
if( boost::optional<Schedule> s = modelObject.coldWaterSupplyTemperatureSchedule() )
{
translateAndMapModelObject(s.get());
idfObject.setString(WaterUse_ConnectionsFields::ColdWaterSupplyTemperatureScheduleName,s->name().get());
}
// Water Use Equipment 1 Name
std::vector<WaterUseEquipment> equipment = modelObject.waterUseEquipment();
for( auto & elem : equipment )
{
boost::optional<IdfObject> _equipment = translateAndMapModelObject(elem);
if( _equipment )
{
IdfExtensibleGroup group = idfObject.pushExtensibleGroup();
group.setString(WaterUse_ConnectionsExtensibleFields::WaterUseEquipmentName,_equipment->name().get());
}
}
return idfObject;
}
示例14: defrostEndTime
boost::optional<IdfObject> ForwardTranslator::translateRefrigerationWalkIn( RefrigerationWalkIn & modelObject )
{
OptionalModelObject temp;
boost::optional<std::string> s;
boost::optional<double> d;
// Name
IdfObject refrigerationWalkIn = createRegisterAndNameIdfObject(openstudio::IddObjectType::Refrigeration_WalkIn,
modelObject);
//AvailabilityScheduleName
boost::optional<Schedule> availabilitySchedule = modelObject.availabilitySchedule();
if( availabilitySchedule )
{
boost::optional<IdfObject> _availabilitySchedule = translateAndMapModelObject(availabilitySchedule.get());
if( _availabilitySchedule && _availabilitySchedule->name() )
{
refrigerationWalkIn.setString(Refrigeration_WalkInFields::AvailabilityScheduleName,_availabilitySchedule->name().get());
}
}
//RatedCoilCoolingCapacity
d = modelObject.ratedCoilCoolingCapacity();
if (d) {
refrigerationWalkIn.setDouble(Refrigeration_WalkInFields::RatedCoilCoolingCapacity,d.get());
}
//OperatingTemperature
d = modelObject.operatingTemperature();
if (d) {
refrigerationWalkIn.setDouble(Refrigeration_WalkInFields::OperatingTemperature,d.get());
}
//RatedCoolingSourceTemperature
d = modelObject.ratedCoolingSourceTemperature();
if (d) {
refrigerationWalkIn.setDouble(Refrigeration_WalkInFields::RatedCoolingSourceTemperature,d.get());
}
//RatedTotalHeatingPower
d = modelObject.ratedTotalHeatingPower();
if (d) {
refrigerationWalkIn.setDouble(Refrigeration_WalkInFields::RatedTotalHeatingPower,d.get());
}
//HeatingPowerScheduleName
boost::optional<Schedule> heatingPowerSchedule = modelObject.heatingPowerSchedule();
if( heatingPowerSchedule )
{
boost::optional<IdfObject> _heatingPowerSchedule = translateAndMapModelObject(heatingPowerSchedule.get());
if( _heatingPowerSchedule && _heatingPowerSchedule->name() )
{
refrigerationWalkIn.setString(Refrigeration_WalkInFields::HeatingPowerScheduleName,_heatingPowerSchedule->name().get());
}
}
//RatedCoolingCoilFanPower
d = modelObject.ratedCoolingCoilFanPower();
if (d) {
refrigerationWalkIn.setDouble(Refrigeration_WalkInFields::RatedCoolingCoilFanPower,d.get());
}
//RatedCirculationFanPower
d = modelObject.ratedCirculationFanPower();
if (d) {
refrigerationWalkIn.setDouble(Refrigeration_WalkInFields::RatedCirculationFanPower,d.get());
}
//RatedTotalLightingPower
d = modelObject.ratedTotalLightingPower();
if (d) {
refrigerationWalkIn.setDouble(Refrigeration_WalkInFields::RatedTotalLightingPower,d.get());
}
//LightingScheduleName
boost::optional<Schedule> lightingSchedule = modelObject.lightingSchedule();
if( lightingSchedule )
{
boost::optional<IdfObject> _lightingSchedule = translateAndMapModelObject(lightingSchedule.get());
if( _lightingSchedule && _lightingSchedule->name() )
{
refrigerationWalkIn.setString(Refrigeration_WalkInFields::LightingScheduleName,_lightingSchedule->name().get());
}
}
//DefrostType
s = modelObject.defrostType();
if (s) {
refrigerationWalkIn.setString(Refrigeration_WalkInFields::DefrostType,s.get());
}
//DefrostControlType
s = modelObject.defrostControlType();
if (s) {
//.........这里部分代码省略.........
示例15: _caseAndWalkinList
boost::optional<IdfObject> ForwardTranslator::translateRefrigerationTranscriticalSystem( RefrigerationTranscriticalSystem & modelObject )
{
OptionalModelObject temp;
boost::optional<std::string> s;
boost::optional<double> d;
std::string name;
// Name
IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::Refrigeration_TranscriticalSystem, modelObject);
//MediumTemperatureRefrigeratedCaseAndWalkInListName
std::vector<RefrigerationCase> mediumTemperatureCases = modelObject.mediumTemperatureCases();
std::vector<RefrigerationWalkIn> mediumTemperatureWalkins = modelObject.mediumTemperatureWalkins();
if( !mediumTemperatureCases.empty() || !mediumTemperatureWalkins.empty() )
{
// Name
name = " Medium Temperature Case and Walkin List";
idfObject.setString(Refrigeration_TranscriticalSystemFields::MediumTemperatureRefrigeratedCaseorWalkinorCaseAndWalkInListName, idfObject.name().get() + name);
IdfObject _caseAndWalkinList(IddObjectType::Refrigeration_CaseAndWalkInList);
m_idfObjects.push_back(_caseAndWalkinList);
_caseAndWalkinList.setName(idfObject.name().get() + name);
for( auto & mediumTemperatureCase : mediumTemperatureCases )
{
boost::optional<IdfObject> _case = translateAndMapModelObject(mediumTemperatureCase);
if( _case )
{
IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup();
eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName,_case->name().get());
}
}
for( auto & mediumTemperatureWalkin : mediumTemperatureWalkins )
{
boost::optional<IdfObject> _walkin = translateAndMapModelObject(mediumTemperatureWalkin);
if( _walkin )
{
IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup();
eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName,_walkin->name().get());
}
}
}
//LowTemperatureRefrigeratedCaseAndWalkInListName
std::vector<RefrigerationCase> lowTemperatureCases = modelObject.lowTemperatureCases();
std::vector<RefrigerationWalkIn> lowTemperatureWalkins = modelObject.lowTemperatureWalkins();
if( !lowTemperatureCases.empty() || !lowTemperatureWalkins.empty() )
{
// Name
name = " Low Temperature Case and Walkin List";
idfObject.setString(Refrigeration_TranscriticalSystemFields::LowTemperatureRefrigeratedCaseorWalkinorCaseAndWalkInListName, idfObject.name().get() + name);
IdfObject _caseAndWalkinList(IddObjectType::Refrigeration_CaseAndWalkInList);
m_idfObjects.push_back(_caseAndWalkinList);
_caseAndWalkinList.setName(idfObject.name().get() + name);
for( auto & lowTemperatureCase : lowTemperatureCases )
{
boost::optional<IdfObject> _case = translateAndMapModelObject(lowTemperatureCase);
if( _case )
{
IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup();
eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName,_case->name().get());
}
}
for( auto & lowTemperatureWalkin : lowTemperatureWalkins )
{
boost::optional<IdfObject> _walkin = translateAndMapModelObject(lowTemperatureWalkin);
if( _walkin )
{
IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup();
eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName,_walkin->name().get());
}
}
}
// SystemType
if ( (!mediumTemperatureCases.empty() || !mediumTemperatureWalkins.empty()) &&
(!lowTemperatureCases.empty() || !lowTemperatureWalkins.empty()) ) {
idfObject.setString(Refrigeration_TranscriticalSystemFields::SystemType,"TwoStage");
}
else {
idfObject.setString(Refrigeration_TranscriticalSystemFields::SystemType,"SingleStage");
}
//.........这里部分代码省略.........
开发者ID:CheyenneBerlin,项目名称:OpenStudio,代码行数:101,代码来源:ForwardTranslateRefrigerationTranscriticalSystem.cpp