CN118276433B - Medicament flow optimization control method for dispensing machine - Google Patents
Medicament flow optimization control method for dispensing machine Download PDFInfo
- Publication number
- CN118276433B CN118276433B CN202410703206.4A CN202410703206A CN118276433B CN 118276433 B CN118276433 B CN 118276433B CN 202410703206 A CN202410703206 A CN 202410703206A CN 118276433 B CN118276433 B CN 118276433B
- Authority
- CN
- China
- Prior art keywords
- american
- lion
- formula
- population
- medicament
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 239000003814 drug Substances 0.000 title claims abstract description 162
- 238000005457 optimization Methods 0.000 title claims abstract description 87
- 238000000034 method Methods 0.000 title claims abstract description 40
- 241000601288 Panthera leo atrox Species 0.000 claims abstract description 138
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 123
- 238000004088 simulation Methods 0.000 claims abstract description 9
- 230000000694 effects Effects 0.000 claims abstract description 7
- 238000013178 mathematical model Methods 0.000 claims description 37
- 238000011161 development Methods 0.000 claims description 30
- 230000003044 adaptive effect Effects 0.000 claims description 18
- 238000013507 mapping Methods 0.000 claims description 16
- 238000004364 calculation method Methods 0.000 claims description 12
- 230000000737 periodic effect Effects 0.000 claims description 12
- 230000006872 improvement Effects 0.000 claims description 11
- 230000008569 process Effects 0.000 claims description 10
- 238000012546 transfer Methods 0.000 claims description 10
- 230000008901 benefit Effects 0.000 claims description 9
- 230000006399 behavior Effects 0.000 claims description 6
- 238000005315 distribution function Methods 0.000 claims description 6
- 230000011273 social behavior Effects 0.000 claims description 6
- 238000013459 approach Methods 0.000 claims description 3
- 230000001105 regulatory effect Effects 0.000 claims description 3
- 230000001276 controlling effect Effects 0.000 claims description 2
- 230000007246 mechanism Effects 0.000 description 4
- 238000006243 chemical reaction Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000004069 differentiation Effects 0.000 description 2
- 230000010354 integration Effects 0.000 description 2
- 238000012544 monitoring process Methods 0.000 description 2
- 230000004044 response Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 239000003795 chemical substances by application Substances 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000036541 health Effects 0.000 description 1
- 230000009191 jumping Effects 0.000 description 1
- 238000005259 measurement Methods 0.000 description 1
- 238000013486 operation strategy Methods 0.000 description 1
- 230000010355 oscillation Effects 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02T—CLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
- Y02T10/00—Road transport of goods or passengers
- Y02T10/10—Internal combustion engine [ICE] based vehicles
- Y02T10/40—Engine management systems
Landscapes
- Feedback Control In General (AREA)
Abstract
The invention discloses a medicament flow optimization control method for a dispensing machine, which belongs to the technical field of PID control and comprises the following steps: s1, constructing a simulation model of a medicament flow control system of a dispensing machine by using MATLAB and Simulink software; s2, improving a American lion optimization algorithm; s3, setting parameters of a medicament flow PID controller of the medicament dispenser by using an improved American lion optimization algorithm, and obtaining optimal Kp, ki and Kd parameters through optimization; s4, inputting three parameters Kp, ki and Kd set through a American lion optimization algorithm into a simulation model of a medicament flow control system of the medicament dispenser constructed through Simulink, and optimizing the control effect of the medicament flow control system of the medicament dispenser.
Description
Technical Field
The invention belongs to the field of PID control optimization, and particularly relates to a medicament flow optimization control method for a dispensing machine.
Background
The medicament flow rate of a dispenser refers to the rate at which the machine can accurately measure and dispense medicament, which is generally dependent on the design and specifications of the dispenser, and the specific requirements of the required dispense, some dispensers can handle large amounts of medicament, hundreds or even thousands of prescriptions can be dispensed per hour, while others are more focused on individually tailored medicaments, which can be slower but more accurate, and the accuracy of the medicament flow rate is critical to the dispenser because excessive or insufficient medicament can pose health risks to the patient, and therefore the dispenser is generally equipped with a high accuracy measurement and control system to ensure that the amount dispensed of each medicament is within the prescribed limits, and the use of a PID controller to control the medicament flow rate of the dispenser is a common method.
The PID controller integrates three links of proportion, integration and differentiation, the operation results are finally utilized to control the actuating mechanism by carrying out corresponding proportion, integration and differentiation operation on input deviation, the stability is high, the structure is simple, the PID controller is widely applied to industrial control, a closed loop control mode is generally adopted, although PID control is widely applied to medicament flow control of a dispensing machine, obvious defects exist, the traditional PID control directly uses errors between a set value and output to control, the phenomenon of overshoot or oscillation of a system can occur, in a medicament flow control system of the dispensing machine, the situation can interfere with the stability of the medicament flow control system of the dispensing machine, secondly, the traditional PID control adopts a linear combination mode to form a control quantity, the mode is not suitable for all systems, particularly, the accuracy of the medicament flow control system of the dispensing machine is influenced when the complex processes such as nonlinearity, time variation are processed, the parameter setting of the PID controller requires abundant experience and skill of staff, the selection is improper, a great deal of time can be spent, and the medicament flow and the accuracy and the dispensing efficiency are influenced when the parameter setting of the dispensing machine is wrong.
The American lion optimizing algorithm is a new intelligent optimizing algorithm, the inspiration comes from the intelligence and life of the American lion, in the algorithm, a unique and powerful mechanism is provided in each stage of exploration and development, which increases the performance of the algorithm for various optimizing problems, in addition, a new intelligent mechanism is provided, which is a phase-change hyper-heuristic mechanism, the PO algorithm can execute phase-change operation during optimizing operation and balance two phase-change stages, each stage can be automatically adjusted according to the nature of the problem, but as with some common intelligent optimizing algorithms, the American lion optimizing algorithm has slow convergence speed, the searching later is easy to fall into a local optimal solution and can not jump out quickly, so that when an actual PID controller is optimized, three parameters of optimal Kp, ki and Kd can not be found under the specified iteration times.
Disclosure of Invention
The invention aims at: the method has the advantages that the convergence rate of an original algorithm is improved through improving the American lion optimization algorithm, the precision of searching for an optimal solution is increased, the possibility that the algorithm falls into a local optimal solution is reduced, three parameters Kp, ki and Kd of a PID controller for the medicament flow of a dispensing machine are optimized through utilizing the improved American lion optimization algorithm, the response time and the overshoot of the PID controller are reduced, and therefore the problems that the traditional PID controller is unstable and poor in adaptability when controlling the medicament flow of the dispensing machine are solved, and the robustness of medicament flow control of the dispensing machine is improved.
In order to achieve the above purpose, the present invention adopts the following technical scheme:
The medicine flow optimizing control method for medicine dispensing machine includes the following steps:
Step one, constructing a simulation model of the medicament flow control system of the dispensing machine by using MATLAB and Simulink software.
Step two, improving the optimization algorithm of the American lion, wherein the specific improvement strategy comprises the following steps:
D1, generating an initial population position of an algorithm by adopting an advantage set mapping method;
D2, improving a long-jump hunting mathematical model of the American lion optimization algorithm by using a periodic self-adaptive T distribution disturbance method, using an optimal position X best (iter) of an ith iteration as a reference point, adopting the self-adaptive T distribution disturbance population position if the current iteration number iter divides the period T, otherwise adopting the original long-jump hunting mathematical model to update the population position;
And D3, improving a voltammetric strategy mathematical model of the American lion optimization algorithm by using an adaptive normal elite strategy, taking the optimal position X best (iter) of the ith iteration as an elite position, taking the elite position as a mean value of normal distribution, adaptively setting a normal distribution standard deviation through the current iteration number in a search space, and finally disturbing the position of the current American lion by using the generated normal elite coefficient, thereby realizing the updating of the population.
And thirdly, setting parameters of a medicament flow PID controller of the dispensing machine by using an improved American lion optimization algorithm, and obtaining optimal Kp, ki and Kd parameters through optimization.
And fourthly, inputting three parameters Kp, ki and Kd set through a American lion optimization algorithm into a simulation model of the medicament flow control system of the medicament dispenser constructed through Simulink, and optimizing the control effect of the medicament flow control system of the medicament dispenser.
In the first step, MATLAB and Simulink software are used for constructing a medicine flow control system of the medicine dispensing machine, wherein the medicine flow control system comprises a signal input unit, a PID controller unit, an improved American lion optimizing algorithm unit, a flow controller unit, a medicine output pump unit and a medicine flow collector unit; the target medicament flow is transmitted through the signal input unit, the deviation e (t) is obtained by making a difference with the actual output quantity of the medicament acquired by the medicament flow acquisition unit, the obtained e (t) is input into the PID controller unit, the e (t) is regulated by the PID controller optimized by the improved American lion optimization algorithm, the control u (t) is output to the flow controller unit, and the flow controller unit generates a control signal to control the medicament output pump to output a medicament with a certain dosage, so that the medicament flow control of the whole medicament dispensing machine is realized.
In the first step, the medicine flow control problem of the medicine dispensing machine is converted into a mathematical model to be optimized, and the mathematical model is an objective function for improving the American lion optimization algorithm.
Further, in the step D1, an advantage set mapping method is adopted to generate an initial population of the algorithm, and the population position generated by using the advantage set is more uniform in the whole searching range, so that the american lion optimization algorithm can obtain better scores in an inexperienced stage, and the follow-up better optimization in each stage is realized, wherein a specific improved formula is shown in a formula (1) and a formula (2):
p=lb+r·(ub-lb) (2);
In formula (1), r is a mapping coefficient, i=1, 2, …, N is the number of populations, j=1, 2, …, dim, dim is the dimension of the population, prime min represents a minimum prime number, the minimum prime number is selected by dividing the prime number by 2, which is less than the minimum value of the dimension of the population, after subtracting 3 from itself, in formula (2), p represents the initialized population position, lb represents the minimum value of the search space, ub represents the maximum value of the search space, and r is the mapping coefficient generated by formula (1).
Further, in the improvement strategy D2, a periodic adaptive t distribution disturbance method is used to improve a long-jump hunting mathematical model of the american lion optimization algorithm, the diversity of the updated population can be improved through the disturbance of the adaptive t distribution, and the diversity of the updated strategy can be increased through the periodic updated population, so that the possibility that the algorithm falls into a local optimal solution in the optimizing process is reduced, the efficiency of the algorithm in the development stage is improved, and a specific improvement formula is shown in a formula (3):
In (3) The method comprises the steps of representing the updated position of an ith American lion, X best (iter) representing the optimal solution of an ith iteration, trnd () representing a T distribution function, iter representing the current iteration number, maxiter representing the maximum iteration number, T representing the period of an updating strategy, beta representing a random number generated between 0 and 2, alpha representing a normal distribution random number between 0 and 3, X i (iter) representing the position of the current American lion, X j (iter) representing a randomly selected position in all individuals in a population, j being a random number between [1, N ], N being the number of populations, updating the population position by using a long-hop hunting strategy improved by an adaptive T distribution disturbance strategy when the iteration number iter and the period T can be divided, otherwise updating the population position by using the original long-hop hunting strategy of the algorithm.
Further, in the step D3, an adaptive normal elite strategy is used to improve a voltammetric mathematical model of the american lion optimization algorithm, a current optimal solution is taken as a mean value of gaussian distribution, a value is generated through a gaussian function according to the size of a search space and a current iteration stage, the current individual position is updated, the updating range of the early stage of the algorithm and the speed of approaching to an optimal solution area can be improved through the adaptive normal elite strategy, and the accuracy of global search in the later stage is improved, wherein specific improvement formulas are shown in formula (4) and formula (5):
in the formula (4), sigma represents a standard deviation in normal distribution, ub represents an upper limit of a search space, lb represents a lower limit of the search space, iter represents a current iteration number, and maxiter represents a maximum iteration number;
In (5) Representing the updated position of the i-th American lion, normrnd () represents a normal distribution function, X best (iter) represents the current optimal solution as the mean of the normal distribution, σ generates a standard deviation representing the normal distribution from equation (4), and X i (t) represents the position of the i-th American lion in the current iteration.
In the third step, parameters of a medicine flow PID controller of the medicine dispensing machine are set by using an improved American lion optimization algorithm, and optimal Kp, ki and Kd parameters are obtained through optimization, and the method specifically comprises the following steps:
S1, simulating the working process of a medicament flow control system of the medicament dispensing machine, designing a transfer function by using a Simulink, and simulating a transfer function model by adopting a second-order nonlinear function;
s2, giving an input signal of a medicine flow control system of the medicine dispensing machine, and taking the input signal of the system as a target medicine flow;
S3, initializing a population scale N of an improved American lion optimization algorithm, a problem dimension dim, an upper limit ub and a lower limit lb of a search space, and a maximum iteration number maxiter, initializing initial positions of the American lion population by adopting an advantage set mapping strategy, calculating the fitness value of each position through an objective function, selecting the optimal fitness value with the minimum fitness value as the population, and taking the position as an optimal solution of the population;
S4, encoding PID controller parameters Kp, ki and Kd of a medicine flow control system of the medicine dispensing machine into three dimensions for improving a position solution of the American lion optimization algorithm;
S5, using IAE as an objective function for improving the American lion optimization algorithm, wherein the formula of the objective function is as follows:
Wherein J represents an adaptability value obtained by improving the American lion optimization algorithm, e (t) represents an error of the medicine flow control system of the medicine dispensing machine at the current running time t, namely a difference value between the target medicine flow and the acquired actual medicine flow, and L is the total running time of the system;
S6, simulating social behaviors of the American lion, establishing a position update strategy mathematical model for improving the optimization algorithm of the American lion, selecting a proper stage for updating according to scores calculated in an inexperienced stage, and utilizing the mathematical model to update position information of the American lion and convert the position information into three parameters of Kp, ki and Kd of a PID controller in a medicament flow control system of the medicament dispenser;
S7, adopting a greedy strategy to carry out adaptability comparison, taking the position with the minimum adaptability value in the iteration as the current optimal position, grading the newly updated population, and taking the grading value as the basis of the next selection updating stage;
S8, circularly executing S6-S7, judging whether the current iteration number reaches the maximum iteration number, if so, exiting the cycle, outputting a global optimal solution, and transmitting the searched optimal solution to three parameters Kp, ki and Kd of a PID controller in a medicine flow control system of the medicine dispensing machine.
Furthermore, in the step S1, in order to better simulate the actual working state of the pharmaceutical flow control system of the pharmaceutical machine, the two-order nonlinear function is designed by using the Simulink simulation software to simulate the working process of the pharmaceutical flow control system of the pharmaceutical machine, so that the accuracy of monitoring the flow of the pharmaceutical flow control system of the pharmaceutical machine is increased, meanwhile, the steady-state error and the dynamic error of the system are reduced, the adaptability and the stability of the whole system are improved, and the formula of the transfer function is as follows:
where G(s) is the transfer function and s is the function variable.
Further, in the step S8, the specific steps of simulating social behavior of the american lion and establishing a position updating strategy mathematical model for improving the optimization algorithm of the american lion are as follows:
S81, taking the previous three iterations as inexperienced stages of the American lion algorithm, calculating scores of the American lion in an exploration stage and a development stage through the inexperienced stages, and balancing conversion between two updating stages better through calculation of the scores, so that global searching capacity of the algorithm is improved, wherein calculation formulas of the scores of the two stages are shown in a formula (6) and a formula (7);
ScoreExplore=(PF1·f1Explor)+(PF2·f2Explor) (6);
ScoreExploit=(PF1·f1Exploit)+(PF2·f2Exploit) (7);
Equation (6) is a scoring calculation formula in the exploration phase, equation (7) is a scoring calculation formula in the development phase, PF1 and PF2 are used to balance the impact of the continuous cost-effectiveness of the exploration and development phases, f1 Explor and f2 Explor represent different cost-effectiveness in the exploration phase, and f1 Exploit and f2 Exploit represent different cost-effectiveness in the development phase;
s82, if the exploration score of the current population is larger than the development score, adopting an exploration stage to update the population, and taking the exploration stage when the American lion is simulated to search the prey as an algorithm updating strategy, wherein the American lion can randomly search food in the self territory at the stage or randomly approach other American lions and utilize the prey, and the mathematical model formula of the exploration stage is shown as the formula (8):
In (8) Representing the updated position of the ith American lion, iter representing the current iteration number, R dim representing a random number between 1 and the population dimension dim, ub representing the upper limit of the search space, lb representing the lower limit of the search space, R being a random number between 0 and 1, X 1、X2…X6 representing six American lion individuals randomly selected from the whole population, G representing a random number between-1 and 1, randomly searching food in the whole search space when the value of R is greater than 0.5, updating the population by using a first formula in formula (8), obtaining prey when the value of R is less than 0.5, and updating the population position by using a second formula in formula (8);
S83, if the development score of the current population is larger than the exploration score, a development stage is adopted to update the population, the development stage is used as an algorithm updating strategy when the American lion is simulated to search for hunting, the development stage comprises two updating strategies, the first is to simulate the long-jump hunting behavior of the American lion during hunting, the population position is updated through an improved periodic self-adaptive t distribution disturbance strategy, an updating formula is shown as a formula (3), the diversity of the updated population is improved through an improved mathematical model of the long-jump hunting behavior, particularly the possibility that the algorithm falls into a local optimal solution is reduced, the second is to simulate the volt strategy of the American lion during hunting, the mathematical model of the volt strategy is improved through an improved adaptive normal elite strategy, the updating formula is shown as a formula (4), the convergence speed of the algorithm in the early stage is improved through the improved mathematical model of the volt strategy, the population can be quickly approaching to an optimal solution area, and the later searching precision of the algorithm is improved.
In summary, due to the adoption of the technical scheme, the beneficial effects of the invention are as follows:
The invention provides a medicament flow optimization control method for a dispensing machine, which comprises the steps of introducing a priority set mapping initialization search population, introducing a periodic self-adaptive t distribution disturbance method to improve a long-jump hunting strategy in a quick operation strategy of a American lion optimization algorithm, introducing an adaptive normal elite strategy to improve a volt strategy of the American lion optimization algorithm, enabling population distribution initialized by the priority set mapping to be more uniform, enabling the population to be more uniform in quality, quickly finding an area where an optimal position is located at the initial stage of the algorithm, improving the searching speed of the algorithm, enabling the diversity of the population to be increased by adopting the periodic t distribution disturbance strategy, quickly finding new optimal individuals when the searching process falls into a local optimal solution, thereby jumping out of the local optimal condition, improving the global searching capability of the algorithm, adopting the adaptive normal elite strategy, enabling an updating range and the approaching speed to the optimal solution area at the early stage of the algorithm, and increasing the precision of the global searching at the later stage, applying the improved American lion optimization algorithm to a PID controller of the dispensing machine flow control system, and enabling the stability of the PID controller to be improved, enabling the PID controller to be fast, and solving the problem that the medicament flow is not stable and the medicament flow of the dispensing machine is not stable when the medicament flow control system is low in the medicament dispensing process.
Drawings
FIG. 1 is a flow chart of a method for optimizing control of medicament flow for a dispensing machine.
Fig. 2 is a model diagram of a PID controller of a pharmaceutical dosage machine medicament flow control system.
FIG. 3 is a graph comparing the effects of the improved American lion optimization algorithm with the original American lion optimization algorithm applied to a PID controller.
FIG. 4 is a graph comparing the fitness of the improved American lion optimization algorithm to the original American lion optimization algorithm.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all embodiments of the invention; all other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1-4, the present invention provides a technical solution.
A medicament flow optimization control method for a dispensing machine is shown in fig. 1, and comprises the following specific steps.
Step one, constructing a simulation model of a medicine flow control system of a medicine dispensing machine by using MATLAB and Simulink software, wherein a model diagram is shown in figure 2 and comprises a signal input unit, a PID controller unit, an improved American lion optimization algorithm unit, a flow controller unit, a medicine output pump unit and a medicine flow collector unit; the target medicament flow is transmitted through the signal input unit, the deviation e (t) is obtained by making a difference with the actual output quantity of the medicament acquired by the medicament flow acquisition unit, the obtained e (t) is input into the PID controller unit, the e (t) is regulated by the PID controller optimized by the improved American lion optimization algorithm, the control u (t) is output to the flow controller unit, and the flow controller unit generates a control signal to control the medicament output pump to output a medicament with a certain dosage, so that the medicament flow control of the whole medicament dispensing machine is realized.
In the first step, the medicine flow control problem of the medicine dispensing machine is converted into a mathematical model to be optimized, the mathematical model is an objective function for improving the American lion optimizing algorithm, IAE is used as the objective function for improving the American lion optimizing algorithm, and the objective function has the following formula:
Wherein J represents an adaptability value obtained by improving the American lion optimization algorithm, e (t) represents an error of the medicine flow control system of the medicine dispensing machine at the current running time t, namely a difference value between the target medicine flow and the acquired actual medicine flow, and L is the total running time of the system;
Further, in order to better simulate the actual working state of the medicament flow control system of the medicament dispenser, the Simulink simulation software is used for designing a second-order nonlinear function to simulate the working process of the medicament flow control system of the medicament dispenser, so that the accuracy of monitoring flow of the medicament flow control system of the medicament dispenser is improved, meanwhile, the steady-state error and the dynamic error of the system are reduced, the adaptability and the stability of the whole system are improved, and the formula of the transfer function is as follows:
where G(s) is the transfer function and s is the function variable.
Writing codes by using MATLAB, and establishing a mathematical model for improving the American optimization algorithm, wherein the specific improvement strategy comprises the following steps: d1, generating an initial population position of an algorithm by adopting an advantage set mapping method;
D2, improving a long-jump hunting mathematical model of the American lion optimization algorithm by using a periodic self-adaptive T distribution disturbance method, using an optimal position X best (iter) of an ith iteration as a reference point, adopting the self-adaptive T distribution disturbance population position if the current iteration number iter divides the period T, otherwise adopting the original long-jump hunting mathematical model to update the population position;
And D3, improving the volt-ampere strategy of the American lion optimization algorithm by using an adaptive normal elite strategy, taking the optimal position X best (iter) of the ith iteration as an elite position, taking the elite position as the mean value of normal distribution, adaptively setting the standard deviation of the normal distribution through the current iteration number in a search space, and finally disturbing the position of the current American lion by using the generated normal elite coefficient, thereby realizing the updating of the population.
Further, an initial population of the algorithm is generated by adopting a priority set mapping method, the population position generated by using the priority set is more uniform in the whole searching range, the optimization algorithm of the American lion is facilitated to obtain better scores in an inexperienced stage, the subsequent stages are better optimized, and a specific improved formula is shown in a formula (1) and a formula (2):
p=lb+r·(ub-lb) (2);
In formula (1), r is a mapping coefficient, i=1, 2, …, N is the number of populations, j=1, 2, …, dim, dim is the dimension of the population, prime min represents a minimum prime number, the minimum prime number is selected by dividing the prime number by 2, which is less than the minimum value of the dimension of the population, after subtracting 3 from itself, in formula (2), p represents the initialized population position, lb represents the minimum value of the search space, ub represents the maximum value of the search space, and r is the mapping coefficient generated by formula (1).
Further, in the improvement strategy D2, a periodic adaptive t distribution disturbance method is used to improve a long-jump hunting mathematical model of the american lion optimization algorithm, the diversity of the updated population can be improved through the disturbance of the adaptive t distribution, and the diversity of the updated strategy can be increased through the periodic updated population, so that the possibility that the algorithm falls into a local optimal solution in the optimizing process is reduced, the efficiency of the algorithm in the development stage is improved, and a specific improvement formula is shown in a formula (3):
In (3) The method comprises the steps of representing the updated position of an ith American lion, X best (iter) representing the optimal solution of an ith iteration, trnd () representing a T distribution function, iter representing the current iteration number, maxiter representing the maximum iteration number, T representing the period of an updating strategy, beta representing a random number generated between 0 and 2, alpha representing a normal distribution random number between 0 and 3, X i (iter) representing the position of the current American lion, X j (iter) representing a randomly selected position in all individuals in a population, j being a random number between [1, N ], N being the number of populations, updating the population position by using a long-hop hunting strategy improved by an adaptive T distribution disturbance strategy when the iteration number iter and the period T can be divided, otherwise updating the population position by using the original long-hop hunting strategy of the algorithm.
Further, in the step D3, an adaptive normal elite strategy is used to improve a voltammetric mathematical model of the american lion optimization algorithm, a current optimal solution is taken as a mean value of gaussian distribution, a value is generated through a gaussian function according to the size of a search space and a current iteration stage, the current individual position is updated, the updating range of the early stage of the algorithm and the speed of approaching to an optimal solution area can be improved through the adaptive normal elite strategy, and the accuracy of global search in the later stage is improved, wherein specific improvement formulas are shown in formula (4) and formula (5):
in the formula (4), sigma represents a standard deviation in normal distribution, ub represents an upper limit of a search space, lb represents a lower limit of the search space, iter represents a current iteration number, and maxiter represents a maximum iteration number;
In (5) Representing the updated position of the i-th American lion, normrnd () represents a normal distribution function, X best (iter) represents the current optimal solution as the mean of the normal distribution, σ generates a standard deviation representing the normal distribution from equation (4), and X i (t) represents the position of the i-th American lion in the current iteration.
Step three, setting parameters of a medicament flow PID controller of the medicament dispenser by utilizing an improved American lion optimization algorithm, and obtaining optimal Kp, ki and Kd parameters by optimization, wherein the method comprises the following specific steps of:
S1, simulating the working process of a medicament flow control system of the medicament dispensing machine, designing a transfer function by using a Simulink, and simulating a transfer function model by adopting a second-order nonlinear function;
s2, giving an input signal of a medicament flow control system of the dispensing machine constructed through Simulink, and taking the input signal of the system as a target medicament flow;
S3, initializing a population scale N, a problem dimension dim, a search space upper limit ub, a search space lower limit lb and a maximum iteration number maxiter of an improved American lion optimization algorithm, initializing initial positions of the American lion population by adopting an advantage set mapping strategy, calculating the fitness value of each position through an objective function, selecting the optimal fitness value with the minimum fitness value as the population, and using the position as an optimal solution of the population, wherein the solution of the population position corresponds to PID controller parameters Kp, ki and Kd of a medicine flow control system of the medicine dispenser;
S4, encoding PID controller parameters Kp, ki and Kd of a medicine flow control system of the medicine dispensing machine into three dimensions for improving a position solution of the American lion optimization algorithm;
S5, using IAE as an objective function for improving the American lion optimization algorithm, wherein the formula of the objective function is as follows:
Wherein J represents an adaptability value obtained by improving the American lion optimization algorithm, e (t) represents an error of the medicine flow control system of the medicine dispensing machine at the current running time t, namely a difference value between the target medicine flow and the acquired actual medicine flow, and L is the total running time of the system;
S6, simulating social behaviors of the American lion, establishing a position update strategy mathematical model for improving the optimization algorithm of the American lion, selecting a proper stage for update according to the scores calculated in the inexperienced stage, updating the position information of the American lion by using the mathematical model, and converting the position information into PID controller parameters Kp, ki and Kd of a medicine flow control system of the medicine dispensing machine;
S7, adopting a greedy strategy to carry out adaptability comparison, taking the position with the minimum adaptability value in the iteration as the current optimal position, and carrying out scoring calculation on the newly updated population, wherein the scoring value is taken as the basis for selecting the updating stage next time;
s8, circularly executing S6-S7, judging whether the current iteration number reaches the maximum iteration number, if so, exiting the cycle, outputting a global optimal solution, and transmitting the searched optimal solution to PID controller parameters Kp, ki and Kd of a medicine flow control system of the medicine dispensing machine.
Further, in the step S8, the specific steps of simulating social behavior of the american lion and establishing a position updating strategy mathematical model for improving the optimization algorithm of the american lion are as follows:
S81, taking the previous three iterations as inexperienced stages of the American lion algorithm, calculating scores of the American lion in an exploration stage and a development stage through the inexperienced stages, and balancing conversion between two updating stages better through calculation of the scores, so that global searching capacity of the algorithm is improved, wherein calculation formulas of the scores of the two stages are shown in a formula (6) and a formula (7);
ScoreExplore=(PF1·f1Explor)+(PF2·f2Explor) (6);
ScoreExploit=(PF1·f1Exploit)+(PF2·f2Exploit) (7);
Equation (6) is a scoring calculation formula in the exploration phase, equation (7) is a scoring calculation formula in the development phase, PF1 and PF2 are used to balance the impact of the continuous cost-effectiveness of the exploration and development phases, f1 Explor and f2 Explor represent different cost-effectiveness in the exploration phase, and f1 Exploit and f2 Exploit represent different cost-effectiveness in the development phase;
s82, if the exploration score of the current population is larger than the development score, adopting an exploration stage to update the population, and taking the exploration stage when the American lion is simulated to search the prey as an algorithm updating strategy, wherein the American lion can randomly search food in the self territory at the stage or randomly approach other American lions and utilize the prey, and the mathematical model formula of the exploration stage is shown as the formula (8):
In (8) Representing the updated position of the ith American lion, iter representing the current iteration number, R dim representing a random number between 1 and the population dimension dim, ub representing the upper limit of the search space, lb representing the lower limit of the search space, R being a random number between 0 and 1, X 1、X2…X6 representing six American lion individuals randomly selected from the whole population, G representing a random number between-1 and 1, randomly searching food in the whole search space when the value of R is greater than 0.5, namely updating the population by using a first formula in formula (8), acquiring prey by using a second formula in formula (8) when the value of R is less than 0.5;
S83, if the development score of the current population is larger than the exploration score, a development stage is adopted to update the population, the development stage is used as an algorithm updating strategy when the American lion is simulated to search for hunting, the development stage comprises two updating strategies, the first is to simulate the long-jump hunting behavior of the American lion during hunting, the population position is updated through an improved periodic self-adaptive t distribution disturbance strategy, an updating formula is shown as a formula (3), the diversity of the updated population is improved through an improved mathematical model of the long-jump hunting behavior, particularly the possibility that the algorithm falls into a local optimal solution is reduced, the second is to simulate the volt strategy of the American lion during hunting, the mathematical model of the volt strategy is improved through an improved adaptive normal elite strategy, the updating formula is shown as a formula (4), the convergence speed of the algorithm in the early stage is improved through the improved mathematical model of the volt strategy, the population can be quickly approaching to an optimal solution area, and the later searching precision of the algorithm is improved.
Inputting three parameters Kp, ki and Kd set by a American lion optimization algorithm into a simulation model of a medicament flow control system of the medicament dispenser constructed by Simulink, and reducing an error e (t) between a target medicament flow and an actual medicament flow by setting the three parameters of PID, so as to optimize the control effect of the medicament flow control system of the medicament dispenser.
In order to verify that the performance of the medicament flow optimization control method for the medicament dispensing machine provided by the invention is stronger compared with that of other methods, the invention is specifically implemented by Matlab mathematical modeling software and Simulink simulation, the improved American lion optimization algorithm optimization PID control is compared with the basic American lion optimization algorithm optimization PID control, in the medicament dispensing machine medicament flow control system, the performance of the PID controller determines the stability and the control precision of the medicament dispensing machine medicament flow control system, and the performance of the algorithm determines the overshoot, the response speed and the dynamic error of the PID controller.
Fig. 3 is a graph comparing the effect of improved american lion optimizing algorithm optimizing PID control with that of basic river american lion optimizing algorithm optimizing PID control, the target value of PID control of the agent flow is 1 unit, and it can be seen from the graph that compared with the PID control optimized by basic algorithm, the effect of optimizing PID control based on improved american lion optimizing algorithm is best, the target value is reached at a faster speed and the stability is better, in general, the improved american lion optimizing algorithm can better optimize the PID controller, and the optimization of parameters can be performed faster while the stability performance is ensured.
In order to verify that the performance of the improved American lion optimization algorithm is superior to that of the basic American lion optimization algorithm, in a test code, setting the population size N of the improved American lion optimization algorithm to be 100, the problem dimension dim to be 3 and the maximum iteration number Max_Iter to be 15, and running the code, as shown in fig. 4, the improved American lion optimization algorithm reaches the vicinity of an optimal fitness value faster than the basic American lion optimization algorithm, the later optimizing precision is higher, and the local optimal solution is quickly jumped out under the condition that the algorithm falls into the local optimal solution, so that the performance of the improved American lion optimization algorithm can be fully described to exceed the basic American lion optimization algorithm according to the principle that the smaller the fitness value is, the better the algorithm performance is.
Claims (2)
1. The medicament flow optimization control method for the dispensing machine is characterized by comprising the following specific steps of:
Firstly, constructing a simulation model of a medicine flow control system of a medicine dispensing machine, wherein the simulation model is constructed by MATLAB and Simulink software and comprises a signal input unit, a PID controller unit, an improved American lion optimization algorithm unit, a flow controller unit, a medicine output pump unit and a medicine flow collector unit; firstly, a target medicament flow is transmitted through a signal input unit, a deviation e (t) is obtained by making a difference with the actual output quantity of the medicament acquired by a medicament flow acquisition unit, the obtained e (t) is input into a PID controller unit, the e (t) is regulated by a PID controller optimized by an improved American lion optimization algorithm, a control u (t) is output to the flow controller unit, the flow controller unit generates a control signal to control a medicament output pump to output a medicament with a certain dosage, and then medicament flow control of the whole medicament dispensing machine is realized, the medicament flow control problem of the medicament dispensing machine is converted into a mathematical model to be optimized, and the mathematical model is an objective function of the improved American lion optimization algorithm;
step two, improving the optimization algorithm of the American lion, wherein the specific improvement strategy comprises the following steps:
D1, generating an initial population position of an algorithm by adopting an advantage set mapping method, wherein a specific improved formula is shown in a formula (1) and a formula (2):
p=lb+r·(ub-lb) (2);
in the formula (1), r is a mapping coefficient, i=1, 2, …, N is the number of groups, j=1, 2, …, dim, dim is the dimension of the group, prime min represents a minimum prime number, the selected rule of the minimum prime number is that the prime number is divided by 2 after subtracting 3, and is smaller than the minimum value of the dimension of the group, in the formula (2), p represents the initialized group position, lb represents the minimum value of the search space, ub represents the maximum value of the search space, and r is the mapping coefficient generated by the formula (1);
D2, using a periodic self-adaptive T distribution disturbance method to improve a long-jump hunting mathematical model of the American lion optimization algorithm, using an optimal position X best (iter) of an item-th iteration as a reference point, and if the current iteration item-division period T is equal to or smaller than a full period T, adopting the self-adaptive T distribution disturbance population position to update the population position, otherwise adopting an original long-jump hunting mathematical model to update the population position, wherein a specific improvement formula is shown in a formula (3):
In (3) Representing the updated position of the ith American lion, X best (iter) representing the optimal solution of the ith iteration, trnd () representing the T distribution function, iter representing the current iteration number, maxiter representing the maximum iteration number, T representing the period of the update strategy, β representing the random number generated between 0 and 2, α representing the normal distribution random number between 0 and 3, X i (iter) representing the position of the current American lion, X j (iter) representing a randomly selected position among all individuals in the population, j being the random number between [1, N ], N being the population number;
d3, improving a volt strategy mathematical model of the American lion optimization algorithm by using an adaptive normal elite strategy, taking the optimal position X best (iter) of the ith iteration as an elite position, taking the elite position as a mean value of normal distribution, adaptively setting a normal distribution standard deviation sigma according to the current iteration number in a search space, and finally disturbing the position of the current American lion by using the generated normal elite coefficient, thereby realizing the update of the population, wherein specific improvement formulas are shown in a formula (4) and a formula (5):
Sigma in formula (4) represents the standard deviation in normal distribution, ub represents the upper limit of the search space, lb represents the lower limit of the search space, iter represents the current iteration number, maxiter represents the maximum iteration number, in formula (5) Representing the updated position of the i th American lion, normrnd () representing a normal distribution function, X best (iter) representing the current optimal solution as the mean value of the normal distribution, sigma generating a standard deviation representing the normal distribution by formula (4), and X i (t) representing the position of the i th American lion of the current iteration number;
step three, setting parameters of a medicament flow PID controller of the medicament dispenser by utilizing an improved American lion optimization algorithm, and obtaining optimal Kp, ki and Kd parameters by optimization, wherein the method comprises the following specific steps of:
S1, simulating the working process of a medicament flow control system of a medicament dispensing machine, designing a transfer function by using a Simulink, and simulating a transfer function model by adopting a second-order nonlinear function;
S2, giving an input signal of a medicament flow control system of the dispensing machine, and taking the input signal of the system as a target medicament flow;
S3, initializing a population scale N, a problem dimension dim, a search space upper limit ub, a search space lower limit lb and a maximum iteration number maxiter of an improved American lion optimization algorithm, initializing initial positions of the American lion population by adopting an advantage set mapping strategy, calculating the fitness value of each position through an objective function, selecting the optimal fitness value with the minimum fitness value as the population, and taking the position as an optimal solution of the population;
S4, encoding PID controller parameters Kp, ki and Kd of a medicine flow control system of the medicine dispensing machine into three dimensions for improving a position solution of the American lion optimization algorithm;
S5, using IAE as an objective function for improving the American lion optimization algorithm, wherein the formula of the objective function is as follows:
Wherein J represents an adaptability value obtained by improving the American lion optimization algorithm, e (t) represents an error of the medicine flow control system of the medicine dispensing machine at the current running time t, namely a difference value between the target medicine flow and the acquired actual medicine flow, and L is the total running time of the system;
S6, simulating social behaviors of the American lion, establishing a position update strategy mathematical model for improving the optimization algorithm of the American lion, selecting a proper stage for updating according to scores calculated in an inexperienced stage, and utilizing the mathematical model to update position information of the American lion and convert the position information into three parameters of Kp, ki and Kd of a PID controller in a medicament flow control system of the medicament dispenser;
S7, adopting a greedy strategy to carry out adaptability comparison, taking the position with the minimum adaptability value in the iteration as the current optimal position, grading the newly updated population, and taking the grading value as the basis of the next selection updating stage;
S8, circularly executing S6-S7, judging whether the current iteration number reaches the maximum iteration number, if so, exiting the cycle, outputting a global optimal solution, and transmitting the searched optimal solution to three parameters Kp, ki and Kd of a PID controller in a medicine flow control system of the medicine dispensing machine;
And fourthly, inputting three parameters Kp, ki and Kd set by the American lion optimization algorithm into a medicine flow control system model of the medicine dispensing machine, and optimizing the control effect of the medicine flow control system of the medicine dispensing machine.
2. The method for optimizing and controlling the flow of medicament for a dispensing machine according to claim 1, wherein in S8, the specific steps of establishing a location update mathematical model for improving the optimization algorithm of the american lion by simulating the social behavior of the american lion are as follows:
S81, taking the previous three iterations as an inexperienced stage of the American lion algorithm, and calculating scores of the American lion in an exploration stage and a development stage through the inexperienced stage, wherein calculation formulas of the scores of the two stages are shown in a formula (6) and a formula (7);
ScoreExplore=(PF1·f1Explor)+(PF2·f2Explor) (6);
ScoreExploit=(PF1·f1Exploit)+(PF2·f2Exploit) (7);
Equation (6) is a scoring calculation formula in the exploration phase, equation (7) is a scoring calculation formula in the development phase, PF1 and PF2 are used to balance the impact of the continuous cost-effectiveness of the exploration and development phases, f1 Explor and f2 Explor represent different cost-effectiveness in the exploration phase, and f1 Exploit and f2 Exploit represent different cost-effectiveness in the development phase;
s82, if the exploration score of the current population is larger than the development score, adopting an exploration stage to update the population, and taking the exploration stage when the American lion is simulated to search the prey as an algorithm updating strategy, wherein the American lion can randomly search food in the self territory at the stage or randomly approach other American lions and utilize the prey, and the mathematical model formula of the exploration stage is shown as the formula (8):
In (8) Representing the updated position of the ith American lion, iter representing the current iteration number, R dim representing a random number between 1 and the population dimension dim, ub representing the upper limit of the search space, lb representing the lower limit of the search space, R being a random number between 0 and 1, X 1、X2…X6 representing six American lion individuals randomly selected from the whole population, G representing a random number between-1 and 1, the American lion randomly searching for food in the whole search space when the value of R is greater than 0.5, i.e. updating the population by using a first formula in formula (8), and the American lion obtaining prey by approaching other American lions when the value of R is less than 0.5, i.e. updating the population position by using a second formula in formula (8);
S83, if the development score of the current population is larger than the exploration score, a development stage is adopted to update the population, the development stage is used as an algorithm updating strategy when the American lion is simulated to search for hunting, the development stage comprises two updating strategies, the first is to simulate the long-jump hunting behavior of the American lion during hunting, the population position is updated through an improved periodic self-adaptive t distribution disturbance strategy, a formula is updated, as shown in a formula (3), the second is to simulate the volt behavior of the American lion during hunting, and the population position updating formula is updated through an improved adaptive normal elite strategy, as shown in a formula (4).
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410703206.4A CN118276433B (en) | 2024-06-03 | 2024-06-03 | Medicament flow optimization control method for dispensing machine |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410703206.4A CN118276433B (en) | 2024-06-03 | 2024-06-03 | Medicament flow optimization control method for dispensing machine |
Publications (2)
Publication Number | Publication Date |
---|---|
CN118276433A CN118276433A (en) | 2024-07-02 |
CN118276433B true CN118276433B (en) | 2024-08-09 |
Family
ID=91648365
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410703206.4A Active CN118276433B (en) | 2024-06-03 | 2024-06-03 | Medicament flow optimization control method for dispensing machine |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118276433B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103011356A (en) * | 2012-08-15 | 2013-04-03 | 重庆水务集团股份有限公司 | Method for controlling automatic chemical dosing of high-turbidity water system |
AU2020103709A4 (en) * | 2020-11-26 | 2021-02-11 | Daqing Oilfield Design Institute Co., Ltd | A modified particle swarm intelligent optimization method for solving high-dimensional optimization problems of large oil and gas production systems |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109634104A (en) * | 2019-01-28 | 2019-04-16 | 辽宁工业大学 | The intelligent optimal control device and its control method of cement raw mix proportioning process |
CN114894887A (en) * | 2022-05-07 | 2022-08-12 | 盐城工学院 | Nondestructive inspection process parameter matching optimization expert system |
CN117492359B (en) * | 2024-01-02 | 2024-03-22 | 济南大学 | Parameter optimization method of self-adaptive PID controller |
-
2024
- 2024-06-03 CN CN202410703206.4A patent/CN118276433B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103011356A (en) * | 2012-08-15 | 2013-04-03 | 重庆水务集团股份有限公司 | Method for controlling automatic chemical dosing of high-turbidity water system |
AU2020103709A4 (en) * | 2020-11-26 | 2021-02-11 | Daqing Oilfield Design Institute Co., Ltd | A modified particle swarm intelligent optimization method for solving high-dimensional optimization problems of large oil and gas production systems |
Also Published As
Publication number | Publication date |
---|---|
CN118276433A (en) | 2024-07-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108133258B (en) | Hybrid global optimization method | |
Pan et al. | A comparison of neural network backpropagation algorithms for electricity load forecasting | |
CN107657349B (en) | Method for extracting scheduling rules of staged power generation of reservoir | |
CN109787251B (en) | Cluster temperature control load aggregation model, system parameter identification and reverse control method | |
CN106026084B (en) | A kind of AGC power dynamic allocation methods based on virtual power generation clan | |
CN111523737A (en) | Automatic optimization-approaching adjusting method for operation mode of electric power system driven by deep Q network | |
CN113887786A (en) | PSO-LSTM-based primary frequency modulation capability evaluation and prediction system | |
CN105487496A (en) | Optimization method for heat-engine plant thermal on-line process identification and control algorithm based on dual-objective parallel ISLAND-HFC mixed model genetic programming algorithm | |
CN106462117A (en) | Controlling a target system | |
CN105574586A (en) | General airplane air-material demand prediction method based on MPSO-BP network | |
CN116300755A (en) | Double-layer optimal scheduling method and device for heat storage-containing heating system based on MPC | |
CN116300401A (en) | Temperature control method for optimizing fuzzy PID (proportion integration differentiation) based on genetic algorithm | |
CN112836885A (en) | Combined load prediction method, combined load prediction device, electronic equipment and storage medium | |
CN103106331A (en) | Photo-etching line width intelligence forecasting method based on dimension-reduction and quantity-increment-type extreme learning machine | |
CN115912367A (en) | Intelligent generation method for operation mode of power system based on deep reinforcement learning | |
CN109212999B (en) | Intelligent generation method and system for digital satellite simulation working condition | |
CN105676637A (en) | Predictive functional control-based molecular weight output PDF control method | |
CN114330119A (en) | Deep learning-based pumped storage unit adjusting system identification method | |
CN118276433B (en) | Medicament flow optimization control method for dispensing machine | |
CN106502093A (en) | Water island dosing On-Line Control Method and device based on GA SVR | |
CN109583560B (en) | Construction method and device of fertilizer discharge amount prediction model of double-variable fertilizer application device | |
CN104537224B (en) | Multi-state System Reliability analysis method and system based on adaptive learning algorithm | |
CN116384251A (en) | New energy generated power combination prediction method and system considering risk avoidance | |
CN116341753A (en) | Method for predicting regional carbon dioxide emission by using machine learning | |
CN109993271A (en) | Grey neural network forecasting based on theory of games |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |