WO2021143915A1 - Control method and apparatus, and storage medium - Google Patents
Control method and apparatus, and storage medium Download PDFInfo
- Publication number
- WO2021143915A1 WO2021143915A1 PCT/CN2021/072590 CN2021072590W WO2021143915A1 WO 2021143915 A1 WO2021143915 A1 WO 2021143915A1 CN 2021072590 W CN2021072590 W CN 2021072590W WO 2021143915 A1 WO2021143915 A1 WO 2021143915A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- stepping motor
- speed
- control
- random number
- control signal
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 124
- 230000008569 process Effects 0.000 claims abstract description 46
- 230000008859 change Effects 0.000 claims abstract description 26
- 230000001133 acceleration Effects 0.000 claims abstract description 23
- 230000007423 decrease Effects 0.000 claims description 17
- 230000003139 buffering effect Effects 0.000 abstract 1
- 238000009825 accumulation Methods 0.000 description 9
- 238000010586 diagram Methods 0.000 description 7
- 230000002093 peripheral effect Effects 0.000 description 6
- 230000009286 beneficial effect Effects 0.000 description 5
- 238000012545 processing Methods 0.000 description 5
- 230000007704 transition Effects 0.000 description 5
- 238000007664 blowing Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 238000012937 correction Methods 0.000 description 2
- 238000006073 displacement reaction Methods 0.000 description 2
- 238000004891 communication Methods 0.000 description 1
- 230000002708 enhancing effect Effects 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Images
Classifications
-
- F—MECHANICAL ENGINEERING; LIGHTING; HEATING; WEAPONS; BLASTING
- F04—POSITIVE - DISPLACEMENT MACHINES FOR LIQUIDS; PUMPS FOR LIQUIDS OR ELASTIC FLUIDS
- F04D—NON-POSITIVE-DISPLACEMENT PUMPS
- F04D27/00—Control, e.g. regulation, of pumps, pumping installations or pumping systems specially adapted for elastic fluids
-
- H—ELECTRICITY
- H02—GENERATION; CONVERSION OR DISTRIBUTION OF ELECTRIC POWER
- H02P—CONTROL OR REGULATION OF ELECTRIC MOTORS, ELECTRIC GENERATORS OR DYNAMO-ELECTRIC CONVERTERS; CONTROLLING TRANSFORMERS, REACTORS OR CHOKE COILS
- H02P8/00—Arrangements for controlling dynamo-electric motors rotating step by step
- H02P8/14—Arrangements for controlling speed or speed and torque
-
- H—ELECTRICITY
- H02—GENERATION; CONVERSION OR DISTRIBUTION OF ELECTRIC POWER
- H02P—CONTROL OR REGULATION OF ELECTRIC MOTORS, ELECTRIC GENERATORS OR DYNAMO-ELECTRIC CONVERTERS; CONTROLLING TRANSFORMERS, REACTORS OR CHOKE COILS
- H02P8/00—Arrangements for controlling dynamo-electric motors rotating step by step
- H02P8/36—Protection against faults, e.g. against overheating or step-out; Indicating faults
Definitions
- the application relates to a control method, device and storage medium, and belongs to the technical field of motor control.
- Stepping motor is an open-loop control motor that converts electrical pulse signals into angular displacement or linear displacement. It is the main executive element in modern digital program control systems and is widely used. For example: used in electronic equipment such as hair dryers and fans.
- the present application provides a control method, device, and storage medium, which can solve the problem of step loss when the motor is turned on and off instantly, which reduces the accuracy of controlling the motor.
- This application provides the following technical solutions:
- a control method is provided, and the method includes:
- the stepping motor is controlled to work in a manner indicated by the control signal.
- the stepper motor operates in an x-phase y-beat mode, where x is the number of coil groups inside the stepper motor; the value of y is based on the step angle of the stepper motor and the rotor The number of teeth is determined.
- controlling the stepping motor to run at uniform acceleration or uniform deceleration based on the control signal includes:
- the movement speed of the stepping motor in the current shot is controlled according to the time interval.
- the time interval is calculated by the following formula:
- the n when the control signal is used to control the stepping motor to turn on, the n takes an integer from 1 to z in turn, and y 0 is the corresponding preset time interval at the beginning; when the control signal is used to control When the stepping motor is turned off, the n takes an integer from z to 1 in turn; the z is the number of beats when the speed of the stepping motor reaches the maximum speed; v min is the minimum speed of the stepping motor; v max is the maximum speed of the stepping motor; k is the acceleration value of the stepping motor; m is used to indicate the magnitude of each speed change.
- controlling the stepping motor to work in a manner indicated by the control signal includes:
- the stepping motor When the speed of the stepping motor is updated to the minimum speed, the stepping motor is controlled to stop running, and the control signal is used to control the closing of the stepping motor.
- the value of x is 4, and the value of y is 8.
- a control device in a second aspect, includes:
- a signal receiving module for receiving a control signal of a stepping motor, and the control signal is used for controlling the on or off of the stepping motor;
- the first control module is configured to control the stepping motor to run at uniform acceleration or uniform deceleration based on the control signal;
- the second control module is used for controlling the stepping motor to work in the manner indicated by the control signal when the speed of the stepping motor is updated to the target speed.
- a control device in a third aspect, includes a processor and a memory; the memory stores a program, and the program is loaded and executed by the processor to realize the stepping motor control described in the first aspect method.
- a computer-readable storage medium is provided, and a program is stored in the storage medium, and the program is loaded and executed by the processor to implement the stepping motor control method described in the first aspect.
- the object of the present invention is also to provide a control method that controls the fan speed by periodically generating random numbers and combining the random numbers with the current gear. Compared with the prior art, it can make the wind speed change rule more in line with the natural law to achieve better performance. The blowing experience close to the natural wind can avoid the uncomfortable feeling caused by the sharp change of wind speed and the additional damage of the fan.
- control method includes the following steps:
- S1 Acquire a set of data within a preset range according to a first preset period as a random number range at the current moment, where the acquisition method is acquisition according to a preset method or random acquisition;
- S2 Acquire a value within the random number range at the current moment as the random number of the current period, where the acquisition method is acquisition according to a preset method or random acquisition;
- the first set period is 1s.
- step S1 the acquisition of a set of data within a preset range as the random number range at the current moment means that the set of data is a numerical value in a regional range or a set of multiple numerical values.
- step S3 the process of controlling the fan according to the random number of the current period includes the following steps:
- the rotation speed of the fan is adjusted according to the second preset control procedure.
- the first preset control process includes the following steps:
- step S4 the combination of the current gear and the random number of the current period to calculate the target rotation speed value at the next moment refers to:
- the random number of the current period is superimposed on the gear value corresponding to the current gear, and the target speed value at the next moment is calculated;
- the m is a positive integer greater than or equal to 1.
- the second preset control process includes the following steps:
- the initial value of the dynamic random number is the random number of the previous cycle, according to the second set cycle, combined with the preset increase and decrease range to perform the accumulation/accumulation operation on the dynamic random number to continuously adjust the dynamic random number selection Until the difference between the value of the dynamic random number and the random number of the current cycle is less than or equal to the preset increase or decrease range, the dynamic random number is adjusted to the random number of the current cycle by accumulating/accumulating again, to complete The adjustment process of dynamic random numbers;
- the current gear and the dynamic random number after each adjustment are combined to calculate the target speed value at the next moment, and the target speed value is sent to the PID controller.
- the control process to adjust the fan speed to the target speed value.
- the preset increase or decrease range is a fixed value.
- the preset increase or decrease range is 200.
- the present invention also provides a computer-readable storage medium, which stores computer-readable instructions, which can cause at least one processor to execute the above-mentioned method.
- the beneficial effects of the present application are: by receiving the control signal of the stepping motor; controlling the stepping motor to run at uniform acceleration or uniform deceleration based on the control signal; when the speed of the stepping motor is updated to the target speed, the stepping motor is controlled to indicate with the control signal It can solve the problem of losing steps when the motor is turned on and off instantly, which reduces the accuracy of the control motor; because the stepper motor runs at a uniform acceleration during the start-up process, and runs at a uniform deceleration during the shutdown process, stepping The switching process of the motor has a buffer phase of speed changes. At this time, the stepper motor will not produce a large impact, which reduces the probability of the stepper motor losing steps.
- the speed adjustment frequency is fixed, which is beneficial to reduce damage to the fan.
- Fig. 1 is a schematic structural diagram of a stepping motor control system provided by an embodiment of the present application
- Fig. 2 is a flowchart of a stepping motor control method provided by an embodiment of the present application
- Fig. 3 is a block diagram of a stepping motor control device provided by an embodiment of the present application.
- Figure 4 is a block diagram of a stepping motor control device provided by an embodiment of the present application.
- Fig. 5 is a flowchart of a method for controlling the speed of a fan of the present invention.
- Fig. 6 is a schematic diagram of a curve of the rotation speed of the fan of the present invention changing with time.
- the number of phases of the stepper motor refers to the number of coil groups inside the stepper motor.
- the number of beats of the stepping motor refers to the number of pulses required for each rotation of a tooth pitch when the stepping motor is running.
- Stepping motor step loss refers to the phenomenon that the stepping motor does not follow the instructions to reach the desired position.
- the reasons that cause the stepper motor to lose steps include: the stepper motor loses steps due to a large collision due to a sudden change in speed during the start and stop of the stepper motor.
- this application provides the following stepping motor control and control method.
- FIG. 1 is a schematic structural diagram of a stepping motor control system provided by an embodiment of the present application. As shown in FIG. 1, the system at least includes: a stepping motor control device 110 and a stepping motor 120.
- the stepping motor control device 110 is connected to the stepping motor 120 in communication.
- the stepper motor 120 operates in an x-phase y-beat mode, where x is the number of coil groups inside the stepper motor; the value of y is determined based on the step angle of the stepper motor and the number of rotor teeth. For example, x is 4 and y is 8. Of course, the values of x and y can also be other values, and this embodiment does not limit the values of x and y.
- the stepping motor 120 uses a 4-phase 5-wire 8-beat stepping motor 120, that is, the rotor of the stepping motor runs in the following phases: A-AB-B-BC-C-CD-D- DA.
- the stepping motor control device 110 is used to control the operation of the stepping motor 120. For example: controlling the start, speed and shutdown of the stepper motor 120.
- the stepping motor control device 110 and the stepping motor 120 may be installed in the same device (for example, a hair dryer, a fan); or, it may be installed in a different device. This embodiment does not compare the stepping motor control device 110 and the stepping motor.
- the installation method of the incoming motor 120 is limited.
- the stepping motor control device 110 is used to: receive the control signal of the stepping motor; control the stepping motor to run at uniform acceleration or uniform deceleration based on the control signal; when the speed of the stepping motor is updated to the target speed, control the stepping The motor works in the manner indicated by the control signal.
- control signal is used to control the opening or closing of the stepper motor.
- control signal is used to control the stepping motor 120 to turn on, and the stepping motor control device 110 controls the stepping motor 120 to run at a uniform acceleration; the control signal indicates the way to control the stepping motor 120 to operate normally.
- control signal is used to control the stepping motor 120 to turn off, and the stepping motor control device 110 controls the stepping motor 120 to run at a uniform deceleration; the control signal indicates the way to control the stepping motor 120 to stop.
- the control signal is generated when an electronic device including a stepper motor receives a user's control operation on the switch button.
- electronic equipment including stepper motors such as hair dryers, fans, power tools, medical equipment, etc.
- switch buttons such as hair dryers, fans, power tools, medical equipment, etc.
- switch circuits connected to the switch buttons
- stepper motor control devices 110 connected to the switch circuits
- the stepping motor 120 connected to the stepping motor control device 110.
- the switch circuit When the user presses the switch button, the switch circuit generates a control signal and sends the control signal to the stepping motor control device 110, and the stepping motor control device 110 controls the stepping motor 120 after receiving the control signal.
- FIG. 2 is a flowchart of a stepping motor control method provided by an embodiment of the present application. This embodiment uses the method to apply to the stepping motor control system shown in FIG. 1, and the execution subject of each step is the stepping motor control system in the system.
- the stepping motor control device 110 is described as an example. The method includes at least the following steps:
- Step 201 Receive a control signal of the stepper motor, where the control signal is used to control the on or off of the stepper motor.
- control signal of the stepper motor is generated when the electronic device including the stepper motor receives a control operation on the switch button by the user.
- control signal When the stepper motor is in the on state, the control signal is used to control the stepper motor to turn off; when the stepper motor is in the off state, the control signal is used to control the stepper motor to turn on.
- the value of x is 4 and the value of y is 8.
- the stepper motor uses a 4-phase 5-wire 8-beat stepper motor 120, that is, the rotor of the stepper motor runs in the following phase: A-AB-B-BC-C-CD-D-DA.
- Step 202 Control the stepping motor to run at uniform acceleration or uniform deceleration based on the control signal.
- control signal is used to control the stepping motor to turn on.
- the stepping motor is controlled to run at a uniform acceleration. Since the stepping motor runs at a uniform acceleration, there is a buffer phase of speed changes during the opening of the stepping motor. At this time, the stepping motor will not produce a large impact, reducing the probability of the stepping motor losing steps.
- control signal is used to control the stepping motor to turn off.
- the stepping motor is controlled to run at a uniform deceleration. Since the stepper motor runs at a uniform deceleration, there is a buffer phase of speed change during the closing process of the stepper motor. At this time, the stepper motor will not produce a large impact, reducing the probability of the stepper motor losing steps.
- the methods for controlling the stepping motor to run at uniform acceleration or uniform deceleration based on the control signal include but are not limited to the following:
- the first type Calculate the time interval between different shots; control the movement speed of the stepping motor in the current shot according to the time interval.
- the control signal is used to control the stepping motor to turn on
- the time interval decreases as the number of beats increases
- the control signal is used to control the stepping motor to turn off
- the time interval increases as the number of beats increases.
- the time interval is calculated by the following formula:
- n when the control signal is used to control the stepping motor to turn on, n takes an integer from 1 to z in turn, and y 0 is the corresponding preset time interval at the beginning; when the control signal is used to control the stepping motor to turn off, n is in turn Take an integer from z to 1; z is the number of beats when the speed of the stepping motor reaches the maximum speed; v min is the minimum speed of the stepping motor; v max is the maximum speed of the stepping motor; k is the acceleration value of the stepping motor ; M is used to indicate the size of each speed change.
- the value of y 0 , the values of v max and v min are set constants, for example: y 0 is 7 ms, v max is 55°/sec, and v min is 10°/sec.
- y 0 is 7 ms
- v max is 55°/sec
- v min is 10°/sec.
- the value of the parameter is limited.
- the second type obtain the corresponding relationship between the number of beats and the time interval; determine the time interval corresponding to the current number of beats in the corresponding relationship; control the movement speed of the stepping motor in the current beat according to the time interval.
- the control signal is used to control the stepping motor to turn on, the time interval decreases as the number of beats increases; when the control signal is used to control the stepping motor to turn off, the time interval increases as the number of beats increases.
- controlling the movement speed of the stepping motor in the current beat according to the time interval includes: for the phase corresponding to the previous beat and the current beat, controlling the phase of the stepping motor from the previous beat within the time interval Run with uniform acceleration or uniform deceleration to the phase corresponding to the current shot.
- the time interval is calculated according to the first method, assuming that during the stepping motor is turned on, the initial time interval y 0 is 7 ms, v max is 55°/sec, and v min is 10°/sec.
- the stepping motor is controlled to run uniformly from phase A to phase AB.
- Step 203 When the speed of the stepping motor is updated to the target speed, the stepping motor is controlled to work in a manner indicated by the control signal.
- control the stepper motor when the speed of the stepper motor is updated to the target speed, control the stepper motor to work in the manner indicated by the control signal, including: when the speed of the stepper motor is updated to the maximum speed, control the stepper motor to a constant time The interval runs between different beats, and the control signal is used to control the opening of the stepping motor; or, when the speed of the stepping motor is updated to the minimum speed, the stepping motor is controlled to stop running, and the control signal is used to control the closing of the stepping motor .
- control signal When the control signal is used to control the opening of the stepping motor, if the speed of the stepping motor is updated to the maximum speed, it means that the stepping motor has finished the uniform acceleration process during the opening process, and at this time, the stepping motor enters the normal operating state;
- control signal is used to control the closing of the stepping motor, if the speed of the stepping motor is updated to the minimum speed, it means that the stepping motor has finished the uniform deceleration process during the closing process. At this time, the stepping motor stops running and cuts off the step. Power into the motor to reduce power consumption.
- the stepper motor control method receives the control signal of the stepper motor; controls the stepper motor to run at uniform acceleration or uniform deceleration based on the control signal; when the speed of the stepper motor is updated to the target speed , Control the stepper motor to work in the manner of control signal; it can solve the problem of losing steps when the motor is turned on and off instantly, which reduces the accuracy of the control motor; because the stepper motor runs uniformly during the startup process, During the shutdown process, the stepper motor will run at a uniform deceleration.
- the stepper motor has a buffer phase of speed change during the switching process. At this time, the stepper motor will not produce a large impact, reducing the probability of stepping motor loss.
- FIG. 3 is a block diagram of a stepping motor control device provided by an embodiment of the present application.
- the device is applied to the stepping motor control device 110 in the stepping motor control system shown in FIG. 1 as an example for description.
- the device includes at least the following modules: a signal receiving module 310, a first control module 320, and a second control module 330.
- the signal receiving module 310 is configured to receive a control signal of a stepper motor, and the control signal is used to control the on or off of the stepper motor;
- the first control module 320 is configured to control the stepping motor to run at uniform acceleration or uniform deceleration based on the control signal;
- the second control module 330 is configured to control the stepping motor to work in the manner indicated by the control signal when the speed of the stepping motor is updated to the target speed.
- stepper motor control device performs stepper motor control
- only the division of the above-mentioned functional modules is used as an example for illustration.
- the above-mentioned function assignments can be divided according to needs.
- the function module is completed, that is, the internal structure of the stepper motor control device is divided into different function modules to complete all or part of the functions described above.
- the stepping motor control device provided by the above-mentioned embodiment and the stepping motor control method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, and will not be repeated here.
- FIG. 4 is a block diagram of a stepping motor control device provided by an embodiment of the present application.
- the device may be an electronic device including the stepping motor control device 110 in the stepping motor control system shown in FIG. 1, such as a hair dryer, a fan (Shaking head fan), electric tools, smart phones, etc., this embodiment does not limit this.
- the device at least includes a processor 401 and a memory 402.
- the processor 401 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so on.
- the processor 401 can adopt DSP (Digital Signal Processing, digital signal processing), FPGA (Field-Programmable Gate Array, field programmable gate array), PLA
- the processor 401 may also include a main processor and a coprocessor.
- the main processor is a processor used to process data in the awake state, also called a CPU (Central Processing Unit, central processing unit); the coprocessor is A low-power processor used to process data in the standby state.
- the memory 402 may include one or more computer-readable storage media, which may be non-transitory.
- the memory 402 may also include high-speed random access memory and non-volatile memory, such as one or more magnetic disk storage devices and flash memory storage devices.
- the non-transitory computer-readable storage medium in the memory 402 is used to store at least one instruction, and the at least one instruction is used to be executed by the processor 401 to implement the step provided by the method embodiment of the present application. Motor control method.
- the stepping motor control device may optionally further include: a peripheral device interface and at least one peripheral device.
- the processor 401, the memory 402, and the peripheral device interface may be connected by a bus or a signal line.
- Each peripheral device can be connected to the peripheral device interface through a bus, a signal line or a circuit board.
- peripheral devices include but are not limited to: radio frequency circuits, touch screens, audio circuits, and power supplies.
- the stepping motor control device may also include fewer or more components, which is not limited in this embodiment.
- the present application also provides a computer-readable storage medium in which a program is stored, and the program is loaded and executed by a processor to implement the stepper motor control method of the foregoing method embodiment.
- this application also provides a computer product including a computer-readable storage medium in which a program is stored, and the program is loaded and executed by a processor to implement the above-mentioned method embodiments The stepping motor control method.
- the present invention proposes a method for controlling the speed of a fan.
- the control method includes the following steps:
- S1 Acquire a set of data within a preset range according to a first preset period as a random number range at the current moment, where the acquisition method is acquisition in a preset manner or random acquisition.
- S2 Acquire a value in the random number range at the current moment as the random number of the current period, where the acquisition method is acquisition in a preset manner or random acquisition.
- the present invention proposes a double random number generation method.
- the speed control of a certain fan uses PID adjustment, so that the fan speed will smoothly follow the target speed (the next output speed) at a rate of change of less than the maximum speed.
- the maximum speed change rate is 300rpm/s (600), and the speed range is 2000rpm-5600rpm.
- the first step is to use a random generator to generate random numbers in a random range at a fixed frequency.
- the random range uses a random generator to generate random numbers from -300rpm to 300rpm. (That is, the range of the maximum random number is -300rpm to 300rpm), then the range of the random number of the current moment finally output in step S1 and the random number of the current period finally output in step S2 must also be included in the range of -300rpm to 300rpm between. For example, first generate a random range (-100, 100) in (-300, 300), and then generate a random value of 45 in (-100, 100), and so on.
- the variation range of the random number is controlled to make the variation law of the random number more in line with the natural law.
- the wind generated by the fan have the random law of natural wind, It can also control its change range, avoiding the discomfort caused by excessive and strong wind speed sudden changes and the additional loss of the fan.
- the present invention proposes the following solutions:
- step S3 the process of controlling the fan according to the random number of the current period includes the following steps:
- the first preset control process includes the following steps:
- the second preset control process includes the following steps:
- the initial value of the dynamic random number is the random number of the previous cycle, according to the second set cycle, combined with the preset increase and decrease range to perform the accumulation/accumulation operation on the dynamic random number to continuously adjust the dynamic random number selection Until the difference between the value of the dynamic random number and the random number of the current cycle is less than or equal to the preset increase or decrease range, the dynamic random number is adjusted to the random number of the current cycle by accumulating/accumulating again, to complete The adjustment process of dynamic random numbers.
- the current gear and the dynamic random number after each adjustment are combined to calculate the target speed value at the next moment, and the target speed value is sent to the PID controller.
- the control process to adjust the fan speed to the target speed value.
- the maximum change range of the fan speed is divided into m range segments by using m gear values.
- the random number of the current period is superimposed on the gear value corresponding to the current gear, and the target speed value at the next moment is calculated.
- the m is a positive integer greater than or equal to 1.
- the final fan speed value will be different.
- the random value corresponding to the current moment can be adjusted to adjust the actual fan speed.
- the fan speed range is 2000rpm-5600rpm, after splitting, the first gear is 2000rpm, the second gear is 2400rpm, and the following are successively Increment and so on.
- the maximum value range of the random number in order to increase the wind speed change range in the two periods before and after, can be appropriately increased to obtain a more obvious natural wind change experience.
- the target fan speed obtained after superposition may exceed its corresponding maximum speed range, and the excess part can be cut off.
- the maximum speed of the fan is taken as the final speed value, and the wind speed can be controlled while ensuring the safe operation of the fan.
- the preset difference threshold such as 300
- the random number of the current cycle can be directly changed Superimposed on the current gear, directly output the final target speed. If the difference between the random number in the current cycle and the random number in the previous cycle exceeds three hundred, it is necessary to further determine the size of the two random numbers to select the accumulation or the accumulation operation.
- the random number of the current cycle is greater than the random number of the previous cycle.
- the random number of the previous cycle is -260 and the random number of the current cycle is 240. If the difference between the two is 500, the dynamic random number will be generated.
- the initial dynamic random number The value is -260, and the accumulation operation is performed with a preset increase or decrease range (such as 200). At the same time, the value of the dynamic random number is superimposed on the current gear, and the transition speed is output:
- the random number of the current cycle is smaller than the random number of the previous cycle.
- the process is similar to the aforementioned adjustment process, except that the accumulation operation is replaced with a accumulation operation, which will not be repeated here.
- the preset difference threshold is directly related to the motor noise, and can be dynamically set according to the actual needs of the user.
- the preset increase/decrease range and the adjustment period are not fixed, and can be dynamically adjusted according to the actual situation to make a trade-off between the smoothness of the adjustment curve and the adjustment time.
- the use of the fan speed control method mentioned in the present invention can not only make the wind speed change law more in line with the natural law to achieve a blowing experience closer to the natural wind, but also avoid the uncomfortable feeling caused by the rapid change of wind speed. And additional damage to the fan.
- the speed adjustment frequency is fixed, which is beneficial to reduce damage to the fan.
Landscapes
- Engineering & Computer Science (AREA)
- Power Engineering (AREA)
- Mechanical Engineering (AREA)
- General Engineering & Computer Science (AREA)
- Control Of Stepping Motors (AREA)
Abstract
Disclosed are a control method and apparatus, and a storage medium, belonging to the technical field of electric motor control. The method comprises: receiving a control signal from a stepper motor, wherein the control signal is used for controlling the stepper motor to turn on or turn off (201); controlling, based on the control signal, the stepper motor to operate at a uniform acceleration or deceleration (202); and controlling, when the speed of the stepper motor is updated to a target speed, the stepper motor to operate in a mode indicated by the control signal (203). The problem of the motor control accuracy being reduced due to the occurrence of a step loss phenomenon during instantaneous turning on and turning off of the motor can be solved; and there is a stage of buffering for a speed change during the turning on or turning off of the stepper motor, because the stepper motor operates at a uniform acceleration in a turning on process and operates at a uniform deceleration in a turning off process, such that the stepper motor will not have a great impact, thereby reducing the probability of step loss of the stepper motor.
Description
本申请涉及一种控制方法、装置及存储介质,属于电机控制技术领域。The application relates to a control method, device and storage medium, and belongs to the technical field of motor control.
步进电机是将电脉冲信号转变为角位移或线位移的开环控制电机,是现代数字程序控制系统中的主要执行元件,应用极为广泛。比如:应用在吹风机、风扇等电子设备中。Stepping motor is an open-loop control motor that converts electrical pulse signals into angular displacement or linear displacement. It is the main executive element in modern digital program control systems and is widely used. For example: used in electronic equipment such as hair dryers and fans.
由于步进电机的瞬间开启和关闭会出现很大的冲撞,因此,可能会出现丢步现象。这样,会给步进电机的精细控制带来误差,导致降低控制电机的准确度的问题。Since the momentary opening and closing of the stepper motor will cause a big collision, there may be lost steps. In this way, errors will be brought to the fine control of the stepper motor, resulting in the problem of reducing the accuracy of the control motor.
发明内容Summary of the invention
本申请提供了一种控制方法、装置及存储介质,可以解决电机的瞬间开启和关闭会出现丢步现象,导致的降低控制电机的准确度的问题。本申请提供如下技术方案:The present application provides a control method, device, and storage medium, which can solve the problem of step loss when the motor is turned on and off instantly, which reduces the accuracy of controlling the motor. This application provides the following technical solutions:
第一方面,提供了一种控制方法,所述方法包括:In the first aspect, a control method is provided, and the method includes:
接收步进电机的控制信号,所述控制信号用于控制所述步进电机的开启或关闭;Receiving a control signal of a stepping motor, where the control signal is used to control turning on or off of the stepping motor;
基于所述控制信号控制所述步进电机匀加速或匀减速运行;Controlling the stepping motor to run with uniform acceleration or uniform deceleration based on the control signal;
在所述步进电机的速度更新至目标速度时,控制所述步进电机以所述控制信号指示的方式工作。When the speed of the stepping motor is updated to the target speed, the stepping motor is controlled to work in a manner indicated by the control signal.
可选地,所述步进电机按照x相y拍方式运行,所述x为所述步进电机内部的线圈组数;所述y的取值基于所述步进电机的步距角和转子齿数确定。Optionally, the stepper motor operates in an x-phase y-beat mode, where x is the number of coil groups inside the stepper motor; the value of y is based on the step angle of the stepper motor and the rotor The number of teeth is determined.
可选地,所述基于所述控制信号控制所述步进电机匀加速或匀减速运行,包括:Optionally, the controlling the stepping motor to run at uniform acceleration or uniform deceleration based on the control signal includes:
计算不同拍之间的时间间隔;其中,在所述控制信号用于控制所述步进电机开启时,所述时间间隔随拍数的增大而减小;在所述控制信号用于控制所述步进电机关闭时,所述时间间隔随拍数的增大而增大;Calculate the time interval between different beats; wherein, when the control signal is used to control the stepping motor to turn on, the time interval decreases as the number of beats increases; when the control signal is used to control all When the stepping motor is turned off, the time interval increases as the number of beats increases;
按照所述时间间隔控制所述步进电机在当前拍的运动速度。The movement speed of the stepping motor in the current shot is controlled according to the time interval.
可选地,所述时间间隔通过下式计算:Optionally, the time interval is calculated by the following formula:
其中,在所述控制信号用于控制所述步进电机开启时,所述n依次取1至z的整数,y
0为起始时对应的预设时间间隔;在所述控制信号用于控制所述步进电机关闭时,所述n依次取z至1的整数;所述z为所述步进电机的速度达到最大速度时的拍数;v
min为所述步进电机的最小速度;v
max为所述步进电机的最大速度;k为所述步进电机的加速度值;m用于指示每次速度变化的大小。
Wherein, when the control signal is used to control the stepping motor to turn on, the n takes an integer from 1 to z in turn, and y 0 is the corresponding preset time interval at the beginning; when the control signal is used to control When the stepping motor is turned off, the n takes an integer from z to 1 in turn; the z is the number of beats when the speed of the stepping motor reaches the maximum speed; v min is the minimum speed of the stepping motor; v max is the maximum speed of the stepping motor; k is the acceleration value of the stepping motor; m is used to indicate the magnitude of each speed change.
可选地,所述在所述步进电机的速度更新至目标速度时,控制所述步进电机以所述控制信号指示的方式工作,包括:Optionally, when the speed of the stepping motor is updated to a target speed, controlling the stepping motor to work in a manner indicated by the control signal includes:
在所述步进电机的速度更新至最大速度时,控制所述步进电机以恒定的时间间隔在不同拍之间运行,所述控制信号用于控制所述步进电机的开启;When the speed of the stepping motor is updated to the maximum speed, controlling the stepping motor to run between different beats at a constant time interval, and the control signal is used to control the turning on of the stepping motor;
或者,or,
在所述步进电机的速度更新至最小速度时,控制所述步进电机停止运行,所述控制信号用于控制所述步进电机的关闭。When the speed of the stepping motor is updated to the minimum speed, the stepping motor is controlled to stop running, and the control signal is used to control the closing of the stepping motor.
可选地,所述x的值为4,所述y的值为8。Optionally, the value of x is 4, and the value of y is 8.
第二方面,提供了一种控制装置,所述装置包括:In a second aspect, a control device is provided, and the device includes:
信号接收模块,用于接收步进电机的控制信号,所述控制信号用于控制所述步进电机的开启或关闭;A signal receiving module for receiving a control signal of a stepping motor, and the control signal is used for controlling the on or off of the stepping motor;
第一控制模块,用于基于所述控制信号控制所述步进电机匀加速或匀减速运行;The first control module is configured to control the stepping motor to run at uniform acceleration or uniform deceleration based on the control signal;
第二控制模块,用于在所述步进电机的速度更新至目标速度时,控制所述步进电机以所述控制信号指示的方式工作。The second control module is used for controlling the stepping motor to work in the manner indicated by the control signal when the speed of the stepping motor is updated to the target speed.
第三方面,提供一种控制装置,所述装置包括处理器和存储器;所述存储器中存储有程序,所述程序由所述处理器加载并执行以实现第一方面所述的步进电机控制方法。In a third aspect, a control device is provided, the device includes a processor and a memory; the memory stores a program, and the program is loaded and executed by the processor to realize the stepping motor control described in the first aspect method.
第四方面,提供一种计算机可读存储介质,所述存储介质中存储有程序,所述程序由所述处理器加载并执行以实现第一方面所述的步进电机控制方法。In a fourth aspect, a computer-readable storage medium is provided, and a program is stored in the storage medium, and the program is loaded and executed by the processor to implement the stepping motor control method described in the first aspect.
本发明目的还在于提供一种控制方法,通过定期生成随机数,结合随机数和当前档位对风机转速进行控制,较之现有技术,既可以使风速的变化规律更符合自然规律以实现更贴近自然风的吹风体验,又能够避免因风速急剧变化带来的不舒适感受和风机的额外损伤。The object of the present invention is also to provide a control method that controls the fan speed by periodically generating random numbers and combining the random numbers with the current gear. Compared with the prior art, it can make the wind speed change rule more in line with the natural law to achieve better performance. The blowing experience close to the natural wind can avoid the uncomfortable feeling caused by the sharp change of wind speed and the additional damage of the fan.
第五方面,结合图5,本发明提出一种控制方法,所述控制方法包括以下步骤:In the fifth aspect, in conjunction with FIG. 5, the present invention proposes a control method. The control method includes the following steps:
S1,按照第一设定周期在预设范围内获取一组数据作为当前时刻的随机数范围,其中,获取方式为按预设方式获取或随机获取;S1: Acquire a set of data within a preset range according to a first preset period as a random number range at the current moment, where the acquisition method is acquisition according to a preset method or random acquisition;
S2,在所述当前时刻的随机数范围获取一个数值作为当前周期的随机数,其中,获取方式为按预设方式获取或随机获取;S2: Acquire a value within the random number range at the current moment as the random number of the current period, where the acquisition method is acquisition according to a preset method or random acquisition;
S3,根据所述当前周期的随机数控制所述风机。S3: Control the fan according to the random number of the current period.
进一步的实施例中,所述第一设定周期为1s。In a further embodiment, the first set period is 1s.
进一步的实施例中,步骤S1中,所述在预设范围内获取一组数据作为当前时刻的随机数范围是指,所述一组数据为区域范围的数值或多个数值的集合。In a further embodiment, in step S1, the acquisition of a set of data within a preset range as the random number range at the current moment means that the set of data is a numerical value in a regional range or a set of multiple numerical values.
进一步的实施例中,步骤S3中,所述根据所述当前周期的随机数控制所述风机的过程包括以下步骤:In a further embodiment, in step S3, the process of controlling the fan according to the random number of the current period includes the following steps:
对比所述当前周期的随机数与上一周期的随机数:Compare the random number of the current cycle with the random number of the previous cycle:
若两者之间的差值小于预设差值阈值,则根据第一预设控制流程调整所述风机的转速;If the difference between the two is less than the preset difference threshold, adjusting the rotation speed of the fan according to the first preset control process;
若两者之间的差值大于等于预设差值阈值,则根据第二预设控制流程调整所述风机的转速。If the difference between the two is greater than or equal to the preset difference threshold, the rotation speed of the fan is adjusted according to the second preset control procedure.
进一步的实施例中,所述第一预设控制流程包括以下步骤:In a further embodiment, the first preset control process includes the following steps:
结合当前档位和当前周期的随机数以计算得到下一时刻的目标转速值,将目标转速值发送至PID控制器,PID控制器按照预设控制流程将风机转速调节为目标转速值。Combining the current gear and the random number of the current period to calculate the target speed value at the next moment, send the target speed value to the PID controller, and the PID controller adjusts the fan speed to the target speed value according to the preset control process.
进一步的实施例中,步骤S4中,所述结合当前档位和当前周期的随机数以计算得到下一时刻的目标转速值是指:In a further embodiment, in step S4, the combination of the current gear and the random number of the current period to calculate the target rotation speed value at the next moment refers to:
采用m个档位值将风机转速最大变化范围分为m个范围段;Use m gear values to divide the maximum change range of fan speed into m range segments;
将当前周期的随机数叠加在当前档位对应的档位值上,计算得到下一时刻的目标转速值;The random number of the current period is superimposed on the gear value corresponding to the current gear, and the target speed value at the next moment is calculated;
所述m为大于等于1的正整数。The m is a positive integer greater than or equal to 1.
进一步的实施例中,所述第二预设控制流程包括以下步骤:In a further embodiment, the second preset control process includes the following steps:
生成动态随机数,动态随机数的初始值为上一周期的随机数,按照第二设定周期,结合预设增减幅度对动态随机数执行累加/累减操作以不断调整动态随机数的取值,直至动态随机数的取值与所述当前周期的随机数之间的差值小于等于预设增减幅度,通过再次累加/累减操作将动态随机数调整为当前周期的随机数,完成对动态随机数的调整过程;Generate a dynamic random number, the initial value of the dynamic random number is the random number of the previous cycle, according to the second set cycle, combined with the preset increase and decrease range to perform the accumulation/accumulation operation on the dynamic random number to continuously adjust the dynamic random number selection Until the difference between the value of the dynamic random number and the random number of the current cycle is less than or equal to the preset increase or decrease range, the dynamic random number is adjusted to the random number of the current cycle by accumulating/accumulating again, to complete The adjustment process of dynamic random numbers;
其中,在动态随机数的调整过程中,结合当前档位和每一次调整后的动态 随机数以计算得到下一时刻的目标转速值,将目标转速值发送至PID控制器,PID控制器按照预设控制流程将风机转速调节为目标转速值。Among them, in the adjustment process of the dynamic random number, the current gear and the dynamic random number after each adjustment are combined to calculate the target speed value at the next moment, and the target speed value is sent to the PID controller. Set the control process to adjust the fan speed to the target speed value.
进一步的实施例中,所述预设增减幅度为一固定值。In a further embodiment, the preset increase or decrease range is a fixed value.
进一步的实施例中,所述预设增减幅度为200。In a further embodiment, the preset increase or decrease range is 200.
本发明还提供了一种计算机可读存储介质,存储有计算机可读指令,可以使至少一个处理器执行上述的方法。The present invention also provides a computer-readable storage medium, which stores computer-readable instructions, which can cause at least one processor to execute the above-mentioned method.
本申请的有益效果在于:通过接收步进电机的控制信号;基于控制信号控制步进电机匀加速或匀减速运行;在步进电机的速度更新至目标速度时,控制步进电机以控制信号指示的方式工作;可以解决电机的瞬间开启和关闭出现丢步现象,导致的降低控制电机的准确度的问题;由于步进电机在开机过程中匀加速运行、在关机过程中匀减速运行,步进电机的开关过程存在速度变化的缓冲阶段,此时,步进电机不会产生较大的冲击,降低步进电机丢步的概率。The beneficial effects of the present application are: by receiving the control signal of the stepping motor; controlling the stepping motor to run at uniform acceleration or uniform deceleration based on the control signal; when the speed of the stepping motor is updated to the target speed, the stepping motor is controlled to indicate with the control signal It can solve the problem of losing steps when the motor is turned on and off instantly, which reduces the accuracy of the control motor; because the stepper motor runs at a uniform acceleration during the start-up process, and runs at a uniform deceleration during the shutdown process, stepping The switching process of the motor has a buffer phase of speed changes. At this time, the stepper motor will not produce a large impact, which reduces the probability of the stepper motor losing steps.
进一步地,以上本发明的技术方案,与现有相比,其显著的有益效果在于:Furthermore, compared with the prior art, the above technical solutions of the present invention have significant beneficial effects in:
(1)通过定期生成随机数,结合随机数和当前档位对风机转速进行控制,较之现有技术,使风速的变化规律更符合自然规律以实现更贴近自然风的吹风体验。(1) By regularly generating random numbers, combining random numbers and current gears to control the fan speed, compared with the prior art, the wind speed change law is more in line with the natural law to achieve a blowing experience closer to natural wind.
(2)采用双随机数生成方法以尽可能生成合理取值范围和变化规律的随机数。(2) The double random number generation method is used to generate random numbers with reasonable value ranges and changing laws as much as possible.
(3)当新产生的随机数与上一周期的随机数差值过大时,采用平滑过渡方式进行修正,避免因风速急剧变化带来的不舒适感受和风机的额外损伤。(3) When the difference between the newly generated random number and the random number of the previous cycle is too large, a smooth transition method is used to correct it to avoid the uncomfortable feeling caused by the rapid change of wind speed and the additional damage of the fan.
(4)转速调整频率固定,有利于减少对风机对损伤。(4) The speed adjustment frequency is fixed, which is beneficial to reduce damage to the fan.
(5)拥有多级档位(如10级),使用户可以根据实际需求自行选择合适的风速波动范围。(5) With multi-level gears (such as level 10), users can choose the appropriate wind speed fluctuation range according to actual needs.
上述说明仅是本申请技术方案的概述,为了能够更清楚了解本申请的技术手段,并可依照说明书的内容予以实施,以下以本申请的较佳实施例并配合附图详细说明如后。The above description is only an overview of the technical solution of the present application. In order to understand the technical means of the present application more clearly and implement it in accordance with the content of the description, the following detailed descriptions are given below with the preferred embodiments of the present application in conjunction with the accompanying drawings.
图1是本申请一个实施例提供的步进电机控制系统的结构示意图;Fig. 1 is a schematic structural diagram of a stepping motor control system provided by an embodiment of the present application;
图2是本申请一个实施例提供的步进电机控制方法的流程图;Fig. 2 is a flowchart of a stepping motor control method provided by an embodiment of the present application;
图3是本申请一个实施例提供的步进电机控制装置的框图;Fig. 3 is a block diagram of a stepping motor control device provided by an embodiment of the present application;
图4是本申请一个实施例提供的步进电机控制装置的框图;Figure 4 is a block diagram of a stepping motor control device provided by an embodiment of the present application;
图5是本发明的风机转速控制方法的流程图。Fig. 5 is a flowchart of a method for controlling the speed of a fan of the present invention.
图6是本发明的风机转速随时间变化的曲线示意图。Fig. 6 is a schematic diagram of a curve of the rotation speed of the fan of the present invention changing with time.
下面结合附图和实施例,对本申请的具体实施方式作进一步详细描述。以下实施例用于说明本申请,但不用来限制本申请的范围。The specific implementation of the present application will be described in further detail below in conjunction with the accompanying drawings and embodiments. The following examples are used to illustrate the application, but are not used to limit the scope of the application.
首先,对本申请涉及的若干名词进行解释。First, explain some terms involved in this application.
步进电机的相数:是指步进电机内部的线圈组数。The number of phases of the stepper motor: refers to the number of coil groups inside the stepper motor.
步进电机的拍数:是指步进电机运行时每转一个齿距所需的脉冲数。The number of beats of the stepping motor: refers to the number of pulses required for each rotation of a tooth pitch when the stepping motor is running.
以2相4线步进电机为例,相数为2,假设转子齿数为50,步距角(每个步距角对应一个脉冲)是1.8°,则转子的齿距为:360°/50=7.2°;拍数为:7.2°/1.8°=4(拍)。换句话说,步进电机的每转一个齿距需要4个脉冲。Take a 2-phase 4-wire stepping motor as an example, the number of phases is 2, assuming that the number of rotor teeth is 50, and the step angle (each step angle corresponds to a pulse) is 1.8°, then the tooth pitch of the rotor is: 360°/50 =7.2°; the number of beats is: 7.2°/1.8°=4 (beats). In other words, each tooth pitch of a stepper motor needs 4 pulses.
步进电机的丢步(或称步进电机失步):是指步进电机没有按照指令到达期望位置的现象。Stepping motor step loss (or stepping motor step loss): refers to the phenomenon that the stepping motor does not follow the instructions to reach the desired position.
导致步进电机丢步的原因包括:步进电机起停过程中由于速度突变产生较大冲撞导致丢步。The reasons that cause the stepper motor to lose steps include: the stepper motor loses steps due to a large collision due to a sudden change in speed during the start and stop of the stepper motor.
为了避免步进电机产生丢步现象,本申请提供下述步进电机控控制方法。In order to prevent the stepping motor from losing steps, this application provides the following stepping motor control and control method.
图1是本申请一个实施例提供的步进电机控制系统的结构示意图,如图1所示,该系统至少包括:步进电机控制装置110和步进电机120。FIG. 1 is a schematic structural diagram of a stepping motor control system provided by an embodiment of the present application. As shown in FIG. 1, the system at least includes: a stepping motor control device 110 and a stepping motor 120.
步进电机控制装置110与步进电机120通信相连。The stepping motor control device 110 is connected to the stepping motor 120 in communication.
可选地,步进电机120按照x相y拍方式运行,x为步进电机内部的线圈组数;y的取值基于步进电机的步距角和转子齿数确定。比如:x为4,y为8,当 然,x和y的取值也可以是其它数值,本实施例不对x和y的取值作限定。Optionally, the stepper motor 120 operates in an x-phase y-beat mode, where x is the number of coil groups inside the stepper motor; the value of y is determined based on the step angle of the stepper motor and the number of rotor teeth. For example, x is 4 and y is 8. Of course, the values of x and y can also be other values, and this embodiment does not limit the values of x and y.
在一个示例中,步进电机120使用4相5线式8拍的步进电机120,即:步进电机的转子按照下述相位运行:A-AB-B-BC-C-CD-D-DA。In one example, the stepping motor 120 uses a 4-phase 5-wire 8-beat stepping motor 120, that is, the rotor of the stepping motor runs in the following phases: A-AB-B-BC-C-CD-D- DA.
步进电机控制装置110用于控制步进电机120的运行。比如:控制步进电机120的启动、速度和关闭。The stepping motor control device 110 is used to control the operation of the stepping motor 120. For example: controlling the start, speed and shutdown of the stepper motor 120.
可选地,步进电机控制装置110可以与步进电机120安装在同一设备中(比如:吹风机、风扇中);或者,安装在不同设备中,本实施例不对步进电机控制装置110和步进电机120的安装方式作限定。Optionally, the stepping motor control device 110 and the stepping motor 120 may be installed in the same device (for example, a hair dryer, a fan); or, it may be installed in a different device. This embodiment does not compare the stepping motor control device 110 and the stepping motor. The installation method of the incoming motor 120 is limited.
本申请中,步进电机控制装置110用于:接收步进电机的控制信号;基于控制信号控制步进电机匀加速或匀减速运行;在步进电机的速度更新至目标速度时,控制步进电机以控制信号指示的方式工作。In this application, the stepping motor control device 110 is used to: receive the control signal of the stepping motor; control the stepping motor to run at uniform acceleration or uniform deceleration based on the control signal; when the speed of the stepping motor is updated to the target speed, control the stepping The motor works in the manner indicated by the control signal.
其中,控制信号用于控制步进电机的开启或关闭。Among them, the control signal is used to control the opening or closing of the stepper motor.
在一个示例中,控制信号用于控制步进电机120开启,步进电机控制装置110控制步进电机120匀加速运行;控制信号指示的方式为控制步进电机120正常运行。In an example, the control signal is used to control the stepping motor 120 to turn on, and the stepping motor control device 110 controls the stepping motor 120 to run at a uniform acceleration; the control signal indicates the way to control the stepping motor 120 to operate normally.
在又一个示例中,控制信号用于控制步进电机120关闭,步进电机控制装置110控制步进电机120匀减速运行;控制信号指示的方式为控制步进电机120停机。In another example, the control signal is used to control the stepping motor 120 to turn off, and the stepping motor control device 110 controls the stepping motor 120 to run at a uniform deceleration; the control signal indicates the way to control the stepping motor 120 to stop.
其中,控制信号是包括步进电机的电子设备接收到用户作用于开关按键上的控制操作时生成的。比如:包括步进电机的电子设备(如吹风机、风扇、电动工具、医疗器械等设备)上安装有开关按键、与开关按键相连的开关电路、与开关电路相连的步进电机控制装置110、以及与步进电机控制装置110相连的步进电机120。用户按压开关按键时,开关电路生成控制信号并将该控制信号发送至步进电机控制装置110,步进电机控制装置110接收到控制信号后对步进电机120进行控制。Wherein, the control signal is generated when an electronic device including a stepper motor receives a user's control operation on the switch button. For example: electronic equipment including stepper motors (such as hair dryers, fans, power tools, medical equipment, etc.) are equipped with switch buttons, switch circuits connected to the switch buttons, stepper motor control devices 110 connected to the switch circuits, and The stepping motor 120 connected to the stepping motor control device 110. When the user presses the switch button, the switch circuit generates a control signal and sends the control signal to the stepping motor control device 110, and the stepping motor control device 110 controls the stepping motor 120 after receiving the control signal.
图2是本申请一个实施例提供的步进电机控制方法的流程图,本实施例以 该方法应用于图1所示的步进电机控制系统中,且各个步骤的执行主体为该系统中的步进电机控制装置110为例进行说明。该方法至少包括以下几个步骤:FIG. 2 is a flowchart of a stepping motor control method provided by an embodiment of the present application. This embodiment uses the method to apply to the stepping motor control system shown in FIG. 1, and the execution subject of each step is the stepping motor control system in the system. The stepping motor control device 110 is described as an example. The method includes at least the following steps:
步骤201,接收步进电机的控制信号,该控制信号用于控制步进电机的开启或关闭。Step 201: Receive a control signal of the stepper motor, where the control signal is used to control the on or off of the stepper motor.
可选地,步进电机的控制信号是包括该步进电机的电子设备接收到用户作用于开关按键上的控制操作时生成的。Optionally, the control signal of the stepper motor is generated when the electronic device including the stepper motor receives a control operation on the switch button by the user.
在步进电机处于开启状态时,控制信号用于控制步进电机关闭;在步进电机处于关闭状态时,控制信号用于控制步进电机开启。When the stepper motor is in the on state, the control signal is used to control the stepper motor to turn off; when the stepper motor is in the off state, the control signal is used to control the stepper motor to turn on.
在一个示例中,x的值为4,y的值为8。换句话说,步进电机使用4相5线式8拍的步进电机120,即:步进电机的转子按照下述相位运行:A-AB-B-BC-C-CD-D-DA。In one example, the value of x is 4 and the value of y is 8. In other words, the stepper motor uses a 4-phase 5-wire 8-beat stepper motor 120, that is, the rotor of the stepper motor runs in the following phase: A-AB-B-BC-C-CD-D-DA.
步骤202,基于控制信号控制步进电机匀加速或匀减速运行。Step 202: Control the stepping motor to run at uniform acceleration or uniform deceleration based on the control signal.
在一个示例中,控制信号用于控制步进电机开启,此时,控制步进电机匀加速运行。由于步进电机匀加速运行,因此,步进电机在开启过程中存在速度变化的缓冲阶段,此时,步进电机不会产生较大的冲击,降低步进电机丢步的概率。In one example, the control signal is used to control the stepping motor to turn on. At this time, the stepping motor is controlled to run at a uniform acceleration. Since the stepping motor runs at a uniform acceleration, there is a buffer phase of speed changes during the opening of the stepping motor. At this time, the stepping motor will not produce a large impact, reducing the probability of the stepping motor losing steps.
在又一个示例中,控制信号用于控制步进电机关闭,此时,控制步进电机匀减速运行。由于步进电机匀减速运行,因此,步进电机在关闭过程中存在速度变化的缓冲阶段,此时,步进电机不会产生较大的冲击,降低步进电机丢步的概率。In another example, the control signal is used to control the stepping motor to turn off. At this time, the stepping motor is controlled to run at a uniform deceleration. Since the stepper motor runs at a uniform deceleration, there is a buffer phase of speed change during the closing process of the stepper motor. At this time, the stepper motor will not produce a large impact, reducing the probability of the stepper motor losing steps.
可选地,基于控制信号控制步进电机匀加速或匀减速运行的方式包括但不限于以下几种:Optionally, the methods for controlling the stepping motor to run at uniform acceleration or uniform deceleration based on the control signal include but are not limited to the following:
第一种:计算不同拍之间的时间间隔;按照时间间隔控制步进电机在当前拍的运动速度。其中,在控制信号用于控制步进电机开启时,时间间隔随拍数的增大而减小;在控制信号用于控制步进电机关闭时,时间间隔随拍数的增大而增大。The first type: Calculate the time interval between different shots; control the movement speed of the stepping motor in the current shot according to the time interval. Among them, when the control signal is used to control the stepping motor to turn on, the time interval decreases as the number of beats increases; when the control signal is used to control the stepping motor to turn off, the time interval increases as the number of beats increases.
可选地,时间间隔通过下式计算:Optionally, the time interval is calculated by the following formula:
其中,在控制信号用于控制步进电机开启时,n依次取1至z的整数,y
0为起始时对应的预设时间间隔;在控制信号用于控制步进电机关闭时,n依次取z至1的整数;z为步进电机的速度达到最大速度时的拍数;v
min为步进电机的最小速度;v
max为步进电机的最大速度;k为步进电机的加速度值;m用于指示每次速度变化的大小。
Among them, when the control signal is used to control the stepping motor to turn on, n takes an integer from 1 to z in turn, and y 0 is the corresponding preset time interval at the beginning; when the control signal is used to control the stepping motor to turn off, n is in turn Take an integer from z to 1; z is the number of beats when the speed of the stepping motor reaches the maximum speed; v min is the minimum speed of the stepping motor; v max is the maximum speed of the stepping motor; k is the acceleration value of the stepping motor ; M is used to indicate the size of each speed change.
其中,y
0的取值、v
max和v
min的取值为设定的常数,比如:y
0为7ms,v
max为55°/秒、v
min为10°/秒,本实施例不对各个参数的取值作限定。
Among them, the value of y 0 , the values of v max and v min are set constants, for example: y 0 is 7 ms, v max is 55°/sec, and v min is 10°/sec. The value of the parameter is limited.
第二种:获取拍数与时间间隔之间的对应关系;在该对应关系中确定当前的拍数对应的时间间隔;按照该时间间隔控制步进电机在当前拍的运动速度。其中,在控制信号用于控制步进电机开启时,时间间隔随拍数的增大而减小;在控制信号用于控制步进电机关闭时,时间间隔随拍数的增大而增大。The second type: obtain the corresponding relationship between the number of beats and the time interval; determine the time interval corresponding to the current number of beats in the corresponding relationship; control the movement speed of the stepping motor in the current beat according to the time interval. Among them, when the control signal is used to control the stepping motor to turn on, the time interval decreases as the number of beats increases; when the control signal is used to control the stepping motor to turn off, the time interval increases as the number of beats increases.
在上述方式中,按照时间间隔控制步进电机在当前拍的运动速度,包括:对于上一拍与当前拍之间对应的相位,在该时间间隔内控制步进电机从上一拍对应的相位匀加速或匀减速运行至当前拍对应的相位。In the above method, controlling the movement speed of the stepping motor in the current beat according to the time interval includes: for the phase corresponding to the previous beat and the current beat, controlling the phase of the stepping motor from the previous beat within the time interval Run with uniform acceleration or uniform deceleration to the phase corresponding to the current shot.
比如:按照第一种方式计算时间间隔,假设在步进电机开启过程中,初始的时间间隔y
0为7ms、v
max为55°/秒、v
min为10°/秒。对于第1拍,k=45、m=10/(2×55)=1/11;
For example, the time interval is calculated according to the first method, assuming that during the stepping motor is turned on, the initial time interval y 0 is 7 ms, v max is 55°/sec, and v min is 10°/sec. For the first beat, k=45, m=10/(2×55)=1/11;
此时,在y
1时间间隔内,控制步进电机从相位A匀加速运行至相位AB。
At this time, within the y 1 time interval, the stepping motor is controlled to run uniformly from phase A to phase AB.
步骤203,在步进电机的速度更新至目标速度时,控制步进电机以控制信号指示的方式工作。Step 203: When the speed of the stepping motor is updated to the target speed, the stepping motor is controlled to work in a manner indicated by the control signal.
可选地,在步进电机的速度更新至目标速度时,控制步进电机以控制信号指示的方式工作,包括:在步进电机的速度更新至最大速度时,控制步进电机以恒定的时间间隔在不同拍之间运行,控制信号用于控制步进电机的开启;或者,在步进电机的速度更新至最小速度时,控制步进电机停止运行,控制信号用于控制步进电机的关闭。Optionally, when the speed of the stepper motor is updated to the target speed, control the stepper motor to work in the manner indicated by the control signal, including: when the speed of the stepper motor is updated to the maximum speed, control the stepper motor to a constant time The interval runs between different beats, and the control signal is used to control the opening of the stepping motor; or, when the speed of the stepping motor is updated to the minimum speed, the stepping motor is controlled to stop running, and the control signal is used to control the closing of the stepping motor .
在控制信号用于控制步进电机的开启时,若步进电机的速度更新至最大速度,则说明步进电机已结束开启过程中的匀加速过程,此时,步进电机进入正常运行状态;在控制信号用于控制步进电机的关闭时,若步进电机的速度更新至最小速度,则说明步进电机已结束关闭过程中的匀减速过程,此时,步进电机停止运行,切断步进电机的电源以降低功耗。When the control signal is used to control the opening of the stepping motor, if the speed of the stepping motor is updated to the maximum speed, it means that the stepping motor has finished the uniform acceleration process during the opening process, and at this time, the stepping motor enters the normal operating state; When the control signal is used to control the closing of the stepping motor, if the speed of the stepping motor is updated to the minimum speed, it means that the stepping motor has finished the uniform deceleration process during the closing process. At this time, the stepping motor stops running and cuts off the step. Power into the motor to reduce power consumption.
综上所述,本实施例提供的步进电机控制方法,通过接收步进电机的控制信号;基于控制信号控制步进电机匀加速或匀减速运行;在步进电机的速度更新至目标速度时,控制步进电机以控制信号指示的方式工作;可以解决电机的瞬间开启和关闭会出现丢步现象,导致的降低控制电机的准确度的问题;由于步进电机在开机过程中匀加速运行、在关机过程中匀减速运行,步进电机的开关过程存在速度变化的缓冲阶段,此时,步进电机不会产生较大的冲击,降低步进电机丢步的概率。In summary, the stepper motor control method provided in this embodiment receives the control signal of the stepper motor; controls the stepper motor to run at uniform acceleration or uniform deceleration based on the control signal; when the speed of the stepper motor is updated to the target speed , Control the stepper motor to work in the manner of control signal; it can solve the problem of losing steps when the motor is turned on and off instantly, which reduces the accuracy of the control motor; because the stepper motor runs uniformly during the startup process, During the shutdown process, the stepper motor will run at a uniform deceleration. The stepper motor has a buffer phase of speed change during the switching process. At this time, the stepper motor will not produce a large impact, reducing the probability of stepping motor loss.
图3是本申请一个实施例提供的步进电机控制装置的框图,本实施例以该装置应用于图1所示的步进电机控制系统中的步进电机控制装置110为例进行说明。该装置至少包括以下几个模块:信号接收模块310、第一控制模块320和第二控制模块330。FIG. 3 is a block diagram of a stepping motor control device provided by an embodiment of the present application. In this embodiment, the device is applied to the stepping motor control device 110 in the stepping motor control system shown in FIG. 1 as an example for description. The device includes at least the following modules: a signal receiving module 310, a first control module 320, and a second control module 330.
信号接收模块310,用于接收步进电机的控制信号,所述控制信号用于控制所述步进电机的开启或关闭;The signal receiving module 310 is configured to receive a control signal of a stepper motor, and the control signal is used to control the on or off of the stepper motor;
第一控制模块320,用于基于所述控制信号控制所述步进电机匀加速或匀减速运行;The first control module 320 is configured to control the stepping motor to run at uniform acceleration or uniform deceleration based on the control signal;
第二控制模块330,用于在所述步进电机的速度更新至目标速度时,控制所述步进电机以所述控制信号指示的方式工作。The second control module 330 is configured to control the stepping motor to work in the manner indicated by the control signal when the speed of the stepping motor is updated to the target speed.
相关细节参考上述方法实施例。For related details, refer to the above method embodiment.
需要说明的是:上述实施例中提供的步进电机控制装置在进行步进电机控制时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将步进电机控制装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的步进电机控制装置与步进电机控制方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that when the stepper motor control device provided in the above embodiment performs stepper motor control, only the division of the above-mentioned functional modules is used as an example for illustration. In actual applications, the above-mentioned function assignments can be divided according to needs. The function module is completed, that is, the internal structure of the stepper motor control device is divided into different function modules to complete all or part of the functions described above. In addition, the stepping motor control device provided by the above-mentioned embodiment and the stepping motor control method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, and will not be repeated here.
图4是本申请一个实施例提供的步进电机控制装置的框图,该装置可以是包含图1所示的步进电机控制系统中的步进电机控制装置110的电子设备,比如:吹风机、风扇(摇头风扇)、电动工具、智能手机等,本实施例对此不作限定。该装置至少包括处理器401和存储器402。FIG. 4 is a block diagram of a stepping motor control device provided by an embodiment of the present application. The device may be an electronic device including the stepping motor control device 110 in the stepping motor control system shown in FIG. 1, such as a hair dryer, a fan (Shaking head fan), electric tools, smart phones, etc., this embodiment does not limit this. The device at least includes a processor 401 and a memory 402.
处理器401可以包括一个或多个处理核心,比如:4核心处理器、8核心处理器等。处理器401可以采用DSP(Digital Signal Processing,数字信号处理)、FPGA(Field-Programmable Gate Array,现场可编程门阵列)、PLAThe processor 401 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so on. The processor 401 can adopt DSP (Digital Signal Processing, digital signal processing), FPGA (Field-Programmable Gate Array, field programmable gate array), PLA
(Programmable Logic Array,可编程逻辑阵列)中的至少一种硬件形式来实现。处理器401也可以包括主处理器和协处理器,主处理器是用于对在唤醒状态下的数据进行处理的处理器,也称CPU(Central Processing Unit,中央处理器);协处理器是用于对在待机状态下的数据进行处理的低功耗处理器。(Programmable Logic Array, Programmable Logic Array) is implemented in at least one hardware form. The processor 401 may also include a main processor and a coprocessor. The main processor is a processor used to process data in the awake state, also called a CPU (Central Processing Unit, central processing unit); the coprocessor is A low-power processor used to process data in the standby state.
存储器402可以包括一个或多个计算机可读存储介质,该计算机可读存储介质可以是非暂态的。存储器402还可包括高速随机存取存储器,以及非易失性存储器,比如一个或多个磁盘存储设备、闪存存储设备。在一些实施例中,存储器402中的非暂态的计算机可读存储介质用于存储至少一个指令,该至少一个指令用于被处理器401所执行以实现本申请中方法实施例提供的步进电机控制方法。The memory 402 may include one or more computer-readable storage media, which may be non-transitory. The memory 402 may also include high-speed random access memory and non-volatile memory, such as one or more magnetic disk storage devices and flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 402 is used to store at least one instruction, and the at least one instruction is used to be executed by the processor 401 to implement the step provided by the method embodiment of the present application. Motor control method.
在一些实施例中,步进电机控制装置还可选包括有:外围设备接口和至少一个外围设备。处理器401、存储器402和外围设备接口之间可以通过总线或信号线相连。各个外围设备可以通过总线、信号线或电路板与外围设备接口相连。示意性地,外围设备包括但不限于:射频电路、触摸显示屏、音频电路、和电源等。In some embodiments, the stepping motor control device may optionally further include: a peripheral device interface and at least one peripheral device. The processor 401, the memory 402, and the peripheral device interface may be connected by a bus or a signal line. Each peripheral device can be connected to the peripheral device interface through a bus, a signal line or a circuit board. Illustratively, peripheral devices include but are not limited to: radio frequency circuits, touch screens, audio circuits, and power supplies.
当然,步进电机控制装置还可以包括更少或更多的组件,本实施例对此不作限定。Of course, the stepping motor control device may also include fewer or more components, which is not limited in this embodiment.
可选地,本申请还提供有一种计算机可读存储介质,所述计算机可读存储介质中存储有程序,所述程序由处理器加载并执行以实现上述方法实施例的步进电机控制方法。Optionally, the present application also provides a computer-readable storage medium in which a program is stored, and the program is loaded and executed by a processor to implement the stepper motor control method of the foregoing method embodiment.
可选地,本申请还提供有一种计算机产品,该计算机产品包括计算机可读存储介质,所述计算机可读存储介质中存储有程序,所述程序由处理器加载并执行以实现上述方法实施例的步进电机控制方法。Optionally, this application also provides a computer product including a computer-readable storage medium in which a program is stored, and the program is loaded and executed by a processor to implement the above-mentioned method embodiments The stepping motor control method.
进一步结合图5,本发明提出一种风机转速控制方法,所述控制方法包括以下步骤:Further in conjunction with FIG. 5, the present invention proposes a method for controlling the speed of a fan. The control method includes the following steps:
S1,按照第一设定周期在预设范围内获取一组数据作为当前时刻的随机数范围,其中,获取方式为按预设方式获取或随机获取。S1: Acquire a set of data within a preset range according to a first preset period as a random number range at the current moment, where the acquisition method is acquisition in a preset manner or random acquisition.
S2,在所述当前时刻的随机数范围获取一个数值作为当前周期的随机数,其中,获取方式为按预设方式获取或随机获取。S2: Acquire a value in the random number range at the current moment as the random number of the current period, where the acquisition method is acquisition in a preset manner or random acquisition.
S3,根据所述当前周期的随机数控制所述风机。S3: Control the fan according to the random number of the current period.
为了最大限度的模拟自然风的变化规律,本发明提出了双随机数生成方法。In order to simulate the changing law of natural wind to the maximum, the present invention proposes a double random number generation method.
假设某一风机的转速控制使用PID调节,使风机转速以小于最大转速变化率平滑的跟随目标速度(下一次的输出转速)。其中最大转速变化率为300rpm/s(600),转速范围为2000rpm-5600rpm。Suppose that the speed control of a certain fan uses PID adjustment, so that the fan speed will smoothly follow the target speed (the next output speed) at a rate of change of less than the maximum speed. The maximum speed change rate is 300rpm/s (600), and the speed range is 2000rpm-5600rpm.
在风机转速控制过程中,第一步为按照固定频率使用随机发生器产生随机范围内的随机数,假设生成频率为1次/s,其中随机范围使用随机发生器产生-300rpm到300rpm的随机数(即最大随机数取值范围为-300rpm到300rpm),那 么在步骤S1中最终输出的当前时刻的随机数范围和步骤S2中最终输出的当前周期的随机数也必然囊括在-300rpm到300rpm之间。如先在(-300,300)内产生一个随机范围(-100,100),然后在(-100,100)中产生一个随机值45等等。通过两次随机取值,在增强随机选择性的基础上,控制随机数的变化幅度,使随机数的变化规律更符合自然规律,除了使风扇最终生成的风具备自然风的随机规律之外,还能够控制其变化幅度,避免过多的较强幅度的风速突变带来的不舒适感和对风机的额外损耗。In the process of fan speed control, the first step is to use a random generator to generate random numbers in a random range at a fixed frequency. Assuming that the generation frequency is 1 time/s, the random range uses a random generator to generate random numbers from -300rpm to 300rpm. (That is, the range of the maximum random number is -300rpm to 300rpm), then the range of the random number of the current moment finally output in step S1 and the random number of the current period finally output in step S2 must also be included in the range of -300rpm to 300rpm between. For example, first generate a random range (-100, 100) in (-300, 300), and then generate a random value of 45 in (-100, 100), and so on. Through two random values, on the basis of enhancing the random selectivity, the variation range of the random number is controlled to make the variation law of the random number more in line with the natural law. In addition to making the wind generated by the fan have the random law of natural wind, It can also control its change range, avoiding the discomfort caused by excessive and strong wind speed sudden changes and the additional loss of the fan.
在生成随机数之后进入正式的风机转速调控过程。After the random number is generated, it enters the formal fan speed control process.
具体的,首先判断生成的当前周期的随机数与上一周期的随机数的差值是否过大,如果差值过大,说明前后两周期的风机转速的变化幅度也将会很大,如果在短期内进行调节,很容易损伤风机,同时由于风速也会急剧变化,容易造成用户的不舒适体验。为此,本发明提出以下方案:Specifically, first determine whether the difference between the generated random number in the current cycle and the random number in the previous cycle is too large. If the difference is too large, it means that the fan speed changes in the two cycles before and after will also be large. Adjusting in a short period of time can easily damage the fan, and at the same time, because the wind speed will change sharply, it is easy to cause uncomfortable user experience. To this end, the present invention proposes the following solutions:
步骤S3中,所述根据所述当前周期的随机数控制所述风机的过程包括以下步骤:In step S3, the process of controlling the fan according to the random number of the current period includes the following steps:
对比所述当前周期的随机数与上一周期的随机数:Compare the random number of the current cycle with the random number of the previous cycle:
(1)若两者之间的差值小于预设差值阈值,则根据第一预设控制流程调整所述风机的转速。(1) If the difference between the two is less than the preset difference threshold, adjust the rotation speed of the fan according to the first preset control procedure.
(2)若两者之间的差值大于等于预设差值阈值,则根据第二预设控制流程调整所述风机的转速。(2) If the difference between the two is greater than or equal to the preset difference threshold, the rotation speed of the fan is adjusted according to the second preset control procedure.
一、第一预设控制流程1. The first preset control process
所述第一预设控制流程包括以下步骤:The first preset control process includes the following steps:
结合当前档位和当前周期的随机数以计算得到下一时刻的目标转速值,将目标转速值发送至PID控制器,PID控制器按照预设控制流程将风机转速调节为目标转速值。Combining the current gear and the random number of the current period to calculate the target speed value at the next moment, send the target speed value to the PID controller, and the PID controller adjusts the fan speed to the target speed value according to the preset control process.
二、第二预设控制流程2. The second preset control process
所述第二预设控制流程包括以下步骤:The second preset control process includes the following steps:
生成动态随机数,动态随机数的初始值为上一周期的随机数,按照第二设定周期,结合预设增减幅度对动态随机数执行累加/累减操作以不断调整动态随机数的取值,直至动态随机数的取值与所述当前周期的随机数之间的差值小于等于预设增减幅度,通过再次累加/累减操作将动态随机数调整为当前周期的随机数,完成对动态随机数的调整过程。Generate a dynamic random number, the initial value of the dynamic random number is the random number of the previous cycle, according to the second set cycle, combined with the preset increase and decrease range to perform the accumulation/accumulation operation on the dynamic random number to continuously adjust the dynamic random number selection Until the difference between the value of the dynamic random number and the random number of the current cycle is less than or equal to the preset increase or decrease range, the dynamic random number is adjusted to the random number of the current cycle by accumulating/accumulating again, to complete The adjustment process of dynamic random numbers.
其中,在动态随机数的调整过程中,结合当前档位和每一次调整后的动态随机数以计算得到下一时刻的目标转速值,将目标转速值发送至PID控制器,PID控制器按照预设控制流程将风机转速调节为目标转速值。Among them, in the adjustment process of the dynamic random number, the current gear and the dynamic random number after each adjustment are combined to calculate the target speed value at the next moment, and the target speed value is sent to the PID controller. Set the control process to adjust the fan speed to the target speed value.
应当理解,在本发明中,从用户体验考虑,我们的目标是在较为稳定的风速变化范围内尽可能地给用户带来自然风的体验。为此,本发明做了以下两个设计:It should be understood that, in the present invention, in consideration of user experience, our goal is to provide users with a natural wind experience as much as possible within a relatively stable wind speed variation range. For this reason, the present invention has made the following two designs:
第一、设置多级档位,使用户可以根据实际需求自行选择合适的风速波动范围。First, set up multi-level gears, so that users can choose the appropriate wind speed fluctuation range according to actual needs.
第二、当前周期的随机数与上一周期的随机数的差值过大时,采用平滑过渡方式进行修正,避免因风速急剧变化带来的不舒适感受和风机的额外损伤。Second, when the difference between the random number of the current cycle and the random number of the previous cycle is too large, a smooth transition method is used to correct it to avoid the uncomfortable feeling caused by the rapid change of wind speed and the additional damage of the fan.
下面结合具体例子对前述两个设计分别进行阐述。The above two designs will be explained separately below in conjunction with specific examples.
关于档位设置,所述结合当前档位和当前周期的随机数以计算得到下一时刻的目标转速值是指:Regarding the gear setting, the combination of the current gear and the random number of the current period to calculate the target speed value at the next moment refers to:
采用m个档位值将风机转速最大变化范围分为m个范围段。The maximum change range of the fan speed is divided into m range segments by using m gear values.
将当前周期的随机数叠加在当前档位对应的档位值上,计算得到下一时刻的目标转速值。所述m为大于等于1的正整数。The random number of the current period is superimposed on the gear value corresponding to the current gear, and the target speed value at the next moment is calculated. The m is a positive integer greater than or equal to 1.
即,即使是同一个随机值,档位不同,最终的风机转速值也不相同。当档位发生变化时,可调取当前时刻对应的随机值,以调整实际风机转速。That is, even if it is the same random value and the gear is different, the final fan speed value will be different. When the gear changes, the random value corresponding to the current moment can be adjusted to adjust the actual fan speed.
例如,使用多个档位把风机转速最大变化范围平均分为几个段,假设档位数为10,风机转速范围为2000rpm-5600rpm,拆分后1档为2000rpm,2挡位2400rpm,后面依次递增等等。For example, using multiple gears to divide the maximum change range of the fan speed into several equally, assuming that the number of gears is 10, the fan speed range is 2000rpm-5600rpm, after splitting, the first gear is 2000rpm, the second gear is 2400rpm, and the following are successively Increment and so on.
在一些例子中,为了增加前后两个周期内的风速变化幅度,可以适当增大随机数的最大取值范围,以获取较为明显的自然风变化体验。在此种情形下,当选择较大档位时,如果生成的随机数也较大,叠加后得到的目标风机转速有可能超出其所对应的最大转速范围,可将超出的部分截掉,以风机的最大转速作为最终转速取值,风速可控的同时确保风机安全运转。In some examples, in order to increase the wind speed change range in the two periods before and after, the maximum value range of the random number can be appropriately increased to obtain a more obvious natural wind change experience. In this case, when a larger gear is selected, if the random number generated is also larger, the target fan speed obtained after superposition may exceed its corresponding maximum speed range, and the excess part can be cut off. The maximum speed of the fan is taken as the final speed value, and the wind speed can be controlled while ensuring the safe operation of the fan.
关于采用平滑过渡方式进行修正,如图1所示,当当前周期的随机数与上一周期的随机数的差值小于预设差值阈值(如300)时,可以直接将当前周期的随机数叠加在当前档位上,直接输出最终的目标转速。而如果当前周期的随机数与上一周期的随机数的差值超出三百,则需要进一步判断两个随机数的大小,以选择累加或累减操作。Regarding the correction using the smooth transition method, as shown in Figure 1, when the difference between the random number of the current cycle and the random number of the previous cycle is less than the preset difference threshold (such as 300), the random number of the current cycle can be directly changed Superimposed on the current gear, directly output the final target speed. If the difference between the random number in the current cycle and the random number in the previous cycle exceeds three hundred, it is necessary to further determine the size of the two random numbers to select the accumulation or the accumulation operation.
(1)当前周期的随机数大于上一周期随机数,例如,上一周期随机数为-260,而当前周期随机数为240,两者相差500,则生成动态随机数,动态随机数的初始取值为-260,以预设增减幅度(如200)进行累加操作,同时将动态随机数的取值叠加在当前档位上,输出过渡转速:(1) The random number of the current cycle is greater than the random number of the previous cycle. For example, the random number of the previous cycle is -260 and the random number of the current cycle is 240. If the difference between the two is 500, the dynamic random number will be generated. The initial dynamic random number The value is -260, and the accumulation operation is performed with a preset increase or decrease range (such as 200). At the same time, the value of the dynamic random number is superimposed on the current gear, and the transition speed is output:
①第一次调整,将动态随机数调整为-60,-60叠加当前档位输出第一个过渡转速。① For the first adjustment, adjust the dynamic random number to -60, and -60 superimposes the current gear to output the first transitional speed.
②第二次调整,将动态随机数调整为140,140叠加当前档位输出第二个过渡转速。②For the second adjustment, adjust the dynamic random number to 140, which superimposes the current gear to output the second transitional speed.
③第三次调整,由于此时动态随机数与当前周期随机数的差值为100,小于预设增减幅度,因此直接将动态随机数调整为240,240叠加当前档位输出最终目标转速。③In the third adjustment, since the difference between the dynamic random number and the current period random number is 100, which is less than the preset increase or decrease range, the dynamic random number is directly adjusted to 240, and 240 is superimposed on the current gear to output the final target speed.
(2)当前周期的随机数小于上一周期随机数,过程类似前述调整过程,只是将累加操作更换为累减操作,在此不再赘述。(2) The random number of the current cycle is smaller than the random number of the previous cycle. The process is similar to the aforementioned adjustment process, except that the accumulation operation is replaced with a accumulation operation, which will not be repeated here.
在前述修正过程中,预设差值阈值与电机噪音直接相关,可根据用户实际需求进行动态设置。同样的,预设增减幅度和调整周期(第二设定周期)也并非固定不变,可以根据实际情况做动态调整,以在调整曲线平滑性和调整时间之间做取舍。In the aforementioned correction process, the preset difference threshold is directly related to the motor noise, and can be dynamically set according to the actual needs of the user. Similarly, the preset increase/decrease range and the adjustment period (the second setting period) are not fixed, and can be dynamically adjusted according to the actual situation to make a trade-off between the smoothness of the adjustment curve and the adjustment time.
结合图6,采用本发明所提及的风机转速控制方法,既可以使风速的变化规律更符合自然规律以实现更贴近自然风的吹风体验,又能够避免因风速急剧变化带来的不舒适感受和风机的额外损伤。With reference to Figure 6, the use of the fan speed control method mentioned in the present invention can not only make the wind speed change law more in line with the natural law to achieve a blowing experience closer to the natural wind, but also avoid the uncomfortable feeling caused by the rapid change of wind speed. And additional damage to the fan.
以上本发明的技术方案,与现有相比,其显著的有益效果在于:Compared with the prior art, the above technical solutions of the present invention have significant beneficial effects as follows:
(1)通过定期生成随机数,结合随机数和当前档位对风机转速进行控制,较之现有技术,使风速的变化规律更符合自然规律以实现更贴近自然风的吹风体验。(1) By regularly generating random numbers, combining random numbers and current gears to control the fan speed, compared with the prior art, the wind speed change law is more in line with the natural law to achieve a blowing experience closer to natural wind.
(2)采用双随机数生成方法以尽可能生成合理取值范围和变化规律的随机数。(2) The double random number generation method is used to generate random numbers with reasonable value ranges and changing laws as much as possible.
(3)当新产生的随机数与上一周期的随机数差值过大时,采用平滑过渡方式进行修正,避免因风速急剧变化带来的不舒适感受和风机的额外损伤。(3) When the difference between the newly generated random number and the random number of the previous cycle is too large, a smooth transition method is used to correct it to avoid the uncomfortable feeling caused by the rapid change of wind speed and the additional damage of the fan.
(4)转速调整频率固定,有利于减少对风机对损伤。(4) The speed adjustment frequency is fixed, which is beneficial to reduce damage to the fan.
(5)拥有多级档位(如10级),使用户可以根据实际需求自行选择合适的风速波动范围。(5) With multi-level gears (such as level 10), users can choose the appropriate wind speed fluctuation range according to actual needs.
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the various technical features in the above-mentioned embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, All should be considered as the scope of this specification.
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only express several implementation manners of the present application, and the description is relatively specific and detailed, but it should not be understood as a limitation on the scope of the invention patent. It should be pointed out that for those of ordinary skill in the art, without departing from the concept of this application, several modifications and improvements can be made, and these all fall within the protection scope of this application. Therefore, the scope of protection of the patent of this application shall be subject to the appended claims.
Claims (19)
- 一种控制方法,其特征在于,所述方法包括:A control method, characterized in that the method includes:接收步进电机的控制信号,所述控制信号用于控制所述步进电机的开启或关闭;Receiving a control signal of a stepping motor, where the control signal is used to control turning on or off of the stepping motor;基于所述控制信号控制所述步进电机匀加速或匀减速运行;Controlling the stepping motor to run with uniform acceleration or uniform deceleration based on the control signal;在所述步进电机的速度更新至目标速度时,控制所述步进电机以所述控制信号指示的方式工作。When the speed of the stepping motor is updated to the target speed, the stepping motor is controlled to work in a manner indicated by the control signal.
- 根据权利要求1所述的方法,其特征在于,所述步进电机按照x相y拍方式运行,所述x为所述步进电机内部的线圈组数;所述y的取值基于所述步进电机的步距角和转子齿数确定。The method according to claim 1, wherein the stepping motor operates in an x-phase y-beat mode, and the x is the number of coil groups inside the stepping motor; the value of y is based on the The step angle of the stepping motor and the number of rotor teeth are determined.
- 根据权利要求2所述的方法,其特征在于,所述基于所述控制信号控制所述步进电机匀加速或匀减速运行,包括:The method according to claim 2, wherein the controlling the stepping motor to run at uniform acceleration or uniform deceleration based on the control signal comprises:计算不同拍之间的时间间隔;其中,在所述控制信号用于控制所述步进电机开启时,所述时间间隔随拍数的增大而减小;在所述控制信号用于控制所述步进电机关闭时,所述时间间隔随拍数的增大而增大;Calculate the time interval between different beats; wherein, when the control signal is used to control the stepping motor to turn on, the time interval decreases as the number of beats increases; when the control signal is used to control all When the stepping motor is turned off, the time interval increases as the number of beats increases;按照所述时间间隔控制所述步进电机在当前拍的运动速度。The movement speed of the stepping motor in the current shot is controlled according to the time interval.
- 根据权利要求3所述的方法,其特征在于,所述时间间隔通过下式计算:The method according to claim 3, wherein the time interval is calculated by the following formula:其中,在所述控制信号用于控制所述步进电机开启时,所述n依次取1至z的整数,y 0为起始时对应的预设时间间隔;在所述控制信号用于控制所述步进电机关闭时,所述n依次取z至1的整数;所述z为所述步进电机的速度达到最大速度时的拍数;v min为所述步进电机的最小速度;v max为所述步进电机的最大速度;k为所述步进电机的加速度值;m用于指示每次速度变化的大小。 Wherein, when the control signal is used to control the stepping motor to turn on, the n takes an integer from 1 to z in turn, and y 0 is the corresponding preset time interval at the beginning; when the control signal is used to control When the stepping motor is turned off, the n takes an integer from z to 1 in turn; the z is the number of beats when the speed of the stepping motor reaches the maximum speed; v min is the minimum speed of the stepping motor; v max is the maximum speed of the stepping motor; k is the acceleration value of the stepping motor; m is used to indicate the magnitude of each speed change.
- 根据权利要求2所述的方法,其特征在于,所述在所述步进电机的速度更新至目标速度时,控制所述步进电机以所述控制信号指示的方式工作,包括:The method according to claim 2, wherein when the speed of the stepping motor is updated to a target speed, controlling the stepping motor to work in a manner indicated by the control signal comprises:在所述步进电机的速度更新至最大速度时,控制所述步进电机以恒定的时间间隔在不同拍之间运行,所述控制信号用于控制所述步进电机的开启;When the speed of the stepping motor is updated to the maximum speed, controlling the stepping motor to run between different beats at a constant time interval, and the control signal is used to control the turning on of the stepping motor;或者,or,在所述步进电机的速度更新至最小速度时,控制所述步进电机停止运行,所述控制信号用于控制所述步进电机的关闭。When the speed of the stepping motor is updated to the minimum speed, the stepping motor is controlled to stop running, and the control signal is used to control the closing of the stepping motor.
- 根据权利要求2所述的方法,其特征在于,所述x的值为4,所述y的值为8。The method according to claim 2, wherein the value of x is 4, and the value of y is 8.
- 一种控制装置,其特征在于,所述装置包括:A control device, characterized in that the device comprises:信号接收模块,用于接收步进电机的控制信号,所述控制信号用于控制所述步进电机的开启或关闭;A signal receiving module for receiving a control signal of a stepping motor, and the control signal is used for controlling the on or off of the stepping motor;第一控制模块,用于基于所述控制信号控制所述步进电机匀加速或匀减速运行;The first control module is configured to control the stepping motor to run at uniform acceleration or uniform deceleration based on the control signal;第二控制模块,用于在所述步进电机的速度更新至目标速度时,控制所述步进电机以所述控制信号指示的方式工作。The second control module is used for controlling the stepping motor to work in the manner indicated by the control signal when the speed of the stepping motor is updated to the target speed.
- 一种控制装置,其特征在于,所述装置包括处理器和存储器;所述存储器中存储有程序,所述程序由所述处理器加载并执行以实现如权利要求1至6任一项所述的步进电机控制方法。A control device, characterized in that the device includes a processor and a memory; a program is stored in the memory, and the program is loaded and executed by the processor to implement the one described in any one of claims 1 to 6 The stepping motor control method.
- 一种计算机可读存储介质,其特征在于,所述存储介质中存储有程序,所述程序被处理器执行时用于实现如权利要求1至6任一项所述的步进电机控制方法。A computer-readable storage medium, wherein a program is stored in the storage medium, and the program is used to implement the stepping motor control method according to any one of claims 1 to 6 when the program is executed by a processor.
- 一种控制方法,其特征在于,所述风机转速控制方法包括:A control method, characterized in that the fan speed control method includes:S1,按照第一设定周期在预设范围内获取一组数据作为当前时刻的随机数范围,其中,获取方式为按预设方式获取或随机获取;S1: Acquire a set of data within a preset range according to a first preset period as a random number range at the current moment, where the acquisition method is acquisition according to a preset method or random acquisition;S2,在所述当前时刻的随机数范围获取一个数值作为当前周期的随机数,其中,获取方式为按预设方式获取或随机获取;S2: Acquire a value within the random number range at the current moment as the random number of the current period, where the acquisition method is acquisition according to a preset method or random acquisition;S3,根据所述当前周期的随机数控制所述风机。S3: Control the fan according to the random number of the current period.
- 根据权利要求10所述的风机转速控制方法,其特征在于,所述第一设定周期为1s。The method for controlling the speed of a fan according to claim 10, wherein the first set period is 1 s.
- 根据权利要求10所述的风机转速控制方法,其特征在于,步骤S1中,所述在预设范围内获取一组数据作为当前时刻的随机数范围是指,所述一组数据为区域范围的数值或多个数值的集合。The method for controlling the speed of a fan according to claim 10, wherein in step S1, acquiring a set of data within a preset range as a random number range at the current moment means that the set of data is a regional range A value or a collection of multiple values.
- 根据权利要求10-12中任意一项所述的风机转速控制方法,其特征在于,步骤S3中,所述根据所述当前周期的随机数控制所述风机的过程包括以下步骤:The method for controlling the speed of a fan according to any one of claims 10-12, wherein in step S3, the process of controlling the fan according to the random number of the current period includes the following steps:对比所述当前周期的随机数与上一周期的随机数:Compare the random number of the current cycle with the random number of the previous cycle:若两者之间的差值小于预设差值阈值,则根据第一预设控制流程调整所述风机的转速;If the difference between the two is less than the preset difference threshold, adjusting the rotation speed of the fan according to the first preset control process;若两者之间的差值大于等于预设差值阈值,则根据第二预设控制流程调整所述风机的转速。If the difference between the two is greater than or equal to the preset difference threshold, the rotation speed of the fan is adjusted according to the second preset control procedure.
- 根据权利要求10所述的风机转速控制方法,其特征在于,所述第一预设控制流程包括以下步骤:The method for controlling the speed of a fan according to claim 10, wherein the first preset control process comprises the following steps:结合当前档位和当前周期的随机数以计算得到下一时刻的目标转速值,将目标转速值发送至PID控制器,PID控制器按照预设控制流程将风机转速调节为目标转速值。Combining the current gear and the random number of the current period to calculate the target speed value at the next moment, send the target speed value to the PID controller, and the PID controller adjusts the fan speed to the target speed value according to the preset control process.
- 根据权利要求14所述的风机转速控制方法,其特征在于,步骤S4中,所述结合当前档位和当前周期的随机数以计算得到下一时刻的目标转速值是指:The fan speed control method according to claim 14, wherein in step S4, the combination of the current gear and the random number of the current period to calculate the target speed value at the next moment refers to:采用m个档位值将风机转速最大变化范围分为m个范围段;Use m gear values to divide the maximum change range of fan speed into m range segments;将当前周期的随机数叠加在当前档位对应的档位值上,计算得到下一时刻的目标转速值;The random number of the current period is superimposed on the gear value corresponding to the current gear, and the target speed value at the next moment is calculated;所述m为大于等于1的正整数。The m is a positive integer greater than or equal to 1.
- 根据权利要求13所述的风机转速控制方法,其特征在于,所述第二预设控制流程包括以下步骤:The method for controlling the speed of a fan according to claim 13, wherein the second preset control process comprises the following steps:生成动态随机数,动态随机数的初始值为上一周期的随机数,按照第二设 定周期,结合预设增减幅度对动态随机数执行累加/累减操作以不断调整动态随机数的取值,直至动态随机数的取值与所述当前周期的随机数之间的差值小于等于预设增减幅度,通过再次累加/累减操作将动态随机数调整为当前周期的随机数,完成对动态随机数的调整过程;Generate a dynamic random number, the initial value of the dynamic random number is the random number of the previous cycle, according to the second set cycle, combined with the preset increase and decrease range, the dynamic random number is accumulated/accumulated to continuously adjust the dynamic random number. Until the difference between the value of the dynamic random number and the random number of the current cycle is less than or equal to the preset increase or decrease range, the dynamic random number is adjusted to the random number of the current cycle by accumulating/accumulating again, to complete The adjustment process of dynamic random numbers;其中,在动态随机数的调整过程中,结合当前档位和每一次调整后的动态随机数以计算得到下一时刻的目标转速值,将目标转速值发送至PID控制器,PID控制器按照预设控制流程将风机转速调节为目标转速值。Among them, in the adjustment process of the dynamic random number, the current gear and the dynamic random number after each adjustment are combined to calculate the target speed value at the next moment, and the target speed value is sent to the PID controller. Set the control process to adjust the fan speed to the target speed value.
- 根据权利要求16所述的风机转速控制方法,其特征在于,所述预设增减幅度为一固定值。The method for controlling the speed of a fan according to claim 16, wherein the preset increase or decrease range is a fixed value.
- 根据权利要求17所述的风机转速控制方法,其特征在于,所述预设增减幅度为200。The method for controlling the speed of a fan according to claim 17, wherein the preset increase or decrease range is 200.
- 一种计算机可读存储介质,其特征在于,存储有计算机可读指令,可以使至少一个处理器执行如权利要求10-18中任一项所述的方法。A computer-readable storage medium, characterized in that it stores computer-readable instructions that can make at least one processor execute the method according to any one of claims 10-18.
Applications Claiming Priority (4)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010058039.4A CN111456958B (en) | 2020-01-19 | 2020-01-19 | Fan rotating speed control method and computer readable storage medium |
CN202010058039.4 | 2020-01-19 | ||
CN202010069431.9 | 2020-01-21 | ||
CN202010069431.9A CN111162703B (en) | 2020-01-21 | 2020-01-21 | Stepping motor control method, stepping motor control device and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2021143915A1 true WO2021143915A1 (en) | 2021-07-22 |
Family
ID=76864746
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/072590 WO2021143915A1 (en) | 2020-01-19 | 2021-01-19 | Control method and apparatus, and storage medium |
Country Status (1)
Country | Link |
---|---|
WO (1) | WO2021143915A1 (en) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006352940A (en) * | 2005-06-13 | 2006-12-28 | Seiko Epson Corp | Stepping motor controller, printer, stepping motor control method and program |
CN102005997A (en) * | 2010-10-27 | 2011-04-06 | 北京和利康源医疗科技有限公司 | Device and method for driving and controlling stepper motor |
CN106765986A (en) * | 2017-01-13 | 2017-05-31 | 青岛海尔空调器有限总公司 | Air-conditioning and its air-out control method |
CN106949080A (en) * | 2017-03-21 | 2017-07-14 | 莱克电气股份有限公司 | A kind of method and apparatus of natural wind simulating |
CN107612455A (en) * | 2017-08-11 | 2018-01-19 | 歌尔股份有限公司 | Motor control method, device and sports equipment |
CN110410955A (en) * | 2019-07-22 | 2019-11-05 | 广东美的制冷设备有限公司 | Control method, device, air conditioner and the storage medium of stepper motor |
CN110535380A (en) * | 2018-05-23 | 2019-12-03 | 杭州海康威视数字技术股份有限公司 | A kind of method for controlling stepping motor, device, system and storage medium |
CN111162703A (en) * | 2020-01-21 | 2020-05-15 | 追觅科技(上海)有限公司 | Stepping motor control method, stepping motor control device and storage medium |
CN111456958A (en) * | 2020-01-19 | 2020-07-28 | 追觅科技(上海)有限公司 | Fan rotating speed control method and computer readable storage medium |
-
2021
- 2021-01-19 WO PCT/CN2021/072590 patent/WO2021143915A1/en active Application Filing
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006352940A (en) * | 2005-06-13 | 2006-12-28 | Seiko Epson Corp | Stepping motor controller, printer, stepping motor control method and program |
CN102005997A (en) * | 2010-10-27 | 2011-04-06 | 北京和利康源医疗科技有限公司 | Device and method for driving and controlling stepper motor |
CN106765986A (en) * | 2017-01-13 | 2017-05-31 | 青岛海尔空调器有限总公司 | Air-conditioning and its air-out control method |
CN106949080A (en) * | 2017-03-21 | 2017-07-14 | 莱克电气股份有限公司 | A kind of method and apparatus of natural wind simulating |
CN107612455A (en) * | 2017-08-11 | 2018-01-19 | 歌尔股份有限公司 | Motor control method, device and sports equipment |
CN110535380A (en) * | 2018-05-23 | 2019-12-03 | 杭州海康威视数字技术股份有限公司 | A kind of method for controlling stepping motor, device, system and storage medium |
CN110410955A (en) * | 2019-07-22 | 2019-11-05 | 广东美的制冷设备有限公司 | Control method, device, air conditioner and the storage medium of stepper motor |
CN111456958A (en) * | 2020-01-19 | 2020-07-28 | 追觅科技(上海)有限公司 | Fan rotating speed control method and computer readable storage medium |
CN111162703A (en) * | 2020-01-21 | 2020-05-15 | 追觅科技(上海)有限公司 | Stepping motor control method, stepping motor control device and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5860594B2 (en) | System and method for starting control of a gas turbine | |
CN103857905B (en) | Operate the method and corresponding wind turbine of wind turbine | |
CN104515256B (en) | control method and device of air conditioner | |
CN102374118B (en) | Power control method for wind generating set | |
US20130049720A1 (en) | Voltage regulator controller and related reference voltage adjusting method | |
US8713297B2 (en) | Decrementing settings for a range of power caps when a power cap is exceeded | |
CN104753439A (en) | PID (piping and instrument diagram) intelligent speed regulating method of electric motor | |
WO2017148362A1 (en) | Control system and control method for ddr system | |
CN100385369C (en) | Apparatus and method for controlling rotation speed of multistage speed and intelligent fan | |
WO2021143915A1 (en) | Control method and apparatus, and storage medium | |
CN108150351A (en) | Method and device for controlling starting and grid connection of wind generating set and storage medium | |
CN110248082A (en) | A kind of method and device for planning camera motion controlling curve | |
KR102197643B1 (en) | Power Smoothing Control System and Method of Wind Turbine for Frequency Regulation | |
CN109973302B (en) | Power limiting control method and device for wind generating set | |
CN104696250A (en) | Stable control method for rotating speed of axial flow fan | |
CN111162703B (en) | Stepping motor control method, stepping motor control device and storage medium | |
CN101349907B (en) | Numerical control system and method for optimizing data stream | |
CN112392656A (en) | Power control method, apparatus and medium | |
CN110311402A (en) | A kind of control method and system of virtual synchronous generator | |
JP2018085827A (en) | Voltage controller | |
CN112177850B (en) | Yaw control method and device of wind generating set | |
CN111049123A (en) | Autonomous current-sharing control method for parallel connection of a large number of direct-current voltage source power modules | |
CN108667364A (en) | A kind of the single step driving method and device of stepper motor | |
US20210098992A1 (en) | State machine for wind power plant | |
JP3915085B2 (en) | Variable speed pumped storage power generation controller |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 21741896 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 21741896 Country of ref document: EP Kind code of ref document: A1 |