ladder_drive 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/Gemfile +8 -0
  4. data/Gemfile.lock +41 -0
  5. data/LICENSE +21 -0
  6. data/README.md +191 -0
  7. data/README_jp.md +193 -0
  8. data/Rakefile +9 -0
  9. data/bin/console +14 -0
  10. data/bin/setup +8 -0
  11. data/exe/ladder_drive +28 -0
  12. data/ladder_drive.gemspec +33 -0
  13. data/lib/ladder_drive/asm.rb +211 -0
  14. data/lib/ladder_drive/cli.rb +55 -0
  15. data/lib/ladder_drive/config.rb +107 -0
  16. data/lib/ladder_drive/config_target.rb +93 -0
  17. data/lib/ladder_drive/console.rb +113 -0
  18. data/lib/ladder_drive/intel_hex.rb +79 -0
  19. data/lib/ladder_drive/ladder_drive.rb +36 -0
  20. data/lib/ladder_drive/plc_define.rb +35 -0
  21. data/lib/ladder_drive/plc_device.rb +171 -0
  22. data/lib/ladder_drive/protocol/emulator/emu_protocol.rb +54 -0
  23. data/lib/ladder_drive/protocol/emulator/emulator.rb +29 -0
  24. data/lib/ladder_drive/protocol/keyence/keyence.rb +31 -0
  25. data/lib/ladder_drive/protocol/keyence/kv_device.rb +51 -0
  26. data/lib/ladder_drive/protocol/keyence/kv_protocol.rb +187 -0
  27. data/lib/ladder_drive/protocol/mitsubishi/mc_protocol.rb +268 -0
  28. data/lib/ladder_drive/protocol/mitsubishi/mitsubishi.rb +30 -0
  29. data/lib/ladder_drive/protocol/mitsubishi/qdevice.rb +114 -0
  30. data/lib/ladder_drive/protocol/protocol.rb +107 -0
  31. data/lib/ladder_drive/tasks/build.rb +101 -0
  32. data/lib/ladder_drive/uploader.rb +101 -0
  33. data/lib/ladder_drive/version.rb +26 -0
  34. data/lib/ladder_drive.rb +32 -0
  35. data/lib/plc/LICENSE +21 -0
  36. data/lib/plc/emulator/emu_device.rb +121 -0
  37. data/lib/plc/emulator/emu_plc.rb +482 -0
  38. data/lib/plc/emulator/emu_plc_server.rb +71 -0
  39. data/lib/plc/emulator/emulator.rb +28 -0
  40. data/lib/plc/keyence/kv/kv-5000/DocumentWindowInfo.xml +91 -0
  41. data/lib/plc/keyence/kv/kv-5000/KvsMon.ini +0 -0
  42. data/lib/plc/keyence/kv/kv-5000/LadderDrive.mod +0 -0
  43. data/lib/plc/keyence/kv/kv-5000/LbkMdm.ini +0 -0
  44. data/lib/plc/keyence/kv/kv-5000/Main.mod +0 -0
  45. data/lib/plc/keyence/kv/kv-5000/MonEnv.kmu +1 -0
  46. data/lib/plc/keyence/kv/kv-5000/PlcSended.dky +0 -0
  47. data/lib/plc/keyence/kv/kv-5000/SensorMonitorInfo.xml +4 -0
  48. data/lib/plc/keyence/kv/kv-5000/TransInfo.tif +0 -0
  49. data/lib/plc/keyence/kv/kv-5000/UnitSet.ue2 +0 -0
  50. data/lib/plc/keyence/kv/kv-5000/UnitSet.ue2.old +0 -0
  51. data/lib/plc/keyence/kv/kv-5000/WsTreeEnv.xml +28 -0
  52. data/lib/plc/keyence/kv/kv-5000/kv-5000.cm1 +0 -0
  53. data/lib/plc/keyence/kv/kv-5000/kv-5000.cm2 +0 -0
  54. data/lib/plc/keyence/kv/kv-5000/kv-5000.ftc +0 -0
  55. data/lib/plc/keyence/kv/kv-5000/kv-5000.kpr +0 -0
  56. data/lib/plc/keyence/kv/kv-5000/kv-5000.lbl +0 -0
  57. data/lib/plc/keyence/kv/kv-5000/kv-5000.mil +0 -0
  58. data/lib/plc/keyence/kv/kv-5000/kv-5000.spl +0 -0
  59. data/lib/plc/keyence/kv/kv-5000/operand-history.txt +16 -0
  60. data/lib/plc/keyence/kv/kv-5000/sample.al2 +2 -0
  61. data/lib/plc/mitsubishi/iq-r/r08/r08.gx3 +0 -0
  62. data/lib/plc/plc.rb +27 -0
  63. data/sample/ladder_drive/sample1.esc +4 -0
  64. data/sample/ladder_drive/sample2.esc +28 -0
  65. data/sample/ladder_drive/sample2.png +0 -0
  66. data/template/escalator/config/plc.yml +27 -0
  67. data/template/ladder_drive/Rakefile +1 -0
  68. data/template/ladder_drive/asm/main.esc +70 -0
  69. data/template/ladder_drive/config/plc.yml +27 -0
  70. metadata +174 -0
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Root>
3
+ <Expanded>0</Expanded>
4
+ <Child>
5
+ <value.first>ユニット構成</value.first>
6
+ <value.second>
7
+ <Expanded>1</Expanded>
8
+ <Child>
9
+ <value.first>[0] KV-5000 R000/R500</value.first>
10
+ <value.second>
11
+ <Expanded>0</Expanded>
12
+ <Child>
13
+ <value.first>Ethernet R30000 DM10000</value.first>
14
+ <value.second>
15
+ <Expanded>0</Expanded>
16
+ </value.second>
17
+ </Child>
18
+ </value.second>
19
+ </Child>
20
+ <Child>
21
+ <value.first>ユニット構成切替</value.first>
22
+ <value.second>
23
+ <Expanded>0</Expanded>
24
+ </value.second>
25
+ </Child>
26
+ </value.second>
27
+ </Child>
28
+ </Root>
@@ -0,0 +1,16 @@
1
+ req_pause
2
+ cycle_running
3
+ ack_pause
4
+ req_clear_program
5
+ #0
6
+ ack_clear_program
7
+ cycle_end
8
+ #9
9
+ #1
10
+ operand_bits
11
+ #2
12
+ #3
13
+ #4
14
+ current_bit_value
15
+ operand
16
+ opr_end
@@ -0,0 +1,2 @@
1
+ ##al2file
2
+ sample=2:192.168.0.10:8500/0/1/0:0:0/0:0::0/
Binary file
data/lib/plc/plc.rb ADDED
@@ -0,0 +1,27 @@
1
+ #
2
+ # Copyright (c) 2016 ITO SOFT DESIGN Inc.
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+
23
+ dir = File.expand_path(File.dirname(__FILE__))
24
+ $:.unshift dir unless $:.include? dir
25
+
26
+ # Use load instead require, because there are two emulator files.
27
+ load File.join(dir, 'emulator/emulator.rb')
@@ -0,0 +1,4 @@
1
+ NOP
2
+ LD X0
3
+ OUT Y0
4
+
@@ -0,0 +1,28 @@
1
+ LD X0
2
+ OUT Y0
3
+ LD M0
4
+ OR M3
5
+ ANI M2
6
+ OUT M3
7
+ LD M4
8
+ ANI M5
9
+ LDI M7
10
+ AND M8
11
+ ORB
12
+ LD M4
13
+ ANI M5
14
+ LDI M7
15
+ AND M8
16
+ ORB
17
+ ANB
18
+ OUT M6
19
+ LD M9
20
+ ANI M10
21
+ OUT M6
22
+ MPS
23
+ AND M11
24
+ OUT M12
25
+ MPP
26
+ AND M13
27
+ OUT M14
28
+ END
Binary file
@@ -0,0 +1,27 @@
1
+ # Run rake with target like this.
2
+ # > rake target=iq-r
3
+
4
+ # plc section
5
+ plc:
6
+ # MITSUBISHI iQ-R
7
+ iq-r: # It's a target name
8
+ cpu: iq-r # It's just a comment.
9
+ protocol: mc_protocol # It's a protocol to communicate with PLC.
10
+ host: 192.168.0.10 # It's PLC's IP address or dns name.
11
+ # port: 5007 # It's PLC's port no. If it's not descript here, use default port.
12
+
13
+ # You can describe targets multiply.
14
+
15
+ # Keyence KV-5000
16
+ kv5000:
17
+ cpu: kv-5000
18
+ protocol: kv_protocol
19
+ host: 192.168.0.11
20
+ # port: 8501
21
+
22
+
23
+ # default section
24
+ default:
25
+ # If you set target iq-r, `rake` is same as `rake target=iq-r`.
26
+ # default target is emulator.
27
+ # target: iq-r
@@ -0,0 +1 @@
1
+ require 'ladder_drive/tasks/build'
@@ -0,0 +1,70 @@
1
+ # |X0|-+-|/X1|-|/Y1|---(Y0)
2
+ # |Y0|-+
3
+ LD X0
4
+ OR Y0
5
+ ANI X1
6
+ ANI Y1
7
+ OUT Y0
8
+
9
+ # |X1|-+-|/X0|-|/Y0|---(Y1)
10
+ # |Y1|-+
11
+ LD X1
12
+ OR Y1
13
+ ANI X0
14
+ ANI Y0
15
+ OUT Y1
16
+
17
+ # |M0|-+-|M2|-+---(M4)
18
+ # |M1|-+-|M3|-+
19
+ LD M0
20
+ OR M1
21
+ LD M2
22
+ OR M3
23
+ ANB
24
+ OUT M4
25
+
26
+ # |M5|-+-|M7|-+---(M10)
27
+ # |M6|-+ |
28
+ # |
29
+ # |M8|-+------+
30
+ # |M9|-+
31
+ LD M5
32
+ OR M6
33
+ AND M7
34
+ LD M8
35
+ OR M9
36
+ ORB
37
+ OUT M10
38
+
39
+ # |M11|-+-/-+---(M13)
40
+ # |M12|-+ +---(Y2)
41
+ # +---(/Y3)
42
+ LD M11
43
+ OR M12
44
+ INV
45
+ MPS
46
+ OUT M13
47
+ MRD
48
+ OUT Y2
49
+ MPP
50
+ OUTI Y3
51
+
52
+ # |M14|---[SET M17]
53
+ # SET is not implement completely.
54
+ # If both conditions of set and rst turn on same time, output is not stable.
55
+ LD M14
56
+ SET M17
57
+
58
+ # |M15|---[RST M17]
59
+ # RST is not implement completely.
60
+ # If both conditions of set and rst turn on same time, output is not stable.
61
+ LD M15
62
+ RST M17
63
+
64
+ # |M16|---[FF M17]
65
+ # Currently ff is not supported.
66
+ #LD M16
67
+ #FF M17
68
+
69
+ NOP
70
+ END
@@ -0,0 +1,27 @@
1
+ # Run rake with target like this.
2
+ # > rake target=iq-r
3
+
4
+ # plc section
5
+ plc:
6
+ # MITSUBISHI iQ-R
7
+ iq-r: # It's a target name
8
+ cpu: iq-r # It's just a comment.
9
+ protocol: mc_protocol # It's a protocol to communicate with PLC.
10
+ host: 192.168.0.10 # It's PLC's IP address or dns name.
11
+ # port: 5007 # It's PLC's port no. If it's not descript here, use default port.
12
+
13
+ # You can describe targets multiply.
14
+
15
+ # Keyence KV-5000
16
+ kv5000:
17
+ cpu: kv-5000
18
+ protocol: kv_protocol
19
+ host: 192.168.0.11
20
+ # port: 8501
21
+
22
+
23
+ # default section
24
+ default:
25
+ # If you set target iq-r, `rake` is same as `rake target=iq-r`.
26
+ # default target is emulator.
27
+ # target: iq-r
metadata ADDED
@@ -0,0 +1,174 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ladder_drive
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Katsuyoshi Ito
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-03-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 4.2.7
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 4.2.7
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.11'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.11'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ description: We aim to design abstraction ladder which is able to run on any PLC with
70
+ same ladder source or binary and prepare full stack tools.
71
+ email:
72
+ - kito@itosoft.com
73
+ executables:
74
+ - ladder_drive
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - ".gitignore"
79
+ - Gemfile
80
+ - Gemfile.lock
81
+ - LICENSE
82
+ - README.md
83
+ - README_jp.md
84
+ - Rakefile
85
+ - bin/console
86
+ - bin/setup
87
+ - exe/ladder_drive
88
+ - ladder_drive.gemspec
89
+ - lib/ladder_drive.rb
90
+ - lib/ladder_drive/asm.rb
91
+ - lib/ladder_drive/cli.rb
92
+ - lib/ladder_drive/config.rb
93
+ - lib/ladder_drive/config_target.rb
94
+ - lib/ladder_drive/console.rb
95
+ - lib/ladder_drive/intel_hex.rb
96
+ - lib/ladder_drive/ladder_drive.rb
97
+ - lib/ladder_drive/plc_define.rb
98
+ - lib/ladder_drive/plc_device.rb
99
+ - lib/ladder_drive/protocol/emulator/emu_protocol.rb
100
+ - lib/ladder_drive/protocol/emulator/emulator.rb
101
+ - lib/ladder_drive/protocol/keyence/keyence.rb
102
+ - lib/ladder_drive/protocol/keyence/kv_device.rb
103
+ - lib/ladder_drive/protocol/keyence/kv_protocol.rb
104
+ - lib/ladder_drive/protocol/mitsubishi/mc_protocol.rb
105
+ - lib/ladder_drive/protocol/mitsubishi/mitsubishi.rb
106
+ - lib/ladder_drive/protocol/mitsubishi/qdevice.rb
107
+ - lib/ladder_drive/protocol/protocol.rb
108
+ - lib/ladder_drive/tasks/build.rb
109
+ - lib/ladder_drive/uploader.rb
110
+ - lib/ladder_drive/version.rb
111
+ - lib/plc/LICENSE
112
+ - lib/plc/emulator/emu_device.rb
113
+ - lib/plc/emulator/emu_plc.rb
114
+ - lib/plc/emulator/emu_plc_server.rb
115
+ - lib/plc/emulator/emulator.rb
116
+ - lib/plc/keyence/kv/kv-5000/DocumentWindowInfo.xml
117
+ - lib/plc/keyence/kv/kv-5000/KvsMon.ini
118
+ - lib/plc/keyence/kv/kv-5000/LadderDrive.mod
119
+ - lib/plc/keyence/kv/kv-5000/LbkMdm.ini
120
+ - lib/plc/keyence/kv/kv-5000/Main.mod
121
+ - lib/plc/keyence/kv/kv-5000/MonEnv.kmu
122
+ - lib/plc/keyence/kv/kv-5000/PlcSended.dky
123
+ - lib/plc/keyence/kv/kv-5000/SensorMonitorInfo.xml
124
+ - lib/plc/keyence/kv/kv-5000/TransInfo.tif
125
+ - lib/plc/keyence/kv/kv-5000/UnitSet.ue2
126
+ - lib/plc/keyence/kv/kv-5000/UnitSet.ue2.old
127
+ - lib/plc/keyence/kv/kv-5000/WsTreeEnv.xml
128
+ - lib/plc/keyence/kv/kv-5000/kv-5000.cm1
129
+ - lib/plc/keyence/kv/kv-5000/kv-5000.cm2
130
+ - lib/plc/keyence/kv/kv-5000/kv-5000.ftc
131
+ - lib/plc/keyence/kv/kv-5000/kv-5000.kpr
132
+ - lib/plc/keyence/kv/kv-5000/kv-5000.lbl
133
+ - lib/plc/keyence/kv/kv-5000/kv-5000.mil
134
+ - lib/plc/keyence/kv/kv-5000/kv-5000.spl
135
+ - lib/plc/keyence/kv/kv-5000/operand-history.txt
136
+ - lib/plc/keyence/kv/kv-5000/sample.al2
137
+ - lib/plc/mitsubishi/iq-r/r08/r08.gx3
138
+ - lib/plc/plc.rb
139
+ - sample/ladder_drive/sample1.esc
140
+ - sample/ladder_drive/sample2.esc
141
+ - sample/ladder_drive/sample2.png
142
+ - template/escalator/config/plc.yml
143
+ - template/ladder_drive/Rakefile
144
+ - template/ladder_drive/asm/main.esc
145
+ - template/ladder_drive/config/plc.yml
146
+ homepage: https://github.com/ito-soft-design/ladder_drive
147
+ licenses:
148
+ - MIT
149
+ metadata: {}
150
+ post_install_message: |2
151
+ ! The 'ladder_drive' gem has been deprecated and has been replaced by 'ladder_drive'.
152
+ ! See: https://rubygems.org/gems/ladder_drive
153
+ ! And: https://github.com/ito-soft-design/ladder_drive
154
+ rdoc_options: []
155
+ require_paths:
156
+ - lib
157
+ required_ruby_version: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - ">="
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
162
+ required_rubygems_version: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ requirements: []
168
+ rubyforge_project:
169
+ rubygems_version: 2.5.1
170
+ signing_key:
171
+ specification_version: 4
172
+ summary: The ladder_drive is a simple abstract ladder for PLC (Programmable Logic
173
+ Controller). Formerly known as 'escalator'.
174
+ test_files: []