plc.myforum.ro Forum Index plc.myforum.ro
PLCs users www.plc.myforum.ro!
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Accuracy reading Power metter mfm384 and cm1241

 
Post new topic   Reply to topic    plc.myforum.ro Forum Index -> Simatic Automation Systems
View previous topic :: View next topic  
Author Message
huynhtrong
Junior 2
Junior 2


Joined: 23 Apr 2017
Posts: 21
Location: vietnam

PostPosted: 29/03/2019 04:21    Post subject: Accuracy reading Power metter mfm384 and cm1241 Reply with quote

Dear our friend,
I'm facing with problem when i read numeroase power metter mfm384 using modbus rtu to collect kwh data .But the accurancy ,data is difference in the screen metter .WIth v1,v2,v3 and f,pf is correct .
example some data kwh from plc reading and power meter screen:
121581.3-121810.3
121581.4-121810.4

i'm sorry my english is not good
thanks for your help.
_________________
aaaa
Back to top
View user's profile Send private message
Aminabed132
Junior
Junior


Joined: 16 Aug 2018
Posts: 7

PostPosted: 29/03/2019 11:34    Post subject: Reply with quote

121810.3 power meter screen
121581.3 kwh from plc
If this is the situation check how do you read data on Modbus...
Back to top
View user's profile Send private message
huynhtrong
Junior 2
Junior 2


Joined: 23 Apr 2017
Posts: 21
Location: vietnam

PostPosted: 31/03/2019 04:23    Post subject: Reply with quote

Aminabed132 wrote:
121810.3 power meter screen
121581.3 kwh from plc
If this is the situation check how do you read data on Modbus...


I read 2 register and convert to float .that's is code in scl :
temp1.%w1 = buffer[0];
temp1.%w0 = buffer[1];
data_convert := Dword_to_real(temp1);

with u1,w1,v1,pf,F,I is correct with value in the display power metter.
But with total kwh is difference .
Thanks for your help
_________________
aaaa
Back to top
View user's profile Send private message
Aminabed132
Junior
Junior


Joined: 16 Aug 2018
Posts: 7

PostPosted: 31/03/2019 13:47    Post subject: Reply with quote

You are always transmitting a number of 16 bit registers.
Accuracy reading Power metter mfm384 and cm1241
Probably the second register has 0000 and do not get error for the first two values.
If one of the registers has 1234(hex) and the other has abcd(hex) you have combine them into the 32 bit float register.
Try as 1234abcd if that doesn't look right when viewed as a float try abcd1234. It will probably be one of those two formats.
Use this 'floating point calculator'
https://www.h-schmidt.net/FloatConverter/IEEE754.html
to be very helpful.
Read the two numbers in hex. Let's say you have 12(hex) and ab(hex)
Place them into the 'hexadecimal representation' area first as 1200ab (the two leading zeroes are needed for the second part) and also try as ab0012.
See which gives the floating point number to what you are expecting and proceed.
Back to top
View user's profile Send private message
huynhtrong
Junior 2
Junior 2


Joined: 23 Apr 2017
Posts: 21
Location: vietnam

PostPosted: 01/04/2019 05:51    Post subject: Reply with quote

Aminabed132 wrote:
You are always transmitting a number of 16 bit registers.
Accuracy reading Power metter mfm384 and cm1241
Probably the second register has 0000 and do not get error for the first two values.
If one of the registers has 1234(hex) and the other has abcd(hex) you have combine them into the 32 bit float register.
Try as 1234abcd if that doesn't look right when viewed as a float try abcd1234. It will probably be one of those two formats.
Use this 'floating point calculator'
https://www.h-schmidt.net/FloatConverter/IEEE754.html
to be very helpful.
Read the two numbers in hex. Let's say you have 12(hex) and ab(hex)
Place them into the 'hexadecimal representation' area first as 1200ab (the two leading zeroes are needed for the second part) and also try as ab0012.
See which gives the floating point number to what you are expecting and proceed.

I'm reading right value from power meter follow instruction .
I'm using s7 1200 -sm1241 reading 14 slave mfm384.I face a problem is crash module after i reading 1 day the Tx Rx led is not blink and stuck in slave 1.
Here is code :
////////////////
//step 1 :

//"Modbus_Config".Req := "Modbus_Config".Temp1;
IF "FirstScan" OR "Modbus_Config".Error THEN
"Modbus_Config".Step := 1;
"Modbus_Config".Slave_Add := 2;//load data in first scan
"Modbus_Config".EnableCaculate := true;
"Modbus_Config".Temp1 := FALSE;


END_IF;
// // sent request and move step
IF ("Modbus_Config".Step = 1 AND NOT "Modbus_Config".Temp1 AND "Modbus_Config".EnableCaculate) THEN
"Modbus_Config".Step := 2;
"Modbus_Config".Temp1 := TRUE;

END_IF;

IF ("Modbus_Config".Step = 2 AND "Modbus_Config".Temp1) THEN
"Modbus_Config".Req := "Modbus_Config".Temp1 AND NOT "Modbus_Config".Busy;

END_IF;

//recived response and next step to move data from buffer
IF ("Modbus_Config".Done AND "Modbus_Config".Step =2) THEN
"Modbus_Config".Step := 3;

END_IF;
//move data
IF "Modbus_Config".Step = 3 THEN
"Modbus_Config".Temp1 := FALSE;
//timer delay for execute
"timer_delay".TON(IN := NOT "Modbus_Config".Temp1,
PT := T#1s);
"Move_Data"(finis => "Modbus_Config".Temp2,
SlaveID := "Modbus_Config".Slave_Add);
IF "Modbus_Config".Temp2 AND "timer_delay".Q THEN
"Modbus_Config".Temp2 := FALSE;

"Modbus_Config".Step := 4;//convert data from word to real
END_IF;

END_IF;
//swap word to real data and incresae slave_address for next process
IF "Modbus_Config".Step = 4 THEN
"Modbus_Config".EnableCaculate := FALSE;
//caculate data
"ConvertData"(SlaveID := "Modbus_Config".Slave_Add,
enable := "Modbus_Config".EnableCaculate);

// call funtion move data to Data_kwh


IF "Modbus_Config".EnableCaculate THEN
"Modbus_Config".Step := 1;
"Modbus_Config".Temp1 := FALSE;
"Modbus_Config".Slave_Add := "Modbus_Config".Slave_Add + 1;
IF "Modbus_Config".Slave_Add > 14 THEN
"Modbus_Config".Slave_Add := 1;

END_IF;
END_IF;
END_IF;

thanks for your helping[/code]
_________________
aaaa
Back to top
View user's profile Send private message
puphajokk
Junior
Junior


Joined: 21 Mar 2019
Posts: 1

PostPosted: 02/04/2019 11:11    Post subject: Reply with quote

use this tool..
Accuracy reading Power metter mfm384 and cm1241
http://www.simplymodbus.ca/TCPclient.htm
Back to top
View user's profile Send private message
Catas Alvaro
Junior
Junior


Joined: 19 Jan 2019
Posts: 3

PostPosted: 02/04/2019 15:25    Post subject: Reply with quote

https://plc-hmi-scadas.com/083.php
https://plc-hmi-scadas.com/TIA_Portal_Modbus_RTU.php
https://plc-hmi-scadas.com/084.php
Back to top
View user's profile Send private message
Aminabed132
Junior
Junior


Joined: 16 Aug 2018
Posts: 7

PostPosted: 02/04/2019 16:13    Post subject: Reply with quote

huynhtrong wrote:
Aminabed132 wrote:
You are always transmitting a number of 16 bit registers.
Accuracy reading Power metter mfm384 and cm1241
Probably the second register has 0000 and do not get error for the first two values.
If one of the registers has 1234(hex) and the other has abcd(hex) you have combine them into the 32 bit float register.
Try as 1234abcd if that doesn't look right when viewed as a float try abcd1234. It will probably be one of those two formats.
Use this 'floating point calculator'
https://www.h-schmidt.net/FloatConverter/IEEE754.html
to be very helpful.
Read the two numbers in hex. Let's say you have 12(hex) and ab(hex)
Place them into the 'hexadecimal representation' area first as 1200ab (the two leading zeroes are needed for the second part) and also try as ab0012.
See which gives the floating point number to what you are expecting and proceed.

I'm reading right value from power meter follow instruction .
I'm using s7 1200 -sm1241 reading 14 slave mfm384.I face a problem is crash module after i reading 1 day the Tx Rx led is not blink and stuck in slave 1.
Here is code :
////////////////
//step 1 :

//"Modbus_Config".Req := "Modbus_Config".Temp1;
IF "FirstScan" OR "Modbus_Config".Error THEN
"Modbus_Config".Step := 1;
"Modbus_Config".Slave_Add := 2;//load data in first scan
"Modbus_Config".EnableCaculate := true;
"Modbus_Config".Temp1 := FALSE;


END_IF;
// // sent request and move step
IF ("Modbus_Config".Step = 1 AND NOT "Modbus_Config".Temp1 AND "Modbus_Config".EnableCaculate) THEN
"Modbus_Config".Step := 2;
"Modbus_Config".Temp1 := TRUE;

END_IF;

IF ("Modbus_Config".Step = 2 AND "Modbus_Config".Temp1) THEN
"Modbus_Config".Req := "Modbus_Config".Temp1 AND NOT "Modbus_Config".Busy;

END_IF;

//recived response and next step to move data from buffer
IF ("Modbus_Config".Done AND "Modbus_Config".Step =2) THEN
"Modbus_Config".Step := 3;

END_IF;
//move data
IF "Modbus_Config".Step = 3 THEN
"Modbus_Config".Temp1 := FALSE;
//timer delay for execute
"timer_delay".TON(IN := NOT "Modbus_Config".Temp1,
PT := T#1s);
"Move_Data"(finis => "Modbus_Config".Temp2,
SlaveID := "Modbus_Config".Slave_Add);
IF "Modbus_Config".Temp2 AND "timer_delay".Q THEN
"Modbus_Config".Temp2 := FALSE;

"Modbus_Config".Step := 4;//convert data from word to real
END_IF;

END_IF;
//swap word to real data and incresae slave_address for next process
IF "Modbus_Config".Step = 4 THEN
"Modbus_Config".EnableCaculate := FALSE;
//caculate data
"ConvertData"(SlaveID := "Modbus_Config".Slave_Add,
enable := "Modbus_Config".EnableCaculate);

// call funtion move data to Data_kwh


IF "Modbus_Config".EnableCaculate THEN
"Modbus_Config".Step := 1;
"Modbus_Config".Temp1 := FALSE;
"Modbus_Config".Slave_Add := "Modbus_Config".Slave_Add + 1;
IF "Modbus_Config".Slave_Add > 14 THEN
"Modbus_Config".Slave_Add := 1;

END_IF;
END_IF;
END_IF;

thanks for your helping[/code]


This code has not significance on casting values...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    plc.myforum.ro Forum Index -> Simatic Automation Systems All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Fa-ti si tu propriul forum GRATUIT, pe www.myforum.ro