×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

PLC PROGRAMMING

PLC PROGRAMMING

PLC PROGRAMMING

(OP)
Hi

I trust you are well. Guy I am looking for help in using a package called concept in writing PLC code. I will be writing code using Functional Body Diagram Programming. I want to write code for boiler water level control.

We have a Differential Pressure Cell and a Water Flow Meter as the new equipment we are adding which need to be part of the control philosophy. The philosophy is as follows, if the DP cell indicates a higher boiler pressure than a lower pump head increase the pump pressure, until pump pressure is greater than boiler pressure so as to ensure flow. We then use the water flow meter to always indicate that there is flow when flow is actually supposed to be occuring. Also if the water flow meter ever indicates absence of flow when flow is required ramp up the pump until the flow monitor indicates flow.

Any heads up

Thanks in advance

RE: PLC PROGRAMMING

I would have more than one flow meter. You wouldn't want to keep increasing the pump pressure when a meter is malfunctioning. How are you setting up your DPC? What is it transmitting its data to?

RE: PLC PROGRAMMING

Boiler level control schemes are well-established. Look up 3-element boiler level control on Google.

RE: PLC PROGRAMMING

NModbus4 - Listener event not firing.

Please find my C# NModbus4 console application code. The problem I'm having the that the listener event is not firing after setting the master C0 relay coil to true. I've also included some screen shots below.

CODE --> c#

using Modbus.Data;
using Modbus.Device;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace NModbus4ListenerDemo
{
    class Program
    {
        #region "Properties"
        static TcpClient tcpClient = new TcpClient();
        static ModbusIpMaster PLCModbusMaster = ModbusIpMaster.CreateIp(tcpClient);
        static string C0_RelayCoil_Address = "3073";
        static ushort C0_RelayCoil_BitAddress = Convert.ToUInt16(Convert.ToInt16(C0_RelayCoil_Address) - 1);
        #endregion

        #region "Setup Listener"
        static IPAddress MiddlewareSlaveIPAddress = IPAddress.Parse("10.95.11.34");
        static TcpListener MiddlewareSlaveTcpListener = new TcpListener(MiddlewareSlaveIPAddress, Convert.ToInt32("502"));
        static ModbusSlave middlewareslave = ModbusTcpSlave.CreateTcp(Convert.ToByte("255"), MiddlewareSlaveTcpListener);
        #endregion

        static void Main(string[] args)
        {
            string PLCMasterIPAddress = "10.95.11.32";
            tcpClient.BeginConnect(PLCMasterIPAddress, 502, null, null);
            Thread.Sleep(100);

            #region "Set Relay Coit C0 to false"
            PLCModbusMaster.WriteSingleCoil(C0_RelayCoil_BitAddress, false);
            Thread.Sleep(50);
            bool[] C0_RelayCoil_BitValue = PLCModbusMaster.ReadCoils(C0_RelayCoil_BitAddress, 1);
            string C0RelayCoilBitValue = C0_RelayCoil_BitValue[0] ? "True" : "False";
            Console.WriteLine("C0 Relay Coil = " + C0RelayCoilBitValue);
            Thread.Sleep(50);
            #endregion

            #region "Create DataStore and start listing"
            MiddlewareSlaveTcpListener.Start();
            middlewareslave.DataStore = DataStoreFactory.CreateDefaultDataStore();
            middlewareslave.DataStore.DataStoreWrittenTo += ModbusDataStore_DataStoreWrittenTo;
            middlewareslave.Listen();
            Thread.Sleep(50);
            #endregion

            #region "Set Relay Coit C0 to false"
            PLCModbusMaster.WriteSingleCoil(C0_RelayCoil_BitAddress, true);
            Thread.Sleep(50);
            C0_RelayCoil_BitValue = PLCModbusMaster.ReadCoils(C0_RelayCoil_BitAddress, 1);
            C0RelayCoilBitValue = C0_RelayCoil_BitValue[0] ? "True" : "False";
            Console.WriteLine("C0 Relay Coil = " + C0RelayCoilBitValue);
            Thread.Sleep(50);
            #endregion

            Console.ReadLine();

            #region "ModbusDataStore_DataStoreWrittenTo"
            void ModbusDataStore_DataStoreWrittenTo(object sender, DataStoreEventArgs e)
            {
                Console.WriteLine("ModbusDataStore_DataStoreWrittenTo event fired!");
            }
            #endregion

        }
    }
} 

This image shows the C0 relay coil set off:


This image shows the CO relay coil set on after the console application has run:


Here is the console application screen after running. Note the absence of the "ModbusDataStore_DataStoreWrittenTo event fired!" message.


Here is the Wireshark information that shows the TCP Modbus traffic between the master and slave over port 502


Here is the PLC configuration information:


RE: PLC PROGRAMMING

Paul... Are you hijacking EngTist96's thread? I don't see it as a correct response.
Please open your own question thread and delete this entry in this thread.

Keith Cress
kcress - http://www.flaminsystems.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close