// setSlotPeakPower() -- set the peak power (Basic::Number or Basic::Watts) bool RfSystem::setSlotPeakPower(Basic::Number* const v) { bool ok = false; LCreal x = -1.0f; Basic::Power* p = dynamic_cast<Basic::Power*>(v); if (p != 0) { // Has power units and we need watts Basic::Watts watts; x = watts.convert(*p); } else if (v != 0) { // Just a Number x = v->getReal(); } // Test and set the power if (x >= 0.0) { ok = setPeakPower(x); } else { std::cerr << "RfSystem::setPeakPower: Power must be greater than or equal zero!" << std::endl; } return ok; }
//------------------------------------------------------------------------------ // setSlotThreshold() -- converts a power to watts and sets our antenna threshold //------------------------------------------------------------------------------ bool Antenna::setSlotThreshold(Basic::Power* const p) { bool ok = false; // Has power units and we need watts Basic::Watts watts; double x = watts.convert(*p); // Test and set the threshold if (x >= 0.0) ok = setThreshold(x); return ok; }