Closed-Loop Automation Optimization System and Method for Control Systems Based on Large Language Model Intelligent Agents
By using a closed-loop automated optimization system based on a large language model intelligent agent, the problem of traditional control system design relying on human experience and general AI open-loop mode is solved, and efficient and accurate control system optimization is achieved. It is applicable to PID controllers and multi-loop control systems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- FUDAN UNIVERSITY
- Filing Date
- 2025-12-25
- Publication Date
- 2026-05-26
AI Technical Summary
Traditional control system design relies on human experience, which is inefficient. The general AI open-loop model is prone to illusions. Existing automation tools lack flexibility and accuracy in indicator calculation, resulting in inefficient and inconsistent optimization of control systems.
A closed-loop automated optimization system based on a large language model intelligent agent is adopted. Through self-perception, intelligent diagnosis and precise execution, the system can automatically tune control parameters and optimize topology. Combined with physical loop break analysis, the system ensures the accuracy of indicators, has self-correction capabilities, and avoids illusion problems.
It achieves full-process automation and intelligence in control system design, improves efficiency and robustness, ensures the accuracy and consistency of indicators, and supports the parallel optimization of hundreds or thousands of control models.
Smart Images

Figure CN122085653A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the interdisciplinary field of AI for Engineering (AI4E) and automatic control technology. Specifically, it relates to a closed-loop automation optimization system and method for control systems based on Large Language Model (LLM) intelligent agents. Background Technology
[0002] In key areas such as industrial automation, aerospace attitude control, and robot motion control, the dynamic performance (e.g., overshoot, response speed) and stability (e.g., phase margin, gain margin) of the control system directly determine the core performance of the product. Among these, the PID controller, as the most widely used control strategy, has its parameter tuning and system topology optimization being core aspects of control engineering design.
[0003] Traditional technical solutions have the following significant drawbacks:
[0004] 1) Reliance on manual experience, resulting in low efficiency: Traditional parameter tuning mainly relies on senior engineers with more than 10 years of industry experience to achieve it through a cycle of "observing waveforms - manual adjustment - simulation verification". A single optimization may take several hours to several days and is difficult to deal with multivariable and nonlinear systems. At the same time, the implicit experience of engineers is difficult to standardize and pass on, resulting in poor consistency of system performance designed by different personnel.
[0005] 2) Open-loop limitations of general AI: Current applications of generative AI in the engineering field are mostly in an open-loop mode (user asks questions → AI generates code → user verifies → human feedback and modification), which has two major pain points: First, AI lacks awareness of the physical simulation environment and is prone to generating "illusory code" containing non-existent ports and invalid function calls; second, humans must intervene to act as "compilers" and "running environments", which cannot achieve full-process automation and seriously restricts R&D efficiency.
[0006] 3) Existing automation tools lack flexibility: Some simulation software's built-in automatic parameter tuning tools (such as MATLAB's PID Autotuner) are based only on fixed mathematical algorithms (such as the Ziegler-Nichols method), lacking "intuitive" judgment on complex engineering constraints. They cannot flexibly adjust control strategies like human experts (such as actively adding lead compensators, notch filters, and other topology changes based on system characteristics), thus limiting their applicability to various scenarios.
[0007] 4) Insufficient accuracy in index calculation: Traditional open-loop frequency domain index (such as phase margin) calculations often rely on mathematical estimation or simplified models, without considering the nonlinear elements and interface characteristics in the actual simulation model. This leads to deviations between the calculation results and the real system, affecting the effectiveness of optimization decisions.
[0008] Therefore, there is an urgent need for an automated optimization system that can integrate the logical reasoning capabilities of AI with the physical modeling capabilities of simulation software, and possess closed-loop feedback, architecture awareness, and anti-illusion characteristics, so as to achieve standardization, efficiency, and intelligence in control engineering design. Summary of the Invention
[0009] To address the shortcomings of existing technologies, this invention aims to provide a closed-loop automated optimization system and method for control systems based on a large language model intelligent agent. By constructing a vertically-domain autonomous agent with capabilities of "self-perception, intelligent diagnosis, precise execution, and continuous feedback," it solves technical problems such as reliance on manual intervention in traditional methods, inefficiency of open-loop general AI, and insufficient flexibility of existing tools. It upgrades AI from an auxiliary advisor to an autonomous executor with self-correction capabilities, significantly improving the efficiency, robustness, and interpretability of control system design, and achieving automation and intelligence throughout the entire control system optimization process. This invention integrates the logical reasoning capabilities of a large language model with the precise computational capabilities of numerical simulation software, enabling automated tuning of control system parameters, topology optimization, and performance verification throughout the entire process. It is suitable for the design and optimization of complex engineering systems such as PID (proportional-integral-derivative) controllers and multi-loop control systems.
[0010] The core technologies of this invention include: a model parsing mechanism with architecture awareness, which traverses the simulation model through an automated script interface, extracts the model topology and parameter configuration, and converts them into JSON structured data containing module port connection information and parameter definitions, thereby endowing the agent with accurate perception of the simulation environment and preventing read-write illusions; and a "physical loop break analysis" method based on dynamic reconstruction of the simulation topology, which ensures the authenticity of key frequency domain indicators such as phase margin while maintaining the integrity of the model. The technical solution of this invention is described in detail below.
[0011] This invention provides a closed-loop automated optimization system for control systems based on large language model intelligent agents. This system achieves fully automated parameter tuning and topology optimization of the control system through closed-loop iteration until preset performance indicators are met. It includes an intelligent agent orchestration module, an interface service module, and a physical simulation engine. The intelligent agent orchestration module is responsible for maintaining the optimization workflow, managing context memory, and executing logical judgments. The interface service module acts as a communication bridge between the intelligent agent and the physical simulation engine, providing model parsing, backup, performance analysis, and instruction execution services. The physical simulation engine is responsible for running high-fidelity numerical simulations, linearization analysis, transfer function extraction, and data visualization of the control system, providing objective and accurate physical truths for the optimization process. Wherein:
[0012] The intelligent agent orchestration module includes a two-layer large language model consisting of a control expert model and an implementation engineer model, as well as auxiliary components. The control expert model, based on connectionism, performs system stability diagnosis and dynamic performance analysis on the received multimodal performance data according to a professional knowledge base of control theory, and outputs optimization strategies. The implementation engineer model, based on model topology information, transforms the strategies into executable instructions and has architecture awareness capabilities that dynamically adapt to the parameter storage location. The auxiliary components include a workflow controller, which is responsible for controlling the entire process progress of "initialization-optimization loop-termination".
[0013] In this invention, the preset performance indicators specifically include:
[0014] 1) Time-domain indicators: including overshoot ( ), Adjustment time ( 2% error band) and steady-state error ( ), used to evaluate the dynamic response quality of the system;
[0015] 2) Frequency domain metrics: Phase margin (PM) and gain margin (GM) obtained through physical loop breakage analysis serve as hard constraints for evaluating the robustness and stability of the system.
[0016] 3) Optimize efficiency metrics: Verify the engineering applicability of the automation method by recording the number of iterations and total time required for the system to converge from the initial state to meet all design metrics.
[0017] In this invention, the control theory knowledge base of the control expert model includes knowledge in the fields of lead compensation, notch filtering, and PID parameter tuning; the multimodal inputs include time-domain waveforms, frequency-domain Bode plots, and quantization performance indicators. The time-domain features include step response curves and various time-domain indicators reflecting dynamic response characteristics, while the frequency-domain features include open-loop Bode plots, closed-loop Bode plots, and phase margin (PM) and gain margin (GM) extracted through physical loop-breaking analysis. These multimodal information elements collectively constitute the complete state space for the agent's decision-making; system stability diagnosis includes insufficient phase margin and inadequate damping; dynamic performance analysis includes excessive overshoot and slow response; optimization strategies include reducing proportional gain, adding a lead compensator, increasing differential gain, and adding a notch filter.
[0018] In this invention, an implementation engineer model, based on symbolic thinking, is proficient in the API operation and modeling rules of the physical simulation engine. It is responsible for receiving the optimization strategy and model topology information from the control expert model, generating directly executable simulation software operation code, and possessing "architecture awareness" capabilities, which can dynamically adapt to the parameter storage location. The simulation software operation code includes generating and modifying parameters, adding modules, and deleting connections.
[0019] In this invention, the control expert model uses a multimodal large model that supports visual-language cross-modal understanding as its base, and the implementation engineer model uses a dedicated code large model that has been specially trained on a massive code corpus as its base.
[0020] In this invention, the auxiliary components also include a history compression module, which compresses the "action-result" of each iteration into structured text to avoid context explosion.
[0021] In this invention, the model parsing service in the interface service module identifies module types, parameter storage methods, and port connection relationships by traversing the simulation model, and generates a topology and parameter table to avoid the "illusion" problem in the execution instructions; the simulation model includes a top-level simulation model module, an intelligent transfer function identification module, a PID controller module, and an external constant module.
[0022] In this invention, the performance analysis service in the interface service module includes time-domain analysis, physical loop-breaking frequency-domain analysis, and data visualization. It adopts physical loop-breaking analysis technology, temporarily deletes feedback connections in the simulation engine, linearizes and extracts the real open-loop transfer function and calculates the stability margin, and automatically restores the connections after analysis to ensure the accuracy of indicator calculation. Data visualization generates step response diagrams, open-loop Bode diagrams, and closed-loop Bode diagrams, and sets the plotting parameter Interpreter='none' to avoid character garbled characters, outputting image URLs for the intelligent agent to read.
[0023] In this invention, the instruction execution service in the interface service module receives the code generated by the implementation engineer model, executes enhanced logic including injecting dummy signals, preventing repeated simulations, and saving conditions, and then calls the physical simulation engine to run.
[0024] This invention also provides a closed-loop automated optimization method for the above-mentioned system, which achieves full automation of control system parameter tuning and topology optimization through a closed-loop iterative process until preset performance indicators are met; the closed-loop iterative process specifically includes:
[0025] Step 1: Initialization
[0026] First, input the target simulation model name and preset performance indicators. Then, back up the target model, parse the model, and finally execute the initial simulation to obtain the current time-domain and frequency-domain performance indicators and visualization charts of the system as optimization benchmarks.
[0027] Step 2: Optimize the loop phase
[0028] (1) Diagnostic decision: The control expert model receives the baseline analysis results or the results of the previous iteration, performs dual-domain diagnosis, and generates optimization strategies;
[0029] (2) Execution of modifications: The implementation engineer model receives the optimization strategy of the control expert model, generates directly executable simulation software operation code, executes the instructions and saves the model;
[0030] (3) Feedback analysis: Obtain the performance indicators and charts of the modified system; compress the "actions" and "results" of this iteration into structured text through the history compression module and update it to the context memory; based on the new performance data, return to step (1) and start the next round of diagnosis and optimization until the preset performance indicators are met.
[0031] In this invention, the method for generating directly executable simulation software operation code in step (2) is as follows:
[0032] If the parameter is stored in an external "pid_params" constant module, generate code to modify the Value attribute of that module;
[0033] If the parameters are stored inside the PID module, generate code to modify the P, I, and D parameters of the module;
[0034] If the strategy involves topology changes, generate code to add modules and connect ports.
[0035] Compared with the prior art, the present invention has the following significant advantages:
[0036] (1) Paradigm Breakthrough: Achieving Evolution from Open Loop to Closed Loop: By introducing a closed loop feedback mechanism, the system has the ability to self-correct and result-oriented, without the need for human intervention to act as a "compiler" or "verifier". The large language model is upgraded from "advisor" to "executor", which completely solves the pain points of low efficiency and easy illusion in the open loop mode of general AI, and eliminates the "steady-state error" of the model.
[0037] (2) Architectural innovation: Engineering implementation of neurosymbolic AI: It integrates connectionism (fuzzy reasoning and creative strategies of LLM) and symbolism (precise calculation and physical truth of simulation software), which not only gives full play to the advantages of large language models in qualitative analysis and empirical decision-making, but also makes up for the lack of quantitative calculation capabilities by using simulation software, thus achieving the synergistic optimization of "creative thinking + objective verification".
[0038] (3) Anti-illusion and architecture awareness: Through deep model analysis ( / inspect_model API), the agent obtains model topology and parameter distribution information in advance, ensuring that the generated code accurately matches the actual model structure, thus avoiding the illusion problem of "fabricating ports and fictitious modules" in traditional AI code generation from the root, and improving the robustness of the system.
[0039] (4) Precise indicators: Physical loop break analysis technology: Compared with traditional mathematical estimation methods, by actually breaking the feedback loop in the simulation environment to perform linearization analysis, the absolute accuracy of key indicators such as open-loop transfer function and phase margin is ensured, providing a reliable basis for optimization decision-making and avoiding optimization failure due to indicator deviation.
[0040] (5) High scalability and standardization: The modular architecture design decouples the decision logic (LLM1), execution logic (LLM2) of the intelligent agent from the simulation environment (physical simulation engine). If the simulation tool needs to be changed (such as replacing MATLAB / Simulink with Python Control library), only the interface service module and the code generation logic of LLM2 need to be modified, without adjusting the decision rules of the control expert model. At the same time, the standardized output indicators and optimization process ensure consistent design quality in different scenarios.
[0041] (6) Significant commercial and industrial value: The implicit experience of senior engineers (adjusting parameters by looking at waveforms) is solidified into a reusable model strategy, realizing the assetization of knowledge; the system can run 24 / 7 without interruption, supporting the parallel optimization of hundreds or thousands of control models, greatly improving R&D efficiency; the standardized analysis process avoids human calculation bias and provides reliable control solutions for industrial production. Attached Figure Description
[0042] To more clearly illustrate the technical solution of the present invention, the following is a description of the accompanying drawings:
[0043] Figure 1: System architecture diagram of closed-loop automated optimization of control system based on large language model intelligent agent.
[0044] Figure 2: Closed-loop automated optimization workflow flowchart. Detailed Implementation
[0045] This invention provides a closed-loop automated optimization method for control systems based on large language model intelligent agents. It aims to address the problems of traditional control parameter tuning heavily relying on human experience, and the tendency for general-purpose large models to produce illusions in engineering applications due to the lack of physical verification mechanisms. This invention innovatively constructs a deeply coupled architecture of semantic reasoning from a large language model and precise numerical simulation calculation: it utilizes the high-level logical analysis capabilities of the large language model as the decision-making core to formulate control strategies, and drives a simulation engine through standardized interfaces for deterministic execution and physical verification. Its core architecture includes an intelligent agent orchestration module, an interface service module, and a physical simulation engine. The specific technical solution is as follows:
[0046] (1) Intelligent agent orchestration module (brain): As the core of the system's decision-making and control, it is responsible for maintaining and optimizing workflows, managing contextual memory, and executing logical judgments. It adopts a two-layer large language model architecture.
[0047] A. Control Expert Model (LLM1): Based on a large multimodal model that supports cross-modal visual-linguistic understanding, and using deep semantic reasoning and thought chain technology, it possesses a professional knowledge base of control theory (including knowledge in areas such as lead compensation, notch filtering, and PID parameter tuning). It is responsible for receiving multimodal inputs (time-domain waveforms, frequency-domain Bode plots, and quantization performance indicators), performing system stability diagnosis (such as insufficient phase margin and inadequate damping) and dynamic performance analysis (such as excessive overshoot and slow response), and outputting targeted optimization strategies (such as "reducing the proportional gain P to 0.5" and "adding a first-order lead compensator").
[0048] B. Implementation Engineer Model (LLM2): This model uses a dedicated large-scale code model trained on a massive code corpus as its foundation. It is proficient in the API operation and modeling rules of the physical simulation engine, and is responsible for receiving optimization strategies and model topology information from the control expert model. It generates directly executable simulation software operation code (such as modifying parameters, adding modules, and deleting connections). It also has "architecture awareness" capabilities and can dynamically adapt to the parameter storage location (internal / external constants of modules).
[0049] C. Auxiliary components: These include workflow controllers (such as Coze Workflow) and history compression modules. The workflow controller is responsible for controlling the entire process progress of "initialization-optimization loop-termination". The history compression module compresses the "action-result" of each iteration into structured text to avoid context explosion.
[0050] (2) Interface Service Module (Hands and Feet): Running on a local or cloud server, built using Python FastAPI, it serves as a communication bridge between the intelligent agent orchestration module and the physics simulation engine, providing four core atomic API services to achieve standardized and robust control of the simulation engine:
[0051] A. Model parsing service ( / inspect_model): Traverses the top-level modules of the simulation model, intelligently identifies the transfer function module (extracting numerator / denominator coefficients), PID controller module, and external constant module (specifically the Constant module named "pid_params"). It accurately parses the module port connection relationships through the PortHandles attribute, and generates output results containing "topology text" and "structured parameter table", providing an "environment map" for the implementation engineer model.
[0052] B. Model Backup Service ( / backup_model): Before the optimization cycle starts, the target simulation model file (.slx format) is automatically copied as a backup file (xxx_backup.slx) to ensure that the optimization can be rolled back to the initial state if it fails. Each iteration is based on a modified version of the original model to ensure the repeatability of the optimization process.
[0053] C. Full-Dimensional Analysis Service ( / run_simulink_analysis): Executes simulations and generates multi-dimensional performance evaluation reports, with core components including time-domain analysis, physical loop break frequency-domain analysis, and data visualization.
[0054] a) Time domain analysis: Inject a step input signal and run a simulation to calculate indicators such as overshoot, rise time, settling time, and steady-state error;
[0055] b) Physical loop break frequency domain analysis: The feedback connection of the control loop is temporarily deleted by an automated script, and a linearization tool (such as linmod) is called to extract the true open-loop transfer function L(s), calculate the phase margin (PM) and gain margin (GM), and then automatically restore the feedback connection; at the same time, the closed-loop transfer function T(s) is extracted and the bandwidth and resonance peak are calculated.
[0056] c) Data visualization: Generate step response plots, open-loop Bode plots, and closed-loop Bode plots. Set the plotting parameter Interpreter='none' to avoid garbled characters and output the image URLs for the agent to read.
[0057] D. Code Execution Service ( / execute_matlab_code): Receives the code generated by the implementation engineer's model, executes the following enhanced logic, and then calls the simulation engine to run it:
[0058] a) Injecting dummy signals: Automatically supplementing the input variables required for simulation to prevent errors caused by missing dependent variables;
[0059] b) Prevent duplicate simulation: Detect whether the code already contains a sim() function call to avoid double calculation;
[0060] c) Conditional saving: When the parameter save_changes=true, the modified model is automatically overwritten and saved, supporting continuous iteration.
[0061] (3) Physical simulation engine: Using numerical simulation software such as MATLAB / Simulink, it is responsible for high-fidelity numerical simulation, linearization analysis, transfer function extraction and data visualization of the control system, providing objective and accurate physical truth for the optimization process, and is the "physical environment" of the system.
[0062] The closed-loop automated optimization process of this invention is divided into an initialization phase and an optimization loop phase, and the specific steps are as follows:
[0063] (1) Initialization phase
[0064] a. Input parameters: Users input the target simulation model name (e.g., my_control_sys.slx) and preset performance indicators (e.g., overshoot < 5%, phase margin ≥ 45°, rise time s) through the interactive interface;
[0065] b. Model backup: The agent orchestration module calls the / backup_model API of the interface service module to back up the target model and ensure that the initial state is traceable;
[0066] c. Model parsing: Call the / inspect_model API to obtain the model topology text and structured parameter table, and clarify the parameter storage location (internal / external constants of the module) and port connection relationships;
[0067] d. Baseline analysis: Call the / run_simulink_analysis API to perform the initial simulation and obtain the current time-domain and frequency-domain performance indicators and visualization charts of the system as an optimization benchmark.
[0068] (2) Optimization loop phase
[0069] Step 1: Multimodal Diagnostics (LLM1 Execution): The control expert model receives baseline analysis results (or results from the previous iteration), including quantitative indicators (overshoot, phase margin PM / gain margin GM, etc.), three visualization charts (step response plot, open-loop Bode plot, closed-loop Bode plot), and historical iteration records, and performs dual-domain diagnostics:
[0070] a. If the open-loop phase margin is PM, the system stability is deemed insufficient, and the strategy of "reducing the proportional gain" or "adding a lead compensator" is output.
[0071] b. If the closed-loop resonant peak is too high, it is determined that the damping is insufficient, and the strategy of "increasing the differential gain D" or "adding a notch filter" is output.
[0072] c. If parameters need to be input through the Demux module, force the output vector format [P, I, D] to ensure parameter compatibility;
[0073] d. Output results: Includes optimization strategies and a flag indicating whether the performance metric (is_satisfied) is met.
[0074] Step 2: Termination Check: The workflow controller checks the is_satisfied flag. If it is true, the loop terminates and the final optimization report (including optimal parameters, performance index comparison, and iteration history) is output. If it is false, proceed to the next step.
[0075] Step 3: Code Generation (LLM2 Execution): The implementation engineer model receives the optimization strategy from the control expert model and the topology information returned by the / inspect_model API, and generates targeted operation code.
[0076] a. If the parameter is stored in an external "pid_params" constant module, generate code to modify the Value attribute of that module (e.g., set_param('pid_params','Value','[0.5,0.1,0.05]')).
[0077] b. If the parameters are stored inside the PID module, generate code to modify the module's P, I, and D parameters (e.g., set_param('my_control_sys / PID Controller','P','0.5','I','0.1','D','0.05')).
[0078] c. If the strategy involves topology changes (such as adding a lead compensator), generate code to add modules and connect ports (e.g., add_block ('simulink / Continuous / Transfer Fcn','my_control_sys / LeadCompensator','Num','[1 2]','Den','[1 0.5]'));
[0079] d. Code constraints: It is strictly forbidden to reference non-existent module names or port numbers to avoid phantom code.
[0080] Step 4: Code Execution and Model Update: The agent orchestration module calls / execute_matlab_codeAPI to execute the code generated by LLM2, and sets save_changes=true to automatically overwrite and save the model.
[0081] Step 5: Iterative Analysis and History Record: Call the / run_simulink_analysis API to obtain the performance metrics and charts of the modified system; use the history record compression module to compress the "actions" (such as "modify pid_params to [0.5,0.1,0.05]") and "results" (such as "overshoot 30%→8%, PM20°→42°") of this iteration into structured text and update it to the context memory.
[0082] Step 6: Iteration: Return to Step 1 and start the next round of diagnosis and optimization based on the new performance data until the preset performance indicators are met.
[0083] The present invention will be further illustrated by the following examples:
[0084] 1. Implementation Scenario Description
[0085] This embodiment takes the "industrial robotic arm position control system" as the optimization object, and the target simulation model is robot_arm_position.slx built with MATLAB / Simulink. The preset performance indicators are: overshoot ≤5%, phase margin ≥45°, and rise time ≤0.3s.
[0086] 2. Core Implementation Process
[0087] Environmental preparation
[0088] Deploy the interface service module: Start the Python FastAPI service on the local server and ensure that it establishes a communication connection with MATLAB / Simulink;
[0089] Configure the intelligent agent orchestration module: Create a workflow on the Coze platform, associate the control expert model (LLM1) and the implementation engineer model (LLM2), and set context memory and iteration termination rules.
[0090] Initialization phase execution
[0091] User input: Enter the model name robot_arm_position and the above performance metrics through the Coze interactive interface;
[0092] Model backup: The agent automatically calls the / backup_model service to back up the original model as robot_arm_position_backup.slx;
[0093] Model analysis: The ` / inspect_model` service is called to obtain the model topology (including the PID controller module, the `pid_params` external constant module, and the controlled object transfer function module) and parameter table (initial PID parameters: P=1.2, I=0.1, D=0.05); Baseline analysis: The ` / run_simulink_analysis` service is called to obtain the initial performance data: overshoot 28.5%, phase margin 22°, rise time 0.82s, generating a step response plot and an open-loop Bode plot, confirming that the initial state does not meet the target performance.
[0094] Optimize the execution of the loop phase
[0095] Round 1 iteration:
[0096] Diagnosis (LLM1): Receives baseline data and graphs, diagnoses "Insufficient phase margin (22° < 45°), weak system stability; excessive overshoot (28.5% > 5%), insufficient damping", outputs the strategy "Reduce proportional gain P to 0.6, keep I=0.1, D=0.05, improve stability and damping", and marks is_satisfied=false; Code Generation (LLM2): Based on the model analysis results (parameters are stored in the pid_params external constant module), generates execution instructions to modify the parameters of this module to [0.6, 0.1, 0.05].
[0097] Execution and Feedback: The interface service module executes the above instructions, overwrites and saves the model, and then calls / run_simulink_analysis to obtain new metrics: overshoot 16.2%, phase margin 35°, rise time 0.51s; the history module compresses the information of this round to "[Round 1] Action: Modify pid_params to [0.6,0.1,0.05]; Result: Overshoot 28.5%→16.2%, PM22°→35°".
[0098] Second iteration:
[0099] Diagnosis (LLM1): Combining the new index with historical records, the diagnosis is "the phase margin is still not satisfied (35°), and stability needs to be further improved". The output strategy is "add a first-order lead corrector (transfer function Num=[1 3], Den=[1 0.5]) and fine-tune P to 0.5".
[0100] Code generation (LLM2): Generates the execution instructions for "adding a lead compensation module and connecting it to the PID output, and modifying pid_params to [0.5,0.1,0.05]";
[0101] Execution and Feedback: After executing the command, the new indicators are: overshoot 7.3%, phase margin 42°, rise time 0.38s, and historical records are updated.
[0102] Third iteration:
[0103] Diagnosis (LLM1): Diagnosis "Overshoot is close to the target (7.3%→5%), phase margin is close to the target (42°→45°)", output strategy "Increase differential gain D to 0.08, improve damping";
[0104] Code generation (LLM2): Generates the execution instruction to "modify pid_params to [0.5,0.1,0.08]";
[0105] Execution and Feedback: The new metrics are: overshoot 4.1%, phase margin 48°, and rise time 0.27s. All metrics meet the preset requirements, and LLM1 is marked as is_satisfied=true.
[0106] Termination and Output
[0107] The workflow controller detects that is_satisfied=true and terminates the optimization loop;
[0108] Output the final report, which includes the optimal PID parameters [0.5, 0.1, 0.08], the lead corrector parameters, a comparison table of iteration metrics, and the final step response plot and Bode plot.
[0109] 3. Implementation effect verification
[0110] Automation level: No human intervention throughout the entire process; optimization was completed in 3 iterations (total time approximately 8 minutes), which is 30 times more efficient than traditional manual parameter tuning (approximately 4 hours).
[0111] Indicator accuracy: The phase margin obtained from physical loop breakage analysis has an error of ≤1.5% compared with manual measurement, with no indicator deviation;
[0112] Robustness: No phantom code appeared, the model backup function ensures that the optimization process can be rolled back, and the iteration history is clear and traceable.
Claims
1. A closed-loop automated optimization system for a control system based on a large language model intelligent agent, characterized in that, This system achieves full automation of control system parameter tuning and topology optimization through closed-loop iteration until the preset performance indicators are met; it includes an intelligent agent orchestration module, an interface service module, and a physical simulation engine. The intelligent agent orchestration module is responsible for maintaining and optimizing workflows, managing context memory, and executing logical judgments. The interface service module acts as a communication bridge between the intelligent agent and the physics simulation engine, providing model parsing, backup, performance analysis, and instruction execution services. The physics simulation engine is responsible for high-fidelity numerical simulation, linearization analysis, transfer function extraction, and data visualization of the control system, providing physical truths for the optimization process. Among these: The intelligent agent orchestration module includes a two-layer large language model consisting of a control expert model and an implementation engineer model, as well as auxiliary components; the control expert model, based on connectionism, performs system stability diagnosis and dynamic performance analysis on the received multimodal performance data according to the professional knowledge base of control theory, and outputs optimization strategies; The implementation engineer model, based on the model topology information, transforms strategies into executable instructions and has architecture awareness capabilities that dynamically adapt to the parameter storage location; the auxiliary components include a workflow controller, which is responsible for controlling the entire process progress of "initialization-optimization loop-termination".
2. The closed-loop automation optimization system for the control system according to claim 1, characterized in that, The control expert model and control theory knowledge base include knowledge in the fields of lead compensation, notch filtering, and PID parameter tuning; multimodal inputs include time-domain waveforms, frequency-domain Bode plots, and quantization performance indicators; system stability diagnosis includes insufficient phase margin and inadequate damping; dynamic performance analysis includes excessive overshoot and slow response; optimization strategies include reducing proportional gain, adding a lead compensator, increasing derivative gain, and adding a notch filter.
3. The closed-loop automation optimization system for the control system according to claim 1, characterized in that, The implementation engineer model, based on symbolic thinking, is proficient in the API operation and modeling rules of the physical simulation engine. It is responsible for receiving the optimization strategy and model topology information from the control expert model, generating directly executable simulation software operation code, and possessing "architecture awareness" capabilities, which can dynamically adapt to the parameter storage location. The simulation software operation code includes generating and modifying parameters, adding modules, and deleting connections.
4. The closed-loop automation optimization system for the control system according to claim 1, characterized in that, The control expert model uses a multimodal large model that supports cross-modal understanding of vision and language as its base, while the implementation engineer model uses a dedicated large code model that has been specially trained on a massive code corpus as its base.
5. The closed-loop automation optimization system for the control system according to claim 1, characterized in that, The auxiliary components also include a history compression module, which compresses the "action-result" of each iteration into structured text to avoid context explosion.
6. The closed-loop automation optimization system for the control system according to claim 1, characterized in that, In the interface service module, the model parsing service traverses the simulation model, identifies the module type, parameter storage method, and port connection relationship, and generates the topology and parameter table to avoid the "illusion" problem in the execution instructions; the simulation model includes the top-level module of the simulation model, the intelligent identification transfer function module, the PID controller module, and the external constant module.
7. The closed-loop automation optimization system for the control system according to claim 1, characterized in that, In the interface service module, the performance analysis service includes time-domain analysis, physical loop break frequency-domain analysis, and data visualization. It adopts physical loop break analysis technology, temporarily deletes feedback connections in the simulation engine, linearizes and extracts the real open-loop transfer function and calculates the stability margin, and automatically restores the connections after analysis to ensure the accuracy of indicator calculation. Data visualization generates step response diagrams, open-loop Bode diagrams, and closed-loop Bode diagrams, and sets the plotting parameter Interpreter='none' to avoid character garbled characters, outputting image URLs for the agent to read.
8. The closed-loop automation optimization method for control systems according to claim 1, characterized in that, In the interface service module, the instruction execution service receives the code generated by the implementation engineer's model, executes enhanced logic including injecting dummy signals, preventing repeated simulations, and saving conditions, and then calls the physical simulation engine to run.
9. A closed-loop automated optimization method based on the system according to any one of claims 1-8, characterized in that, It achieves full automation of control system parameter tuning and topology optimization through a closed-loop iterative process until the preset performance indicators are met; the closed-loop iterative process specifically includes: Step 1: Initialization First, input the target simulation model name and preset performance indicators. Then, back up the target model, parse the model, and finally execute the initial simulation to obtain the current time-domain and frequency-domain performance indicators and visualization charts of the system as optimization benchmarks. Step 2: Optimize the loop phase (1) Diagnostic decision: The control expert model receives the baseline analysis results or the results of the previous iteration, performs dual-domain diagnosis, and generates optimization strategies; (2) Execution of modifications: The implementation engineer model receives the optimization strategy of the control expert model, generates directly executable simulation software operation code, executes the instructions and saves the model; (3) Feedback analysis: Obtain the performance indicators and charts of the modified system; compress the "actions" and "results" of this iteration into structured text through the history compression module and update it to the context memory; based on the new performance data, return to step (1) and start the next round of diagnosis and optimization until the preset performance indicators are met.
10. The closed-loop automated optimization method according to claim 9, characterized in that, In step (2), the method for generating directly executable simulation software operation code is as follows: If the parameter is stored in an external "pid_params" constant module, generate code to modify the Value attribute of that module; If the parameters are stored inside the PID module, generate code to modify the P, I, and D parameters of the module; If the strategy involves topology changes, generate code to add modules and connect ports.