Skip to content

Instantly share code, notes, and snippets.

@atimin
Created October 14, 2011 06:37
Show Gist options
  • Save atimin/1286409 to your computer and use it in GitHub Desktop.
Save atimin/1286409 to your computer and use it in GitHub Desktop.
Example description XPCA application
# http://xpca.org
# Timin Aleksey 2011
template :analog_point do
min_raw 0
max_raw 0xffff
min_scale 0
max_scale 100
end
template :pump do
scanner :scanner_1, :slave => locals[:slave] do
scan_rate 5
place :holding_register
start_addr locals[:offset]
lenght 5
end
point :state, :scanner => :scanner_1 do
offset 0
desc_state lambda{value == 1 ? "On" : "Off"}
end
scope :scanner => :scanner_1, :template => :analog_point do
point :press_in, :offset => 1
point :press_out, :offset => 2
point :temp, :offset => 3
end
end
group :place_1 do
channel :tcp_conn, :protocol => :modbus_tcp do
ip '127.0.0.1'
port 1502
end
slave :dev_1, :channel => :tcp_conn do
id 1
end
group :pump_1, :template => :pump do
slave :dev_1
offset 0
end
(2...5).each do |i|
group "pump_" + i, :template => :pump do
slave :dev_1
offest i * 5
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment