Why does TCP lag on bigger files?

2 views (last 30 days)
Charlie Martin
Charlie Martin on 8 Aug 2021
Answered: Pratyush on 17 Apr 2024 at 5:14
Hello,
I have created an islanded microgrid powered by a PV inverter. I have tried to communicate information over TCP/IP but I have noticed a large lag between the original data and the communicated data. Would anyone happen to know why this is? I have attached said file, on it you will see a subsystem titled TCP/IP Communications where I am trying to transmit information about a battery State of Charge over TCP/IP. I have also attached a support file which has the script needed for this Simulink file.
If I use a basic system (also attached) there is no lag in transmitting a signal.
I assume that the large file size of the islanded microgrid requires more computation and that this is what causes the lag in the transmitted TCP message. Has anyone had similar experiences or can point me in the right direction.
Thank you in advance for any assistance!

Answers (1)

Pratyush
Pratyush on 17 Apr 2024 at 5:14
Hi Charlie,
To address the lag in TCP/IP communication within your complex MATLAB/Simulink islanded microgrid model, consider the following points:
  1. Simplify the model or divide it into smaller subsystems for more efficient computation.
  2. Optimize TCP settings or switch to UDP for less overhead if data loss is tolerable.
  3. Streamline data serialization/deserialization to reduce latency.
  4. Check and optimize your network setup to eliminate external delays.
  5. Use real-time execution tools like Simulink Real-Time to synchronize model execution with external systems.
  6. Ensure your computational hardware is capable of handling the model's demands, upgrading if necessary.
Debugging Steps:
  • Profile your model to find computational bottlenecks.
  • Use network tools to monitor and analyze TCP/IP communications.
  • Incrementally add complexity to the model, monitoring the impact on communication latency.
Improving communication latency involves a mix of model optimization, communication protocol adjustment, and ensuring adequate hardware and network conditions.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!