Skip to content

renxinxing123/SimulinkUnderstandingAgent

Repository files navigation

Text2Simulink

Text2Simulink is a multi-agent Simulink simulation generation system built on the Coral Protocol. It enables users to generate custom Simulink models by describing their requirements in natural language. The system leverages three collaborative agents—an InterfaceAgent, a ResearchSimulinkAgent, and a BuildSimulinkAgent—to search for relevant reference models and automatically construct new Simulink simulations that meet the user’s needs.


System Architecture

  • InterfaceAgent Interacts directly with the user. Receives natural language requests describing the desired Simulink simulation and communicates with the other agents to fulfill the task.

  • ResearchSimulinkAgent Searches a database of existing Simulink models to find similar or relevant reference examples based on the user's requirements.

  • BuildSimulinkAgent Builds the Simulink model by combining the user's instructions and reference cases identified by the ResearchSimulinkAgent. Uses MATLAB and Simulink automation to generate executable models.

All agent communication is coordinated via the Coral Protocol, allowing for distributed and modular agent collaboration.


Dependencies

  • Coral Protocol Server

  • Python 3.10+

  • MATLAB R2024b (with matlab.engine for Python)

  • Python packages:

    pip install langchain-mcp-adapters==0.0.10 langchain-openai worldnewsapi langchain langchain-core langchain_community

Installation

  1. Clone and Start Coral Server

    git clone https://github.com/Coral-Protocol/coral-server.git
    cd coral-server
    ./gradlew run
  2. Prepare Python Environment

    • Install dependencies as listed above.
  3. MATLAB Setup

    • Ensure MATLAB R2024b is installed and matlab.engine for Python is configured.
    • See MathWorks documentation if you need help with setup.

Running the System

Open four terminal windows:

  1. Terminal 1: Start the Coral Server

    cd coral-server
    ./gradlew run
  2. Terminal 2: Start InterfaceAgent

    python 0-langchain-interface.py
  3. Terminal 3: Start ResearchSimulinkAgent

    python 1-langchain-ResearchSimulinkAgent.py
  4. Terminal 4: Start BuildSimulinkAgent

    python 2-langchain-BuildSimulinkAgent.py

Make sure all terminals are in the correct environment and have access to required dependencies.


Example Usage

After all agents are running, interact with the InterfaceAgent. For example, you can request:

Please help me generate a simulink simulation with 2 bouncing balls, each should be placed with different height, and please record the height and speed of these two balls in a same scope.

The system will automatically:

  1. Interpret your request.
  2. Retrieve similar reference models.
  3. Build a new Simulink simulation combining your requirements and references.
  4. Output a ready-to-run Simulink model that meets your needs.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors