Forum

S7-300 SM 331 level...
 
Notifications
Clear all

[Solved] S7-300 SM 331 level scaling shows only 0, 25, 50, 75 percent, DINT maths

7 Posts
4 Users
0 Reactions
55 Views
(@bram99)
Trusted Member
Joined: 1 year ago
Posts: 33
Topic starter   [#10]

Sorry if this is basic, it's my first analog signal. Water tank 4 metres tall, level transmitter 4 to 20mA into an SM 331 on a CPU 315-2 DP, STEP 7 5.6, channel is PIW 256.

I take PIW 256 into a DINT with ITD, divide by 6912 counts per metre, then multiply by 25 for percent. The HMI only ever shows 0, 25, 50, 75 or 100 and nothing in between. Watched the tank fill this morning and it sat on 25 for ten minutes, then jumped straight to 50.

I swapped the transmitter for the spare and got the same thing, and the channel is set to 4 to 20mA in HW Config. Someone in the office reckoned it's a 12 bit card so maybe the resolution is too low. Not sure if a 12 bit card is really only good for four steps up a 4 metre tank, or if it's my divide by 6912 that won't give me anything in between.


Advertisement

   
Quote
(@marekw)
New Member
Joined: 2 years ago
Posts: 0
 

Before the maths, prove the loop. Put a meter in series with the transmitter. What mA at the level you've got right now, and at the same moment what does PIW 256 show raw in a VAT table? If the raw count creeps up smoothly while the percent sits still, the transmitter and the card are fine and it's the maths.


Advertisement

   
ReplyQuote
(@bram99)
Trusted Member
Joined: 1 year ago
Posts: 33
Topic starter  

Meter says 9.8mA at about 1.4m on the sight glass. What's a VAT table, the monitor table? In that one PIW 256 reads 10018 and it creeps up nicely as the tank fills. Percent stays at 25.

10018 divided by 6912 is 1.449, which is right for metres, so the raw's fine? I did the whole thing in DINT because I read somewhere that REAL is slow on the 300.



   
ReplyQuote
 joeb
(@joeb)
New Member
Joined: 7 months ago
Posts: 0
 

I'm learning on a Micro820 and did nearly the same thing last month. Is it the divide throwing the decimal away? Mine only ever showed whole numbers.



   
ReplyQuote
(@sergio74)
New Member
Joined: 2 years ago
Posts: 0
 

Yes. VAT is the variable table. ITD gives you a DINT, DIV_DI on two DINTs gives you a DINT, so 10018 / 6912 is 1 and the .449 is gone before you ever multiply. 1 times 25 is 25. Below 6912 counts it's 0. Nothing wrong with the card. 12 bits is 27648 steps over the range.

Convert first, then divide. ITD, then DTR, then DIV_R by 276.48. Or do the full scaling formula in REAL for the day the low end isn't zero, REAL isn't too slow for one level signal.

Or drop FC105 SCALE in from the Standard Library, TI-S7 Converting Blocks. IN is your PIW, HI_LIM 100.0, LO_LIM 0.0, BIPOLAR false, OUT is a REAL. Someone did a decent article on the module side: https://plctr.com/understanding-the-basics-of-input-output-modules-in-automation/



   
ReplyQuote
(@bram99)
Trusted Member
Joined: 1 year ago
Posts: 33
Topic starter  

Put FC105 in with 0.0 and 100.0 this morning. HMI shows 36.2 percent and it moves as the tank fills.

So it was my own divide all along. Doing it in DINT threw the decimal part away before the times 25, which is why the answer could only ever land on 0, 25, 50, 75 or 100. Nothing wrong with the card or the transmitter, and FC105 SCALE into a REAL tag sorted the lot.

I had it backwards about REAL, I think. It was the integer that was the problem, not the speed.

One thing I haven't understood. FC105 has a BIPOLAR input and I left it false. Do I ever need it true on a 4 to 20 channel? Thanks sergio74, marekw and joeb.



   
ReplyQuote
(@marekw)
New Member
Joined: 2 years ago
Posts: 0
 

Bipolar is for plus and minus 10V. Leave it false for 4 to 20.



   
ReplyQuote
Share: