Water Tank PLC Control Simulation with Matlab Simulink


To play this simulation you need to have this item:

  1. Unity PRO S (minimum) / Unity Pro L /Unity Pro XL. Version 5 / 6 / 7 / 8 (I’m not provide the installer, you can find on another forum 1.5 Gb)
  2. Matlab 2012 / Matlab 2013 with simulink (I’m not provide the installer, you can find on another forum 6.5Gb)
  3. Modbus Ehternet OPC Server (Iconics) http://adf.ly/lA1Gt this is free OPC server, you don’t need to license the software
  4. Simulink Model, OPC Configuration(should be load from iconics modbus OPC Server) http://adf.ly/lA205


Water Tank with Valve, Simulink Model


To see how it works, you should see the video above.

OPC Configuration block setting (simulink)

OPC Read /Write Block Setting:


Below are the ladder diagram for logic control to controling level on water tank.

I set Valve will close when Level reach high limit 14 meters.

and Valve will open when level reach low limit 5 meters.

Ladder Diagram

simply ladder diagram using SET and RESET (Latching – Unlatching) block


Modbus Ethernet OPC Configuration


[spoiler effect=”simple” show=”next installation”]


after installing you need to configure it or just load configuration from download file.

Configure OPC:

[spoiler effect=”simple” show=”Congure OPC Server”]


17 thoughts on “Water Tank PLC Control Simulation with Matlab Simulink”

  1. Mas, di beberapa catatan ada fasilitas download as PDF. Bagusan dikasih semuanya mas, biar tutorialnya di coba setiap saat. Kita susah internet disini

  2. can you provide some information on the Unity project you used for this? How did you configure the variables to read/write to the OPC server?

  3. Thanks Rifqi,

    Actually I am interested in the PLC code in Unity Pro. How do you configure the networks in “Communication -> Networks”? How do are the tags in the OPC server mapped to variables in the PLC? Are you able to post the Unity project you used as an .sta file? Or just some screen captures of the configuration pages of networks and variables (“Variables & FB instances”)?

    Thanks again – Jon.

  4. @Jon

    You’re welcome Jon,

    I just configure network for the IP address.
    Quantum provide Modbus TCP/IP connection from its ethernet port in CPU

    The OPC mapped to variable via Modbus Address. For example I have %m1 and I read from OPC 00001 (or 1), and for %MW1 to 40001.

    let me upload sta file.

  5. Hi, thank you for showing the connection sample with PLC M340 and Simulink.
    Could you again share the simulink model file? The link is not validate anymore….

Leave a Reply

Your email address will not be published. Required fields are marked *