plc_access 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +25 -19
- data/README.md +68 -0
- data/images/fx_comm_setting.png +0 -0
- data/images/plc_share.png +0 -0
- data/lib/plc_access/protocol/plc_share/plc_share.rb +32 -0
- data/lib/plc_access/protocol/plc_share/plc_share_protocol.rb +69 -0
- data/lib/plc_access/protocol/protocol.rb +1 -0
- data/lib/plc_access/version.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab5af068754de94a85c011c2649a60b913bf7d5767f19b6c7acccddf95dc13ad
|
4
|
+
data.tar.gz: 8f0750599d28cceff1c12816236ce7766f29120e0ed985f56e05a7cee4c4c1e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4723143d4b6f0ffaf4eb56925b04dbb9eb14fe61bbab1ee216383876bbd187969761af2237120d415fc496cb16e3e8f24312b612ac4e28cae9f3816af62f0ba
|
7
|
+
data.tar.gz: 584140d65859c52ec474286a53e1ec551b84c9c401bf3613d57457151d730ecc23c472458bbfa35bf83ca073fb3f93fd6ac117d1e348b64e8f7938497c731ba2
|
data/Gemfile.lock
CHANGED
@@ -1,43 +1,49 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
plc_access (0.1.
|
4
|
+
plc_access (0.1.3)
|
5
5
|
serialport (~> 1.3, >= 1.3.1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
ast (2.4.2)
|
11
|
-
json (2.
|
12
|
-
|
13
|
-
|
11
|
+
json (2.10.1)
|
12
|
+
language_server-protocol (3.17.0.4)
|
13
|
+
lint_roller (1.1.0)
|
14
|
+
parallel (1.26.3)
|
15
|
+
parser (3.3.7.1)
|
14
16
|
ast (~> 2.4.1)
|
15
|
-
|
17
|
+
racc
|
18
|
+
power_assert (2.0.5)
|
19
|
+
racc (1.8.1)
|
16
20
|
rainbow (3.1.1)
|
17
21
|
rake (12.3.3)
|
18
|
-
regexp_parser (2.
|
19
|
-
|
20
|
-
|
21
|
-
rubocop (1.36.0)
|
22
|
+
regexp_parser (2.10.0)
|
23
|
+
rr (3.1.1)
|
24
|
+
rubocop (1.72.2)
|
22
25
|
json (~> 2.3)
|
26
|
+
language_server-protocol (~> 3.17.0.2)
|
27
|
+
lint_roller (~> 1.1.0)
|
23
28
|
parallel (~> 1.10)
|
24
|
-
parser (>= 3.
|
29
|
+
parser (>= 3.3.0.2)
|
25
30
|
rainbow (>= 2.2.2, < 4.0)
|
26
|
-
regexp_parser (>=
|
27
|
-
|
28
|
-
rubocop-ast (>= 1.20.1, < 2.0)
|
31
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
32
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
29
33
|
ruby-progressbar (~> 1.7)
|
30
|
-
unicode-display_width (>=
|
31
|
-
rubocop-ast (1.
|
32
|
-
parser (>= 3.
|
33
|
-
ruby-progressbar (1.
|
34
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
35
|
+
rubocop-ast (1.38.0)
|
36
|
+
parser (>= 3.3.1.0)
|
37
|
+
ruby-progressbar (1.13.0)
|
34
38
|
serialport (1.3.2)
|
35
|
-
test-unit (3.
|
39
|
+
test-unit (3.6.7)
|
36
40
|
power_assert
|
37
41
|
test-unit-rr (1.0.5)
|
38
42
|
rr (>= 1.1.1)
|
39
43
|
test-unit (>= 2.5.2)
|
40
|
-
unicode-display_width (
|
44
|
+
unicode-display_width (3.1.4)
|
45
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
46
|
+
unicode-emoji (4.0.4)
|
41
47
|
|
42
48
|
PLATFORMS
|
43
49
|
ruby
|
data/README.md
CHANGED
@@ -80,6 +80,74 @@ plc["DM0", 10].to_string()
|
|
80
80
|
|
81
81
|
```
|
82
82
|
|
83
|
+
## Supported PLCs
|
84
|
+
|
85
|
+
### Keyence
|
86
|
+
|
87
|
+
It supports Keyence PLCs with an Ethernet connection.
|
88
|
+
|
89
|
+
```
|
90
|
+
plc = PlcAccess::Protocol::Keyence::KvProtocol.new host: '192.168.0.10', port: 8501
|
91
|
+
```
|
92
|
+
|
93
|
+
### Mitsubishi
|
94
|
+
|
95
|
+
It supports Mitsubishi PLCs with an Ethernet connection.
|
96
|
+
|
97
|
+
```
|
98
|
+
plc = PlcAccess::Protocol::Mitsubishi::McProtocol.new host: '192.168.0.10', port: 5010
|
99
|
+
```
|
100
|
+
|
101
|
+
It supports Mitsubishi Fx PLCs with a Serial connection.
|
102
|
+
|
103
|
+
```
|
104
|
+
plc = PlcAccess::Protocol::Mitsubishi::FxProtocol.new port: /dev/tty.usbxxxxx'
|
105
|
+
```
|
106
|
+
|
107
|
+
PLC configuration:
|
108
|
+
- baudrate: 19200
|
109
|
+
- bit: 7
|
110
|
+
- parity: Odd
|
111
|
+
- stop bit: 1
|
112
|
+
|
113
|
+

|
114
|
+
|
115
|
+
### Omron
|
116
|
+
|
117
|
+
It supports Omron PLCs with an Ethernet connection.
|
118
|
+
|
119
|
+
```
|
120
|
+
plc = PlcAccess::Protocol::Omron::FinsTcpProtocol.new host: '192.168.0.10', port: 9600
|
121
|
+
```
|
122
|
+
|
123
|
+
It supports Omron PLCs with a C Mode serial connection.
|
124
|
+
|
125
|
+
```
|
126
|
+
plc = PlcAccess::Protocol::Omron::CModeProtocol.new port: /dev/tty.usbxxxxx'
|
127
|
+
```
|
128
|
+
|
129
|
+
### Plc Share
|
130
|
+
|
131
|
+
Plc Share is a protocol conversion application. It runs on Windows and connects to various PLCs using a serial or Ethernet connection. You can then connect with the Plc Share Protocol, which extends Keyence’s protocol. You can specify a target PLC’s device.
|
132
|
+
|
133
|
+
[Plc Share](http://iphone.itosoft.com/plcshare)
|
134
|
+
|
135
|
+

|
136
|
+
|
137
|
+
```
|
138
|
+
plc = PlcAccess::Protocol::PlcShare::PlcShareProtocol.new host: '192.168.0.10', port: 10000, device_type: :fx
|
139
|
+
```
|
140
|
+
|
141
|
+
You can choose a target PLC by using the device type option.
|
142
|
+
|
143
|
+
|device_type|Target PLCs|
|
144
|
+
|:-:|:--|
|
145
|
+
|:kv|Keyence PLCs|
|
146
|
+
|:fx|Mitsubishi Fx PLCs|
|
147
|
+
|:q|Mitsubishi Q/L/R PLCs|
|
148
|
+
|:omron|Omron PLCs|
|
149
|
+
|
150
|
+
|
83
151
|
## Contributing
|
84
152
|
|
85
153
|
Bug reports and pull requests are welcome on GitHub at https://github.com/ito-soft-design/plc_access. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/ito-soft-design/plc_access/blob/master/CODE_OF_CONDUCT.md).
|
Binary file
|
Binary file
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The MIT License (MIT)
|
4
|
+
#
|
5
|
+
# Copyright (c) 2025 ITO SOFT DESIGN Inc.
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
8
|
+
# a copy of this software and associated documentation files (the
|
9
|
+
# "Software"), to deal in the Software without restriction, including
|
10
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
11
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
12
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
13
|
+
# the following conditions:
|
14
|
+
#
|
15
|
+
# The above copyright notice and this permission notice shall be
|
16
|
+
# included in all copies or substantial portions of the Software.
|
17
|
+
#
|
18
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
19
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
20
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
21
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
22
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
23
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
24
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
25
|
+
|
26
|
+
dir = __dir__
|
27
|
+
$LOAD_PATH.unshift dir unless $LOAD_PATH.include? dir
|
28
|
+
|
29
|
+
require 'socket'
|
30
|
+
require 'logger'
|
31
|
+
require 'timeout'
|
32
|
+
require 'plc_share_protocol'
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The MIT License (MIT)
|
4
|
+
#
|
5
|
+
# Copyright (c) 2025 ITO SOFT DESIGN Inc.
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
8
|
+
# a copy of this software and associated documentation files (the
|
9
|
+
# "Software"), to deal in the Software without restriction, including
|
10
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
11
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
12
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
13
|
+
# the following conditions:
|
14
|
+
#
|
15
|
+
# The above copyright notice and this permission notice shall be
|
16
|
+
# included in all copies or substantial portions of the Software.
|
17
|
+
#
|
18
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
19
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
20
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
21
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
22
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
23
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
24
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
25
|
+
|
26
|
+
module PlcAccess
|
27
|
+
module Protocol
|
28
|
+
module PlcShare
|
29
|
+
class PlcShareProtocol < PlcAccess::Protocol::Keyence::KvProtocol
|
30
|
+
attr_accessor :device_type
|
31
|
+
|
32
|
+
def initialize(options = {})
|
33
|
+
super
|
34
|
+
@socket = nil
|
35
|
+
@host = options[:host] || '192.168.0.10'
|
36
|
+
@port = options[:port] || 10000
|
37
|
+
self.device_type = options[:device_type] if options[:device_type]
|
38
|
+
end
|
39
|
+
|
40
|
+
# Device type
|
41
|
+
# :kv Keyence device
|
42
|
+
# :fx Mitsubishi Fx device
|
43
|
+
# :q Mitsubishi Q/L device
|
44
|
+
# :omron Omron device
|
45
|
+
def device_type= type
|
46
|
+
@device_type = type
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def device_class
|
52
|
+
case @device_type
|
53
|
+
when :kv
|
54
|
+
PlcAccess::Protocol::Keyence::KvDevice
|
55
|
+
when :fx
|
56
|
+
PlcAccess::Protocol::Mitsubishi::FxDevice
|
57
|
+
when :q
|
58
|
+
PlcAccess::Protocol::Mitsubishi::QDevice
|
59
|
+
when :omron
|
60
|
+
PlcAccess::Protocol::Omron::OmronDevice
|
61
|
+
else
|
62
|
+
PlcAccess::Protocol::Keyence::KvDevice
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
data/lib/plc_access/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plc_access
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katsuyoshi Ito
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: serialport
|
@@ -49,6 +49,8 @@ files:
|
|
49
49
|
- Rakefile
|
50
50
|
- bin/console
|
51
51
|
- bin/setup
|
52
|
+
- images/fx_comm_setting.png
|
53
|
+
- images/plc_share.png
|
52
54
|
- lib/plc_access.rb
|
53
55
|
- lib/plc_access/act_as_type.rb
|
54
56
|
- lib/plc_access/protocol/keyence/keyence.rb
|
@@ -64,6 +66,8 @@ files:
|
|
64
66
|
- lib/plc_access/protocol/omron/omron.rb
|
65
67
|
- lib/plc_access/protocol/omron/omron_device.rb
|
66
68
|
- lib/plc_access/protocol/plc_device.rb
|
69
|
+
- lib/plc_access/protocol/plc_share/plc_share.rb
|
70
|
+
- lib/plc_access/protocol/plc_share/plc_share_protocol.rb
|
67
71
|
- lib/plc_access/protocol/protocol.rb
|
68
72
|
- lib/plc_access/version.rb
|
69
73
|
- plc_access.gemspec
|
@@ -89,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
93
|
- !ruby/object:Gem::Version
|
90
94
|
version: '0'
|
91
95
|
requirements: []
|
92
|
-
rubygems_version: 3.4.
|
96
|
+
rubygems_version: 3.4.19
|
93
97
|
signing_key:
|
94
98
|
specification_version: 4
|
95
99
|
summary: The PlcAccess communicates with PLCs.
|