EnglishУкраїнськаmRussian
Login/New
Topic with many replies

Command/message from openSCADA to some device in network


| 1 | 2 | Last
Author Message
Written on: 26. 12. 2012 [08:34]
ajinkya
Ajinkya Biradar
Topic creator
registered since: 17.12.2012
Posts: 23
Hello
I am trying to communicate to a host in network via openSCADA.

I want to send a magic packet (wake on LAN packet) to the PC in order to switch it on. (I have enabled the wake on lan option in boot manager.)

I have a GUI created in figure shown below. When I press switch on button the magic packet should be sent to perticular IP(host).

So question is

how to send a TCP packet via openSCADA?
Where should i write code for that in "Transport protocols -> Modbus" or in "process tab of widget"?
Also In what all places i need to do changes?

Thank you
Attachment

pc_status.png (File type: image/png, Size: 207.77 kilobytes) — 2354 downloads
Written on: 26. 12. 2012 [19:25]
roman
Roman Savochenko
Moderator
Contributor
Developer
registered since: 12.12.2007
Posts: 3742
"ajinkya" wrote:

So question is

Questions are not "Features and service request"!

"ajinkya" wrote:

how to send a TCP packet via openSCADA?
Where should i write code for that in "Transport protocols -> Modbus" or in "process tab of widget"?
Also In what all places i need to do changes?

Into DAQ template or DAQ.JavaLikeCalc controller direct. Read patient QuickStart http://wiki.oscada.org/HomePageEn/Doc/QuickStart#h995-26
and
http://wiki.oscada.org/HomePageEn/Doc/QuickStart#h995-9

And use user API functions: messIO()
http://wiki.oscada.org/HomePageEn/Doc/ProgrammManual#h946-14

Learn, learn and learn better than work, work and work.
Written on: 27. 12. 2012 [13:36]
almaz
Almaz Karimov
Contributor
registered since: 25.09.2008
Posts: 516
Or use user API function: system
http://wiki.oscada.org/HomePageEn/Doc/ProgrammManual#h946-6
to call the script.
Simple shell script:
http://www.jimmy.co.at/weblog/?p=30

Or use sysCall
http://wiki.oscada.org/HomePageEn/Doc/FLibSYS?v=yhj#h899-4
JAVASCRIPT
using Special.FLibSYS;
test=sysCall("wakeonlan ..........");

sudo apt-get install wakeonlan
wakeonlan [-h] [-v] [-i IP_address] [-p port] [-f file] [[hardware_address]

[This article was edited 2 times, at last 27.12.2012 at 13:52.]

21 век - век повсеместной автоматизации. Главное - во благо всем людям.
Written on: 28. 03. 2013 [16:21]
ajinkya
Ajinkya Biradar
Topic creator
registered since: 17.12.2012
Posts: 23
Hello Sir,
This is a bit late reply since I was a bit out of the project and had some other module to work on.

As you asked to use wake on LAN using "sudo apt-get install wakeonlan".
I was able to do it on terminal and PC is waking up in both sleep/hibernate and shutdown mode.
I tried the same thing on windows platform with this link http://www.depicus.com/wake-on-lan/wake-on-lan-cmd.aspx

And i also have the packet format (observed using wireshark) which is being sent by these software.

And Now I need some help using "syscall" as you suggested.
What I am not getting here is where should I actually write these set of commands.

Thank you very much for your reply.
Written on: 29. 03. 2013 [06:39]
almaz
Almaz Karimov
Contributor
registered since: 25.09.2008
Posts: 516
The program is written in JavaLikeCalc:
http://wiki.oscada.org/HomePageEn/Doc/JavaLikeCalc?v=13pw#h867-2

21 век - век повсеместной автоматизации. Главное - во благо всем людям.
Written on: 05. 08. 2013 [14:28]
ajinkya
Ajinkya Biradar
Topic creator
registered since: 17.12.2012
Posts: 23
Hello sirs,

I am getting this kind of response in Modbus-Response tab, when I start the created project in openscada,
--> device error: connect to internet socket error

but and as soon as I start the openscada_AGLKS project I get the error (actually it connects to the socket this time)
--> 2: requested address not allow or request area too long.

again if i close the openscada_AGLKS project, it again says the same thing "device error: connect to internet socket error".

I am sure that I am missing some setting for using MODBUS for my project, but I am not able to locate it.

Kindly Guide on this matter.

+

I have modified a small back-end program for button event handler looking at test modules you provided.....
as mentioned in one your replies in this post --> " Button in GUI and the “enabler” in logical level "

Script--

JAVASCRIPT
ev_cur = ev_rez = "";
off=0;
while(true)
{
  ev_cur=Special.FLibSYS.strParse(event,0,"\n",off);
  if( ev_cur == "" ) break;
  if( ev_cur == "ws_BtPress:/com_PwUp1") com_PwUp1_color=(com_PwUp1_color=="red")?"green":"red" ; 
  if( ev_cur == "ws_BtPress:/com_PwUp1") st_PC_ON1_text=(st_PC_ON1_text=="OFF")?"ON":"OFF" ; 
  else ev_rez += (ev_cur+"\n");
}
event=ev_rez;


I want to ask, where you would advise to write this script

1. in widgets -> created liberary name-> widget -> properties
2. or in projects -> project name -> root page(SO) -> memos-> added liberary element -> properties

and as replied by almaz sir, if at all I have to send a packet then for that the script should be written in
Data acquisition ->module->JavaLikeCalc->controller

Right??
Attachment

device error.png (File type: image/png, Size: 299.5 kilobytes) — 2183 downloads
modbus_report.png (File type: image/png, Size: 301.32 kilobytes) — 2163 downloads
Written on: 05. 08. 2013 [19:32]
roman
Roman Savochenko
Moderator
Contributor
Developer
registered since: 12.12.2007
Posts: 3742
"ajinkya" wrote:

I am getting this kind of response in Modbus-Response tab, when I start the created project in openscada,
--> device error: connect to internet socket error

You do not send any request's data.

"ajinkya" wrote:

but and as soon as I start the openscada_AGLKS project I get the error (actually it connects to the socket this time)
--> 2: requested address not allow or request area too long.

Here you have incorrect data area request, concrete your device tell this has not register "2"

"ajinkya" wrote:

Kindly Guide on this matter.

See to where you send the request and what you send. For examples see to work demo-configuration.

"ajinkya" wrote:

I want to ask, where you would advise to write this script
1. in widgets -> created liberary name-> widget -> properties
2. or in projects -> project name -> root page(SO) -> memos-> added liberary element -> properties

Into Projects tree you deal with the interface's pages but into libraries tree with widgets also then you must write the script into corresponding place. But better way all scripts write only into libraries.

"ajinkya" wrote:

and as replied by almaz sir, if at all I have to send a packet then for that the script should be written in
Data acquisition ->module->JavaLikeCalc->controller

Right??

No. Into Projects and Libraries you should write interface's code and into like Data acquisition ->module->JavaLikeCalc->controller write communication code for prevent interface freeze on the communication acts.

Learn, learn and learn better than work, work and work.
Written on: 16. 11. 2013 [14:59]
ajinkya
Ajinkya Biradar
Topic creator
registered since: 17.12.2012
Posts: 23
Hello Sir,
I made some mistakes in linking that is why I am not able to get the back-end working.

Here is what I understood looking at the demo project AGLKS about the linking the different modules.

Linking is done in 2 parts.
say for example
Part I:
In "Java-like based calculator -> controller" We write the Attribute configuration list, in form "<io>:<aid>:<anm>"
which are the parameters from the attribute list which are to be controlled/monitored.

like
'st_open' (from 'KS102' from AGLKS->Root Page(SO)->KM101->Mnemo->KM101)
is listed in the Attribute configuration list in Block based calculator->Mainstation->parameter->KW2 in Block's IOs field.

then in 'links' tab from properties of Mnemo item 'KM101' from AGLKS project we link it to the Block based calculator same
parameter as ----> prm:/BlockCalc/KM101/KW102/st_open(+).

Part II:
Then in "Transport protocol-> MODBUS -> Data" we add the same parameter and then in the same window in 'Links' tab
it is linked with the Block calculator as "BlockCalc.Anast1to2node.KW2.st_open(+)"

I am kind of confused about this linking part, can you guide me further.
which one out of Block based calculator and Java-like based calculator should i use.

I have got a system function call to make on button press as mentioned below (which is as per the previous replies in this thread)
-----------------------------------------------------------------
using Special.FLibSYS;
test = sysCall("etherwake -i eth0 <MAC address>");
or
test = net rpc shutdown -l 10.114.12.50 -f -U domain\\username password
-----------------------------------------------------------------

Any help to get me going will be appreciated ...
Thanks in advance.
Written on: 17. 11. 2013 [10:43]
roman
Roman Savochenko
Moderator
Contributor
Developer
registered since: 12.12.2007
Posts: 3742
"ajinkya" wrote:

I am kind of confused about this linking part, can you guide me further.
which one out of Block based calculator and Java-like based calculator should i use.

Sure link from Transport you can set to only source elsewhere you need create second IO and that will second source.

"ajinkya" wrote:

I have got a system function call to make on button press as mentioned below (which is as per the previous replies in this thread)
-----------------------------------------------------------------
using Special.FLibSYS;
test = sysCall("etherwake -i eth0 <MAC address>");
or
test = net rpc shutdown -l 10.114.12.50 -f -U domain\\username password
-----------------------------------------------------------------

This is different commands and what do you really want to do?

Learn, learn and learn better than work, work and work.
Written on: 18. 11. 2013 [08:52]
ajinkya
Ajinkya Biradar
Topic creator
registered since: 17.12.2012
Posts: 23
Hello Sir,
As i mentioned in previous thread, I have my customized front-end ready(with your help :-) ), it can be seen in attachment.

In the attached image there is one button named "wake up". So on that button press event I want to call the system function
ether wake -->> sysCall("etherwake -i eth0 <MAC address>"); <<--

As of now it only seen working in front end , like it changes its color, text on the button to "Turn off" and the status message too, but nothing is written to execute the actual command like "etherwake -----" or "net rpc shutdown --------"

So I want your guidance on this.
Thanks in advance.
----------------------------------------------------------------------------------------------------------------------------------------
I have already tried and tested both the commands
1. etherwake -i eth0 <MAC address>
2. net rpc shutdown -l 10.114.12.50 -f -U domain\\username%password

they found to be working from my terminal and I am able to wake up any PC irrespective of OS and
also able to shutdown any windows pc using 2nd command.
----------------------------------------------------------------------------------------------------------------------------------------
Attachment

query_backend.png (File type: image/png, Size: 161.45 kilobytes) — 2119 downloads
| 1 | 2 | Last



0391