Difference between revisions of "softMC as OPC UA Server"

From SoftMC-Wiki
Jump to: navigation, search
 
(6 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
[[File:OPC 01.jpg|RTENOTITLE]]
 
[[File:OPC 01.jpg|RTENOTITLE]]
  
To enable softMC OPC UA you need:
 
  
OPC_UA.LIB , if you do not have the file contact servotronix support
 
  
Load it from the config.prg
 
  
<u>CONFIG.PRG</u>
+
= '''To enable softMC OPC UA you need:''' =
  
program
+
*Install '''ipk '''or '''rpm&nbsp;[http://softmc.servotronix.com/img_auth.php/c/cb/opcua.zip http://softmc.servotronix.com/img_auth.php/c/cb/opcua.zip]&nbsp;'''with OPC UA to your softMC controller,&nbsp;if you do not have the file contact servotronix support
 +
*Copy '''OPC_UA.LIB''' file to your softMC controller , if you do not have the file contact servotronix support
 +
*Load it from the '''config.prg''', see below
 +
*Exctute it from '''autoexec.prg''', see below
  
&nbsp;&nbsp;&nbsp; ..
+
= '''CONFIG.PRG''' =
  
&nbsp;&nbsp;&nbsp; Print "system is running&nbsp; -&nbsp; "
+
program
 +
<syntaxhighlight lang="vb">
  
&nbsp;&nbsp;&nbsp; Sys.DoubleFormat = 1
+
Print "system is running"
  
&nbsp;&nbsp;&nbsp; Load opc_ua.lib
+
Sys.DoubleFormat = 1
 +
 
 +
Load opc_ua.lib
  
&nbsp;&nbsp;&nbsp; ..
+
end program
  
end program
+
</syntaxhighlight>
  
<u>AUTOEXEC.PRG</u>
+
= '''AUTOEXEC.PRG''' =
  
 
Program Continue
 
Program Continue
  
dim x as long
+
'''dim x as long'''
  
 
Load startprg.prg
 
Load startprg.prg
Line 40: Line 43:
 
..
 
..
  
Load .prg
+
Load IND4.prg
  
StartTask OPC_GL.prg
+
StartTask IND4.prg
  
Print "OPC UA Global value ready"
+
'''x =stop_start_server&nbsp;; restart OPC UA server'''
 +
 
 +
End Program
  
 
&nbsp;
 
&nbsp;
  
x =stop_start_server
+
= '''Example for servo drive Temperature and power mesurmen'''t =
 
 
 
 
 
End Program
 
  
 
<u>IND4.PRG</u>
 
<u>IND4.PRG</u>

Latest revision as of 15:46, 1 November 2023

RTENOTITLE



To enable softMC OPC UA you need:

  • Install ipk or rpm http://softmc.servotronix.com/img_auth.php/c/cb/opcua.zip with OPC UA to your softMC controller, if you do not have the file contact servotronix support
  • Copy OPC_UA.LIB file to your softMC controller , if you do not have the file contact servotronix support
  • Load it from the config.prg, see below
  • Exctute it from autoexec.prg, see below

CONFIG.PRG

program

Print "system is running"

Sys.DoubleFormat = 1
 
Load opc_ua.lib

end program

AUTOEXEC.PRG

Program Continue

dim x as long

Load startprg.prg

while startprg.prg.state <> 10

    sleep 500

end while

..

Load IND4.prg

StartTask IND4.prg

x =stop_start_server ; restart OPC UA server

End Program

 

Example for servo drive Temperature and power mesurment

IND4.PRG

common shared A1_PWRTEMP as long

common shared A1_POWER  as long

common shared A1_Cycle as long

common shared A2_PWRTEMP as long

common shared A2_POWER  as long

common shared A2_Cycle as long

 

program

A1_Cycle = 2

A2_Cycle = 4

while 1

 A1_PWRTEMP=ec_sdo_read(a1.dadd,0x2044,2)

 A1_POWER = abs(a1.TFb) * abs(a1.vfb) / 1000

 A2_PWRTEMP=ec_sdo_read(a2.dadd,0x2044,2)

 A2_POWER = a2.TFb * a2.vfb / 1000

 sleep 10

end while

end program