Skip to content

Commit

Permalink
reset functions for units
Browse files Browse the repository at this point in the history
  • Loading branch information
mck-sbs committed Mar 2, 2020
1 parent bd5f61a commit a873fda
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
5 changes: 5 additions & 0 deletions pyconsys/DControl.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ def __init__(self, kd=1):
self._kd = kd
self._xe_old = 0

def reset(self, kd):
""" resets the unit """
self._kd = kd
self._xe_old = 0

def get_xa(self, xe):
""" give input, get output
Parameters:
Expand Down
6 changes: 6 additions & 0 deletions pyconsys/DelayControl.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ def __init__(self, delay=0):
self._queue = queue.Queue()
self._counter = 0

def reset(self, delay):
""" resets the unit """
self._delay = delay
self._counter = 0
self._queue.queue.clear()

def get_xa(self, xe):
""" give input, get output
Parameters:
Expand Down
5 changes: 5 additions & 0 deletions pyconsys/IControl.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ def __init__(self, ki=1):
self._ki = ki
self._sum = 0

def reset(self, ki):
""" resets the unit """
self._ki = ki
self._sum = 0

def get_xa(self, xe):
""" give input, get output
Parameters:
Expand Down
4 changes: 4 additions & 0 deletions pyconsys/PControl.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ def __init__(self, kp=1):
kp(float): Kp"""
self._kp = kp

def reset(self, kp):
""" resets the unit """
self._kp = kp

def get_xa(self, xe):
""" give input, get output
Parameters:
Expand Down
8 changes: 3 additions & 5 deletions pyconsys/PIDControl.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ def update_params(self, kp, ki, kd):
kp(float): Kp
ki(float): Ki
kd(float): Kd """
self._pControl._kp = kp
self._iControl._ki = ki
self._iControl._sum = 0
self._dControl._kd = kd
self._dControl._xe_old = 0
self._pControl.reset(kp)
self._iControl.reset(ki)
self._dControl.reset(kd)

def get_xa(self, xe):
""" give input, get output
Expand Down

0 comments on commit a873fda

Please sign in to comment.