# PID Code for a GEFanuc 90-30

S

#### Seb

I need to write my own PID code in ladder logic.
The PID function block only accepts integer values for the PV and SP. Same with the CV. (I know that the internal calc are done with floats)
I lose too much resolution when I scale down my raw numbers to integers. I'm planning on writing the code to support floating point inputs, calculations and outputs. Then they can be scaled down to integers if required for an analog output card. Did any one do this before? Is it available online?

Thanks

C

#### Curt Wuollet

You can often get around the need for floats by multiplying everything
by a thousand or ten thousand. It's not just that simple of course, but
thinking millivolts instead of volts, etc. just improved your resolution
by a bunch. That's why they can set this up for integers.

Regards

cww

T

#### Torulf Wiberg

Sebastien,

If your PV is supplied via an analog input that is readable as raw counts
then there is no loss in precision running the PID with 'counts' i.e.
unscaled binary values. This is valid if your PID can handle the numerical
range of your PV and CV in raw counts and if you statement "I know that the
internal calc are done with floats" giving a larger precision for things
like integral accumulator.
The approach is not of the beautiful kind, but, as we all know, part of the
art of engineering is making best use of what you have at hands.

/T

-------------------------------------------------------
Torulf Wiberg Tel. +46 (0)411 533 110
Deterministic Control AB Fax +46 (0)703 83 08 08
Karl Kulls v=E4g 6 Mob. +46 (0)70 595 09 97
SE-274 56 Abbek=E5s
SWEDEN

J

#### Johan Bengtsson

How many bits does your analog input and output cards support? more than 16? If yes then you are quite unusual and would have a limitation in resolution, if not then this actually isn't an issue if you use the right scale (the best scale is to not change anything at all from the input A/D.

Are you sure the internals use float? I actually doubt it but I do not know about this particular implementation.

/Johan Bengtsson

----------------------------------------
P&L, Innovation in training
Box 252, S-281 23 H{ssleholm SWEDEN
Tel: +46 451 49 460, Fax: +46 451 89 833
E-mail: [email protected]
Internet: http://www.pol.se/
----------------------------------------

S

#### SIDHPURKBPL

hi all,
regarding the internal floats. well it is a 386sx processor. no fpu. so it would need to be emulation if at all it is there. in my case, with the 90-30 i simply scale all data from 0-32000. this way the actual loss of resolution is small. if resolution is an issue, then there is support for the double data type which is signed 32 bits and should be adequate for most, if not all purposes. mail me if i have not made myself clear about any part.
regards
tomy zacharia
instrumentation engineer