Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Notifications
Login / Register
Community
Community
Notifications
close
  • Forums
  • Knowledge Center
  • Events & Webinars
  • Ideas
  • Blogs
Help
Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Login / Register
Sustainability
Sustainability

Join our "Ask Me About" community webinar on May 20th at 9 AM CET and 5 PM CET to explore cybersecurity and monitoring for Data Center and edge IT. Learn about market trends, cutting-edge technologies, and best practices from industry experts.
Register and secure your Critical IT infrastructure

Send StruxureWare Lite aka Can2Go data to Energy Operation

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…

cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Home
  • Schneider Electric Community
  • EcoStruxure Power & Grid
  • Gateways and Energy Servers
  • Send StruxureWare Lite aka Can2Go data to Energy Operation
Options
  • Mark Topic as New
  • Mark Topic as Read
  • Float this Topic for Current User
  • Bookmark
  • Subscribe
  • Mute
  • Printer Friendly Page
Invite a Co-worker
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send Invite Cancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Send New Invite Close
Top Experts
User Count
Romain_Polette
Spock Romain_Polette Spock
98
Randi_Dolan
Commander Randi_Dolan Commander
46
Guillaume_Evrard
Commander Guillaume_Evrard Commander
43
Thierry_Baudard
Commander Thierry_Baudard Commander
30
View All

Invite a Colleague

Found this content useful? Share it with a Colleague!

Invite a Colleague Invite
Back to Gateways and Energy Servers
LaurentCoene
Captain LaurentCoene Captain
Captain

Posted: ‎2014-10-20 07:01 PM

1 Like
0
497
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2014-10-20 07:01 PM

Send StruxureWare Lite aka Can2Go data to Energy Operation

Even though, we do have the great article from , many people have been asking for this old post from the defunct energyoperation.info blog. So there it is:

In our second topic about the StruxureWare Lite offer, we’ll show you how, thanks to the Lua scripting languague, you can create native EO file format (or any file format) and send them to Energy Operation.

First you need to identify the data you want to send and create the metes in Energy Operation. Again, since it’s all scripted in Lua, you could use whatever you want, but in our case, I decided to use the Name of the objects. You can see that in your explorer window:

5002

For the temperature sensors, just select the sensor in the tree, and it will also appear in the grid.

5003

Log in to Energy Operation, and create your metering tags where you want to see the data:

5004

Now Energy Operation is ready to receive the data.

Next, we need to create the actual csv file in the StruxureWare Lite box. To do that, we need to create a Lua script.

In the explorer view, click on Add Objects (the little + green icon):

5005

Then in the filter, select “Lua Program”. Select of of the available program which will then appear as selected in the right list, and click on Add Objects.

5006

Now your script will appear in the Explorer windows for your SmartStruxure Controller.

Select the newly created script, and rename it to whatever makes sense to you. In our case, it’s “Create EO File Lua Program”.

5007

Here is the code you need to put:

if createEOFileInit == nil then -- Initialization

createEOFileInit = true

  -- Interval Length in minutes

intervalLenght = 5

  -- Initialize list of devices.topics (tags) to be trended

  -- The Object Name is the Unique ID in Energy Operation and should be unique to the implementation.

tags = {"AI44", "AV3"}

-- File name

  fileName = scl.getserial() .. "_" .. scl.getmac():gsub(":", "") .. "_" .. ME.CFG1_Node_Instance.value .. ".csv"

  -- File Header

  header = "## ACTION:UPDATE ENTITY:MeterData SCHEMA:Default VERSION:1.0.0".."\r\n" .. "AcquisitionDateTime,Value,MeterLocalId\r\n"

else

-- This section will read points at every interval and write to the CSV file

timer = os.date("*t")

if timer.min % intervalLenght == 0 and flag == 0 then -- Run at every intervals

  buffer = ""

for tagIndex = 1, #tags do -- Generate string with all arguments to be written to CSV

timestamp = string.sub(os.date(),0,10) .. "T" .. string.sub(os.date(),12,19) .. ".0000000+00:00,"

arglist = scl.nodes["ME"][tags[tagIndex] .. "_Present_Value"].value .. "," .. scl.nodes["ME"][tags[tagIndex] .. "_Object_Name"].value

buffer = buffer .. timestamp .. arglist .. "\r\n"

  end

file, info = io.open(fileName, "a+") -- write to CSV

if file then

  size = file:seek("end")

  if (size == 0) then

  -- file is empty. Ensure to add the header

  file:write(header)

  end

file:write(buffer)

file:close()

end

arglist = ""

flag = 1 -- Action completed once, no need to run more until the next interval

end

if timer.min % intervalLenght ~= 0 then

  flag = 0

end

end

-- --------------------

As specified in the header, there are two parameters that you need to modify. The interval lenght (in minutes) which you should try to match to your utility. In addition, the list of objects that you want to export.

Once you run it, after the first interval is passed, you will start to see a file in the upload manager of your controller.

5008

Now we only have to send the file. To do so, we will create another Lua script. Here is the code for it:

if sendToEOInit == nil then -- Initialization

sendToEOInit = true

-- Send filename to EO ftp server

function ftpFile()

now = os.date("*t")

ftpResult, ftpError = ftp.put{

host = "10.0.0.5",

user = "yourUsername",

password = "password",

argument = "can2go_" .. now.hour .. now.min .. "_" .. fileName,

source = ltn12.source.file(io.open(fileName, "r"))

}

end

-- Is it time to try to send again?

function isItTime()

this_time = scl.sysclock() 

if (this_time - last_time >= frequency) then

last_time = this_time

return true;

else

return false;

end 

end

-- debug function

function writeToDebug(str)

print(os.date() .. ": " .. str)

end

-- Initialize a few more variables

fileName = scl.getserial() .. "_" .. scl.getmac():gsub(":", "") .. "_" .. ME.CFG1_Node_Instance.value .. ".csv"

frequency = 0 -- First run happens now. Subsequent run happens depending on result of FTP (every minutes or hourly)

  last_time = scl.sysclock()

else

  if (isItTime()) then

  writeToDebug("Initiating FTP transfer.")

ftpFile()

  if ftpResult >= 1 then -- success

  writeToDebug(fileName .. " File succesfully sent.")

  if (io.open("previous_" .. fileName) ~= nil) then

  os.remove("previous_" .. fileName)

  end

  os.rename(fileName, "previous_" .. fileName) -- Create a new backup with current file

  frequency = 3600

  elseif ftp_err ~= nil then -- error

  print("ftp put error : " .. ftp_err)

  frequency = 60

  end

end

end

-- -------------------------

The script will by default send data every hour, but you can change this, by changing the frequency at the end of the script from 3600seconds to whatever you would like. Be sensible about it though!

Finally, make sure to change the host, username and password to send the data to the right implementation.

That’s it! What thing we need to highlight though. The box currently does not support SSL encryption. You are sending data over FTP which means the data is not encrypted. After talking to the team, they seem to have a plan to add support for HTTPS, so more good things to come.

Attachments
Create EO File - LC.lua.zip
FTP to EO - LC.lua.zip
Tags (6)
  • Tags:
  • can2go
  • energy
  • eo
  • ftp
  • mpm
  • operation
Reply
  • All forum topics
  • Previous Topic
  • Next Topic
Replies 0
To The Top!

Forums

  • APC UPS Data Center Backup Solutions
  • EcoStruxure IT
  • EcoStruxure Geo SCADA Expert
  • Metering & Power Quality
  • Schneider Electric Wiser

Knowledge Center

Events & webinars

Ideas

Blogs

Get Started

  • Ask the Community
  • Community Guidelines
  • Community User Guide
  • How-To & Best Practice
  • Experts Leaderboard
  • Contact Support
Brand-Logo
Subscribing is a smart move!
You can subscribe to this board after you log in or create your free account.
Forum-Icon

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.

Register today for FREE

Register Now

Already have an account? Login

Terms & Conditions Privacy Notice Change your Cookie Settings © 2025 Schneider Electric

This is a heading

With achievable small steps, users progress and continually feel satisfaction in task accomplishment.

Usetiful Onboarding Checklist remembers the progress of every user, allowing them to take bite-sized journeys and continue where they left.

of