tallakt-plcutil 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/History.txt +6 -0
- data/LICENSE +0 -0
- data/Manifest.txt +18 -12
- data/README.rdoc +5 -1
- data/Rakefile +0 -0
- data/TODO +1 -4
- data/VERSION +1 -1
- data/bin/awlpp +0 -0
- data/bin/intouchpp +0 -0
- data/bin/pl7tointouch +7 -0
- data/bin/s7tointouch +0 -0
- data/lib/tallakt-plcutil/schneider/pl7_to_intouch_runner.rb +135 -0
- data/lib/tallakt-plcutil/siemens/awlfile.rb +0 -0
- data/lib/tallakt-plcutil/siemens/sdffile.rb +0 -0
- data/lib/tallakt-plcutil/siemens/step7_to_intouch_runner.rb +0 -0
- data/lib/tallakt-plcutil/wonderware/intouch_pretty_print_runner.rb +0 -0
- data/lib/tallakt-plcutil/wonderware/intouchfile.rb +0 -0
- data/lib/tallakt-plcutil/wonderware/standard_sections.yaml +0 -0
- data/lib/tallakt-plcutil.rb +0 -0
- data/script/console.cmd +0 -0
- data/script/destroy.cmd +0 -0
- data/script/generate.cmd +0 -0
- data/tallakt-plcutil.gemspec +79 -0
- data/test/helper.rb +0 -0
- data/test/test_tallakt-plcutil.rb +0 -0
- metadata +23 -9
data/.gitignore
CHANGED
data/History.txt
CHANGED
data/LICENSE
CHANGED
File without changes
|
data/Manifest.txt
CHANGED
@@ -4,23 +4,26 @@ Manifest.txt
|
|
4
4
|
README.rdoc
|
5
5
|
Rakefile
|
6
6
|
TODO
|
7
|
+
VERSION
|
7
8
|
bin
|
8
9
|
bin/awlpp
|
9
10
|
bin/intouchpp
|
11
|
+
bin/pl7tointouch
|
10
12
|
bin/s7tointouch
|
11
13
|
lib
|
12
|
-
lib/plcutil
|
13
|
-
lib/plcutil/
|
14
|
-
lib/plcutil/
|
15
|
-
lib/plcutil/siemens
|
16
|
-
lib/plcutil/siemens/
|
17
|
-
lib/plcutil/siemens/
|
18
|
-
lib/plcutil/
|
19
|
-
lib/plcutil/
|
20
|
-
lib/plcutil/wonderware
|
21
|
-
lib/plcutil/wonderware/
|
22
|
-
lib/plcutil.rb
|
23
|
-
plcutil.
|
14
|
+
lib/tallakt-plcutil
|
15
|
+
lib/tallakt-plcutil/schneider
|
16
|
+
lib/tallakt-plcutil/schneider/pl7_to_intouch_runner.rb
|
17
|
+
lib/tallakt-plcutil/siemens
|
18
|
+
lib/tallakt-plcutil/siemens/awlfile.rb
|
19
|
+
lib/tallakt-plcutil/siemens/awl_pretty_print_runner.rb
|
20
|
+
lib/tallakt-plcutil/siemens/sdffile.rb
|
21
|
+
lib/tallakt-plcutil/siemens/step7_to_intouch_runner.rb
|
22
|
+
lib/tallakt-plcutil/wonderware
|
23
|
+
lib/tallakt-plcutil/wonderware/intouchfile.rb
|
24
|
+
lib/tallakt-plcutil/wonderware/intouch_pretty_print_runner.rb
|
25
|
+
lib/tallakt-plcutil/wonderware/standard_sections.yaml
|
26
|
+
lib/tallakt-plcutil.rb
|
24
27
|
script
|
25
28
|
script/console
|
26
29
|
script/console.cmd
|
@@ -28,9 +31,12 @@ script/destroy
|
|
28
31
|
script/destroy.cmd
|
29
32
|
script/generate
|
30
33
|
script/generate.cmd
|
34
|
+
tallakt-plcutil.gemspec
|
31
35
|
test
|
36
|
+
test/helper.rb
|
32
37
|
test/input_files
|
33
38
|
test/input_files/step7_v5.4
|
34
39
|
test/input_files/step7_v5.4/00000001.AWL
|
35
40
|
test/input_files/step7_v5.4/S7_pro2.zip
|
36
41
|
test/input_files/step7_v5.4/SYMLIST.DBF
|
42
|
+
test/test_tallakt-plcutil.rb
|
data/README.rdoc
CHANGED
@@ -23,6 +23,10 @@ Convert a siemens IO list into a Wonderware Intouch (non IAS) DB import file
|
|
23
23
|
|
24
24
|
s7tointouch -s SYMLIST.DBF -a SIEMENSPLC 00000007.AWL
|
25
25
|
|
26
|
+
Convert a PL7 text export file to intouch CSV import file
|
27
|
+
|
28
|
+
pl7tointouch -i exported.txt -o importme.csv
|
29
|
+
|
26
30
|
The commands support the --help parameter for a full list of parameters
|
27
31
|
|
28
32
|
|
@@ -32,7 +36,7 @@ The commands support the --help parameter for a full list of parameters
|
|
32
36
|
|
33
37
|
== INSTALL:
|
34
38
|
|
35
|
-
sudo gem
|
39
|
+
sudo gem gemcutter
|
36
40
|
sudo gem install tallakt-plcutil
|
37
41
|
|
38
42
|
|
data/Rakefile
CHANGED
File without changes
|
data/TODO
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/bin/awlpp
CHANGED
File without changes
|
data/bin/intouchpp
CHANGED
File without changes
|
data/bin/pl7tointouch
ADDED
data/bin/s7tointouch
CHANGED
File without changes
|
@@ -0,0 +1,135 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
require 'tallakt-plcutil/wonderware/intouchfile'
|
5
|
+
require 'ostruct'
|
6
|
+
|
7
|
+
module PlcUtil
|
8
|
+
# Command line tool to read and output an awl file
|
9
|
+
class PL7ToIntouchRunner
|
10
|
+
def initialize(command_line_arguments)
|
11
|
+
# standard command line options
|
12
|
+
@intouchoptions = {}
|
13
|
+
@output = nil
|
14
|
+
@input = nil
|
15
|
+
@symlistfile = nil
|
16
|
+
@access_name = nil
|
17
|
+
@pl7_tags = []
|
18
|
+
@prefix = nil
|
19
|
+
@alarm = false
|
20
|
+
@caps = false
|
21
|
+
@alarm_group = '$System'
|
22
|
+
|
23
|
+
# Parse command line options
|
24
|
+
option_parser.parse! command_line_arguments
|
25
|
+
|
26
|
+
|
27
|
+
if @input
|
28
|
+
File.open @input do |f|
|
29
|
+
read_pl7_file f
|
30
|
+
end
|
31
|
+
else
|
32
|
+
read_pl7_file $stdin
|
33
|
+
end
|
34
|
+
|
35
|
+
# Write to intouch file
|
36
|
+
if @output
|
37
|
+
File.open @output, 'w' do |f|
|
38
|
+
print_to_file f
|
39
|
+
end
|
40
|
+
else
|
41
|
+
print_to_file $stdout
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
def read_pl7_file(io)
|
47
|
+
io.each_line do |l|
|
48
|
+
mres = l.match /^%M(W)?(\d+)(:X(\d+))?\t(\S+)\t(\S+)(\t\"?([^\t"]*))?/
|
49
|
+
if mres
|
50
|
+
item = OpenStruct.new
|
51
|
+
item.is_word = mres[1]
|
52
|
+
item.index = mres[2].to_i
|
53
|
+
item.bit_index = mres[4] && mres[4].to_i
|
54
|
+
item.tagname = mres[5]
|
55
|
+
item.comment = mres[8]
|
56
|
+
@pl7_tags << item
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
def make_alarm(io)
|
63
|
+
io.alarm_state = 'On'
|
64
|
+
io.alarm_comment = io.comment
|
65
|
+
io.group = @alarm_group
|
66
|
+
end
|
67
|
+
|
68
|
+
def print_to_file(f)
|
69
|
+
@intouchfile = IntouchFile.new nil, @intouchoptions
|
70
|
+
|
71
|
+
@pl7_tags.each do |item|
|
72
|
+
data = {:item_use_tagname => 'No', :comment => item.comment }
|
73
|
+
tag = (@prefix || '') + item.tagname
|
74
|
+
tag = tag.upcase if @caps
|
75
|
+
|
76
|
+
if item.bit_index
|
77
|
+
@intouchfile.new_io_disc(tag, data) do |io|
|
78
|
+
io.item_name = '%d:%02d' % [400001 + item.index, 16 - item.bit_index]
|
79
|
+
make_alarm(io) if @alarm
|
80
|
+
end
|
81
|
+
elsif item.is_word
|
82
|
+
@intouchfile.new_io_int(tag, data) do |io|
|
83
|
+
io.item_name = '%d S' % (item.index + 400001)
|
84
|
+
end
|
85
|
+
else
|
86
|
+
@intouchfile.new_io_disc(tag, data) do |io|
|
87
|
+
io.item_name = (item.index + 1).to_s
|
88
|
+
make_alarm(io) if @alarm
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
@intouchfile.write_csv f
|
94
|
+
end
|
95
|
+
|
96
|
+
|
97
|
+
def option_parser
|
98
|
+
OptionParser.new do |opts|
|
99
|
+
opts.banner = "Usage: pl7tointouch [options]"
|
100
|
+
opts.on("-a", "--access ACCESSNAME", String, "Set access name for all tags") do |access_name|
|
101
|
+
@intouchoptions[:access_name] = access_name
|
102
|
+
end
|
103
|
+
opts.on("-o", "--output FILE", String, "Output to specified file instead of", "standard output") do |output|
|
104
|
+
@output = output
|
105
|
+
end
|
106
|
+
opts.on("-i", "--input FILE", String, "Input from specified file instead of", "standard input") do |input|
|
107
|
+
@input = input
|
108
|
+
end
|
109
|
+
opts.on("--alarm", "Mark bit tags as alarms") do
|
110
|
+
@alarm = true
|
111
|
+
end
|
112
|
+
opts.on("-g", "--alarm-group GROUP", String, "Select intouch alarm group") do |alg|
|
113
|
+
@alarm_group = alg
|
114
|
+
@alarm = true
|
115
|
+
end
|
116
|
+
opts.on("--caps", "tag name in capital letters") do
|
117
|
+
@caps = true
|
118
|
+
end
|
119
|
+
opts.on("-p", "--prefix PREFIX", String, "Add PREFIX to tagname") do |prefix|
|
120
|
+
@prefix = prefix
|
121
|
+
end
|
122
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
123
|
+
puts opts
|
124
|
+
exit
|
125
|
+
end
|
126
|
+
# --alarm --alarmgroup
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
def show_help
|
131
|
+
puts option_parser
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/tallakt-plcutil.rb
CHANGED
File without changes
|
data/script/console.cmd
CHANGED
File without changes
|
data/script/destroy.cmd
CHANGED
File without changes
|
data/script/generate.cmd
CHANGED
File without changes
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{tallakt-plcutil}
|
8
|
+
s.version = "0.2.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Tallak Tveide"]
|
12
|
+
s.date = %q{2010-10-12}
|
13
|
+
s.description = %q{Ruby library for using Siemens and Intouch files}
|
14
|
+
s.email = %q{tallak@tveide.net}
|
15
|
+
s.executables = ["awlpp", "intouchpp", "pl7tointouch", "s7tointouch"]
|
16
|
+
s.extra_rdoc_files = [
|
17
|
+
"LICENSE",
|
18
|
+
"README.rdoc",
|
19
|
+
"TODO"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".gitignore",
|
23
|
+
"History.txt",
|
24
|
+
"LICENSE",
|
25
|
+
"Manifest.txt",
|
26
|
+
"README.rdoc",
|
27
|
+
"Rakefile",
|
28
|
+
"TODO",
|
29
|
+
"VERSION",
|
30
|
+
"bin/awlpp",
|
31
|
+
"bin/intouchpp",
|
32
|
+
"bin/pl7tointouch",
|
33
|
+
"bin/s7tointouch",
|
34
|
+
"lib/tallakt-plcutil.rb",
|
35
|
+
"lib/tallakt-plcutil/schneider/pl7_to_intouch_runner.rb",
|
36
|
+
"lib/tallakt-plcutil/siemens/awl_pretty_print_runner.rb",
|
37
|
+
"lib/tallakt-plcutil/siemens/awlfile.rb",
|
38
|
+
"lib/tallakt-plcutil/siemens/sdffile.rb",
|
39
|
+
"lib/tallakt-plcutil/siemens/step7_to_intouch_runner.rb",
|
40
|
+
"lib/tallakt-plcutil/wonderware/intouch_pretty_print_runner.rb",
|
41
|
+
"lib/tallakt-plcutil/wonderware/intouchfile.rb",
|
42
|
+
"lib/tallakt-plcutil/wonderware/standard_sections.yaml",
|
43
|
+
"script/console",
|
44
|
+
"script/console.cmd",
|
45
|
+
"script/destroy",
|
46
|
+
"script/destroy.cmd",
|
47
|
+
"script/generate",
|
48
|
+
"script/generate.cmd",
|
49
|
+
"tallakt-plcutil.gemspec",
|
50
|
+
"test/helper.rb",
|
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",
|
54
|
+
"test/test_tallakt-plcutil.rb"
|
55
|
+
]
|
56
|
+
s.homepage = %q{http://github.com/tallakt/plcutil}
|
57
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
58
|
+
s.require_paths = ["lib"]
|
59
|
+
s.rubygems_version = %q{1.3.6}
|
60
|
+
s.summary = %q{Ruby PLC file library}
|
61
|
+
s.test_files = [
|
62
|
+
"test/helper.rb",
|
63
|
+
"test/test_tallakt-plcutil.rb"
|
64
|
+
]
|
65
|
+
|
66
|
+
if s.respond_to? :specification_version then
|
67
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
68
|
+
s.specification_version = 3
|
69
|
+
|
70
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
71
|
+
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
72
|
+
else
|
73
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
74
|
+
end
|
75
|
+
else
|
76
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
data/test/helper.rb
CHANGED
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tallakt-plcutil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 0.2.0
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Tallak Tveide
|
@@ -9,30 +14,34 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date:
|
17
|
+
date: 2010-10-12 00:00:00 +02:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: thoughtbot-shoulda
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
23
29
|
version: "0"
|
24
|
-
|
30
|
+
type: :development
|
31
|
+
version_requirements: *id001
|
25
32
|
description: Ruby library for using Siemens and Intouch files
|
26
33
|
email: tallak@tveide.net
|
27
34
|
executables:
|
28
35
|
- awlpp
|
29
36
|
- intouchpp
|
37
|
+
- pl7tointouch
|
30
38
|
- s7tointouch
|
31
39
|
extensions: []
|
32
40
|
|
33
41
|
extra_rdoc_files:
|
34
42
|
- LICENSE
|
35
43
|
- README.rdoc
|
44
|
+
- TODO
|
36
45
|
files:
|
37
46
|
- .gitignore
|
38
47
|
- History.txt
|
@@ -44,8 +53,10 @@ files:
|
|
44
53
|
- VERSION
|
45
54
|
- bin/awlpp
|
46
55
|
- bin/intouchpp
|
56
|
+
- bin/pl7tointouch
|
47
57
|
- bin/s7tointouch
|
48
58
|
- lib/tallakt-plcutil.rb
|
59
|
+
- lib/tallakt-plcutil/schneider/pl7_to_intouch_runner.rb
|
49
60
|
- lib/tallakt-plcutil/siemens/awl_pretty_print_runner.rb
|
50
61
|
- lib/tallakt-plcutil/siemens/awlfile.rb
|
51
62
|
- lib/tallakt-plcutil/siemens/sdffile.rb
|
@@ -59,6 +70,7 @@ files:
|
|
59
70
|
- script/destroy.cmd
|
60
71
|
- script/generate
|
61
72
|
- script/generate.cmd
|
73
|
+
- tallakt-plcutil.gemspec
|
62
74
|
- test/helper.rb
|
63
75
|
- test/input_files/step7_v5.4/00000001.AWL
|
64
76
|
- test/input_files/step7_v5.4/S7_pro2.zip
|
@@ -77,18 +89,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
77
89
|
requirements:
|
78
90
|
- - ">="
|
79
91
|
- !ruby/object:Gem::Version
|
92
|
+
segments:
|
93
|
+
- 0
|
80
94
|
version: "0"
|
81
|
-
version:
|
82
95
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
96
|
requirements:
|
84
97
|
- - ">="
|
85
98
|
- !ruby/object:Gem::Version
|
99
|
+
segments:
|
100
|
+
- 0
|
86
101
|
version: "0"
|
87
|
-
version:
|
88
102
|
requirements: []
|
89
103
|
|
90
104
|
rubyforge_project:
|
91
|
-
rubygems_version: 1.3.
|
105
|
+
rubygems_version: 1.3.6
|
92
106
|
signing_key:
|
93
107
|
specification_version: 3
|
94
108
|
summary: Ruby PLC file library
|