예제 #1
0
 Unit BTUUnit_Impl::clone() const {
   OS_ASSERT(system() == UnitSystem::BTU);
   std::shared_ptr<BTUUnit_Impl> impl(new BTUUnit_Impl(*this));
   return BTUUnit(impl).cast<Unit>();
 }
예제 #2
0
BTUUnit createBTULuminousFlux() {
  return BTUUnit(BTUExpnt(0,0,0,0,0,1,0,0,1),0,"lm");
}
예제 #3
0
BTUUnit createBTUIlluminance() {
  return BTUUnit(BTUExpnt(0,-2,0,0,0,1,0,0,1),0,"fc");
}
예제 #4
0
BTUUnit createBTUCurrency() {
  return BTUUnit(BTUExpnt(0,0,0,0,0,0,0,0,0,0,0,1));
}
예제 #5
0
BTUUnit createBTUPower() {
  return BTUUnit(BTUExpnt(1,0,-1));
}
예제 #6
0
BTUUnit createBTUPeople() {
  return BTUUnit(BTUExpnt(0,0,0,0,0,0,0,0,0,1));
}
예제 #7
0
BTUUnit createBTUCycle() {
  return BTUUnit(BTUExpnt(0,0,0,0,0,0,0,0,0,0,1));
}
예제 #8
0
BTUUnit createBTUAmountOfSubstance() {
  return BTUUnit(BTUExpnt(0,0,0,0,0,0,1));
}
예제 #9
0
BTUUnit createBTUSolidAngle() {
  return BTUUnit(BTUExpnt(0,0,0,0,0,0,0,0,1));
}
예제 #10
0
BTUUnit createBTUElectricCurrent() {
  return BTUUnit(BTUExpnt(0,0,0,0,1));
}
예제 #11
0
BTUUnit createBTULuminousIntensity() {
  return BTUUnit(BTUExpnt(0,0,0,0,0,1));
}
예제 #12
0
BTUUnit createBTUTemperature() {
  return BTUUnit(BTUExpnt(0,0,0,1));
}
예제 #13
0
BTUUnit createBTUTime() {
  return BTUUnit(BTUExpnt(0,0,1));
}
예제 #14
0
BTUUnit createBTULength() {
  return BTUUnit(BTUExpnt(0,1));
}
예제 #15
0
BTUUnit createBTUEnergy() {
  return BTUUnit(BTUExpnt(1));
}
예제 #16
0
boost::optional<Unit> ScheduleTypeLimits::units(std::string unitType, bool returnIP) {
  boost::to_lower(unitType);
  OptionalUnit result;

  if (unitType.empty() ||
      (unitType == "dimensionless") ||
      (unitType == "availability") ||
      (unitType == "controlmode"))
  {
    if (returnIP) {
      result = IPUnit();
    }
    else {
      result = SIUnit();
    }
    return result;
  }

  char firstLetter = unitType[0];
  switch (firstLetter) {
  case 'a' :
    {
      if (unitType == "activitylevel") {
        result = (createSIPower() / createSIPeople());
      }
      else if (unitType == "angle") {
        result = createIPAngle();
      }
      break;
    }
  case 'c' :
    {
      if (unitType == "capacity") {
        if (returnIP) {
          result = BTUUnit(BTUExpnt(1,0,-1));
        }
        else {
          result = createSIPower();
        }
      }
      else if (unitType == "clothinginsulation") {
        result = Unit();
        result->setBaseUnitExponent("clo",1);
      }
      else if (unitType == "convectioncoefficient") {
        if (returnIP) {
          result = BTUUnit(BTUExpnt(1,-2,-1,-1));
        }
        else {
          result = createSIThermalConductance();
        }
      }
      break;
    }
  case 'd' :
    {
      if (unitType == "deltatemperature") {
        if (returnIP) {
          result = createFahrenheitTemperature();
          result->cast<TemperatureUnit>().setAsRelative();
        }
        else {
          result = createCelsiusTemperature();
          result->cast<TemperatureUnit>().setAsRelative();
        }
      }
      break;
    }
  case 'l' :
    {
      if (unitType == "linearpowerdensity") {
        if (returnIP) {
          result = (createIPPower() / createIPLength());
        }
        else {
          result = (createSIPower() / createSILength());
        }
      }
      break;
    }
  case 'm' :
    {
      if (unitType == "massflowrate") {
        if (returnIP) {
          result = IPUnit(IPExpnt(1,0,-1));
        }
        else {
          result = SIUnit(SIExpnt(1,0,-1));
        }
      }
      break;
    }
  case 'p' :
    {
      if (unitType == "percent") {
        result = Unit();
        result->setBaseUnitExponent("%",1);
      }
      else if (unitType == "power") {
        result = createSIPower();
      }
      else if (unitType == "precipitationrate") {
        if (returnIP) {
          result = BTUUnit(BTUExpnt(0,1,-1));
        }
        else {
          result = WhUnit(WhExpnt(0,-1,1));
        }
      }
      else if (unitType == "pressure") {
        if (returnIP) {
          result = createIPPressure();
        }
        else {
          result = createSIPressure();
        }
      }
      break;
    }
  case 'r' :
    {
      if (unitType == "rotationsperminute") {
        result = createCFMFrequency();
      }
      break;
    }
  case 's' :
    {
      if (unitType == "solarenergy") {
        result = WhUnit(WhExpnt(1,1,-2));
      }
      break;
    }
  case 't' :
    {
      if (unitType == "temperature") {
        if (returnIP) {
          result = createFahrenheitTemperature();
        }
        else {
          result = createCelsiusTemperature();
        }
      }
      break;
    }
  case 'v' :
    {
      if (unitType == "velocity") {
        if (returnIP) {
          result = CFMUnit(CFMExpnt(1,-1));
        }
        else {
          result = SIUnit(SIExpnt(0,1,-1));
        }
      }
      if (unitType == "volumetricflowrate") {
        if (returnIP) {
          result = IPUnit(IPExpnt(0,3,-1));
        }
        else {
          result = SIUnit(SIExpnt(0,3,-1));
        }
      }
      break;
    }
  }

  return result;
}