Ask our Experts
Didn't find what you are looking for? Ask our experts!
Launch of Consumer/Home Owner registration process! We are pleased to announce the commencement of the Consumer/Home Owner Registration Process on Community. Consumers/Home Owners may now proceed to register by clicking on Login/Register. The process is straightforward and designed to be completed in just a few steps.
Schneider Electric support forum to share knowledge about product selection, installation and troubleshooting for EcoStruxure Panel Server, PowerTag, Com'X, Link150…
Search in
User | Count |
---|---|
109 | |
52 | |
46 | |
32 |
Link copied. Please paste this link to share this article on your social media post.
There are several resources describing how to create custom pages to display multiple devices in a same page, how to troubleshoot, how to dynamically display device registers without reloading the whole html page:
What I'm going to show here is not described in any documents up to now.
All the examples are referring to simple measurements of 1 register. This register is converted to a float value using another single register containing the scaling factor.
There are devices which use Float32 measurements, so that takes 2 registers. (1 register means 1 Modbus Register = 1 Holding Register = 16 bits).
So, the JavaScript code has to read 2 consecutive registers for each Float32 value, then it has to use EGX300's embedded JavaScript code to convert each group of 2 Registers into Float32 Data Values.
Here is an example of a static shtml page (refreshed by the meta tag every 2 seconds) that reads 3 values from a PM3255 meter which has Slave Address 14.
<html>
<head>
<meta http-equiv="refresh" content="2">
<title>PM3255 - Slave ID = 14</title>
<script language="javascript" type="text/javascript" src="/realtimedata.js"></script>
</head>
<body style="font-family:Arial" onLoad="updateData();">
<form name="view_form">
<table border="1" cellspacing="0" style="width: 600px; marginleft: auto; margin-right:auto">
<tr>
<td colspan="3" style="background-color: #A9A39C; width: 600px; text-align: center; font-weight: bold; font-size: x-large">PM3255 - Slave ID = 14</td>
</tr>
<tr>
<td style="width: 300px; text-align: center; font-weight: bold;">Frequency</td>
<td style="width: 90px; text-align: center" id="frequency"></td>
<td style="width: 100px; text-align: center">Hz</td>
</tr>
<tr>
<td style="width: 300px; text-align: center; font-weight: bold;">Current</td>
<td style="width: 90px; text-align: center" id="current"></td>
<td style="width: 100px; text-align: center">Amps</td>
</tr>
<tr>
<td style="width: 300px; text-align: center; font-weight: bold;">Voltage</td>
<td style="width: 90px; text-align: center" id="voltage"></td>
<td style="width: 100px; text-align: center">Volts</td>
</tr>
<tr>
</table>
</form>
<br />
<hr align="left" width="600px"/>
<div style="textalign: auto; font-size: small">© 2015 Schneider Electric. All rights reserved.</div>
<script type="text/javascript">
function updateData()
{
// Read Registers (this is actually done when the page is served by the EGX300)
Registers =[PL__14^3010,3011,3036,3037,3110,3111__PL];
// Convert each group of 2 Registers into Float32 Data Values
CurrentAvg = ConvertIEE754(Registers[0],Registers[1]);
VoltageAvg = ConvertIEE754(Registers[2],Registers[3]);
Frequency = ConvertIEE754(Registers[4],Registers[5]);
// Put data on the page, formatting the text to fixed number of decimals
document.getElementById("current").innerHTML = CurrentAvg.toFixed(3);
document.getElementById("voltage").innerHTML = VoltageAvg.toFixed(1);
document.getElementById("frequency").innerHTML = Frequency.toFixed();
}
</script>
</body>
</html>
I hope this helps as a starting example for more complex scripts.
______________________________________________________
Created on 6th NOV 2015 by
Adrian Dicea
Global Expert Technical Support Engineer - Support Prime PSE / EGX
You’ve reached the end of your document
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.