Accuracy of S7-200 compared with S7-300 and MATLAB

netronio

Member
Join Date
Nov 2006
Location
Thesaloniki
Posts
5
I am a student and i am doing a dissertation which condists of implementing a predictive control algorithm in the PLC.

In the laboratory we have a PLC S7-300 with CPU 313C-2DP and a PLC S7-200 with CPU 222 connected with EM 277

The main idea is to implement the algorithm first in the S7-300 and then in the S7-200 to see the differences and the response times of each controller.

The predictive control algorithms have a large amount of calculations that must be executed in each sampling period.

In general,in each sampling instant

150*(a*b*c*d) additions and
150*(a*b*c*d) multiplications

where a ranges from 0 to 88
b ranges from 0 to 86
c ranges from 0 to 21
d ranges from 0 to 23

have to be done

The algorithm gradually increanse the parameters.

What i have realised is that as the parameters increase, so the accuracy of the results differ from the expected values.
The expected values are computed in MATLAB so a slight difference is expected.But the strange thing is that the implementation with the S7-300 controller give differents results with the S7-200 controller.

I also did another experiment in order to test it.
I wrote a program in MATLAB which generates 2 arrays with size 200 of random elements following normal distribution.
I multiplied the elements and gor the result.The I did this procedure with both S7-300 and S7-200.
For doing this experiment twice with different numbers,i got the results:

MATLAB S7-300 S7-200
-19.901 -19.90173 -20.04157
-12.478 -12.47769 -12.20856

So an obvious difference in the results of S7-200 can be seen.My question is,is it possible that the S7-200 have a different accuracy(especially when they are dealing with floating point numbers) that can affect the result of a procedure?
When a lot a calculations is needed,the result will differ considerably from expected?
And,why has different results with S7-300 although they use pretty much the same technology?

thank you in advance,
Giannis Sdrolias
 
Last edited:
First of all, you should use vpa function in MATLAB to enable at least 5 digits after decimal point in order to comapre it better.
I also notice slight difference when comparing S/-300 and Matlab, but didn't work with S7-200. It will be interesting to read other opinions on this issue. Good luck with your research.
Regards
 
Extract from the S7-200 system manual:

Real (or floating-point) numbers are represented in the format described in the ANSI/IEEE 754--1985 standard
(single-precision). Refer to that standard for more information.

A description of the mentioned standard can be found here on Wikipedia.

Maybe this info can help shed a little bit of light on the subject.

Kind regards,
 
netronio said:
And,why has different results with S7-300 although they use pretty much the same technology?

The 200s and 300s (unless you are using the term very loosely) do not use the same technology. They use very different processors and the memory and instruction set is completely different. They weren't even developed by the same divisions at Siemens. You might as well be comparing an S7300 with a SLC500.

Maybe the results should be the same for other reasons, but not because the processors are similar.
 
I would check how the numbers are rounded.

There are four ways to round numbers. Also, the number of guard bit may differ.

It could be that your numerical methods technqie is poor and that makes matters worse. I fight these problems all the time.

I recently had a similar problem. I had to convert a linear to discrete system and do this in an embedded system without the aid of Matlab, Scilab or Mathcad.

It would be helpful to know exactly what you are doing. I know that matrix math requires a lot of mulitplies and adds. Adding small numbers to big numbers is a sure way to lose precision.
 
Any chance you could post the S7-300 project ? I would be interested to see the results produced by PLCSIM, a 315 and 317 running the same code.
 

Similar Topics

I am working on an installation that will require sensor cabling interconnecting sensors to PLC subject to outdoor temperatures. Will the ambient...
Replies
3
Views
2,063
So I have a plc program where most of the outputs are based on a counter that goes from 0 to 1000. The counter speed is adjustable and is...
Replies
23
Views
5,931
I have been working for a small turn key machine builder. We mostly do table top machine which do a few automated steps in assembling a product...
Replies
20
Views
5,332
Using a 1769-IT6 module with a Type K thermocouple, we're seeing a +7 degree C offset. We used a calibrated fluke tester and simulated both 0C...
Replies
12
Views
2,729
Hi... I am using AB MPL-B540K with Kinetix6200 and CLX 1756-L72, 1756-M03SE sercos interface for flying shear application cutting metal sheet with...
Replies
7
Views
2,356
Back
Top Bottom