Control/ PLC questions

ackees

Member
Join Date
Aug 2020
Location
florida
Posts
4
Describe how you would perform a 2-point linear calibration of a PLC analog input? The scaling is calculated in PLC ladder.
 
y=mx+b


OR


Code:
Y-Y0     Y1-Y0
----  =  -----
X-X0     X1-X0
which is the same thing in different form.


hello fellow Mather.


Y= m * x + b


m = ((y2-y1) / (x2 - x1))

solve for m; plug in y0 and x0 for one point; solve for b; plug back into original equation; you now have a scale block
 
As to how, ignoring the actual formulas, and assuming the scaling actually works:


Two buttons. One is "CAL LOW", one is "CAL HIGH".
On my HMI Calibration Screens, I also include two fields for "Eng. Unit Low", and "Eng. Unit High".


If I use a signal calibrator as a source, it is just hook up the signal calibrator, set it to the low input value, and hit the CAL LOW button, then set it to the high input value, and hit the CAL HIGH button.


If using actual physical instruments, like a pressure transmitter, I'll hook up an external pressure source (Nitrogen usually), set my pressure source to the low value, enter the actual value in the Eng. Unit Low field, and hit the CAL LOW button. Then set the pressure source to the high value, enter the actual pressure in the Eng. Unit High field, and hit the CAL HIGH button.


As a matter of course, we do check the calibrations here at 0%, 25%, 50%, 75% and 100% after a calibration is done.
 
hello fellow Mather.


Y= m * x + b


m = ((y2-y1) / (x2 - x1))

solve for m; plug in y0 and x0 for one point; solve for b; plug back into original equation; you now have a scale block


yes, like I said, it is (i.e. expresses) the same thing, with no plug-back-in required because b can be solved directly e.g.


b = Y0 - X0 * (Y1-Y0) / (X1 - X0)


(which = Y0 - X0 * m = Y1 - X1 * m, which is what you were saying)


I used the second form because it is easier to understand from the data one may get from the calibration. As rdrast mentions, it is not uncommon to have a [calibrate] option on a PLC that will initiate a procedure to measure the X0/Y0 and X1/Y0 pairs, calculate m and b, and store m and b into the data for future use.
 
Describe how you would perform a 2-point linear calibration of a PLC analog input? The scaling is calculated in PLC ladder.

On most modern PLC's you'd do this by putting the analog input module into calibration mode and then applying a known current or voltage source to the input being calibrated.

Scaling is a separate issue altogether, and I assume that you already know how to do that.
 
... Scaling is a separate issue altogether, and I assume that you already know how to do that.




They are two sides of the same coin; a descriptive term for scaling is de-calibration; the math is of the same form, i.e. if



y = mx + b


then


x = My + B


where


M = 1/m


and


B = -b/m


So if the OP is asking about one, I think it optimistic to assume they know aught about the other.


This is basic stuff; anyone who does not know it in their bones should not be allowed near equipment without supervision. I'm not saying they cannot learn it, but until they do, to them "any sufficiently advanced technology is indistinguishable from magic" (Arthur C. Clarke - I thought it was Bradbury, but The Google saved me, cf. here; see also Clark's Law, ibid.).
 
y=mx+b


OR


Code:
Y-Y0     Y1-Y0
----  =  -----
X-X0     X1-X0


which is the same thing in different form.

Admittedly math is my worst subject so how do you come up with the above formula from the question “Describe how you would perform a 2-point linear calibration of a PLC analog input? The scaling is calculated in PLC ladder.”

Please help me understand the thought process here. Thanks in advance for your help.
 
Admittedly math is my worst subject ...


Well you could fix that first: all math is is based on counting. But we don't have space for that now.



Say you were driving from west of Gary to Osceola (just east of South Bend).


From previous trips you know it is 80mi miles from Gary to Osceola along I-90 and Route 31, but your odometer is broken today.



...[Gary]<-------------------80mi------------------>[Osceola]


There is construction the whole way, so your speed will be a constant 40mph*.


Even without mad math skills, I suspect that by now you know that if you pass through Gary at midnight (0000), you will arrive in Osceola at 2am (0200), i.e in 2h after you left gary, which you get by dividing 80mi by 40mph.


But let's say you pass through La Porte at 1am, 1h after Gary.


[Gary]<-------1h------>[La Porte]<------1h------>[Osceola]







Your odometer is broken*, but how far is La Porte from Gary? Obviously it is 40mi from Gary, which you get by multiplying the 1h traveled by 40mph. But let's look at it another way:


Speed is constant at 40mph, and speed is defined as distance (miles) divided by (per) time (hour). What this means is that for every hour you drive, you will travel 40mi. So a plot of distance vs. time is a line:


Code:
  ^miles
  |          /
80+         x
  |        /
  |       /
  |      /
  |     /
40+    x
  |   /
  |  /
  | /
  |/
0-+----+----+----->hours
  0    1    2
And because the plot of this time vs. distance is a line, this trip is called a linear process. Very few processes are truly linear, but very very few cannot be represented well enough with a linear model, at least over some limited range of operation. Even motion control problems, which are often non-linear in position, will model constant acceleration so they are linear in velocity vs. time, or even constant jerk, so they are linear in acceleration vs. time.


Back to your trip ...



Use Yc and Xc to represent distance and time, respectively, of city c from Gary, so

Ygary = 0mi
Yosceola = 80mi
Ylaporte = ?


Xgary = 0100 (0h)
Xosceola = 0200 (2h)
Xlaporte = 0100 (1h)





So for the Gary-Osceola trip, we have



Code:
        Yosceola - Ygary   80mi - 0mi   80mi
speed = ---------------- = ---------- = ---- = 40mph
        Xosceola - Xgary   2h   -  0h    2h
And for the Gary-La Porte trip we have


Code:
        Ylaporte - Ygary   Ylaporte - 0mi
speed = ---------------- = -------------- = 40mph
        Xlaporte - Xgary   1h       -  0h
Now comes the cool part: note that it does not matter if you started in Oshkosh at midnight and pass through Gary at 5am and 200mi from Oshkosh:


Ygary = 200mi
Yosceola = 280mi
Ylaporte = ?


Xgary = 5h
Xosceola = 7h
Xlaporte = 6h




Code:
        Yosceola - Ygary   280mi - 200mi   80mi
speed = ---------------- = ------------- = ---- = 40mph
        Xosceola - Xgary   7h    -    5h    2h
And for the Gary-La Porte trip we have


Code:
        Ylaporte - Ygary   Ylaporte - 200mi
speed = ---------------- = ---------------- = 40mph
        Xlaporte - Xgary   6h       -    5h
So, you should recognize those formulas from my previous post, e.g. if we drop the laporte subscripts, and use 1 for Osceola and 0 for Gary, and set the two speed formulas equal (since both are 40mph), i.e. we get (Y-Y0)/(X-X0) = (Y1-Y0)/(X1/X0) from my previous post.


Note that if we were interested in the distance from Gary to Portage (Yportage), and we knew that we went past Portage 15minutes, or 0.25h, after Gary, the same formula applies with Xportage equal to 0.25h (or 5.25h) and Yportage will be 10mi.



And that is a long way around to an answer your query:


how do you come up with the above formula from the question “Describe how you would perform a 2-point linear calibration of a PLC analog input? The scaling is calculated in PLC ladder.”
I.e. because the original question is specifically about a linear process, and that is the fundamental equation that expresses all linear processes.

Further, it does not matter if your odometer is working and your watch is broken, and you see that you drive through La Porte at 40mi past Gary (or 240 from Oshkosh), the form of the equations is exactly the same, except the ratios become 0.025 hours per mile, i.e. the reciprocal of the speed, and you know you got to Portage 1h after Gary.


Finally, 40mph or 0.025hpm are both equal to unity i.e. to 1, so all of this boils down to multiplying by 1. See here.


* yes I know, so how do you maintain 40mph, because if the odometer is broken it is unlikely that the speedometer is working? You're in 5th gear of my 1993 Ford Ranger and the tachometer is steady at 1333rpm on the 205R15 fully inflated tires so you know it's 40mph, okay? Yes, I know you are lugging my engine; it's got 350kmi on it and it does not care, and neither do I :rolleyes:.
 
Drbit oh & Bob O,
Thanks for the incredibly detailed info & links. As I read thru this it is apparent that I don’t have enough brain power or liquor nearby to absorb this info. I will now adjourn to the package store to pick some up.

I have never heard of y=mx+b before. HS geometry was as far as I could make it in math. I’ll take the easy way out and blame it on the poor rollout of New Math” by school systems in the mid-60’s. Honestly, it scarred (scared?) me so much.

My hat’s off to you programmers. I mastered everything else in the electrical field but programming, which is my Achilles heel. Thanks again.
 
My worldview does not allow for someone to get into a technical field, who cannot understand this stuff.


xxx.png


There is a recipe that feeds 8 people with 4 tubes of biscuits, 1/3 cup of sugar, and 4oz of butter.


If I had 24 guests, that is thrice 8 people to feed, so I could make it three time 4+4+4=12 tubes, 1/3+1/3+1/3 = 1 cup sugar, 4+4+4 = 12oz butter.


If I had twelve guests, I could make one batch for the first 8, and 4 people left over; 4 is half of 8, so another half a recipe would do it: 4 * 1/2 = 2 tubes; 1/3 * 1/2 = 1/6 cup sugar; 1/2 * 4 = 2oz butter. So a total of 4+2=6 tubes; 1/3+1/6 = 1/2 cup sugar; 4+2=6oz butter.


That is all that is happening here: let's look just at the tubes of biscuits: 4 tubes feeds 8 people. Another way of saying that is
Code:
4 tubes
-------
8 people


= (4/8) tube/person


 = (1/2) (tube/person)


= 0.5 (tube/person)
Notice that we get same (tube/person) rate if we use the 8- and 24-person cases and the [y0,y1,x0,x1] notation:


Code:
Case 1 is 24 persons
Case 0 is 24 persons


X1 = 24persons
Y1 = 12tubes, the number of tubes required to feed 24 persons
X0 = 8persons
Y0 = 4tubes, the number of tubes required to feed 8 persons


Y1 - Y0
------- =
X1 - X0




 12tubes   -    4tubes       8  tubes       1  tube
---------------------  =  ---  ------   =  -  ------ = 0.5 tube/person
24persons - 8 persons      16  persons     2  persons
Why does the form of these two approaches look different i.e. the former case:

4/8 => 0.5

vs. the latter case:

(12-4)/(24-8) => 0.5?



Actually they are not; the reason is that the former case (4/8 => 0.5) has hidden an implicit assumption, specifically, that we need 0 tubes for zero persons. Adding those data, the former case can be more properly written, in a form that is identical to the latter case, as
Code:
X1 = 8persons
Y1 = 4tubes to feed 8 persons (X1)
X0 = 0persons
Y0 = 0tubes to feed 0 persons (X0)


Y1 - Y0
------- =
X1 - X0


4tubes   -    0tubes       4   tubes
---------------------  =  ---  ------   =  0.5 tube/person
8persons -   0persons      8   persons
Subtracting zero from any quantity "X" is an identity operation i.e. the result is the same quantity "X" we started with, which is why the zeros are excluded in the [(4/8) => 0.5] form, but they are there nonetheless, even if they are implicit.






What is being described here is a model, a model that predicts the number of tubes required to feed any number of people. And it is a linear model.


No matter what two cases we take, the incremental quantity of tube/person will not change; this is the defining characteristic of a linear model.




Stepping back, all programming is a model of something in the real world, and almost all processes are either linear, or are near-enough linear that a linear model works. Those processes that are sufficiently non-linear are have model that are restricted to a limited range and evaluated over that range only*.



Please excuse my monomania here, but I have spent an entire career as an engineer and a programmer, and I have done very few things that are not based on this simple linear principle, which I understood well before I even started in college.


And I just realized that, in my passion, I used a food recipe example when I should have said this:


If you have a detector/transducer/sensor system that sends a 4-20ma signal, and you push that current through a 50Ω resistor, what is the voltage, in mV, across that resistor when the signal is 4mA? What is it at 20mA? 6.5mA? 0mA? If you have mastered everything else in the electrical field, then you probably know this in your sleep better than me awake.


The reason I ask is that this system, which is basically Ohm's Law, is another linear model. The fixed resistor provides a constant rate - or ratio - of 50 Volts per Amp (or mV per mA) in that system.


That's it.



* Calculus is the art of making the range small enough, even infinitely so, that linear is accurate enough over that range, and then combining adjacent ranges together to compose a model that covers the entire usable range. But calculus is a whole 'nother kettle of fish; baby steps for now.



** It's not perfectly linear but any variation from linear probably requires high-quality instrumentation to detect.
 
Last edited:
Doc, let me know if you ever get sick of the winters up there. There is an engineering/programming job waiting for you in NC.
 
Control / PLC Question

What is PLC ?

The answer is....

An industrial grade computer that is capable of being programmed to perform control functions. Identify four tasks in addition to relay switching ...
 

Similar Topics

Describe how you would perform a 2-point linear calibration of a PLC analog input? The scaling is calculated in PLC ladder. While tuning a...
Replies
15
Views
4,470
Hi there, I have two questions. Well, is there how to monitor my output in my PLC without a sensor? For example, if I energize my VALVE (24VDC)...
Replies
13
Views
3,772
Hi all, I have 3 Questions of Siemens PLC program. 1. I need to write a PI control in the program. As I know I set D_set as 0 then it is a PI...
Replies
4
Views
4,640
Hi, I'm thinking about using commands for Melservo J5 controller via HMI without PLC. Have you guys done this kind of control configuration for...
Replies
3
Views
139
Hi, I have a 1500 that controls a station with diferents warehouses, but i also have a 1200 that controls one of those warehouses, i have been...
Replies
9
Views
277
Back
Top Bottom