Control method and system based on electric rocking chair

文档序号:591743 发布日期:2021-05-28 浏览:34次 中文

阅读说明:本技术 一种基于电动摇椅的控制方法及系统 (Control method and system based on electric rocking chair ) 是由 李振钦 张涛 万利 项方 邓伟文 于 2020-12-30 设计创作,主要内容包括:本发明公开了一种基于电动摇椅的控制方法,包括根据预设速度获取所述电动摇椅的电机所需要的预设驱动电压;根据所述预设驱动电压计算得到第一驱动电压和第二驱动电压;以所述第一驱动电压驱动所述电机工作第一时长后,再以所述第二驱动电压驱动所述电机工作第二时长;同时对所述电机进行第一PID调节及第二PID调节,并实时计算第三驱动电压,其中,所述第一PID调节为纯比例调节,所述第二PID调节包括比例、积分以及微分调节;以所述第三驱动电压驱动所述电机。本发明还提供了一种基于电动摇椅的控制系统。采用本发明,能够降低系统超调量,提高系统的稳定性和实时性。(The invention discloses a control method based on an electric rocking chair, which comprises the steps of obtaining a preset driving voltage required by a motor of the electric rocking chair according to a preset speed; calculating according to the preset driving voltage to obtain a first driving voltage and a second driving voltage; after the first driving voltage drives the motor to work for a first time period, the second driving voltage drives the motor to work for a second time period; simultaneously carrying out first PID regulation and second PID regulation on the motor, and calculating a third driving voltage in real time, wherein the first PID regulation is pure proportion regulation, and the second PID regulation comprises proportion, integral and differential regulation; driving the motor with the third driving voltage. The invention also provides a control system based on the electric rocking chair. By adopting the invention, the overshoot of the system can be reduced, and the stability and the real-time performance of the system can be improved.)

1. A control method based on an electric rocking chair is characterized by comprising the following steps:

acquiring a preset driving voltage required by a motor of the electric rocking chair according to a preset speed;

calculating according to the preset driving voltage to obtain a first driving voltage and a second driving voltage;

after the first driving voltage drives the motor to work for a first time period, the second driving voltage drives the motor to work for a second time period;

simultaneously carrying out first PID regulation and second PID regulation on the motor, and calculating a third driving voltage in real time, wherein the first PID regulation is pure proportion regulation, and the second PID regulation comprises proportion, integral and differential regulation;

driving the motor with the third driving voltage.

2. The method of claim 1, wherein the step of performing a first PID adjustment and a second PID adjustment of the motor simultaneously and calculating a third driving voltage in real time comprises:

calculating the real-time speed of the electric rocking chair in the second PID adjusting period according to the pulse number detected by the photoelectric sensor of the electric rocking chair in the second PID adjusting period and a motor constant;

calculating to obtain the speed set by each gear of the electric rocking chair in the second PID adjusting period according to the speed set by each gear of the electric rocking chair in the last second PID adjusting period, the pulse number detected by the photoelectric sensor in the first PID adjusting period and the actually set pulse number of the first PID adjustment in the first PID adjusting period;

calculating to obtain a pwm value obtained through the first PID adjustment and the second PID adjustment according to the pwm value obtained through the first PID adjustment and the second PID adjustment at the last time, the speed set by each gear of the electric rocking chair in the second PID adjustment period, and the real-time speed of the electric rocking chair in the second PID adjustment period;

and calculating to obtain a third driving voltage according to the pwm value obtained by the first PID adjustment and the second PID adjustment.

3. The method of claim 2, wherein the step of calculating the real-time speed of the electric swing during the second PID adjustment period based on the number of pulses detected by the photosensor of the electric swing during the second PID adjustment period and a motor constant comprises:

and calculating the real-time speed of the electric rocking chair in the second PID adjusting period according to a formula F _ speed ═ Impulse ═ A, wherein F _ speed is the real-time speed of the electric rocking chair in one second PID adjusting period, Impulse is the number of pulses detected by a photoelectric sensor of the electric rocking chair in one second PID adjusting period, A is a motor constant, and the motor constant is 1.8-2.

4. The method of claim 2, wherein the step of calculating the speed of each gear setting of the electric swing according to the speed of each gear setting of the electric swing in the second PID adjustment period, the number of pulses detected by the photosensor in the first PID adjustment period, and the number of pulses actually set for the first PID adjustment in the first PID adjustment period comprises:

calculating the speed set by each gear of the electric rocking chair in the second PID adjusting period according to a formula Speedset + PID2 (setup pulse, action pulse), wherein Speedset is the speed set by each gear of the electric rocking chair in the second PID adjusting period, Speedset is the speed set by each gear of the electric rocking chair in the last PID adjusting period, action pulse is the number of pulses detected by the photoelectric sensor in one first PID adjusting period, and setup pulse is the number of pulses actually set by the first PID adjusting in one first PID adjusting period.

5. The method as claimed in claim 2, wherein the step of calculating the pwm value obtained through the first and second PID adjustments according to the pwm value obtained through the first and second PID adjustments at the last time, the speed set for each gear of the electric rocking chair during the second PID adjustment period, and the real-time speed of the electric rocking chair during the second PID adjustment period comprises:

and calculating a pwm value obtained through the first PID adjustment and the second PID adjustment according to a formula pwm + PID1(Speedset, F _ speed), wherein pwm is the pwm value obtained through the first PID adjustment and the second PID adjustment, pwm is the pwm value obtained through the last PID adjustment and the second PID adjustment, Speedset is a speed set for each gear of the electric rocking chair in the second PID adjustment period, and F _ speed is a real-time speed of the electric rocking chair in the second PID adjustment period.

6. The method of claim 1, wherein the step of driving the motor at the third drive voltage comprises:

according to the formula U4=U3The fourth driving voltage is obtained by/N calculation, wherein, U4Is a fourth driving voltage, U3The third driving voltage is N, and N is a positive integer;

according to the formula U5=U4M is calculated to obtain a fifth driving voltage, wherein U5Is a fifth driving voltage, U4M is the accumulated number of times of applying voltage to the motor, and the value of M is taken from 1 to N;

and driving the motor with the fifth driving voltage in sequence.

7. The electric rocking chair-based control method of claim 6, wherein the value of N ranges from 1 to 50.

8. The method of claim 1, wherein the first driving voltage is less than the predetermined driving voltage and the second driving voltage is less than the first driving voltage.

9. An electric rocking chair-based control method as claimed in claim 1, wherein the period of the first PID adjustment and the period of the second PID adjustment are both greater than twice the motor movement period.

10. A control system based on an electric rocking chair is characterized by comprising a main control module, a PID control module, a motor driving module, an acquisition module and a calculation module;

the acquisition module is used for acquiring a preset driving voltage required by a motor of the electric rocking chair according to a preset speed;

the calculation module is used for calculating to obtain a first driving voltage and a second driving voltage according to the preset driving voltage;

the PID control module is used for simultaneously carrying out first PID adjustment and second PID adjustment on the motor and calculating a third driving voltage in real time, wherein the first PID adjustment is pure proportion adjustment, and the second PID adjustment comprises proportion, integral and differential adjustment;

the motor driving module is used for driving a motor;

the main control module is used for driving the motor to work for a first time length by the first driving voltage, then driving the motor to work for a second time length by the second driving voltage, and driving the motor by the third driving voltage.

Technical Field

The invention relates to the field of circuits, in particular to a control method and a control system based on an electric rocking chair.

Background

The rocking chair speed regulating system is a time-varying and nonlinear real-time system, the speed has hysteresis, the common control method can cause the system to have oscillation and overshoot phenomena of different degrees, and if the external interference is large, the regulating time is too long, and an ideal control effect cannot be obtained.

At present, two methods are available for regulating the speed of a rocking chair. According to the first method, the output voltage of the motor is constant, and different motor fixed voltages are output according to different gears of the rocking chair, so that the rocking chair angle relatively accords with the requirement of people. And secondly, keeping the traveling distance of the motor in unit time constant, and adopting the traditional PID regulation according to speed feedback so as to achieve the angle of the rocking chair required by the motor. The error of the control method I is larger, when the weight of the rocking chair is continuously increased, the system speed cannot be compensated in real time, and meanwhile, the stability is very poor when external interference factors are large. The method is used for the traditional PID algorithm, and although the influence of two variables on external factors can be considered, the PID algorithm is very difficult in parameter setting and is not easy to control. The cause is as follows: 1: the rocking chair speed regulating system belongs to a time-varying and nonlinear real-time system in the whole system operation process. 2: due to PID algorithm control, a proportional link can generate a large stable error, so that overshoot is large, an integral link can cause too large oscillation, instantaneity is poor, a differential link is too sensitive, and parameter setting is not good.

Disclosure of Invention

The invention aims to provide a control method and a control system based on an electric rocking chair, which can reduce the overshoot of the system and improve the stability and the real-time performance of the system.

In order to solve the technical problem, the invention provides a control method based on an electric rocking chair, which comprises the following steps: acquiring a preset driving voltage required by a motor of the electric rocking chair according to a preset speed; calculating according to the preset driving voltage to obtain a first driving voltage and a second driving voltage; after the first driving voltage drives the motor to work for a first time period, the second driving voltage drives the motor to work for a second time period; simultaneously carrying out first PID regulation and second PID regulation on the motor, and calculating a third driving voltage in real time, wherein the first PID regulation is pure proportion regulation, and the second PID regulation comprises proportion, integral and differential regulation; driving the motor with the third driving voltage.

Preferably, the step of simultaneously performing the first PID adjustment and the second PID adjustment on the motor and calculating the third driving voltage in real time includes: calculating the real-time speed of the electric rocking chair in the second PID adjusting period according to the pulse number detected by the photoelectric sensor of the electric rocking chair in the second PID adjusting period and a motor constant; calculating to obtain the speed set by each gear of the electric rocking chair in the second PID adjusting period according to the speed set by each gear of the electric rocking chair in the last second PID adjusting period, the pulse number detected by the photoelectric sensor in the first PID adjusting period and the actually set pulse number of the first PID adjustment in the first PID adjusting period; calculating to obtain a pwm value obtained through the first PID adjustment and the second PID adjustment according to the pwm value obtained through the first PID adjustment and the second PID adjustment at the last time, the speed set by each gear of the electric rocking chair in the second PID adjustment period, and the real-time speed of the electric rocking chair in the second PID adjustment period; and calculating to obtain a third driving voltage according to the pwm value obtained by the first PID adjustment and the second PID adjustment.

Preferably, the step of calculating the real-time speed of the electric rocking chair in the second PID adjustment period according to the number of pulses detected by the photoelectric sensor of the electric rocking chair in the second PID adjustment period and a motor constant includes: and calculating the real-time speed of the electric rocking chair in the second PID adjusting period according to a formula F _ speed ═ Impulse ═ A, wherein F _ speed is the real-time speed of the electric rocking chair in one second PID adjusting period, Impulse is the number of pulses detected by a photoelectric sensor of the electric rocking chair in one second PID adjusting period, A is a motor constant, and the motor constant is 1.8-2.

Preferably, the step of calculating the speed set for each gear of the electric rocking chair in the second PID adjustment period according to the speed set for each gear of the electric rocking chair in the last second PID adjustment period, the number of pulses detected by the photosensor in the first PID adjustment period, and the number of pulses actually set for the first PID adjustment in the first PID adjustment period includes: calculating the speed set by each gear of the electric rocking chair in the second PID adjusting period according to a formula Speedset + PID2 (setup pulse, action pulse), wherein Speedset is the speed set by each gear of the electric rocking chair in the second PID adjusting period, Speedset is the speed set by each gear of the electric rocking chair in the last PID adjusting period, action pulse is the number of pulses detected by the photoelectric sensor in one first PID adjusting period, and setup pulse is the number of pulses actually set by the first PID adjusting in one first PID adjusting period.

Preferably, the step of calculating the pwm value obtained through the first PID adjustment and the second PID adjustment according to the pwm value obtained through the first PID adjustment and the second PID adjustment at the last time, the speed set for each gear of the electric rocking chair in the second PID adjustment period, and the real-time speed of the electric rocking chair in the second PID adjustment period includes: and calculating a pwm value obtained through the first PID adjustment and the second PID adjustment according to a formula pwm + PID1(Speedset, F _ speed), wherein pwm is the pwm value obtained through the first PID adjustment and the second PID adjustment, pwm is the pwm value obtained through the last PID adjustment and the second PID adjustment, Speedset is a speed set for each gear of the electric rocking chair in the second PID adjustment period, and F _ speed is a real-time speed of the electric rocking chair in the second PID adjustment period.

Preferably, the step of driving the motor at the third driving voltage includes: according to the formula U4=U3The fourth driving voltage is obtained by/N calculation, wherein, U4Is the fourth driving voltage, and is,U3the third driving voltage is N, and N is a positive integer; according to the formula U5=U4M is calculated to obtain a fifth driving voltage, wherein U5Is a fifth driving voltage, U4M is the accumulated number of times of applying voltage to the motor, and the value of M is taken from 1 to N; and driving the motor with the fifth driving voltage in sequence.

Preferably, the value range of N is 1-50.

Preferably, the first driving voltage is smaller than the preset driving voltage, and the second driving voltage is smaller than the first driving voltage.

Preferably, the period of the first PID adjustment and the period of the second PID adjustment are both greater than twice the motor movement period.

The invention also provides a control system based on the electric rocking chair, which comprises a main control module, a PID control module, a motor driving module, an acquisition module and a calculation module; the acquisition module is used for acquiring a preset driving voltage required by a motor of the electric rocking chair according to a preset speed; the calculation module is used for calculating to obtain a first driving voltage and a second driving voltage according to the preset driving voltage; the PID control module is used for simultaneously carrying out first PID adjustment and second PID adjustment on the motor and calculating a third driving voltage in real time, wherein the first PID adjustment is pure proportion adjustment, and the second PID adjustment comprises proportion, integral and differential adjustment; the motor driving module is used for driving a motor; the main control module is used for driving the motor to work for a first time length by the first driving voltage, then driving the motor to work for a second time length by the second driving voltage, and driving the motor by the third driving voltage.

The beneficial effects of the implementation of the invention are as follows:

the invention obtains the preset driving voltage required by the motor of the electric rocking chair according to the preset speed; calculating according to the preset driving voltage to obtain a first driving voltage and a second driving voltage; after the first driving voltage drives the motor to work for a first time period, the second driving voltage drives the motor to work for a second time period; simultaneously carrying out first PID regulation and second PID regulation on the motor, and calculating a third driving voltage in real time, wherein the first PID regulation is pure proportion regulation, and the second PID regulation comprises proportion, integral and differential regulation; driving the motor with the third driving voltage. By adopting the invention, in the process of regulating the speed of the rocking chair, the non-linear characteristic that the input and the output of the speed regulating system are not proportional can be well solved by combining the structural parameters of the motor according to the set gears and by a sectional speed control method, the real-time property of the system can be improved by finding the balance state of the system, and the control method has stable and reliable swing amplitude and good user experience; the invention reduces the overshoot of the system, improves the stability and the real-time performance of the system, can stabilize the rocking chair within 30S, meets the time and the effect required by people, has stable swing amplitude and uniform speed and strong practicability, and can meet the requirements of consumers.

Drawings

Fig. 1 is a flow chart of a control method based on an electric rocking chair provided by the invention;

FIG. 2 is a flow chart of PID adjustment of a control method based on an electric rocking chair provided by the invention;

fig. 3 is a flowchart of a voltage output method of the control method based on the electric rocking chair provided by the invention;

fig. 4 is a schematic diagram of a control system for an electric swing chair according to the present invention.

Detailed Description

In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail with reference to the accompanying drawings. It is only noted that the invention is intended to be limited to the specific forms set forth herein, including any reference to the drawings, as well as any other specific forms of embodiments of the invention.

As shown in fig. 1, the present invention provides a control method based on an electric rocking chair, including:

and S101, acquiring a preset driving voltage required by a motor of the electric rocking chair according to a preset speed.

Because the corresponding speed of each gear of the electric rocking chair is different, the driving voltage of the motor required by the electric rocking chair is also different, and the driving voltage required by the motor to maintain the speed can be obtained according to the corresponding speed of different gears. It should be noted that the speed of the electric rocking chair corresponds to the preset driving voltage.

The advantages of initially adopting this driving mode are: the situation that the motor is driven by all voltages at the beginning is avoided, so that the rocking chair is prevented from being directly thrown away by too much force, and safety accidents are avoided; after the rocking chair is driven by the first driving voltage, the rocking chair has inertia, so that a little force is reduced for the second time, and the effect of saving energy can be achieved; in addition, if PID control is adopted at the beginning, too much force is generated to shake the rocking chair out.

And S102, calculating to obtain a first driving voltage and a second driving voltage according to the preset driving voltage.

And S103, driving the motor to work for a first time period by the first driving voltage, and then driving the motor to work for a second time period by the second driving voltage.

The electric rocking chair starts to move from a standstill, a first driving voltage and a second driving voltage are obtained according to the preset driving voltage, and the motor works for a first time period with the first driving voltage and then works for a second time period with the second driving voltage.

Preferably, the first driving voltage is less than the preset driving voltage. Preferably, the second driving voltage is smaller than the first driving voltage. Specifically, the first driving voltage is selected to be half of the preset driving voltage, and the second driving voltage is selected to be 40% of the preset driving voltage. And the first and second time periods are both 28ms, but are not limited thereto.

And S104, simultaneously carrying out first PID adjustment and second PID adjustment on the motor, and calculating a third driving voltage in real time, wherein the first PID adjustment is pure proportional adjustment, and the second PID adjustment comprises proportional, integral and differential adjustment.

Preferably, the period of the first PID adjustment is more than twice the period of the motor movement. Preferably, the period of the second PID adjustment is more than twice the period of the motor movement. It should be noted that, according to Nyquist-Shannon sampling theorem, the sampling period is less than 1/2 times the integer period, the sampling frequency should be greater than 2 times the original frequency, and according to the motor parameters, it completely sees that the minimum time required for a motor motion period is 2ms, so the sampling period of PID is at least 4 ms. According to practical conditions, the period of the first PID adjustment is set as 16ms, and the period of the second PID adjustment is set as 100ms, but the method is not limited to the period.

And S105, driving the motor by the third driving voltage.

By adopting the invention, in the process of regulating the speed of the rocking chair, the non-linear characteristic that the input and the output of the speed regulating system are not proportional can be well solved by combining the structural parameters of the motor according to the set gears and by a sectional speed control method, the real-time property of the system can be improved by finding the balance state of the system, and the control method has stable and reliable swing amplitude and good user experience; the invention reduces the overshoot of the system, improves the stability and the real-time performance of the system, can stabilize the rocking chair within 30S, meets the time and the effect required by people, has stable swing amplitude and uniform speed and strong practicability, and can meet the requirements of consumers.

As shown in fig. 2, preferably, the step of performing the first PID adjustment and the second PID adjustment on the motor at the same time and calculating the third driving voltage in real time includes:

s201, calculating according to the pulse number detected by the photoelectric sensor of the electric rocking chair in the second PID adjusting period and a motor constant to obtain the real-time speed of the electric rocking chair in the second PID adjusting period.

S202, calculating according to the speed set by each gear of the electric rocking chair in the second PID adjusting period last time, the pulse number detected by the photoelectric sensor in the first PID adjusting period and the actually set pulse number of the first PID adjustment in the first PID adjusting period to obtain the speed set by each gear of the electric rocking chair in the second PID adjusting period.

And S203, calculating according to the pwm value obtained through the first PID adjustment and the second PID adjustment at the last time, the speed set by each gear of the electric rocking chair in the second PID adjustment period and the real-time speed of the electric rocking chair in the second PID adjustment period to obtain the pwm value obtained through the first PID adjustment and the second PID adjustment.

And S204, calculating to obtain a third driving voltage according to the pwm value obtained by the first PID adjustment and the second PID adjustment.

Preferably, the step of calculating the real-time speed of the electric rocking chair in the second PID adjustment period according to the number of pulses detected by the photoelectric sensor of the electric rocking chair in the second PID adjustment period and a motor constant includes: and calculating the real-time speed of the electric rocking chair in the second PID adjusting period according to a formula F _ speed ═ Impulse ═ A, wherein F _ speed is the real-time speed of the electric rocking chair in one second PID adjusting period, Impulse is the number of pulses detected by a photoelectric sensor of the electric rocking chair in one second PID adjusting period, A is a motor constant, and the motor constant is 1.8-2. The motor constant selected in the embodiment of the present invention is 1.9345, but is not limited thereto, and the motor constants of different motors are different.

Preferably, the step of calculating the speed set for each gear of the electric rocking chair in the second PID adjustment period according to the speed set for each gear of the electric rocking chair in the last second PID adjustment period, the number of pulses detected by the photoelectric sensor in the first PID adjustment period, and the number of pulses actually set for the first PID adjustment in the first PID adjustment period includes: calculating the speed set by each gear of the electric rocking chair in the second PID adjusting period according to a formula Speedset + PID2 (setup pulse, action pulse), wherein Speedset is the speed set by each gear of the electric rocking chair in the second PID adjusting period, Speedset is the speed set by each gear of the electric rocking chair in the last PID adjusting period, action pulse is the number of pulses detected by the photoelectric sensor in one first PID adjusting period, and setup pulse is the number of pulses actually set by the first PID adjusting in one first PID adjusting period.

Further, the step of calculating the pwm value obtained through the first PID adjustment and the second PID adjustment according to the pwm value obtained through the first PID adjustment and the second PID adjustment at the last time, the speed set for each gear of the electric rocking chair in the second PID adjustment period, and the real-time speed of the electric rocking chair in the second PID adjustment period includes: and calculating a pwm value obtained through the first PID adjustment and the second PID adjustment according to a formula pwm + PID1(Speedset, F _ speed), wherein pwm is the pwm value obtained through the first PID adjustment and the second PID adjustment, pwm is the pwm value obtained through the last PID adjustment and the second PID adjustment, Speedset is a speed set for each gear of the electric rocking chair in the second PID adjustment period, and F _ speed is a real-time speed of the electric rocking chair in the second PID adjustment period.

It should be noted that, in combination with a specific application scenario of the present invention, definitions of variables in the first formula, the second formula, and the third formula are further described;

pulse, the pulse number detected by a photoelectric sensor in PID regulation with the sampling period of 100 ms;

f _ speed, namely the real-time speed of PID adjustment with the sampling period of 100 ms;

speedset, the speed set by each gear of PID regulation with the sampling period of 100ms, which is a value obtained by multiple tests and used as a comparison value;

actualpulse, the actual pulse number detected by a photoelectric sensor with 16ms sampling period and PID adjustment;

a pulse with a sampling period of 16ms is actually set by PID adjustment, and the value obtained by multiple tests is used as a comparison value;

and Pwm is obtained through two-way PID adjustment, and then the Pwm value of the MCU is changed, so that the motor speed is changed.

In addition, the item uses incremental PID, but is not limited to this, and the function code used in the item is as follows:

as shown in fig. 3, preferably, the step of driving the motor at the third driving voltage includes:

s301, according to the formula U4=U3The fourth driving voltage is obtained by/N calculation, wherein, U4Is a fourth driving voltage, U3The third driving voltage is N, and N is a positive integer;

s302, according to the formula U5=U4M is calculated to obtain a fifth driving voltage, wherein U5Is a fifth driving voltage, U4M is the accumulated number of times of applying voltage to the motor, and the value of M is taken from 1 to N;

and S303, sequentially driving the motor by the fifth driving voltage.

Preferably, the value range of N is 1-50.

It should be noted that the PID controller gives a value completely for 100ms, but according to the motor structure, if the changed voltage value for 100ms is too large, the input power will be impacted, which results in the rocking chair being stuck. One swing period of the rocking chair is 1000ms, the voltage of the motor is limited to be slowly added in multiple parts, the soft start effect can be achieved, and the impact on the motor and a circuit board is not large.

As shown in fig. 4, the invention further provides a control system based on the electric rocking chair, which comprises a main control module 1, a PID control module 2, a motor driving module 3, an obtaining module 5 and a calculating module 4; the acquisition module 5 is used for acquiring a preset driving voltage required by a motor of the electric rocking chair according to a preset speed; the calculation module 4 is used for calculating to obtain a first driving voltage and a second driving voltage according to the preset driving voltage; the PID control module 2 is used for simultaneously performing first PID adjustment and second PID adjustment on the motor and calculating a third driving voltage in real time, wherein the first PID adjustment is pure proportion adjustment, and the second PID adjustment comprises proportion, integral and differential adjustment; the motor driving module 3 is used for driving a motor; the main control module 1 is configured to drive the motor to operate for a first time period with the first driving voltage, drive the motor to operate for a second time period with the second driving voltage, and drive the motor with the third driving voltage.

According to the invention, the preset driving voltage required by the motor of the electric rocking chair is obtained through the obtaining module 5 according to the preset speed; calculating to obtain a first driving voltage and a second driving voltage according to the preset driving voltage through the calculating module 4; the first PID regulation and the second PID regulation are realized through the PID control module 2; and the main control module 1 controls the output of the motor driving module 3 according to the PID control module 2 and the calculation module 4. By adopting the invention, in the process of regulating the speed of the rocking chair, the non-linear characteristic that the input and the output of the speed regulating system are not proportional can be well solved by combining the structural parameters of the motor according to the set gears and by a sectional speed control method, the real-time property of the system can be improved by finding the balance state of the system, and the control method has stable and reliable swing amplitude and good user experience; the invention reduces the overshoot of the system, improves the stability and the real-time performance of the system, can stabilize the rocking chair within 30S, meets the time and the effect required by people, has stable swing amplitude and uniform speed and strong practicability, and can meet the requirements of consumers.

The step that the PID control module 2 performs first PID adjustment on the motor and performs second PID adjustment on the motor to obtain a third driving voltage comprises the following steps: calculating the real-time speed of the electric rocking chair in the second PID adjusting period according to a first formula, wherein the first formula is as follows: f _ speed is the real-time speed of the electric rocking chair in one second PID adjustment period, Impulse is the number of pulses detected by a photoelectric sensor of the electric rocking chair in one second PID adjustment period, and a is a motor constant. Preferably, the motor constant is 1.8-2, and the motor constant selected in the embodiment of the invention is 1.9345, but not limited thereto, and the motor constants of different motors are different. And calculating the speed set by each gear of the electric rocking chair in the second PID regulation period according to a second formula, wherein the second formula is as follows: the Speedset is the Speedset + PID2 (setup pulse, actual pulse), the Speedset is the speed set for each gear of the electric rocking chair in one second PID adjusting period, the actual pulse is the pulse number detected by the photoelectric sensor in one first PID adjusting period, and the setup pulse is the actually set pulse number of the first PID adjustment in one first PID adjusting period. And calculating a pwm value obtained by the first PID adjustment and the second PID adjustment according to a third formula, wherein the third formula is as follows: pwm + PID1(Speedset, F _ speed), where pwm is the pwm value obtained by the first PID adjustment and the second PID adjustment. And calculating to obtain a third driving voltage according to the pwm value.

While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention.

13页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种智能调节教学椅

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!