tallakt-plcutil 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -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
|
@@ -0,0 +1,139 @@
|
|
1
|
+
TYPE "User defined DB"
|
2
|
+
VERSION : 0.1
|
3
|
+
|
4
|
+
|
5
|
+
STRUCT
|
6
|
+
int_at_0_0 : INT ; //First int
|
7
|
+
bool_at_2_0 : BOOL ; //First bool
|
8
|
+
bool_at_2_1 : BOOL ;
|
9
|
+
bool_at_2_2 : BOOL ;
|
10
|
+
word_at_4_0 : WORD ;
|
11
|
+
dword_at_6_0 : DWORD ;
|
12
|
+
byte_at_10_0 : BYTE ;
|
13
|
+
dint_at_12_0 : DINT ;
|
14
|
+
real_at_16_0 : REAL ;
|
15
|
+
s5time_at_20 : S5TIME ;
|
16
|
+
time_at_22_0 : TIME ;
|
17
|
+
date_at_26_0 : DATE ;
|
18
|
+
time_of_day_at_28_0 : TIME_OF_DAY ;
|
19
|
+
char_at_32_0 : CHAR := 't';
|
20
|
+
byte_at_33_0 : BYTE ;
|
21
|
+
byte_at_34_0 : BYTE ;
|
22
|
+
END_STRUCT ;
|
23
|
+
END_TYPE
|
24
|
+
|
25
|
+
DATA_BLOCK "Data block 1"
|
26
|
+
TITLE =
|
27
|
+
VERSION : 0.1
|
28
|
+
|
29
|
+
|
30
|
+
STRUCT
|
31
|
+
struct_at_0_0 : "User defined DB"; //Temporary placeholder variable
|
32
|
+
struct_at_36_0 : "User defined DB";
|
33
|
+
char_array_at_72_0 : ARRAY [0 .. 10 ] OF CHAR ;
|
34
|
+
anonomous_struct_at_84_0 : STRUCT
|
35
|
+
bool_at_84_0 : BOOL ;
|
36
|
+
bool_at_84_1 : BOOL ;
|
37
|
+
char_at_85_0 : CHAR := 'x';
|
38
|
+
char_at_86_0 : CHAR ;
|
39
|
+
word_at_88_0 : WORD ;
|
40
|
+
char_at_90_0 : CHAR ;
|
41
|
+
char_array_at_92_0 : ARRAY [0 .. 9 ] OF //array comment 1
|
42
|
+
CHAR ;
|
43
|
+
char_at_102_0 : CHAR ;
|
44
|
+
END_STRUCT ;
|
45
|
+
word_at_104_0 : WORD ;
|
46
|
+
char_at_106_0 : CHAR ;
|
47
|
+
bool_at_107_0 : BOOL ;
|
48
|
+
char_at_108_0 : CHAR ;
|
49
|
+
char_array_at_110_0 : ARRAY [0 .. 1 ] OF CHAR ;
|
50
|
+
END_STRUCT ;
|
51
|
+
BEGIN
|
52
|
+
struct_at_0_0.int_at_0_0 := 0;
|
53
|
+
struct_at_0_0.bool_at_2_0 := FALSE;
|
54
|
+
struct_at_0_0.bool_at_2_1 := FALSE;
|
55
|
+
struct_at_0_0.bool_at_2_2 := FALSE;
|
56
|
+
struct_at_0_0.word_at_4_0 := W#16#0;
|
57
|
+
struct_at_0_0.dword_at_6_0 := DW#16#0;
|
58
|
+
struct_at_0_0.byte_at_10_0 := B#16#0;
|
59
|
+
struct_at_0_0.dint_at_12_0 := L#0;
|
60
|
+
struct_at_0_0.real_at_16_0 := 0.000000e+000;
|
61
|
+
struct_at_0_0.s5time_at_20 := S5T#0MS;
|
62
|
+
struct_at_0_0.time_at_22_0 := T#0MS;
|
63
|
+
struct_at_0_0.date_at_26_0 := D#1990-1-1;
|
64
|
+
struct_at_0_0.time_of_day_at_28_0 := TOD#0:0:0.0;
|
65
|
+
struct_at_0_0.char_at_32_0 := 't';
|
66
|
+
struct_at_0_0.byte_at_33_0 := B#16#0;
|
67
|
+
struct_at_0_0.byte_at_34_0 := B#16#0;
|
68
|
+
struct_at_36_0.int_at_0_0 := 0;
|
69
|
+
struct_at_36_0.bool_at_2_0 := FALSE;
|
70
|
+
struct_at_36_0.bool_at_2_1 := FALSE;
|
71
|
+
struct_at_36_0.bool_at_2_2 := FALSE;
|
72
|
+
struct_at_36_0.word_at_4_0 := W#16#0;
|
73
|
+
struct_at_36_0.dword_at_6_0 := DW#16#0;
|
74
|
+
struct_at_36_0.byte_at_10_0 := B#16#0;
|
75
|
+
struct_at_36_0.dint_at_12_0 := L#0;
|
76
|
+
struct_at_36_0.real_at_16_0 := 0.000000e+000;
|
77
|
+
struct_at_36_0.s5time_at_20 := S5T#0MS;
|
78
|
+
struct_at_36_0.time_at_22_0 := T#0MS;
|
79
|
+
struct_at_36_0.date_at_26_0 := D#1990-1-1;
|
80
|
+
struct_at_36_0.time_of_day_at_28_0 := TOD#0:0:0.0;
|
81
|
+
struct_at_36_0.char_at_32_0 := 't';
|
82
|
+
struct_at_36_0.byte_at_33_0 := B#16#0;
|
83
|
+
struct_at_36_0.byte_at_34_0 := B#16#0;
|
84
|
+
char_array_at_72_0[0] := ' ';
|
85
|
+
char_array_at_72_0[1] := ' ';
|
86
|
+
char_array_at_72_0[2] := ' ';
|
87
|
+
char_array_at_72_0[3] := ' ';
|
88
|
+
char_array_at_72_0[4] := ' ';
|
89
|
+
char_array_at_72_0[5] := ' ';
|
90
|
+
char_array_at_72_0[6] := ' ';
|
91
|
+
char_array_at_72_0[7] := ' ';
|
92
|
+
char_array_at_72_0[8] := ' ';
|
93
|
+
char_array_at_72_0[9] := ' ';
|
94
|
+
char_array_at_72_0[10] := ' ';
|
95
|
+
anonomous_struct_at_84_0.bool_at_84_0 := FALSE;
|
96
|
+
anonomous_struct_at_84_0.bool_at_84_1 := FALSE;
|
97
|
+
anonomous_struct_at_84_0.char_at_85_0 := 'x';
|
98
|
+
anonomous_struct_at_84_0.char_at_86_0 := ' ';
|
99
|
+
anonomous_struct_at_84_0.word_at_88_0 := W#16#0;
|
100
|
+
anonomous_struct_at_84_0.char_at_90_0 := ' ';
|
101
|
+
anonomous_struct_at_84_0.char_array_at_92_0[0] := ' ';
|
102
|
+
anonomous_struct_at_84_0.char_array_at_92_0[1] := ' ';
|
103
|
+
anonomous_struct_at_84_0.char_array_at_92_0[2] := ' ';
|
104
|
+
anonomous_struct_at_84_0.char_array_at_92_0[3] := ' ';
|
105
|
+
anonomous_struct_at_84_0.char_array_at_92_0[4] := ' ';
|
106
|
+
anonomous_struct_at_84_0.char_array_at_92_0[5] := ' ';
|
107
|
+
anonomous_struct_at_84_0.char_array_at_92_0[6] := ' ';
|
108
|
+
anonomous_struct_at_84_0.char_array_at_92_0[7] := ' ';
|
109
|
+
anonomous_struct_at_84_0.char_array_at_92_0[8] := ' ';
|
110
|
+
anonomous_struct_at_84_0.char_array_at_92_0[9] := ' ';
|
111
|
+
anonomous_struct_at_84_0.char_at_102_0 := ' ';
|
112
|
+
word_at_104_0 := W#16#0;
|
113
|
+
char_at_106_0 := ' ';
|
114
|
+
bool_at_107_0 := FALSE;
|
115
|
+
char_at_108_0 := ' ';
|
116
|
+
char_array_at_110_0[0] := ' ';
|
117
|
+
char_array_at_110_0[1] := ' ';
|
118
|
+
END_DATA_BLOCK
|
119
|
+
|
120
|
+
ORGANIZATION_BLOCK "Cycle Execution"
|
121
|
+
TITLE = "Main Program Sweep (Cycle)"
|
122
|
+
VERSION : 0.1
|
123
|
+
|
124
|
+
|
125
|
+
VAR_TEMP
|
126
|
+
OB1_EV_CLASS : BYTE ; //Bits 0-3 = 1 (Coming event), Bits 4-7 = 1 (Event class 1)
|
127
|
+
OB1_SCAN_1 : BYTE ; //1 (Cold restart scan 1 of OB 1), 3 (Scan 2-n of OB 1)
|
128
|
+
OB1_PRIORITY : BYTE ; //Priority of OB Execution
|
129
|
+
OB1_OB_NUMBR : BYTE ; //1 (Organization block 1, OB1)
|
130
|
+
OB1_RESERVED_1 : BYTE ; //Reserved for system
|
131
|
+
OB1_RESERVED_2 : BYTE ; //Reserved for system
|
132
|
+
OB1_PREV_CYCLE : INT ; //Cycle time of previous OB1 scan (milliseconds)
|
133
|
+
OB1_MIN_CYCLE : INT ; //Minimum cycle time of OB1 (milliseconds)
|
134
|
+
OB1_MAX_CYCLE : INT ; //Maximum cycle time of OB1 (milliseconds)
|
135
|
+
OB1_DATE_TIME : DATE_AND_TIME ; //Date and time OB1 started
|
136
|
+
END_VAR
|
137
|
+
BEGIN
|
138
|
+
END_ORGANIZATION_BLOCK
|
139
|
+
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tallakt-plcutil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2010-10-12 00:00:00.
|
12
|
+
date: 2010-10-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dbf
|
16
|
-
requirement: &
|
16
|
+
requirement: &270292080 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 1.6.6
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *270292080
|
25
25
|
description: Ruby library for using Siemens, Schneider and Intouch files
|
26
26
|
email: tallak@tveide.net
|
27
27
|
executables:
|
@@ -34,20 +34,23 @@ extra_rdoc_files:
|
|
34
34
|
- LICENSE
|
35
35
|
- README.rdoc
|
36
36
|
files:
|
37
|
+
- lib/tallakt-plcutil/schneider/pl7_to_intouch_runner.rb
|
38
|
+
- lib/tallakt-plcutil/siemens/awlfile.rb
|
37
39
|
- lib/tallakt-plcutil/siemens/awl_pretty_print_runner.rb
|
38
40
|
- lib/tallakt-plcutil/siemens/sdffile.rb
|
39
41
|
- lib/tallakt-plcutil/siemens/step7_to_intouch_runner.rb
|
40
|
-
- lib/tallakt-plcutil/siemens/awlfile.rb
|
41
42
|
- lib/tallakt-plcutil/version.rb
|
42
|
-
- lib/tallakt-plcutil/schneider/pl7_to_intouch_runner.rb
|
43
43
|
- lib/tallakt-plcutil/wonderware/intouchfile.rb
|
44
44
|
- lib/tallakt-plcutil/wonderware/intouch_pretty_print_runner.rb
|
45
45
|
- lib/tallakt-plcutil/wonderware/standard_sections.yaml
|
46
46
|
- lib/tallakt-plcutil.rb
|
47
|
-
- bin/pl7tointouch
|
48
47
|
- bin/awlpp
|
49
48
|
- bin/intouchpp
|
49
|
+
- bin/pl7tointouch
|
50
50
|
- bin/s7tointouch
|
51
|
+
- test/input_files/step7_v5.4/00000001.AWL
|
52
|
+
- test/input_files/step7_v5.4/S7_pro2.zip
|
53
|
+
- test/input_files/step7_v5.4/SYMLIST.DBF
|
51
54
|
- History.txt
|
52
55
|
- LICENSE
|
53
56
|
- README.rdoc
|
@@ -73,9 +76,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
76
|
version: '0'
|
74
77
|
requirements: []
|
75
78
|
rubyforge_project:
|
76
|
-
rubygems_version: 1.8.
|
79
|
+
rubygems_version: 1.8.15
|
77
80
|
signing_key:
|
78
81
|
specification_version: 3
|
79
82
|
summary: Ruby PLC file library
|
80
|
-
test_files:
|
81
|
-
|
83
|
+
test_files:
|
84
|
+
- test/input_files/step7_v5.4/00000001.AWL
|
85
|
+
- test/input_files/step7_v5.4/S7_pro2.zip
|
86
|
+
- test/input_files/step7_v5.4/SYMLIST.DBF
|