Home > Communication, Instrument & Automation, Tips & Trick, Tutorial > Water Tank PLC Control Simulation with Matlab Simulink

Water Tank PLC Control Simulation with Matlab Simulink

April 28th, 2014 Leave a comment Go to comments

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


next installation »

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

Configure OPC:

Congure OPC Server »

  1. illank
    May 1st, 2014 at 22:32 | #1

    laddernya terlalu ribet….

    bisa dibuat lebih simple lagi pak…

    lebih banyak belajar yah…

  2. May 2nd, 2014 at 16:47 | #2

    sudah dilengkapi dengan yang simple, menggunakan fasiltas latching coil. FBD dan ladder

  3. Annas
    May 10th, 2014 at 20:20 | #3

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

  4. May 10th, 2014 at 21:51 | #4

    Ok, saya cek dulu, harusnya otomatis muncul.
    Terimakasih atas masukannya

  5. Jon
    September 19th, 2014 at 10:06 | #5

    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?

  6. September 19th, 2014 at 13:36 | #6

    What kind information do you need? Variable information? let me update soon.

    yes I configure OPC server for read and write to PLC. and Simulink read and write to OPC.

    btw I also have another simulink model for tank mixing, If you interested I will upload it.
    check this out http://www.youtube.com/watch?v=UPNC_Ke1Xkk

  7. Jon
    September 19th, 2014 at 13:50 | #7

    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.

  8. September 19th, 2014 at 17:35 | #8


    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.

  9. Jon
    September 20th, 2014 at 12:46 | #9

    did you upload the .sta file? I cannot see it on the site.

  10. September 20th, 2014 at 16:10 | #10
  11. Jon
    September 21st, 2014 at 11:16 | #11

    Finally got it working. Thanks!

  12. kumbakarna87
    December 6th, 2015 at 05:52 | #12

    gan bisa diupload ulang Simulink Model, OPC Configuration, di 4shared sudah tidak ada. trims

  13. Shin
    January 11th, 2016 at 11:17 | #13

    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….

  14. Mikhail
    December 20th, 2016 at 19:08 | #14

    Can you share the simulink model file? The link is not validate anymore.

  15. November 27th, 2017 at 23:52 | #15

    Pode ter certeza de que será seu melhor investimento. http://sobrevivealark.com/index.php?action=profile;u=2647

  16. November 29th, 2017 at 21:56 | #16

    Tente nadar. Senhor-livramento!!!! Parabens!!!!
    Oi gente. http://www.scnindia.com/index.php/scn/blog/item/74-tbba/74-tbba