The present disclosure generally relates to motor controllers, and more particularly relates to systems and methods for reducing code execution times in such motor controllers.
Modern closed-loop motor controllers typically include a processor for executing software code designed to control (e.g., via a pulse-width modulation or “PWM” signal) the rotational position and speed of the motor. Typically, the execution of the software code—the collective duration of which is referred to as the “code execution time”—must take place during a predetermined time period, sometimes referred to as the “PWM period” or “PWM switching period.” This code execution time might encompass, for example, code for estimating the position and/or speed of the motor (referred to herein as “position and speed processing”) and/or code for current regulation (referred to herein as “current regulator processing”).
It will be apparent that it is desirable to reduce the amount of code execution time taking place within a given PWM switching period. Accomplishing this reduction is difficult however, as utilizing a higher performance processor (to speed up code execution) can lead to increased costs, while adjusting the PWM period can increase audible noise and/or lower motor control performance.
Accordingly, it is desirable to provide improved systems and methods for motor control with reduced code execution time. Furthermore, other desirable features and characteristics of the present invention will become apparent from the subsequent detailed description and the appended claims, taken in conjunction with the accompanying drawings and the foregoing technical field and background.
Systems and methods are provided for reducing code execution time in motor controller systems. In one embodiment, a method for motor control includes receiving a feedback signal from a motor component and transmitting a motor control signal to control the motor component based on first and second attributes of the motor component (e.g., motor position/speed, motor current, etc.) by iteratively alternating between two modes. In the first mode a first code execution segment is performed utilizing the feedback signal to determine a current value of a first attribute of the motor component (i.e., closed loop), and a current value of a second attribute of the motor component is determined using a past value of the second attribute (i.e., open loop). In the second mode a second code execution segment is performed utilizing the feedback signal to determine a current value of the second attribute of the motor component, and a current value of the first attribute of the motor component is determined using a past value of the first attribute.
In one embodiment, the first code execution segment corresponds to motor position and speed processing. In one embodiment, the second code execution segment corresponds to current regulator processing.
In one embodiment, the second attribute of the motor is motor current.
In one embodiment, the first attribute of the motor is motor position, a third attribute of the motor is motor speed, and the current value of the first attribute is set equal to a sum of the past value of the motor position and the product of the past value of the motor speed and a predetermined time interval.
In one embodiment, the method includes performing an analog-to-digital conversion of the feedback signal prior to transmitting the motor control signal.
In one embodiment, the motor control signal is a pulse-width modulation (PWM) signal.
A motor controller in accordance with one embodiment includes a processor configured to execute machine readable software instructions that, when executed by the processor, cause the processor to receive a feedback signal from a motor component communicatively coupled to the motor controller, wherein the feedback signal is responsive to one or more attributes of the motor. The motor controller further transmits a motor control signal to control the motor component based on first and second attributes of the motor component by iteratively alternating between two modes: a first mode in which a first code execution segment is performed utilizing the feedback signal to determine a current value of a first attribute of the motor, and a current value of a second attribute of the motor is determined using a past value of the second attribute, and a second mode in which a second code execution segment is performed utilizing the feedback signal to determine a current value of the second attribute of the motor, and a current value of the first attribute of the motor is determined using a past value of the first attribute.
In one embodiment, the first code execution segment corresponds to motor position and speed processing. In one embodiment, the second code execution segment corresponds to current regulator processing.
In one embodiment, the second attribute of the motor is motor current.
In one embodiment, the first attribute of the motor is motor position, a third attribute of the motor is motor speed, and the current value of the first attribute is set equal to a sum of the past value of the motor position and the product of the past value of the motor speed and a predetermined time interval.
In one embodiment, the method further includes performing an analog-to-digital conversion of the feedback signal prior to transmitting the motor control signal.
In one embodiment, the motor control signal is a pulse-width modulation (PWM) signal.
A moveable platform in accordance with one embodiment includes a motor component; a drive system mechanically coupled to the motor component; a motor controller communicatively coupled to the motor component, the motor controller configured to: receive a feedback signal from a motor component, the feedback signal responsive to one or more attributes of the motor; transmit a motor control signal to control the motor based on first and second attributes of the motor by iteratively alternating between two modes. In the first mode, a first code execution segment is performed utilizing the feedback signal to determine a current value of a first attribute of the motor, and a current value of a second attribute of the motor is determined using a past value of the second attribute. In the second mode, a second code execution segment is performed utilizing the feedback signal to determine a current value of the second attribute of the motor, and a current value of the first attribute of the motor is determined using a past value of the first attribute.
In one embodiment, the first code execution segment corresponds to motor position and speed processing. In one embodiment, the second code execution segment corresponds to current regulator processing.
In one embodiment, the motor controller further performs an analog-to-digital conversion of the feedback signal prior to transmitting the motor control signal.
In one embodiment, the motor control signal is a pulse-width modulation (PWM) signal.
In one embodiment, the drive system is selected from the group consisting of electric vehicle drive systems and electric bike drive systems.
The exemplary embodiments will hereinafter be described in conjunction with the following drawing figures, wherein like numerals denote like elements, and wherein:
Systems and methods are described for performing motor control using a reduced code execution time, thus preventing the potential cost increase resulting from using higher performance processors and/or the increased noise and reduced motor control performance caused by decreasing the motor control period—e.g., a pulse with modulation (PWM) period.
The following detailed description is merely exemplary in nature and is not intended to limit the application and uses. Furthermore, there is no intention to be bound by any expressed or implied theory presented in the preceding technical field, background, brief summary, or the following detailed description. As used herein, the term “module” refers to any hardware, software, firmware, electronic control component, processing logic, and/or processor device, individually or in any combination, including without limitation: application specific integrated circuit (ASIC), a field-programmable gate-array (FPGA), an electronic circuit, a processor (shared, dedicated, or group) and memory that executes one or more software or firmware programs, a combinational logic circuit, and/or other suitable components that provide the described functionality.
Embodiments of the present disclosure may be described herein in terms of functional and/or logical block components and various processing steps. It should be appreciated that such block components may be realized by any number of hardware, software, and/or firmware components configured to perform the specified functions. For example, an embodiment of the present disclosure may employ various integrated circuit components, e.g., memory elements, digital signal processing elements, logic elements, look-up tables, or the like, which may carry out a variety of functions under the control of one or more microprocessors or other control devices. In addition, those skilled in the art will appreciate that embodiments of the present disclosure may be practiced in conjunction with any number of systems, and that the systems described herein is merely one exemplary embodiments of the present disclosure.
For the sake of brevity, conventional techniques related to motor controllers, PWM systems, drive systems, computer software, and other functional aspects of the systems (and the individual operating components of the systems) may not be described in detail herein. Furthermore, the connecting lines shown in the various figures contained herein are intended to represent example functional relationships and/or physical couplings between the various elements. It should be noted that many alternative or additional functional relationships or physical connections may be present in an embodiment of the present disclosure.
Referring now to
Moveable platform 100 might correspond to any type of vehicle or device that incorporates an electrical motor or other electrical machine and which might benefit from the use of a motor controller system with reduced code execution time as described herein. Non-limiting examples of such moveable platforms include electric bikes, motorcycles, trucks, electric or hybrid vehicles (including autonomous vehicles), marine vessels, aircraft, robotic devices, and the like.
Motor controller 110 includes at least one processor 151 and a computer-readable storage device or media 152. The processor 151 may be any custom-made or commercially available processor, a central processing unit (CPU), a graphics processing unit (GPU), an auxiliary processor among several processors associated with the motor controller 110, a semiconductor-based microprocessor (in the form of a microchip or chip set), any combination thereof, or generally any device for executing code instructions. The computer readable storage device or media 152 may include volatile and nonvolatile storage in read-only memory (ROM), random-access memory (RAM), or the like. The computer-readable storage device or media 152 may be implemented using any of a number of known memory devices such as PROMs (programmable read-only memory), EPROMs (electrically PROM), EEPROMs (electrically erasable PROM), flash memory, or any other electric, magnetic, optical, or combination memory devices capable of storing data, some of which represent executable instructions, used by the motor controller 110 in controlling the moveable platform 100.
The code instructions that are executed by processor 151 may include one or more separate programs, each of which comprises an ordered listing of executable instructions for implementing logical functions. The executable instructions may be implemented using any high or low-level computer language now known or later developed, for example, compiled c code, assembly language code, or the like. The instructions, when executed by the processor 151, receive and process signals from motor 120 (and potentially other subsystems, not illustrated), perform logic, calculations, methods and/or algorithms for automatically generating a control signal 111 (e.g., a PWM control signal) that is transmitted to motor 120 based on the logic, calculations, methods, and/or algorithms.
In some embodiments, motor command signal 111 comprises a PWM signal selected to control the rotational speed of motor 120. The range of embodiments is not so limiting, however. The nature of PWM signals are known in the art, and need not be described in detail herein. In general, the term “PWM” is used to refer to any control scheme in which the duty cycle of a train of on/off pulses is used to control the average voltage and/or current provided to motor 120, thereby controlling its rotational speed.
Motor 120 may be any type of brushed or brushless electrical motor now known or later developed. Motor controller 110 receives feedback from motor 120 in the form of a signal or signals 121. In one embodiment, signal 121 includes information regarding the rotational speed (ω) and the position (θ), of one or more components of motor 120. In other embodiments, fewer or more attributes of motor 120 are included within signal 121. A variety of sensors known in the art may be used in conjunction with motor 120 to provide feedback signal 121, including, for example, resolvers, optical or capacitive encoders, hall-effect devices, and the like.
As mentioned briefly above, the execution of the software code by controller 110 takes place during a “code execution time” that necessarily fits within the PWM switching period.” In accordance with the illustrated embodiment, this code execution time encompasses the execution of code for estimating the position and/or speed of the motor based on feedback signal 121 (“position and speed processing”) and the execution of code for current regulation (“current regulator processing”). Position and speed processing includes, for example, extracting motor 120 position and speed from the measured raw motor currents and voltages, or measured raw position feedback signals from one or more encoders or resolver as known in the art.
Current regulator processing is performed in any suitable manner to produce motor terminal voltage values corresponding to the commanded motor current and/or the desired motor shaft torque (i.e. “direct torque control”). In general, the motor terminal voltages are computed based upon the measured and commanded currents.
Referring first to
As will be apparent in
In this regard,
That is, code execution time 320 includes open loop position and speed processing segment 202, but closed loop current regulator processing segment 205. Conversely, code execution time 321 includes open loop current regulator processing segment 203, but closed loop position and speed processing segment 206. Instead, as discussed in further detail below, during code execution time 320, new position and speed values are computed in open loop fashion based on speed and acceleration estimated in previous PWM period and is used in place of the value typically produced during closed loop current regulator processing segment 203. Similarly, during code execution time 321, the values of speed and position are computed in closed loop fashion based on the measured motor currents and voltages, or raw positions in current PWM period, and while the current regulator processing is in open loop fashion, which is much simpler than closed loop one. As will be appreciated from comparing
Referring now to the flowchart illustrated in
In addition, it is assumed that a state of the motor controller 110 is stored such that the system can determine whether it performed, during a previous PWM period, a given (closed loop) code execution segment, or whether it performed the alternate (open loop) estimate. In the present example, this is accomplished by storing the state of two flags, which will be referred to herein as a “speed estimation flag” and a “current regulator flag.” During any cycle of the loop shown in
With that in mind, the method continues to 402, in which the system is queried as to whether the first code execution segment flag is False, and the second code execution segment is True. In the present example, the first code execution segment will be associated with position and speed processing, and the second code execution segment will be associated with current regulator processing. The invention is not so limited, however.
If the query at 402 returns a True, then processing continues with steps 411-414 and then loops back to step 401. If the query at 402 returns a False, then processing continues with steps 421-424 before looping back to step 401.
With respect to 411, the system (i.e., motor controller 110) first runs a full, closed loop version of the position and speed processing code (e.g., segment 202 in
Referring now to the “False” branch from step 402, beginning with step 421, the system updates the position and speed estimation open loop based on the previous values, i.e., the values determined during the previous PWM period. In one embodiment, the motor position is estimated as being equal to the previous motor position multiplied by the previous angular velocity. Stated another way, if the position and velocity of motor 120 is given, for any iteration k, as θ[k] and w[k] respectively, then the values assigned at step 421 are as follows: θ[k]=θ[k−1]+w[k−1]T, and w[k]=w[k−1], where T is the time elapsed between iterations (e.g., the PWM period 210).
Next, at 422, one or more “other” functions are executed, as discussed previously. Subsequently, at 423, the full, closed-loop current regulator processing is performed (e.g., segment 203 in
It will be appreciated that the logic of method 400 results in a motor control scheme in which, for each code execution segment, that segment alternates between being performed closed loop (i.e., utilizing feedback signal 121 from motor 120) and being performed open loop (i.e., utilizing only state information from a prior iteration). This results in a reduced code execution time, thus preventing the potential cost increase resulting from using higher performance processors and/or the increased noise and reduced motor control performance caused by decreasing the motor control period.
While at least one exemplary embodiment has been presented in the foregoing detailed description, it should be appreciated that a vast number of variations exist. It should also be appreciated that the exemplary embodiment or exemplary embodiments are only examples, and are not intended to limit the scope, applicability, or configuration of the disclosure in any way. Rather, the foregoing detailed description will provide those skilled in the art with a convenient road map for implementing the exemplary embodiment or exemplary embodiments. It should be understood that various changes can be made in the function and arrangement of elements without departing from the scope of the disclosure as set forth in the appended claims and the legal equivalents thereof.