Gateways and Energy Servers
Schneider Electric support forum to share knowledge about product selection, installation and troubleshooting for EcoStruxure Panel Server, PowerTag, Com'X, Link150…
User | Count |
---|---|
82 | |
46 | |
28 | |
28 |
Link copied. Please paste this link to share this article on your social media post.
We are trying to get data from a PM750 on a custom webpage.
We followed the instructions from .
But we do not get any data. ( we use PL tags)
Any tips?
Regards Jos.
example code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd\">
<!-- Copyright 2009 Schneider Electric. All Rights Reserved. -->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="refresh" content="5">
<title>Frequency - PM750</title>
</head>
<body style="font-family:Arial" onLoad="updateData();">
<form name="view_form">
<div id="time_spot" style="text-align: center"></div>
<table border="1" cellspacing="0" style="width: 600px; marginleft:auto; margin-right:auto">
<tr>
<td colspan="3" style="width: 600px; text-align: center; fontweight:bold; font-size: x-large">Frequency - PM750</td>
</tr>
<tr>
<td style="width: 300px; text-align: center">Frequency</td>
<td style="width: 90px; text-align: center"id="frequency"></td>
<td style="width: 100px; text-align: center">Hz</td>
</tr>
</table>
<br /><hr style="width:66%; height:1px" /><div style="textalign:center; font-size: small">© 2011 Schneider Electric. All rights reserved.</div>
</form>
<script type="text/javascript">
function updateData() {
// Read Registers (this is actually done when the page is served by the EGX300)
Registers = [PL__2^4013__PL];
// Assign Data Values
Frequency = Registers[0];
// Scale Frequency
Frequency *= 0,01;
// Put data on the page
document.getElementById("frequency").innerHTML = Frequency;
}
</script>
</body>
</html>
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Hi Jos,
Let me see if we can get you some help.
James
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Also, the Frequency in the PM750 is located at register 1020 and it is 2 registers long. So, your PL Tag should look like this: PL__*^H1020[2]__PL, where * = the device ID assigned in the EGX.
Another note. Frequency is stored as a IEEE754 floating point formatted number. So, to get the actual value, you will have to convert the data received into this format. Here is a webpage that does that conversion and also explains the parts of the number (sign, exponent, and mantissa) IEEE-754 Floating-Point Conversion from 32-bit Hexadecimal to Floating-Point
Link copied. Please paste this link to share this article on your social media post.
We did a succesful test with a PM710 a long time ago.
This is the code. (As you can see, a PM7X0 is not easy to use in a custom web page.)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>pagina 1</title>
<meta name="generator" content="WYSIWYG Web Builder - http://www.wysiwygwebbuilder.com">
<style type="text/css">
body
{
background-color: #FFFFFF;
color: #000000;
}
</style>
<meta http-equiv="refresh" content="5">
</head>
<body style="font-family:Arial" onLoad="updateData();"
>
<script type="text/javascript">
function updateData()
{
R1=[PL__20^H1014[2]__PL];
var BinWaarde11=dec2bin(R1[0]);
var BinWaarde12=dec2bin(R1[1]);
BinWaarde11=makelength(BinWaarde11);
BinWaarde12=makelength(BinWaarde12);
var BinWaarde1=BinWaarde11+BinWaarde12;
var Waarde1=IEEE754(BinWaarde1);
document.getElementById("cel_1").innerHTML=Waarde1.toFixed(1);
R2=[PL__20^H1016[2]__PL];
var BinWaarde21=dec2bin(R2[0]);
var BinWaarde22=dec2bin(R2[1]);
BinWaarde21=makelength(BinWaarde21);
BinWaarde22=makelength(BinWaarde22);
var BinWaarde2=BinWaarde21+BinWaarde22;
var Waarde2=IEEE754(BinWaarde2);
document.getElementById("cel_2").innerHTML=Waarde2.toFixed(1);
R3=[PL__20^H1018[2]__PL];
var BinWaarde31=dec2bin(R3[0]);
var BinWaarde32=dec2bin(R3[1]);
BinWaarde31=makelength(BinWaarde31);
BinWaarde32=makelength(BinWaarde32);
var BinWaarde3=BinWaarde31+BinWaarde32;
var Waarde3=IEEE754(BinWaarde3);
document.getElementById("cel_3").innerHTML=Waarde3.toFixed(1);
R4=[PL__20^H1006[2]__PL];
var BinWaarde41=dec2bin(R4[0]);
var BinWaarde42=dec2bin(R4[1]);
BinWaarde41=makelength(BinWaarde41);
BinWaarde42=makelength(BinWaarde42);
var BinWaarde4=BinWaarde41+BinWaarde42;
var Waarde4=IEEE754(BinWaarde4);
document.getElementById("cel_4").innerHTML=Waarde4.toFixed(1);
R5=[PL__20^H1000[2]__PL];
var BinWaarde51=dec2bin(R5[0]);
var BinWaarde52=dec2bin(R5[1]);
BinWaarde51=makelength(BinWaarde51);
BinWaarde52=makelength(BinWaarde52);
var BinWaarde5=BinWaarde51+BinWaarde52;
var Waarde5=IEEE754(BinWaarde5);
document.getElementById("cel_5").innerHTML=Waarde5.toFixed(3);
}
function dec2bin(x)
{
x = parseInt(x);
var bin = x.toString(2);
var hex = x.toString(16).toUpperCase();
var octal = x.toString(8);
return bin;
}
function bin2dec(x)
{
x = parseInt(x, 2);
var dec = x.toString(10);
var hex = x.toString(16).toUpperCase();
var octal = x.toString(8);
return dec;
}
function IEEE754(x)
{
// test is the bin is 32 bits or 31bits (in case of 0) and add a zero before it
var length=x.length;
if(length=31)
x=0+x;
// divide the bin in 3 parts
var part1 = Left(x,1);
var part2 = Left(Right(x,31),8);
var part3 = Right(x,23);
part2 = bin2dec(part2)-127;
// start of part3 transformation
var DecPart3= parseInt(1);
var y=parseInt(23);
var z=parseInt(1);
while (y>0)
{
var BitPart3 = Left(Right(part3,y),1);
DecPart3 = DecPart3 + (BitPart3*(Math.pow(0.5,z)));
y=y-parseInt(1);
z=z+parseInt(1);
}
return (Math.pow(-1,part1)*Math.pow(2,part2)*DecPart3) ;
}
function Left(str, n){
if (n <= 0)
return "";
else if (n > String(str).length)
return str;
else
return String(str).substring(0,n);
}
function Right(str, n){
if (n <= 0)
return "";
else if (n > String(str).length)
return str;
else {
var iLen = String(str).length;
return String(str).substring(iLen, iLen - n);
}
}
function makelength(x)
{
var d=x.length;
if(d<16)
{
var m=16-d;
for (i=m;i>0;i--)
{
x=0+x;
}
}
return x;
}
</script>
<table style="position:absolute;left:630px;top:295px;width:340px;height:110px;z-index:0;border:2px #000000 solid;" cellpadding="0" cellspacing="1" id="Table1">
<tr>
<td align="right" valign="top" style="border:1px #C0C0C0 solid;width:104px;height:18px;">
<font style="font-size:13px" color="#000000" face="Arial">Spanning L-L:</font></td>
<td align="center" valign="top" style="border:1px #C0C0C0 solid;width:172px;height:18px;" id="cel_1">
</td>
<td align="left" valign="top" style="border:1px #C0C0C0 solid;height:18px;">
<font style="font-size:13px" color="#000000" face="Arial">V</font></td>
</tr>
<tr>
<td align="right" valign="top" style="border:1px #C0C0C0 solid;width:104px;height:18px;">
<font style="font-size:13px" color="#000000" face="Arial">Spanning L-N:</font></td>
<td align="center" valign="top" style="border:1px #C0C0C0 solid;width:172px;height:18px;" id="cel_2">
</td>
<td align="left" valign="top" style="border:1px #C0C0C0 solid;height:18px;">
<font style="font-size:13px" color="#000000" face="Arial">V</font></td>
</tr>
<tr>
<td align="right" valign="top" style="border:1px #C0C0C0 solid;width:104px;height:18px;">
<font style="font-size:13px" color="#000000" face="Arial">Stroom:</font></td>
<td align="center" valign="top" style="border:1px #C0C0C0 solid;width:172px;height:18px;" id="cel_3">
</td>
<td align="left" valign="top" style="border:1px #C0C0C0 solid;height:18px;">
<font style="font-size:13px" color="#000000" face="Arial">A</font></td>
</tr>
<tr>
<td align="right" valign="top" style="border:1px #C0C0C0 solid;width:104px;height:18px;">
<font style="font-size:13px" color="#000000" face="Arial">Vermogen:</font></td>
<td align="center" valign="top" style="border:1px #C0C0C0 solid;width:172px;height:18px;" id="cel_4">
</td>
<td align="left" valign="top" style="border:1px #C0C0C0 solid;height:18px;">
<font style="font-size:13px" color="#000000" face="Arial">kW tot</font></td>
</tr>
<tr>
<td align="right" valign="top" style="border:1px #C0C0C0 solid;width:104px;height:18px;">
<font style="font-size:13px" color="#000000" face="Arial">Energie:</font></td>
<td align="center" valign="top" style="border:1px #C0C0C0 solid;width:172px;height:18px;" id="cel_5">
</td>
<td align="left" valign="top" style="border:1px #C0C0C0 solid;height:18px;">
<font style="font-size:13px" color="#000000" face="Arial">kWh</font></td>
</tr>
</table>
<div id="wb_Image1" style="margin:0;padding:0;position:absolute;left:576px;top:54px;width:453px;height:178px;text-align:left;z-index:1;">
<img src="Logo_orange_rgb_75p.jpg" id="Image1" alt="" border="0" style="width:453px;height:178px;"></div>
<div id="wb_Image2" style="margin:0;padding:0;position:absolute;left:143px;top:66px;width:389px;height:581px;text-align:left;z-index:2;">
<img src="bord_Prisma_15p%20copy_01.jpg" id="Image2" alt="" border="0" style="width:389px;height:581px;"></div>
</body>
</html>
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
It looks like, unless the Modbus data format is unsigned 16 bit, all registers need to be rearranged in order to show correct data in the custom web page.
The example, that Philippe gives, shows how to display floating point values. Long registers (32 bit) and signed 16 bit and 32 bit registers, ... also require a conversion.
Is there any document available describing how to do these conversions?
As most registers types are supported by the EGX (default pages), these functions must already be incorporated in the device, right?
Link copied. Please paste this link to share this article on your social media post.
Hi Daniel,
Yes, you are correct. The data returned from a Modbus Read function is a 16 bit unsigned integer. We do not have a document that describes how to convert raw data to Engineering units. However, there is a file on-board the EGX300 called "realtimedata.js" that does all of these conversions. You can use this file as a reference (or to just copy code) for your conversions.
Please let me know if I can be of further assistance.
Randi
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.