| 4444 | } |
| 4445 | |
| 4446 | boost::optional<model::ModelObject> ReverseTranslator::translateTrmlUnit(const pugi::xml_node& trmlUnitElement, openstudio::model::Model& model) { |
| 4447 | boost::optional<openstudio::model::ModelObject> result; |
| 4448 | |
| 4449 | if (!istringEqual(trmlUnitElement.name(), "TrmlUnit")) { |
| 4450 | return result; |
| 4451 | } |
| 4452 | |
| 4453 | // Name |
| 4454 | pugi::xml_node nameElement = trmlUnitElement.child("Name"); |
| 4455 | const auto* name = nameElement.text().as_string(); |
| 4456 | |
| 4457 | // AvailSchRef |
| 4458 | pugi::xml_node availSchRefElement = trmlUnitElement.child("AvailSchRef"); |
| 4459 | boost::optional<model::Schedule> availSch = model.getModelObjectByName<model::Schedule>(availSchRefElement.text().as_string()); |
| 4460 | |
| 4461 | // Type |
| 4462 | pugi::xml_node typeElement = trmlUnitElement.child("TypeSim"); |
| 4463 | |
| 4464 | // PriAirFlow |
| 4465 | pugi::xml_node priAirFlowElement = trmlUnitElement.child("PriAirFlowMaxSim"); |
| 4466 | pugi::xml_node priAirFlowMinElement = trmlUnitElement.child("PriAirFlowMinSim"); |
| 4467 | boost::optional<double> primaryAirFlow; |
| 4468 | boost::optional<double> primaryAirFlowMin; |
| 4469 | |
| 4470 | if (!autosize()) { |
| 4471 | boost::optional<double> _priAirFlow = lexicalCastToDouble(priAirFlowElement); |
| 4472 | if (_priAirFlow) { |
| 4473 | primaryAirFlow = unitToUnit(_priAirFlow.get(), "cfm", "m^3/s").get(); |
| 4474 | } |
| 4475 | } |
| 4476 | |
| 4477 | boost::optional<double> _priAirFlowMin = lexicalCastToDouble(priAirFlowMinElement); |
| 4478 | if (_priAirFlowMin) { |
| 4479 | primaryAirFlowMin = unitToUnit(_priAirFlowMin.get(), "cfm", "m^3/s").get(); |
| 4480 | } |
| 4481 | |
| 4482 | pugi::xml_node airSysElement = trmlUnitElement.parent(); |
| 4483 | pugi::xml_node airSystemTypeElement; |
| 4484 | if (airSysElement) { |
| 4485 | airSystemTypeElement = airSysElement.child("TypeSim"); |
| 4486 | } |
| 4487 | |
| 4488 | if (istringEqual("VAVNoReheatBox", typeElement.text().as_string())) { |
| 4489 | model::Schedule schedule = model.alwaysOnDiscreteSchedule(); |
| 4490 | |
| 4491 | model::AirTerminalSingleDuctVAVNoReheat terminal(model, schedule); |
| 4492 | |
| 4493 | pugi::xml_node minAirFracSchRefElement = trmlUnitElement.child("MinAirFracSchRef"); |
| 4494 | if (boost::optional<model::Schedule> minAirFracSch = model.getModelObjectByName<model::Schedule>(minAirFracSchRefElement.text().as_string())) { |
| 4495 | terminal.setZoneMinimumAirFlowInputMethod("Scheduled"); |
| 4496 | terminal.setMinimumAirFlowFractionSchedule(minAirFracSch.get()); |
| 4497 | } else if (primaryAirFlowMin) { |
| 4498 | terminal.setZoneMinimumAirFlowInputMethod("FixedFlowRate"); |
| 4499 | terminal.setFixedMinimumAirFlowRate(primaryAirFlowMin.get()); |
| 4500 | } else { |
| 4501 | terminal.setZoneMinimumAirFlowInputMethod("Constant"); |
| 4502 | terminal.setConstantMinimumAirFlowFraction(0.5); |
| 4503 | } |
nothing calls this directly
no test coverage detected