| 487 | } |
| 488 | |
| 489 | bool UtilityBill_Impl::setPeakDemandUnit(const std::string& peakDemandUnit) { |
| 490 | bool result = false; |
| 491 | std::vector<std::string> peakDemandUnitValues = this->peakDemandUnitValues(); |
| 492 | if (peakDemandUnitValues.empty() && peakDemandUnit.empty()) { |
| 493 | result = setString(OS_UtilityBillFields::PeakDemandUnit, peakDemandUnit); |
| 494 | } else { |
| 495 | auto it = std::find(peakDemandUnitValues.begin(), peakDemandUnitValues.end(), peakDemandUnit); |
| 496 | if (it != peakDemandUnitValues.end()) { |
| 497 | result = setString(OS_UtilityBillFields::PeakDemandUnit, peakDemandUnit); |
| 498 | } |
| 499 | } |
| 500 | return result; |
| 501 | } |
| 502 | |
| 503 | bool UtilityBill_Impl::setTimestepsInPeakDemandWindow(unsigned timestepsInPeakDemandWindow) { |
| 504 | if (this->fuelType() == FuelType::Electricity) { |