PLCS.net - Interactive Q & A

PLCS.net - Interactive Q & A (http://www.plctalk.net/qanda/index.php)
-   LIVE PLC Questions And Answers (http://www.plctalk.net/qanda/forumdisplay.php?f=2)
-   -   PLC Recommendations for Horizontal Fuel Tank Doser Project (http://www.plctalk.net/qanda/showthread.php?t=131707)

sengle January 11th, 2022 03:52 PM

PLC Recommendations for Horizontal Fuel Tank Doser Project
 
Greetings from all the way down here in New Zealand:-)
I have a challenge for you all.....

I have a need for a PLC to run a Doser pump to pump Additive into a Diesel tank.

The tricky bit is that the Main tank/cylinder is horizontal, so the maths isnt nice and straightforward like if it was a vertical tank.

The other tricky part is that tank filling happens at random times by a third party, and is a random quantity. Unfortunately there is no key lock, or hatch cover, or button press or any other easy digital triggers to alert the PLC that the tank is being filled.

We have an Analog pressure/level sensor which needs to understand/realise when the tank is topped up with diesel and that will trigger the Doser Pump routine.

We need to send alerts/updates via SMS/Txt.

So, I was looking at the Siemens Logo with CMR2020 cellular modem.
The modem integrates nicely with the Logo and it will let me send and receive txts/status etc.
Unfortunately I dont think the Logo will be able to do the complicated maths though.
PlanB is to use a calibration Table for the tank contents (more accurate), however the Logo cant handle tables, so was thinking of Move/Compare type blocks, but again I think the Logo would be limited by its available Block memory?

PlanC is to look at a S7-1200 which can do the complicated maths (Calculate). It doesnt do Tables though, so was thinking of Move/Compare type blocks as the S7-1200 has the block memory capacity?
It looks like the CP1242-7 modem works with it and will do what I require.

PlanD(!) - Looked at Eaton Easy4 - as it does Tables, but doesnt do complicated maths. The Easy4s cant receive SMS/txts, only MODBUS TCP.

There are a few other requirements ie. need 2 Analog inputs, 1 High speed digital input (200Hz) for Flowmeter, 2 Digital inputs for buttons, and 1 Digital out for Doser pump.

So, Long story short, I am looking for Hardware suggestions/recommendations please.

Many thanks.

Cheers,
Steve

drbitboy January 11th, 2022 04:01 PM

If the PLC does not have trig functions but does have floating point math, they are, in principle, straightforward to approximate (cf. https://ntrs.nasa.gov/api/citations/...9700026648.pdf), six digits of accuracy is only two terms, but the kabuki dance needed to get to those two terms is even longer, so the only question is whether the logo PLC can provide entough instructions.

mylespetro January 11th, 2022 04:06 PM

Quote:

Originally Posted by drbitboy (Post 904634)
straightforward to approximate (cf. https://ntrs.nasa.gov/api/citations/...9700026648.pdf),

Off topic, but I love when you or Peter say something is simple (which it probably realistically is) and then link to a PDF that literally looks like rocket science, which in this case may be true, as it's a NASA technote :lolis:

drbitboy January 11th, 2022 04:38 PM

Well, to be fair, I did not write "simple, but "straightforward," as in "Your destination is straight ahead, a mere thirty-eight miles down this bicycle path" ;). It's all in the bookkeeping.

Whoops, I think this may be quicker: https://stackoverflow.com/a/394512/1992064

busarider29 January 11th, 2022 04:48 PM

Until I see a better platform, my recommendation for PLC platform remains the same - Beckhoff with TwinCAT-3 software.
Basic arithmetic and trig functions
Extended mathematical functions (paid for library)

If those aren't enough, you can always add the free OSCAT user-made functions and function blocks library, loaded with all the math functions you could ever realistically ask for, plus many, many others.
OSCAT Library documentation
OSCAT (adjusted for TwinCAT) download

Matrix Math (TcMatrix) library for TwinCAT

TF6350 - enables the transmission of SMS messages or emails using PLC function blocks
SendSMS Function Block

L D[AR2,P#0.0] January 11th, 2022 06:52 PM

FYI the S7-1200 would allow you to implement a calibration table if desired.

CENTER January 11th, 2022 08:18 PM

The way we have been doing this is by using the flow meter pulses and adding what ever per 10,100 or 1000. For gas we were adding as the trucks were filling at the rack. Same gas different additive for each brand.

sengle January 11th, 2022 08:33 PM

Quote:

Originally Posted by drbitboy (Post 904634)
If the PLC does not have trig functions but does have floating point math, they are, in principle, straightforward to approximate (cf. https://ntrs.nasa.gov/api/citations/...9700026648.pdf), six digits of accuracy is only two terms, but the kabuki dance needed to get to those two terms is even longer, so the only question is whether the logo PLC can provide entough instructions.

Thank you very much for your response.
The Logo doesnt do floating point math, so I guess that its not an option.
My head hurts looking at that document!

sengle January 11th, 2022 08:38 PM

Quote:

Originally Posted by busarider29 (Post 904644)
Until I see a better platform, my recommendation for PLC platform remains the same - Beckhoff with TwinCAT-3 software.
Basic arithmetic and trig functions
Extended mathematical functions (paid for library)

If those aren't enough, you can always add the free OSCAT user-made functions and function blocks library, loaded with all the math functions you could ever realistically ask for, plus many, many others.
OSCAT Library documentation
OSCAT (adjusted for TwinCAT) download

Matrix Math (TcMatrix) library for TwinCAT

TF6350 - enables the transmission of SMS messages or emails using PLC function blocks
SendSMS Function Block

Very interesting thanks. I had no idea that Beckhoff made such a product.
I have spent the afternoon looking around their site, and reading the manuals etc and have learnt a lot!

Unfortunately, in my requirements, I failed to say that I also wanted to contact/interrogate the device via SMS/txt.
The TF6350 SMTP/SMS Solution appears to be only Outbound?

sengle January 11th, 2022 08:47 PM

Quote:

Originally Posted by L D[AR2,P#0.0] (Post 904658)
FYI the S7-1200 would allow you to implement a calibration table if desired.

Thanks for this info!
I cant find any doc or reference to this in the manual.
Conceptually - how would this be done?

Cheers,
Steve

sengle January 11th, 2022 09:03 PM

Quote:

Originally Posted by CENTER (Post 904666)
The way we have been doing this is by using the flow meter pulses and adding what ever per 10,100 or 1000. For gas we were adding as the trucks were filling at the rack. Same gas different additive for each brand.

Yes this would be ideal and so much simpler.
However, we have no control over the filling process at all and cant capture flow rate during the fill :banghead:

CENTER January 11th, 2022 10:39 PM

A flow meter would be the way to go. Probably less expensive, more accurate and very simple. You can use tank gauges. I did a job with omntec and was able to get a 0/10 output to use for other equipment + around here you need a approved high tank alarms.
https://morbros.com/products/gauges-...tronic-gauging
https://www.omntec.com

drbitboy January 11th, 2022 11:00 PM

Quote:

Originally Posted by sengle (Post 904667)
Thank you very much for your response.
The Logo doesnt do floating point math, so I guess that its not an option.
My head hurts looking at that document!


What type of math does Logo have available? Can you point to a manual? I am looking at this and there isn't even fixed point math available.

I find it hard to believe that hardware could handle SMS.


What sort of accuracy are you after?

drbitboy January 11th, 2022 11:47 PM

Quote:

Originally Posted by sengle (Post 904628)
We have an Analog pressure/level sensor which needs to understand/realise when the tank is topped up with diesel and that will trigger the Doser Pump routine.

You are thinking of something like this?

The program can be in one of several states:
  • Idle
    • Dosing not needed
    • Level is stable i.e. not changing, beyond some measurement deadband, over some time, say half an hour
  • Filling or draining: level is not stable
  • New stable level:
    • If new level is lower than last stable level
      • Save new level as last stable level
      • Return to Idle state
    • If new level is higher than last stable level, then
      • calculate dosing needed
      • execute calculated dosing
      • Save new level as last stable level
      • return to Idle state
Depending on accuracy required, the dosing calculation probably could get away without trig functions; a naive numerical integration scheme is possible with integer multiplies, adds, and compares, although overflow will have to be dealt with, depending on the raw range of the pressure sensor.

But the extra effort to develop such a scheme would pay for a more capable PLC, many times over.

JesperMP January 12th, 2022 04:24 AM

S7-1200 can definitely do the job.
I dont know if there is library function to do a calibration table, but even if there is I would prefer to write my own in SCL (equivalent to Structured Text).
I wouldnt use the Calculate block.
There should be plenty memory available.

I think that any modern PLC can do the job easily. Especially if it supports Structured Text.
A 'smart relay' such as a Logo will probably be hard pressed to do the job. Not impossible, using integer math and various tricks, but the saving on hardware will be lost in time spent to get it working.

busarider29 January 12th, 2022 08:14 AM

Quote:

Originally Posted by sengle (Post 904668)
Unfortunately, in my requirements, I failed to say that I also wanted to contact/interrogate the device via SMS/txt.
The TF6350 SMTP/SMS Solution appears to be only Outbound?

Unusual requirement, but sending messages to the PLC from your phone can be done, but just maybe in a different way. At least one way that I know of is to use the MQQT protocol via TF6701 TwinCAT 3 IoT Communication. From my understanding, there are MQQT phone apps that you can then use to send messages to the broker, which then get relayed to the PLC.

drbitboy January 12th, 2022 08:14 AM

Quote:

Originally Posted by JesperMP (Post 904691)
...the saving on hardware will be lost in time spent to get it working.

+1; get a better PLC.

Reliably detecting a filling event will likely be more difficult than calculating the dosing.

Calculations are easy; measurements are hard.

sengle January 12th, 2022 03:34 PM

Quote:

Originally Posted by drbitboy (Post 904675)
What type of math does Logo have available? Can you point to a manual? I am looking at this and there isn't even fixed point math available.

I find it hard to believe that hardware could handle SMS.


What sort of accuracy are you after?

Logo manual here:
https://support.industry.siemens.com...?download=true
No it doesnt look like it can do floating point math.

Surprisingly it handles modem integration quite well and the Logo has a specific dedicated CMR2020 modem for it.
https://support.industry.siemens.com...?download=true


Up to +-5% is acceptable.

sengle January 12th, 2022 03:36 PM

Quote:

Originally Posted by drbitboy (Post 904677)
You are thinking of something like this?

The program can be in one of several states:
  • Idle
    • Dosing not needed
    • Level is stable i.e. not changing, beyond some measurement deadband, over some time, say half an hour
  • Filling or draining: level is not stable
  • New stable level:
    • If new level is lower than last stable level
      • Save new level as last stable level
      • Return to Idle state
    • If new level is higher than last stable level, then
      • calculate dosing needed
      • execute calculated dosing
      • Save new level as last stable level
      • return to Idle state
Depending on accuracy required, the dosing calculation probably could get away without trig functions; a naive numerical integration scheme is possible with integer multiplies, adds, and compares, although overflow will have to be dealt with, depending on the raw range of the pressure sensor.

But the extra effort to develop such a scheme would pay for a more capable PLC, many times over.

Yes this is exactly what is required. Thank you for summarising it perfectly!
What PLC would you recommend that would be capable?

sengle January 12th, 2022 03:38 PM

Quote:

Originally Posted by JesperMP (Post 904691)
S7-1200 can definitely do the job.
I dont know if there is library function to do a calibration table, but even if there is I would prefer to write my own in SCL (equivalent to Structured Text).
I wouldnt use the Calculate block.
There should be plenty memory available.

I think that any modern PLC can do the job easily. Especially if it supports Structured Text.
A 'smart relay' such as a Logo will probably be hard pressed to do the job. Not impossible, using integer math and various tricks, but the saving on hardware will be lost in time spent to get it working.

Thanks Jesper. Totally Agree it makes sense to get capable Hardware rather than lost time looking for workarounds

sengle January 12th, 2022 03:42 PM

Quote:

Originally Posted by busarider29 (Post 904699)
Unusual requirement, but sending messages to the PLC from your phone can be done, but just maybe in a different way. At least one way that I know of is to use the MQQT protocol via TF6701 TwinCAT 3 IoT Communication. From my understanding, there are MQQT phone apps that you can then use to send messages to the broker, which then get relayed to the PLC.

Thanks for looking into this.
There is no LAN/WAN connectivity unfortunately.
These are 30 Remote sites which will all have this standalone PLC solution, so we need to be able to contact/interrogate the PLCs.

Tom Jenkins January 12th, 2022 04:47 PM

1 Attachment(s)
You need floating point, but you can do the calculation with multiplication and addition based on level.

busarider29 January 12th, 2022 06:11 PM

Quote:

Originally Posted by sengle (Post 904763)
Thanks for looking into this.
There is no LAN/WAN connectivity unfortunately.
These are 30 Remote sites which will all have this standalone PLC solution, so we need to be able to contact/interrogate the PLCs.

Here you go.....

CU8210-D004-0103: LTE USB modem.

See pg. 8 of the documentation here. - "The USB stick can also receive and send text messages using the Short Message Service (SMS)"

Add the Cabinet dome for protection of the device.

Explore the various IPCs and Embedded PCs available. It appears your application is rather small and simple. Any IPC or CX equipped with USB port should work just fine. For applications where the PC/CX might be exposed to harsher environments, I would opt for something in the CX line (Embedded PC).

CORRECTION EDIT: The LTE stick can only operate with Windows 7, Windows 10, or TwinCAT BSD. This limitation may inherently omit a few of your options for PC/CX selection, as some of the "Economy" CX's are only available with Windows CE (ex..CX9020).

Peter Nachtwey January 13th, 2022 11:52 AM

Quote:

Originally Posted by mylespetro (Post 904636)
Off topic, but I love when you or Peter say something is simple (which it probably realistically is) and then link to a PDF that literally looks like rocket science, which in this case may be true, as it's a NASA technote :lolis:

I would use a look up table. I would generate it using Mathcad but most would use Excel. Then do linear interpolation betweeun the points. If I needed more accuracy I would use Lagrange interpolation which is a 3rd order interpolation but I doubt this is required.

drbitboy January 13th, 2022 12:34 PM

1 Attachment(s)
Quote:

Originally Posted by Peter Nachtwey (Post 904846)
If I needed more accuracy I would use Lagrange interpolation which is a 3rd order interpolation but I doubt this is required.

It is not; if accuracy to a percent or so is acceptable and square root is available (but no trig e.g. MicroLogix 1100), then linear is good enough (below from @Tom Jenkins's sheet; see here also).
Attachment 60648
atan(1) would be replaced by 0.785... in the actual case.

But on MicroLogix the lookup table would be available anyway.

busarider29 January 13th, 2022 01:01 PM

Here you go....

FB_CTRL_LIN_INTERPOLATION

The caveat is that the above FB is part of a paid-for library (TF4100 Controller Toolbox), meaning if you want to use this for all 30 PLC's, you would need to purchase this library for each one of those 30 stand-alone PLC's. The cost of the library is dependent on the 'Performance Level' of the IPC/CX. We purchased the library for a performance level 70 IPC, and I believe the cost of it was ~$450 USD. For your application, a performance level 40 IPC/CX is all you would require, and that's only because you need the modem USB stick, which requires Win7 or Win10.

A much cheaper option in lieu of the TF4100 Controller Toolbox library:
Explore the FB's and Functions in the free OSCAT library I linked in a previous post, particularly "LINEAR_INT" on page 101, and "POLYNOMIAL_INT" on page 102. One of those should work for your application. The OSCAT library is free!!

You could also just code a polynomial in your logic. I did that for two of our machines in RSLogix500, with some pre-work in Excel.

drbitboy January 13th, 2022 01:42 PM

Math is not the problem for any but the most rudimentary processor; this could be done even if only integer math was available, though it would be a mess.

So to answer the OP, look for something that handles the SMS requirement cleanly and has either floating point with square root, or the capability to store a lookup table.

A lot less time is going to be spent coding how much to dose than coding when to dose.

sengle January 13th, 2022 08:45 PM

Quote:

Originally Posted by Tom Jenkins (Post 904772)
You need floating point, but you can do the calculation with multiplication and addition based on level.

Thanks Tom

sengle January 13th, 2022 08:47 PM

Quote:

Originally Posted by busarider29 (Post 904778)
Here you go.....

CU8210-D004-0103: LTE USB modem.

See pg. 8 of the documentation here. - "The USB stick can also receive and send text messages using the Short Message Service (SMS)"

Add the Cabinet dome for protection of the device.

Explore the various IPCs and Embedded PCs available. It appears your application is rather small and simple. Any IPC or CX equipped with USB port should work just fine. For applications where the PC/CX might be exposed to harsher environments, I would opt for something in the CX line (Embedded PC).

CORRECTION EDIT: The LTE stick can only operate with Windows 7, Windows 10, or TwinCAT BSD. This limitation may inherently omit a few of your options for PC/CX selection, as some of the "Economy" CX's are only available with Windows CE (ex..CX9020).

Thanks very much for your detailed response.
I am very impressed with Beckhoffs offerings and am in touch with the New Zealand agent now. Cheers!

sengle January 13th, 2022 08:48 PM

Quote:

Originally Posted by drbitboy (Post 904865)
Math is not the problem for any but the most rudimentary processor; this could be done even if only integer math was available, though it would be a mess.

So to answer the OP, look for something that handles the SMS requirement cleanly and has either floating point with square root, or the capability to store a lookup table.

A lot less time is going to be spent coding how much to dose than coding when to dose.

Thank you very much for taking the time to look at this for me.
Cheers!

Kelkoon January 14th, 2022 06:57 AM

Hi Sengle,


I'm late for the discussion but I think you would save a lot of time with S7-1200. It's by far more cappable and the LOGO programming software it is dificult to use for complex logic.


Also fo S7-1200 there is the Library of General Functios available that can be downloaded from https://support.industry.siemens.com...view/109479728. It is free of charge but needs to be registered. This library includes many usefull functios like Non Linear Interpolation, Limitation of rate of limit, temperature conversions, signal generators.



Best regards,
Kelkoon

drbitboy January 14th, 2022 08:24 AM

+1 for the S7-1200, as long as there is an SMS library.

And not that it would be worth it, but even with only 16-bit signed integer math, the tank parameters can be approximated reasonably well: see this link.

sengle January 14th, 2022 09:54 PM

Quote:

Originally Posted by Kelkoon (Post 904915)
Hi Sengle,


I'm late for the discussion but I think you would save a lot of time with S7-1200. It's by far more cappable and the LOGO programming software it is dificult to use for complex logic.


Also fo S7-1200 there is the Library of General Functios available that can be downloaded from https://support.industry.siemens.com...view/109479728. It is free of charge but needs to be registered. This library includes many usefull functios like Non Linear Interpolation, Limitation of rate of limit, temperature conversions, signal generators.



Best regards,
Kelkoon

Thanks very much for this info.
Its looking more and more like S7-1200 is the way to go. I am investigating their CP1242-7 V2 Modem as it looks like it will let me do what I need to do.

drbitboy January 15th, 2022 12:37 AM

TL;DR

Although there is no reason to do so in 2021, the horizontal tank can be modeled with integer math alone, as close as the integers allow: see this link.

Darran SDUK February 25th, 2022 04:14 AM

There's nothing much this Edge beast from Opto22 can't do!


All times are GMT -4. The time now is 06:56 AM.

.