ME 305
|
ClosedLoop Class. More...
Public Member Functions | |
def | __init__ (self, Kp_initial, Vdesired) |
Initializes object in ClosedLoop class. More... | |
def | run (self, Vmeasured) |
Calculates CL duty. More... | |
def | set_Kp (self, Kp_input) |
Changes the Gain Value. More... | |
def | __init__ (self, Kp_initial, Kd_initial) |
Initializes object in ClosedLoop class. More... | |
def | run (self, Pmeasured, Vmeasured) |
Calculates CL duty. More... | |
def | set_Kp (self, Kp_input) |
Changes the Gain Value. More... | |
def | __init__ (self) |
Initializes ClosedLoop class. More... | |
def | setgain (self, Kp, Kd, Ki) |
Sets gains to user input from task_user.py. More... | |
def | run (self, Pref, Pmeasured, Vmeasured, Kisign) |
Calculates output of each closed loop. More... | |
Public Attributes | |
Kp | |
Proportional gain. More... | |
Vdesired | |
CLduty | |
Kd | |
Derivative gain. More... | |
Ki | |
Integral gain. More... | |
start | |
Start time of when class instance first initialized. | |
accum | |
Contains accumulation of angular position error. | |
CLvalue | |
Final value of closed loop after application of various gains. | |
ClosedLoop Class.
Consists of methods and variables to calculate the closed loop duty cycle. Combined with main.py and task_user.py, it sets the duty cycle to a value that will produce an output speed close to Vdesired
Consists of methods and variables to calculate the closed loop duty cycle. Combined with main.py and task_user.py, it sets the duty cycle to a value that will produce an output speed close to Kd initial
Consists of methods and variables to calculate the duty cycle to automatically balance a ball. The task_user.py runs the instances of this class for cascaded control
def closedloop.ClosedLoop.__init__ | ( | self, | |
Kp_initial, | |||
Vdesired | |||
) |
Initializes object in ClosedLoop class.
Takes input and creates an object that will calculate the output duty cycle
Kp_initial | Initial gain for closed loop |
Vdesired | Desired speed for motor |
def closedloop.ClosedLoop.__init__ | ( | self, | |
Kp_initial, | |||
Kd_initial | |||
) |
Initializes object in ClosedLoop class.
Takes input and creates an object that will calculate the output duty cycle
Kp_initial | Initial gain for closed loop |
Vdesired | Desired speed for motor |
def closedloop.ClosedLoop.__init__ | ( | self | ) |
Initializes ClosedLoop class.
def closedloop.ClosedLoop.run | ( | self, | |
Pmeasured, | |||
Vmeasured | |||
) |
Calculates CL duty.
Uses Vmeasured as well as initalized parameters to
Vmeasured |
def closedloop.ClosedLoop.run | ( | self, | |
Pref, | |||
Pmeasured, | |||
Vmeasured, | |||
Kisign | |||
) |
Calculates output of each closed loop.
The output of the outer closed loop will provide the reference position to be used in the inner loop. The final output is the duty cycle.
Pref | Reference position |
Pmeasured | Measured position of ball or platform |
Vmeasured | Measured velocity of ball or platform |
Kisign | Controls positive or negative magnitude of integral gain |
def closedloop.ClosedLoop.run | ( | self, | |
Vmeasured | |||
) |
Calculates CL duty.
Uses Vmeasured as well as initalized parameters to
Vmeasured |
def closedloop.ClosedLoop.set_Kp | ( | self, | |
Kp_input | |||
) |
Changes the Gain Value.
Changes the Gain value for the closed loop duty cycle calculation
Kp_input | Input gain from user for integral control |
def closedloop.ClosedLoop.set_Kp | ( | self, | |
Kp_input | |||
) |
Changes the Gain Value.
Changes the Gain value for the closed loop duty cycle calculation
Kp_input | Input gain from user for integral control |
def closedloop.ClosedLoop.setgain | ( | self, | |
Kp, | |||
Kd, | |||
Ki | |||
) |
Sets gains to user input from task_user.py.
Kp | Proportional gain |
Kd | Derivative gain |
Ki | Integral gain |
closedloop.ClosedLoop.Kd |
Derivative gain.
Initializes to be used in various other methods. Initially 0.
closedloop.ClosedLoop.Ki |
Integral gain.
Initializes to be used in various other methods. Initially 0.
closedloop.ClosedLoop.Kp |
Proportional gain.
Initializes to be used in various other methods. Initially 0.