PLC Supervisory Control

THIMMY01

Member
Join Date
Aug 2021
Location
Huddersfield
Posts
37
Hi everyone,
I'm quite new here and new to plc ladder programming. I have done some courses to have basic knowledge of the program, and I'm currently working on a project using Gx works 2, mainly about using a plc as a supervisory function or control with Arduino uno for controlling flow rate through a motorized control valve. The logic is that:
1. the PLC will have two feedbacks; one for the motor position and the other for the flow rate.
2. the PLC will be able to get a setpoint from HMI
3. the PLC will send analog signal to the arduino based on the setpoint from the HMI(the arduino will use PID to control the motorised valve).
4. the PLC gets acknowledgement from the arduino
5. the PLC checks if there's error after comparing the setpoint with the feedbacks and update the arduino
6. The PLC updates the HMI on it's I/O status.

I will glad to get any help here as to how to go about the ladder programming to accomplish the above PLC logic. Thanks in anticipation.
 
Although it's Mitsubishi you have not stated which model of PLC or HMI, one other point why the arduino ? what interface from the PLC to the arduino is it coms ?.
The PLC could do all you want including the PID.
More information is needed I think.
 
Guessing by the initial description this is still class work type?

1. Motor position? What is being used to track this?
1A. Flow Rate, what are you using to track that.

How are you sending this data to the PLC? You will need to determine how to handle the motor positioning data, that'll be fun to work out, a little trying but when you get it, its a nice victory. Temp is just knowing the scaling on the sending end and matching it up on the PLCs end.

2. You just need to get that data from the HMI to the PLC. What HMI are you using? How will it communicate to the PLC?

3. Why use the Ard? Does the PLC not have PID capability?

4. Thats on the Ard to send a Ok back in some form, but what are you acknowledging? If just looking for it to say yes im here, consider a heartbeat.

5. That sounds like the PLC is doing the PID also..

6. Standard fare for a PLC/HMI. You want to show Motor, flow rate, temp, etc statuses. HMI just reads those values from the PLC. This will work the same was as #2

I'm a big propoent of scaling EVERYTHING in the PLC. Don't scale anything in the HMI. You can truncate in the HMI if you like. lopping off long decimal numbers to 1 or 2 precision. Reason being, its alot easier to manage in the PLC if you have to update a setpoint. No questining what some random analog value is when its a human readable number... 0-100% for motor speed, valve position, etc. 0-32767.. you have to figure out that scale every time? slows you down. Let the PLC scale it and use the scaled human readable number in your logic.
 
Nearly all Mitsubishi from FX1S up to the Q/L series (so that is most of them) have PID instructions, like others do not see the point of Arduino.
It looks from the description that the valve is a motor driven valve & a sensor for flow rate.
 
Thanks so much for the prompt replies. I'm so delighted to be here. I see most of the replies has same trend. There are three reasons for using the Arduino in the project:

1. Because of the Covid restriction, I don't really have frequent access to the lab for proper testing as I work on the project. So I decided to use arduino for most of the computation.
2. I also learnt through research that using PLC for the PID algorithm can reduce the precision of the position control system for very high speed operation which can be improved on through using low-level & high-level language.
3. Finally, I would love to have practical experience of using both the PLC and arduino and I'm making use of the opportunity.

I'm planning on using the CC-link communication protocol between the PLC and arduino. I just need help with how the ladder programming will be.
 
Which PLC are you thinking of using this is important as the FX & Q/L have different analogues regarding programming, for example the Q/L series you can set the configuration of the card to automatically place the raw analogue value into Data memories, the FX (Depending on version) needs PLC code to access them. If you are just using the simulator analogues are not supported so all you can do is write an algorithm that works on the memory where the analogue raw data would be.
For FX it uses the TO & FROM instructions to write & read the cards information.
However, there are some clones out there with built in analogues that claim to be FX3 compatible but in reality they are not completely & are more akin to the older FX for example the on-board analogues use RD3A WR3A instructions to read/write the analogue values.
See pic for a typical simple analogue in for an FX
If you post the hardware regarding the PLC model & analogue cards you intend to use I can help.
EDIT: Your statement about the precision does not make sense, PLC's have been doing this for years & as you are reading the analogue values into the PLC anyway where is the loss ?
PID is never very fast, certainly not for flow & position control of flowrate as the sample time is usually between 100ms & a few seconds as high speed will become unstable (depending on the response of the controlling equipment) if as you stated, you are using a motorised valve then it's response is quite slow. The conversion of the analogue signals in the PLC will be a lot faster than your coms via CC link. The flow or temperature sensors will also have latency.

FX Analogue.png
 
Last edited:
I'm planning on using the CC-link communication protocol between the PLC and arduino. I just need help with how the ladder programming will be.
Hello and welcome to the forum.
Please clarify what you mean by "CC-Link" because it can mean many things:
CC-Link (plain vanilla): Physical layer is RS485 but needs special ASIC. If you are planning to use arduino on CC-LINK you would need to develop the CC-Lin data link layer in software, unless there is an Arduino with CC-LINK slave ASIC. I have never heard about such a product. If the interface you have in mind is CC-Link, I would advice you think about it again. CC-Link supports several baud rates and the soft-modem has to be able to detect the baud rate, so when there is no communication it has to monitor the different baud rates until the valid one is detected. Also the fastest baud rate is 10 Mbaud. I think it is really difficult to achieve this with an RS485 driver and by means of soft-logic. Not impossible, but very hard.

CC-Link IE Basic: (IE means industrial Ethernet). This protocol uses normal Ethernet and there is a sample application available to CLPA (CC-Link partners association). It is doable, but you need to become member of the CLPA to get the sample sources, because it is only licenced to CLPA members.

Then there is CC-Link IE Field and CC-Link IE TSN, both of which require ASIC and the arduino board is unlikely to support.

On the other hand, the Mitsubishi PLC supports Modbus TCP client with one special module, or you can develop a Modbus TCP client with the GX engineering tool through the normal Ethernet port. On the arduino side you would have to use use Modbus TCP server for this approach. Modbus TCP is fully open and there are lots of samples in Githubs, and it is a relatively easy protocol, very well documented as well. Still, it is a lot of work and if you are not familiar with Modbus TCP it will require some learning effort. Good luck.
 
Thanks, this has shed lots of light to going forward with the project. I will be using QCPU (Q mode) series and Q03UD PLC type. I have done the PID programming with the Arduino using a PWM to voltage converter to drive the motorized valve (which has an integrated circuit). But I'm not yet sure of the communication protocol to use between the PLC and Arduino, just got to know the CC-link works well with the Mitsubishi PLCs. So I'm open to idea of which one to use.
 
Depending on the analog modules you use see pics.
I have shown a AD/DA combined module, to set it up add new intelligent function module in the PLC tree on the left, configure it as the input/output address, set the switch setting for the type of input & parameters in A/D & D/A (note: if you use separate cards then you need two modules & config those both).
Then set the Auto refresh to automatically store the raw data into the data memories you want, There are many different settings but most can be ignored if not required, you may want scaling or you can do it in the program as posted before, I find this better as you can put zero & spans on an HMI so you can alter them (use latched memory areas or it will reset on power up), this is simpler than writing the code to do it as you have to code putting the card in config mode etc.

Module select.png Switch setting.png AD Setting.png Auto refresh.png
 
With your illustration, I have been able to set up the A/D & D/A module and the Auto refresh as you've shown, which is a great thing to achieve for me. But how do I go about the PLC program for reading the set point from the HMI, sending the setpoint to the arduino, and supervising the flow control system via the two feedback (flowrate and motor position)?
 
First question what HMI are you using ?, Assume you mean a real HMI & not something you have cobbled up.
There is no need to do anything, HMI's have in-built coms for a range of most PLC's for example The Mitsubishi GOT, all you do is configure your screens.
For example lets assume you have in your PLC allocated memory areas for your variables like so.
Analog readings from sensors D20, D21, D22, D23, D24, D25 (4 in 2 out).
Set-points (that will be for the HMI) D500, D501, D502 etc.
Then all you do is on a screen you drop an analog display variable give it the address of say D20, format the number of places etc. For saet-points same thing but you make the HMI variable operator entry so that the operator (or engineer using password level) can change it. The HMI will send & recieve the data as required.
So as for display/write to PLC nothing is needed.
As the analogs are integers you may wish to convert them to real numbers for decimal places i.e. you take the raw value convert it to a real (float) manipulate it i.e. divide the raw analog to meaningful values. There are a number of ways to do this (cannot remember exactly but I don't think the Analogs on Mitsubishi can scale to a real) so if you want say flowrate of 0.0-100.0 cubic mtrs per min then in the scaling you make it 1000 (some HMI's can use implied decimal place i.e. it is still 0-1000 but displayed as 0.0 to 100.0 or you convert the raw analog to a real (float) then divide by 10.
Note: in Mitsubishi a float is either 32 or 64 bit notation so if you use say D100 as the variable it takes either 2 or 4 D locations so for a 32 bit float it uses D100 & D101, so the next available spare Variable is D102.
I will post some code (will depend on size) but if it is too large I will PM you for you to send me your email & I will send it to you.
This should give you some basis for writing the PLC code.
 
Right, here is some code, the first program block is how to convert from raw data to floats & scale it.
There is an FB for a simple PI (No D) function that I have converted from an FX, so may be some coding errors but seems to work but difficult to simulate completely without hardware I have used this many times on flow, temperature, pressure, level etc. never needed Derivative component and although have probably done hundreds of loops only used D a couple of times.
As for communication have only used non protocol programming on 232/485 add on boards & as you do not seem to know what protocol to use then cannot give any info on this.

Excuse the HMI screen & comments this was thrown together in an hour or so.

HMI.png PI Control.png
 

Attachments

  • Analog PLC.zip
    189 KB · Views: 4
I will be using a real HMI, so it should have inbuilt coms for PLC as you said. Thanks so much for the attached files. I will go through it and see what I can come up with. Many thanks. Will give a feedback soon.
 

Similar Topics

I am studying a project of Supervisory in a PLC Allen-Bradley Micrologix 1200 (Rockwell Automation). For supervisory I just need read and write...
Replies
7
Views
3,171
HI everyone, i am new to Siemens plc programming and i am in need of some help. yesterday we had an S7-1200 CPU 1214C fail to turn on an output to...
Replies
7
Views
142
Hello, I have a Mitsubishi FX3G 14M PLC and a E615 HMI from Mitsubishi/Beijer. I'm using GXWorks 2 to do the programming and I have no problem...
Replies
4
Views
85
Hi, I'm trying to import a Rockwell/AB EDS to Beckhoff but I'm not sure how to import/install the EDS. It is a PowerFlex 525 EDS. Is there a way...
Replies
1
Views
90
I want to communicate my Q series PLC with Factory IO using GX works 2 software, I want to use modbus as server and the ips are as follows plc...
Replies
0
Views
59
Back
Top Bottom