[Git][NTPsec/ntpsec][master] 2 commits: ntpheatusb: Make step mode work. Ten 1°C steps up, ten back down.

Gary E. Miller gitlab at mg.gitlab.com
Wed Mar 22 23:08:41 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
61fb4653 by Gary E. Miller at 2017-03-22T16:04:45-07:00
ntpheatusb: Make step mode work.  Ten 1°C steps up, ten back down.

- - - - -
853ce155 by Gary E. Miller at 2017-03-22T16:08:12-07:00
ntpq: tweak error message.

- - - - -


2 changed files:

- contrib/ntpheatusb
- ntpclients/ntpq


Changes:

=====================================
contrib/ntpheatusb
=====================================
--- a/contrib/ntpheatusb
+++ b/contrib/ntpheatusb
@@ -91,6 +91,13 @@ Discrete PID control
     def __repr__(self):
         return ("D_value=%s, I_value=%s" % (self.D_value, self.I_value))
 
+
+    def setPoint(self,set_point):
+            """
+            Initilize the setpoint of PID
+            """
+            self.set_point = set_point
+
     def update(self, current_value):
         """
         Calculate PID output value for given reference input and feedback
@@ -124,7 +131,7 @@ parser.add_argument('-p', '--pid',
 parser.add_argument('-s', '--step',
                     action="store_true",
                     dest='step',
-                    help="Step up 1C every hour for 10 hours, then back down.")
+                    help="Step up 1C every 2 hours for 20 hours, then back down.")
 parser.add_argument('-t', '--temp',
                     default=[45.0],
                     dest='target_temp',
@@ -167,7 +174,11 @@ usbrelay_off = ['usbrelay', '959BI_1=0']
 #
 # if the temp oscillates then increase D
 #
-pid = PID(setpoint=temp_gate, P=35.0, I=10.0, D=5.0)
+pid = PID(setpoint=temp_gate, P=35.0, I=10.0, D=10.0)
+
+start_time = time.time()
+step_time = start_time
+step = 0
 
 start_time = gmtime()
 step_time = start_time
@@ -176,8 +187,8 @@ step = 0
 try:
     while True:
         if args.step:
-            now = gmtime()
-            if 3600 < (now - step_time):
+            now = time.time()
+            if 7200 < (now - step_time):
                 # time to step
                 step_time = now
                 step += 1
@@ -188,7 +199,8 @@ try:
                     # step down
                     temp_gate -= 1.0
                 if 9 < step:
-                    step = 10-
+                    step = -11
+            pid.setPoint(temp_gate)
 
         # grab the needed output
         output = run_binary(["temper-poll", "-c"])


=====================================
ntpclients/ntpq
=====================================
--- a/ntpclients/ntpq
+++ b/ntpclients/ntpq
@@ -1626,7 +1626,8 @@ if __name__ == '__main__':
             try:
                 interpreter.termwidth = int(val)
             except ValueError as e:
-                sys.stderr.write("'%s' is not a recognizable number\n" % val)
+                sys.stderr.write("Error: -W parameter '%s' not a number\n"
+                                 % val)
                 sys.stderr.write(usage)
                 raise SystemExit(1)
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/fda25abf2560defe4940be1b00484c5f183a26f4...853ce155a5f96d5830314ac0e768761922b95326
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170322/b6721823/attachment.html>


More information about the vc mailing list