Support derivative term in PID algorithm and support to set cycle interval time from fan table

1. Support to calculate derivative term in PID algorithm.
2. Add two properties: cycleIntervalTimeMS and updateThermalsTimeMS
in fan table that could be used to decide "time interval of PID control loop"
and "time interval to update thermals' cached value".

Tested:

- PID algorithm:
    1. Check pid-control-service could calculate output PWM
       according to the fan table.

	[Test log]
        root@greatlakes:~# systemctl status phosphor-pid-control -l
        * phosphor-pid-control.service - Phosphor-Pid-Control Margin-based Fan Control Daemon
             Loaded: loaded (/lib/systemd/system/phosphor-pid-control.service; enabled; preset: enabled)
             Active: active (running) since Fri 2018-03-09 05:09:35 PST; 1min 47s ago
           Main PID: 3105 (swampd)
             CGroup: /system.slice/phosphor-pid-control.service
                     `-3105 /usr/bin/swampd -c /usr/share/entity-manager/configurations/fan-table.json
        ...
        Mar 09 05:10:29 greatlakes phosphor-pid-control[3105]: PID Zone 1 max SetPoint 3.75 requested by
        PID_NIC_SENSOR_TEMP BMC_SENSOR_FAN0_TACH BMC_SENSOR_FAN2_TACH BMC_SENSOR_FAN4_TACH BMC_SENSOR_FAN6_TACH

- Cycle interval time:
    1. Set cycleIntervalTimeMS and updateThermalsTimeMS
       to 1000 ms in fan table
    2. Check service would update thermal every second from debug log.

	[Test log]
        root@greatlakes:~# journalctl -u phosphor-pid-control --since "Mar 09 04:52:16"
        Mar 09 04:52:16 greatlakes systemd[1]: Started Phosphor-Pid-Control Margin-based Fan Control Daemon.
        ...
        Mar 09 04:53:28 greatlakes phosphor-pid-control[2795]: processThermals
        Mar 09 04:53:28 greatlakes phosphor-pid-control[2795]: processFans
        Mar 09 04:53:29 greatlakes phosphor-pid-control[2795]: processThermals
        Mar 09 04:53:29 greatlakes phosphor-pid-control[2795]: processFans
        Mar 09 04:53:30 greatlakes phosphor-pid-control[2795]: processThermals
        Mar 09 04:53:30 greatlakes phosphor-pid-control[2795]: processFans

Change-Id: I04e1b440603c3ad66a1e26c96451992785da6fe6
Signed-off-by: Bonnie Lo <Bonnie_Lo@wiwynn.com>
diff --git a/pid/zone.hpp b/pid/zone.hpp
index 179b24d..41514a7 100644
--- a/pid/zone.hpp
+++ b/pid/zone.hpp
@@ -36,14 +36,14 @@
 {
   public:
     DbusPidZone(int64_t zone, double minThermalOutput, double failSafePercent,
-                const SensorManager& mgr, sdbusplus::bus_t& bus,
-                const char* objPath, bool defer) :
+                conf::CycleTime cycleTime, const SensorManager& mgr,
+                sdbusplus::bus_t& bus, const char* objPath, bool defer) :
         ModeObject(bus, objPath,
                    defer ? ModeObject::action::defer_emit
                          : ModeObject::action::emit_object_added),
         _zoneId(zone), _maximumSetPoint(),
         _minThermalOutputSetPt(minThermalOutput),
-        _failSafePercent(failSafePercent), _mgr(mgr)
+        _failSafePercent(failSafePercent), _cycleTime(cycleTime), _mgr(mgr)
     {
         if (loggingEnabled)
         {
@@ -68,6 +68,8 @@
     void clearRPMCeilings(void) override;
     double getFailSafePercent(void) const override;
     double getMinThermalSetPoint(void) const;
+    uint64_t getCycleIntervalTime(void) const override;
+    uint64_t getUpdateThermalsCycle(void) const override;
 
     Sensor* getSensor(const std::string& name) override;
     void determineMaxSetPointRequest(void) override;
@@ -107,6 +109,7 @@
     bool _redundantWrite = false;
     const double _minThermalOutputSetPt;
     const double _failSafePercent;
+    const conf::CycleTime _cycleTime;
 
     std::set<std::string> _failSafeSensors;