tallakt-plcutil 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/plcutil/schneider/pl7_to_intouch_runner.rb +11 -2
- data/lib/plcutil.rb +1 -1
- metadata +1 -1
@@ -46,10 +46,15 @@ module PlcUtil
|
|
46
46
|
|
47
47
|
def read_pl7_file(io)
|
48
48
|
io.each_line do |l|
|
49
|
-
mres = l.match(/^%M(W)?(\d+)(:X(\d+))?\t(\S+)\t(\S+)(\t\"?([^\t"]*))?/)
|
49
|
+
mres = l.match(/^%M(W|F)?(\d+)(:X(\d+))?\t(\S+)\t(\S+)(\t\"?([^\t"]*))?/)
|
50
50
|
if mres
|
51
51
|
item = OpenStruct.new
|
52
|
-
|
52
|
+
case mres[1]
|
53
|
+
when 'W'
|
54
|
+
item.is_word = true
|
55
|
+
when 'F'
|
56
|
+
item.is_float = true
|
57
|
+
end
|
53
58
|
item.index = mres[2].to_i
|
54
59
|
item.bit_index = mres[4] && mres[4].to_i
|
55
60
|
item.tagname = mres[5]
|
@@ -83,6 +88,10 @@ module PlcUtil
|
|
83
88
|
@intouchfile.new_io_int(tag, data) do |io|
|
84
89
|
io.item_name = '%d S' % (item.index + 400001)
|
85
90
|
end
|
91
|
+
elsif item.is_float
|
92
|
+
@intouchfile.new_io_real(tag, data) do |io|
|
93
|
+
io.item_name = '%d F' % (item.index + 400001)
|
94
|
+
end
|
86
95
|
else
|
87
96
|
@intouchfile.new_io_disc(tag, data) do |io|
|
88
97
|
io.item_name = (item.index + 1).to_s
|
data/lib/plcutil.rb
CHANGED