Lines Matching full:zone

6 #include "pid/zone.hpp"
19 #include <xyz/openbmc_project/Debug/Pid/Zone/common.hpp>
47 using DebugPidZone = sdbusplus::common::xyz::openbmc_project::debug::pid::Zone;
57 // Build a PID Zone. in TEST()
76 int64_t zone = 1; in TEST() local
97 DbusPidZone p(zone, minThermalOutput, failSafePercent, cycleTime, m, in TEST()
132 zone = std::make_unique<DbusPidZone>( in PidZoneTest()
162 std::unique_ptr<DbusPidZone> zone; member in pid_control::__anon416c5d230111::PidZoneTest
169 EXPECT_EQ(zoneId, zone->getZoneID()); in TEST_F()
174 // Verifies that the zone starts in manual mode. Verifies that one can set in TEST_F()
176 EXPECT_FALSE(zone->getManualMode()); in TEST_F()
178 zone->setManualMode(true); in TEST_F()
179 EXPECT_TRUE(zone->getManualMode()); in TEST_F()
184 // Verifies that the zone starts in enable mode. Verifies that one can set in TEST_F()
199 zone->addPidControlProcess(sensorname, sensorType, setpoint, in TEST_F()
201 EXPECT_TRUE(zone->isPidProcessEnabled(sensorname)); in TEST_F()
206 // Tests adding a fan PID controller to the zone, and verifies it's in TEST_F()
210 std::make_unique<ControllerMock>("fan1", zone.get()); in TEST_F()
217 zone->addFanPID(std::move(tpid)); in TEST_F()
223 // while zone is in auto mode redundant writes should be disabled in TEST_F()
224 EXPECT_FALSE(zone->getRedundantWrite()); in TEST_F()
227 zone->setManualMode(true); in TEST_F()
228 zone->setManualMode(false); in TEST_F()
229 EXPECT_TRUE(zone->getRedundantWrite()); in TEST_F()
232 zone->processFans(); in TEST_F()
233 EXPECT_FALSE(zone->getRedundantWrite()); in TEST_F()
241 // Need to add pid control process for the zone that can enable in TEST_F()
256 zone->addPidControlProcess(sensorname, sensorType, setpoint, in TEST_F()
265 zone->addSetPoint(v, sensorname); in TEST_F()
269 zone->determineMaxSetPointRequest(); in TEST_F()
270 EXPECT_EQ(5000, zone->getMaxSetPointRequest()); in TEST_F()
273 zone->clearSetPoints(); in TEST_F()
276 zone->determineMaxSetPointRequest(); in TEST_F()
277 EXPECT_EQ(zone->getMinThermalSetPoint(), zone->getMaxSetPointRequest()); in TEST_F()
285 // Need to add pid control process for the zone that can enable in TEST_F()
300 zone->addPidControlProcess(sensorname, sensorType, setpoint, in TEST_F()
307 zone->addSetPoint(v, sensorname); in TEST_F()
311 zone->determineMaxSetPointRequest(); in TEST_F()
314 EXPECT_EQ(zone->getMinThermalSetPoint(), zone->getMaxSetPointRequest()); in TEST_F()
320 // and verify that the sensor name is empty and failsafe duty is PID zone's in TEST_F()
328 zone->addPidFailSafePercent(input1, values[0]); in TEST_F()
329 zone->addPidFailSafePercent(input2, values[1]); in TEST_F()
330 zone->addPidFailSafePercent(input3, values[2]); in TEST_F()
332 zone->markSensorMissing("temp1", "Sensor threshold asserted"); in TEST_F()
334 EXPECT_EQ(failSafePercent, zone->getFailSafePercent()); in TEST_F()
337 zone->getFailSafeSensors(); in TEST_F()
353 zone->addPidFailSafePercent(input1, values[0]); in TEST_F()
354 zone->addPidFailSafePercent(input2, values[1]); in TEST_F()
355 zone->addPidFailSafePercent(input3, values[2]); in TEST_F()
357 zone->markSensorMissing("temp1", "Sensor threshold asserted"); in TEST_F()
358 zone->markSensorMissing("temp2", "Sensor reading bad"); in TEST_F()
359 zone->markSensorMissing("temp3", "Sensor unavailable"); in TEST_F()
361 EXPECT_EQ(80, zone->getFailSafePercent()); in TEST_F()
364 zone->getFailSafeSensors(); in TEST_F()
376 // This test will add a couple thermal inputs, and verify that the zone in TEST_F()
401 // Now that the sensors exist, add them to the zone. in TEST_F()
402 zone->addThermalInput(name1, false); in TEST_F()
403 zone->addThermalInput(name2, false); in TEST_F()
405 // Initialize Zone in TEST_F()
406 zone->initializeCache(); in TEST_F()
409 EXPECT_TRUE(zone->getFailSafeMode()); in TEST_F()
422 zone->updateSensors(); in TEST_F()
425 EXPECT_FALSE(zone->getFailSafeMode()); in TEST_F()
427 EXPECT_EQ(r1.value, zone->getCachedValue(name1)); in TEST_F()
428 EXPECT_EQ(r2.value, zone->getCachedValue(name2)); in TEST_F()
457 // Now that the sensors exist, add them to the zone. in TEST_F()
458 zone->addFanInput(name1, false); in TEST_F()
459 zone->addFanInput(name2, false); in TEST_F()
461 // Initialize Zone in TEST_F()
462 zone->initializeCache(); in TEST_F()
474 // Method under test will read through each fan sensor for the zone and in TEST_F()
476 zone->updateFanTelemetry(); in TEST_F()
478 EXPECT_EQ(r1.value, zone->getCachedValue(name1)); in TEST_F()
479 EXPECT_EQ(r2.value, zone->getCachedValue(name2)); in TEST_F()
509 zone->addThermalInput(name1, false); in TEST_F()
510 zone->addThermalInput(name2, false); in TEST_F()
512 // Initialize Zone in TEST_F()
513 zone->initializeCache(); in TEST_F()
516 EXPECT_TRUE(zone->getFailSafeMode()); in TEST_F()
528 zone->updateSensors(); in TEST_F()
529 EXPECT_FALSE(zone->getFailSafeMode()); in TEST_F()
542 zone->updateSensors(); in TEST_F()
543 EXPECT_TRUE(zone->getFailSafeMode()); in TEST_F()
549 // is set for sensor1, the zone should not enter failsafe mode when in TEST_F()
576 zone->addThermalInput(name1, true); in TEST_F()
577 zone->addThermalInput(name2, false); in TEST_F()
579 // Initialize Zone in TEST_F()
580 zone->initializeCache(); in TEST_F()
582 // As sensors are not initialized, zone should be in failsafe mode in TEST_F()
583 EXPECT_TRUE(zone->getFailSafeMode()); in TEST_F()
595 zone->updateSensors(); in TEST_F()
599 EXPECT_FALSE(zone->getFailSafeMode()); in TEST_F()
606 zone->updateSensors(); in TEST_F()
609 EXPECT_FALSE(zone->getFailSafeMode()); in TEST_F()
619 zone->updateSensors(); in TEST_F()
621 // MissingIsAcceptable is true for sensor1, so the zone should not be in TEST_F()
623 EXPECT_FALSE(zone->getFailSafeMode()); in TEST_F()
632 zone->updateSensors(); in TEST_F()
634 // Now, the zone should be in failsafe mode, because sensor2 does not in TEST_F()
636 EXPECT_TRUE(zone->getFailSafeMode()); in TEST_F()
643 zone->updateSensors(); in TEST_F()
646 EXPECT_FALSE(zone->getFailSafeMode()); in TEST_F()
675 // Now that the sensors exist, add them to the zone. in TEST_F()
676 zone->addFanInput(name1, false); in TEST_F()
677 zone->addFanInput(name2, false); in TEST_F()
679 // Initialize Zone in TEST_F()
680 zone->initializeCache(); in TEST_F()
683 EXPECT_TRUE(zone->getFailSafeMode()); in TEST_F()
695 // Method under test will read through each fan sensor for the zone and in TEST_F()
697 zone->updateFanTelemetry(); in TEST_F()
700 EXPECT_FALSE(zone->getFailSafeMode()); in TEST_F()
702 EXPECT_EQ(r1.value, zone->getCachedValue(name1)); in TEST_F()
703 EXPECT_EQ(r2.value, zone->getCachedValue(name2)); in TEST_F()
732 // Now that the sensors exist, add them to the zone. in TEST_F()
733 zone->addFanInput(name1, false); in TEST_F()
734 zone->addFanInput(name2, false); in TEST_F()
736 // Initialize Zone in TEST_F()
737 zone->initializeCache(); in TEST_F()
740 EXPECT_TRUE(zone->getFailSafeMode()); in TEST_F()
752 // Method under test will read through each fan sensor for the zone and in TEST_F()
754 zone->updateFanTelemetry(); in TEST_F()
757 EXPECT_FALSE(zone->getFailSafeMode()); in TEST_F()
765 zone->updateFanTelemetry(); in TEST_F()
766 EXPECT_TRUE(zone->getFailSafeMode()); in TEST_F()
771 // One can grab a sensor from the manager through the zone. in TEST_F()
788 zone->addThermalInput(name1, false); in TEST_F()
791 EXPECT_EQ(mgr->getSensor(name1), zone->getSensor(name1)); in TEST_F()
796 // Tests adding a thermal PID controller to the zone, and verifies it's in TEST_F()
800 std::make_unique<ControllerMock>("thermal1", zone.get()); in TEST_F()
807 zone->addThermalPID(std::move(tpid)); in TEST_F()
815 zone->processThermals(); in TEST_F()
820 // Tests adding a fan PID controller to the zone, and verifies it's in TEST_F()
824 std::make_unique<ControllerMock>("fan1", zone.get()); in TEST_F()
831 zone->addFanPID(std::move(tpid)); in TEST_F()
838 zone->processFans(); in TEST_F()
859 zone->manual(true); in TEST_F()
860 EXPECT_TRUE(zone->getManualMode()); in TEST_F()
872 EXPECT_EQ(zone->failSafe(), zone->getFailSafeMode()); in TEST_F()