http://www.we-con.com.cn/en/
Lua configration
Contents
Vbox edge calculation01
02 Lua script interface
Edge calculation
1."Edge calculation" supports to calculate with lua language.Lua is a powerful,efficient,
lightweight, embeddable scripting language. It supports procedural programming,
object-oriented programming, functional programming, data-driven programming,and
data description.
Which model of Vbox supports “edge calculation”?
Model Edge calculation
S-4G Yes
S-00 Yes
S-3N Yes
S-NG Yes
E-00 No
E-2G No
2."Edge calculation" inludes:
Import:import new script from computer,and the original scripts will be cleared if
import new scripts.
Export:export “vbox.script” to computer.But user can not program it
Sync series:update script into vbox in batches
Delete series:delete script into vbox in batches
New:creat new script.Up to five new scripts can be added
Mode:
initialization,timing,
execute if disconnect:execute one time after Vbox disconnects server.
execute if connect:execute one time after Vbox connects server.
Debug:test script and check result.In general,user will print different text to test
whether script is correct.
3.Make a simple demo
step1:click “new”
step2:Enter script name “Test” , choose timing mode and click “save and next”
step4:Enter print(“happy new year”) and save
script format:function .main()
step5:click “Edge calculation” and “Sync”.If “synchronization” is successful,the status
will display green.
step6:if the status display green,then click “Debug” to test result.
Click the button OFF--> ON,the text “happy new year” will print every second.
Lua script demo
1.Address Operation:transfer data from address A to B
Demo1: D2 to D0
Depend on diffferent format of data.Vbox open different script functions.for example.
addr_setshort(addr,num) Function: Write 16-bit signed decimal address
addr_getshort(addr) Function: Read 16-bit signed decimal address
addr_getword(string addr)Function: Read 16-bit unsigned decimal address
More script function are in the second section of “V-BOX Script Interface Manual”
Demo2:Arithmetic
Demo3:set 100 to D0--D19
Demo3:short message(test version)
if M0 rising edge,send “temperature alarm”
if M0 falling edge,send “temperatuer alarm solved”
Only vbox with 4G module that can support short message
Thank you

WECON V-BOX Lua Configration

  • 1.
  • 2.
  • 3.
    Edge calculation 1."Edge calculation"supports to calculate with lua language.Lua is a powerful,efficient, lightweight, embeddable scripting language. It supports procedural programming, object-oriented programming, functional programming, data-driven programming,and data description. Which model of Vbox supports “edge calculation”? Model Edge calculation S-4G Yes S-00 Yes S-3N Yes S-NG Yes E-00 No E-2G No
  • 4.
    2."Edge calculation" inludes: Import:importnew script from computer,and the original scripts will be cleared if import new scripts. Export:export “vbox.script” to computer.But user can not program it Sync series:update script into vbox in batches Delete series:delete script into vbox in batches New:creat new script.Up to five new scripts can be added Mode: initialization,timing, execute if disconnect:execute one time after Vbox disconnects server. execute if connect:execute one time after Vbox connects server. Debug:test script and check result.In general,user will print different text to test whether script is correct.
  • 5.
    3.Make a simpledemo step1:click “new” step2:Enter script name “Test” , choose timing mode and click “save and next”
  • 6.
    step4:Enter print(“happy newyear”) and save script format:function .main() step5:click “Edge calculation” and “Sync”.If “synchronization” is successful,the status will display green.
  • 7.
    step6:if the statusdisplay green,then click “Debug” to test result. Click the button OFF--> ON,the text “happy new year” will print every second.
  • 8.
    Lua script demo 1.AddressOperation:transfer data from address A to B Demo1: D2 to D0 Depend on diffferent format of data.Vbox open different script functions.for example. addr_setshort(addr,num) Function: Write 16-bit signed decimal address addr_getshort(addr) Function: Read 16-bit signed decimal address addr_getword(string addr)Function: Read 16-bit unsigned decimal address More script function are in the second section of “V-BOX Script Interface Manual”
  • 9.
  • 10.
    Demo3:short message(test version) ifM0 rising edge,send “temperature alarm” if M0 falling edge,send “temperatuer alarm solved” Only vbox with 4G module that can support short message
  • 11.