machine_setup 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +28 -25
- data/README.rdoc +45 -17
- data/Rakefile +6 -6
- data/TODO +5 -5
- data/VERSION +1 -1
- data/bin/setup_config_gen +41 -0
- data/examples/underleaver/underleaver.setup.param +42 -31
- data/examples/underleaver/underleaver.setup.param.de.yml +105 -53
- data/examples/underleaver/underleaver.setup.param.en.yml +41 -5
- data/lib/setup_configuration/array.rb +15 -0
- data/lib/setup_configuration/parameter_machinetype_bridge.rb +12 -0
- data/lib/setup_configuration/setup_config.rb +67 -12
- data/lib/setup_configuration/suite_generator.rb +79 -3
- data/lib/setup_configuration/templates/logcodesetup.exp.erb +15 -0
- data/lib/setup_configuration/templates/mps3.ini.erb +12 -16
- data/lib/setup_configuration/translation.rb +2 -0
- data/lib/setup_configuration.rb +6 -1
- data/test/setup_configuration/machine_type_test.rb +36 -0
- data/test/setup_configuration/parameter_test.rb +51 -0
- data/test/setup_configuration/setup_configuration_test.rb +1 -1
- data/test/test_helper.rb +3 -0
- metadata +13 -6
- data/bin/setup_config_gen.rb +0 -30
data/.gitignore
CHANGED
@@ -1,27 +1,30 @@
|
|
1
|
-
## MAC OS
|
2
|
-
.DS_Store
|
3
|
-
|
4
|
-
## TEXTMATE
|
5
|
-
*.tmproj
|
6
|
-
tmtags
|
7
|
-
|
8
|
-
## EMACS
|
9
|
-
*~
|
10
|
-
\#*
|
11
|
-
.\#*
|
12
|
-
|
13
|
-
## VIM
|
14
|
-
*.swp
|
15
|
-
|
16
|
-
## PROJECT::GENERAL
|
17
|
-
coverage
|
18
|
-
rdoc
|
19
|
-
pkg
|
20
|
-
|
21
|
-
## RubyMine
|
22
|
-
.idea
|
23
|
-
|
24
|
-
## PROJECT::SPECIFIC
|
1
|
+
## MAC OS
|
2
|
+
.DS_Store
|
3
|
+
|
4
|
+
## TEXTMATE
|
5
|
+
*.tmproj
|
6
|
+
tmtags
|
7
|
+
|
8
|
+
## EMACS
|
9
|
+
*~
|
10
|
+
\#*
|
11
|
+
.\#*
|
12
|
+
|
13
|
+
## VIM
|
14
|
+
*.swp
|
15
|
+
|
16
|
+
## PROJECT::GENERAL
|
17
|
+
coverage
|
18
|
+
rdoc
|
19
|
+
pkg
|
20
|
+
|
21
|
+
## RubyMine
|
22
|
+
.idea
|
23
|
+
|
24
|
+
## PROJECT::SPECIFIC
|
25
25
|
|
26
26
|
/test/trans.rb
|
27
|
-
/test/y.rb
|
27
|
+
/test/y.rb
|
28
|
+
/examples/**/*.lng
|
29
|
+
/examples/**/*.EXP
|
30
|
+
/examples/**/mps3.ini
|
data/README.rdoc
CHANGED
@@ -1,17 +1,45 @@
|
|
1
|
-
=
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
==
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
1
|
+
= Machine_setup: Generating configuration files for a machine setup
|
2
|
+
|
3
|
+
Github: http://github.com/robi-wan/machine_setup/
|
4
|
+
|
5
|
+
== Intro
|
6
|
+
|
7
|
+
Machine_setup is a gem which helps generating a set of configuration files for a machine setup.
|
8
|
+
It takes a parameter description file and translation files with german and english translations and generates
|
9
|
+
the appropriate configuration files.
|
10
|
+
|
11
|
+
== Installation
|
12
|
+
|
13
|
+
You can install the gem with
|
14
|
+
|
15
|
+
gem install machine_setup
|
16
|
+
|
17
|
+
This gem depends on 'i18n'.
|
18
|
+
|
19
|
+
== Usage
|
20
|
+
|
21
|
+
Describe your setup configuration for a machine (including translations for supported languages) and set the main
|
22
|
+
file as a parameter to 'setup_config_gen':
|
23
|
+
|
24
|
+
setup_config_gen ../examples/underleaver/underleaver.setup.param
|
25
|
+
|
26
|
+
=== Parameter descriptions
|
27
|
+
|
28
|
+
=== Translations
|
29
|
+
|
30
|
+
=== Generating
|
31
|
+
|
32
|
+
|
33
|
+
== Note on Patches/Pull Requests
|
34
|
+
|
35
|
+
* Fork the project.
|
36
|
+
* Make your feature addition or bug fix.
|
37
|
+
* Add tests for it. This is important so I don't break it in a
|
38
|
+
future version unintentionally.
|
39
|
+
* Commit, do not mess with rakefile, version, or history.
|
40
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
41
|
+
* Send me a pull request. Bonus points for topic branches.
|
42
|
+
|
43
|
+
== License
|
44
|
+
|
45
|
+
MIT License. See the included MIT-LICENSE file.
|
data/Rakefile
CHANGED
@@ -5,13 +5,13 @@ begin
|
|
5
5
|
require 'jeweler'
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
7
|
gem.name = "machine_setup"
|
8
|
-
gem.executables = ["setup_config_gen
|
8
|
+
gem.executables = ["setup_config_gen"]
|
9
9
|
gem.summary = %Q{Generating configuration for machine setup parameters.}
|
10
10
|
gem.description = %Q{Helps generating configuration files for machine setup parameters.}
|
11
11
|
gem.email = "robi-wan@suyu.de"
|
12
12
|
gem.homepage = "http://github.com/robi-wan/machine_setup"
|
13
13
|
gem.authors = ["robi-wan"]
|
14
|
-
gem.add_runtime_dependency "i18n", ">= 0.3.
|
14
|
+
gem.add_runtime_dependency "i18n", ">= 0.3.2"
|
15
15
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
16
|
end
|
17
17
|
Jeweler::GemcutterTasks.new
|
@@ -21,8 +21,8 @@ end
|
|
21
21
|
|
22
22
|
require 'rake/testtask'
|
23
23
|
Rake::TestTask.new(:test) do |test|
|
24
|
-
test.libs << '
|
25
|
-
test.pattern = 'test
|
24
|
+
test.libs << 'test'
|
25
|
+
test.pattern = 'test/**/*_test.rb'
|
26
26
|
test.verbose = true
|
27
27
|
end
|
28
28
|
|
@@ -30,7 +30,7 @@ begin
|
|
30
30
|
require 'rcov/rcovtask'
|
31
31
|
Rcov::RcovTask.new do |test|
|
32
32
|
test.libs << 'test'
|
33
|
-
test.pattern = 'test
|
33
|
+
test.pattern = 'test/**/*_test.rb'
|
34
34
|
test.verbose = true
|
35
35
|
end
|
36
36
|
rescue LoadError
|
@@ -48,7 +48,7 @@ Rake::RDocTask.new do |rdoc|
|
|
48
48
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
49
49
|
|
50
50
|
rdoc.rdoc_dir = 'rdoc'
|
51
|
-
rdoc.title = "
|
51
|
+
rdoc.title = "machine_setup #{version}"
|
52
52
|
rdoc.rdoc_files.include('README*')
|
53
53
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
54
54
|
end
|
data/TODO
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
-
|
1
|
+
- code cleanup
|
2
2
|
|
3
|
-
-
|
3
|
+
- cleaner file / module / class - structure
|
4
4
|
|
5
|
-
-
|
5
|
+
- check erb templates with mri ruby and jruby (erb.rb)
|
6
6
|
|
7
|
-
-
|
7
|
+
- check erubis
|
8
8
|
|
9
|
-
-
|
9
|
+
- rubygems usage: http://gist.github.com/54177
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
begin
|
4
|
+
param_def=ARGV[0]
|
5
|
+
|
6
|
+
raise RuntimeError.new("Missing argument: file with parameter definition") if param_def.nil?
|
7
|
+
raise RuntimeError.new("Wrong argument: file '#{param_def}' with parameter definition not found") unless File.file?(param_def)
|
8
|
+
|
9
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
10
|
+
require 'setup_configuration'
|
11
|
+
|
12
|
+
# load file with parameter dsl
|
13
|
+
load param_def
|
14
|
+
|
15
|
+
# get reference to suite instance which holds parameter configuration
|
16
|
+
suite=SetupConfiguration::Suite.instance
|
17
|
+
|
18
|
+
#set output path
|
19
|
+
generator = SetupConfiguration::SuiteGenerator.new()
|
20
|
+
generator.output_path=File.dirname(param_def)
|
21
|
+
|
22
|
+
# load files with translations
|
23
|
+
SetupConfiguration::Translation.translation_files(suite.name).each() do |t|
|
24
|
+
trans_file=File.join(File.dirname(param_def), t)
|
25
|
+
if File.file?(trans_file)
|
26
|
+
SetupConfiguration::Translation::Translator.i18n_load_path(trans_file)
|
27
|
+
else
|
28
|
+
puts "WARNING: expected file with translations '#{trans_file}' not found."
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
generator.generate()
|
33
|
+
|
34
|
+
puts("#{File.basename(__FILE__)} completed.")
|
35
|
+
rescue Exception => e
|
36
|
+
#puts("Error, program will exit => #{e}!")
|
37
|
+
puts(e.message)
|
38
|
+
#puts(e.backtrace().join("\n"))
|
39
|
+
exit(1)
|
40
|
+
|
41
|
+
end
|
@@ -1,4 +1,15 @@
|
|
1
|
-
SetupConfiguration :underleaver do
|
1
|
+
SetupConfiguration :underleaver, :ul do
|
2
|
+
|
3
|
+
setting do
|
4
|
+
min 0..0
|
5
|
+
max 0..0
|
6
|
+
balance_min 3000..3029
|
7
|
+
balance_max 3030..3059
|
8
|
+
machine_type :all_machines, 0, 0..999
|
9
|
+
machine_type :underleaver_one, 1, 1000..1999
|
10
|
+
machine_type :underleaver_two, 2, 2000..2999
|
11
|
+
machine_type :underleaver_three, 3, 3000..3999
|
12
|
+
end
|
2
13
|
|
3
14
|
category :common do
|
4
15
|
param :underleaver_config, 1
|
@@ -24,82 +35,82 @@ SetupConfiguration :underleaver do
|
|
24
35
|
end
|
25
36
|
|
26
37
|
param :ext_enabling_previous_unit, 13
|
38
|
+
|
39
|
+
param :source_parameter_working_velocity, 21
|
40
|
+
|
41
|
+
param :roll_bracket_active, 22
|
42
|
+
param :factor_activation_point_roll_bracket, 23 do
|
43
|
+
depends_on :roll_bracket_active
|
44
|
+
end
|
27
45
|
end
|
28
46
|
|
29
47
|
category :drives do
|
30
48
|
|
31
49
|
# paper roll drive
|
32
|
-
param :
|
50
|
+
param :paper_roll_drive_selection, 300
|
33
51
|
param :paper_roll_drive_distance_revolution, 301 do
|
34
|
-
depends_on :
|
52
|
+
depends_on :paper_roll_drive_selection
|
35
53
|
end
|
36
54
|
param :paper_roll_drive_gear_in, 302 do
|
37
|
-
depends_on :
|
55
|
+
depends_on :paper_roll_drive_selection
|
38
56
|
end
|
39
57
|
param :paper_roll_drive_gear_out, 303 do
|
40
|
-
depends_on :
|
58
|
+
depends_on :paper_roll_drive_selection
|
41
59
|
end
|
42
60
|
|
43
61
|
# blade drive
|
44
|
-
param :
|
62
|
+
param :blade_drive_selection, 310
|
45
63
|
param :blade_drive_diameter, 311 do
|
46
|
-
depends_on :
|
64
|
+
depends_on :blade_drive_selection
|
47
65
|
end
|
48
66
|
param :blade_drive_gear_in, 312 do
|
49
|
-
depends_on :
|
67
|
+
depends_on :blade_drive_selection
|
50
68
|
end
|
51
69
|
param :blade_drive_gear_out, 313 do
|
52
|
-
depends_on :
|
70
|
+
depends_on :blade_drive_selection
|
53
71
|
end
|
54
72
|
|
55
73
|
#paper feed drive
|
56
|
-
param :
|
74
|
+
param :paper_feed_drive_selection, 320
|
57
75
|
param :paper_feed_drive_distance_revolution, 321 do
|
58
|
-
depends_on :
|
76
|
+
depends_on :paper_feed_drive_selection
|
59
77
|
end
|
60
78
|
param :paper_feed_drive_gear_in, 322 do
|
61
|
-
depends_on :
|
79
|
+
depends_on :paper_feed_drive_selection
|
62
80
|
end
|
63
81
|
param :paper_feed_drive_gear_out, 323 do
|
64
|
-
depends_on :
|
82
|
+
depends_on :paper_feed_drive_selection
|
65
83
|
end
|
66
84
|
|
67
85
|
#transport drive
|
68
|
-
param :
|
86
|
+
param :transport_drive_selection, 330
|
69
87
|
param :transport_drive_distance_revolution, 331 do
|
70
|
-
depends_on :
|
88
|
+
depends_on :transport_drive_selection
|
71
89
|
end
|
72
90
|
param :transport_drive_gear_in, 332 do
|
73
|
-
depends_on :
|
91
|
+
depends_on :transport_drive_selection
|
74
92
|
end
|
75
93
|
param :transport_drive_gear_out, 333 do
|
76
|
-
depends_on :
|
94
|
+
depends_on :transport_drive_selection
|
77
95
|
end
|
78
96
|
param :transport_drive_belt_length, 334 do
|
79
|
-
depends_on :
|
97
|
+
depends_on :transport_drive_selection
|
80
98
|
end
|
81
99
|
|
82
100
|
#infeed drive
|
83
|
-
param :
|
101
|
+
param :infeed_drive_selection, 350
|
84
102
|
param :infeed_drive_distance_revolution, 351 do
|
85
|
-
depends_on :
|
103
|
+
depends_on :infeed_drive_selection
|
86
104
|
end
|
87
105
|
param :infeed_drive_gear_in, 352 do
|
88
|
-
depends_on :
|
106
|
+
depends_on :infeed_drive_selection
|
89
107
|
end
|
90
108
|
param :infeed_drive_gear_out, 353 do
|
91
|
-
depends_on :
|
109
|
+
depends_on :infeed_drive_selection
|
92
110
|
end
|
93
111
|
param :infeed_drive_belt_length, 354 do
|
94
|
-
depends_on :
|
112
|
+
depends_on :infeed_drive_selection
|
95
113
|
end
|
96
114
|
end
|
97
115
|
|
98
|
-
|
99
|
-
min (0..0)
|
100
|
-
max (0..0)
|
101
|
-
balance_min (3000..3029)
|
102
|
-
balance_max (3030..3059)
|
103
|
-
end
|
104
|
-
|
105
|
-
end
|
116
|
+
end
|
@@ -9,23 +9,26 @@ de:
|
|
9
9
|
#parameter
|
10
10
|
underleaver_config:
|
11
11
|
name: "Underleaver virtuell=1 / real=0"
|
12
|
-
comment:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
12
|
+
comment: |
|
13
|
+
Einerstelle:
|
14
|
+
x0: Steuerung mit realen Achsen und Schutzhauben
|
15
|
+
x1: Steuerung simuliert alle nicht angew�hlten Achsen und Schutzhauben
|
16
|
+
|
17
|
+
|
18
|
+
Zehnerstelle:
|
19
|
+
0x: CanBus einschalten
|
20
|
+
1x: CanBus ausschalten
|
21
|
+
|
22
|
+
|
23
|
+
Hunderterstelle:
|
24
|
+
1xx: Steuerung simuliert alle Antriebe
|
22
25
|
|
23
26
|
distance_photo_sensor:
|
24
27
|
name: "Weg Lichtschranke bis Blattaustritt"
|
25
|
-
comment: ""
|
28
|
+
comment: "Abstand der Lichtschranke vom Blattaustritt."
|
26
29
|
|
27
30
|
distance_blade_to_sheet_drive:
|
28
|
-
name:
|
31
|
+
name: "Weg Schneide bis Blattantrieb"
|
29
32
|
comment: ""
|
30
33
|
|
31
34
|
distance_sheet_drive_to_sheet_exit:
|
@@ -38,12 +41,15 @@ de:
|
|
38
41
|
|
39
42
|
paper_jam_detection_active:
|
40
43
|
name: "Papierstau�berwachung"
|
41
|
-
comment:
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
comment: |
|
45
|
+
Erm�glicht die Abschaltung der Papierstau�berwachung
|
46
|
+
|
47
|
+
|
48
|
+
0=Abwahl
|
49
|
+
1=Anwahl
|
50
|
+
|
51
|
+
|
52
|
+
(Standard: 1)
|
47
53
|
|
48
54
|
paper_jam_detection_signal_length:
|
49
55
|
name: "Signaldauer f�r Papierstau"
|
@@ -52,7 +58,7 @@ de:
|
|
52
58
|
Bei Angabe von 0 wird die Zeitdauer programmintern festgelegt."
|
53
59
|
|
54
60
|
paper_jam_detection_check_time:
|
55
|
-
name: "Papierstau�berpr�fungszeit nach '
|
61
|
+
name: "Papierstau�berpr�fungszeit nach 'letztem' Produkt"
|
56
62
|
comment: "Die �berpr�fung, ob ein Papierstau vorliegt, erfolgt bei Beginn der F�rderung des n�chsten Blattes.
|
57
63
|
Kommt nach dem aktuellen Produkt eine Weile kein Produkt mehr, so erm�glicht dieser Parameter die Einstellung
|
58
64
|
der Zeitdauer, nach deren Ablauf eine Papierstau�berpr�fung vorgenommen wird.\n
|
@@ -63,7 +69,7 @@ de:
|
|
63
69
|
Die Angabe wird 1:1 im Programm verwendet."
|
64
70
|
|
65
71
|
ext_enabling_following_unit:
|
66
|
-
name: "Externe Freigabe nachgelagerter Einheit (NE)"
|
72
|
+
name: "Externe Freigabe von nachgelagerter Einheit (NE)"
|
67
73
|
comment: "An/Abwahl der externen Freigabe der nachgelagerten Einheit.\n
|
68
74
|
\n
|
69
75
|
0: Der Underleaver arbeitet als 'Standalone'-Maschine oder besitzt innerhalb einer Linie keine nachgelagerte Einheit.\n
|
@@ -92,35 +98,79 @@ de:
|
|
92
98
|
1: negatives Dauersignal - Freigabe bei 0V\n
|
93
99
|
2: positives Dauersignal - Freigabe bei 12V"
|
94
100
|
|
95
|
-
|
101
|
+
source_parameter_working_velocity:
|
102
|
+
name: "Parameterquelle f�r Bandgeschwindigkeit"
|
103
|
+
comment: |
|
104
|
+
Dieser Parameter bestimmt den Programmparameter, dessen Wert f�r die Ermittlung der Bandgeschwindigkeit genutzt werden soll.
|
105
|
+
|
106
|
+
|
107
|
+
0: Liniengeschwindigkeit
|
108
|
+
|
109
|
+
12: Wiegeschwindigkeit (Maschine steht z.B. hinter Waage)
|
110
|
+
14: Liniengeschwindigkeit (Maschine steht z.B. hinter Wippe, Markierband oder Transportband)
|
111
|
+
|
112
|
+
|
113
|
+
Der Parameter mit der ausgew�hlten Nummer wird verwendet.
|
114
|
+
Intern wird eine �berpr�fung des Geschwindigkeitswertes vorgenommen.
|
115
|
+
|
116
|
+
roll_bracket_active:
|
117
|
+
name: "Rollenbremse aktiv"
|
118
|
+
comment: |
|
119
|
+
An/Abwahl der Steuerung der Rollenbremse
|
120
|
+
|
121
|
+
|
122
|
+
0: Die Rollenbremse wird nicht verwendet.
|
123
|
+
|
124
|
+
|
125
|
+
1: Die Rollenbremse wird angesteuert und an einem bestimmten Aktivierungspunkt (abh�ngig von der T�nzerposition) geschaltet.
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
Standard: 1
|
130
|
+
|
131
|
+
factor_activation_point_roll_bracket:
|
132
|
+
name: "Faktor Aktivierungspunkt Rollenbremse"
|
133
|
+
comment: |
|
134
|
+
Faktor f�r den Aktivierungspunkt der Rollenbremse.
|
135
|
+
|
136
|
+
|
137
|
+
Standardm��ig wird die Rollenbremse unterhalb des unteren Teachpunktes des T�nzers aktiviert. Sollte ein h�herer Aktivierungspunkt notwendig sein, kann �ber diesen Parameter ein Prozentwert angegeben werden, um den der Aktivierungspunkt in Richtung des oberen Teachpunktes des T�nzers verschoben wird. Der Prozentwert bezieht sich auf den Abstand zwischen unteren und oberen Teachpunkt.
|
138
|
+
|
139
|
+
paper_roll_drive_selection:
|
96
140
|
name: "Bahnantrieb abgew�hlt=0/Servo=1/FU=2"
|
97
|
-
comment: &COMMON_DRIVE_CONFIG
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
141
|
+
comment: &COMMON_DRIVE_CONFIG |
|
142
|
+
Einerstelle: An/Abwahl
|
143
|
+
|
144
|
+
|
145
|
+
XXX0: Achse im System nicht vorhanden ,wird vom System simuliert.
|
146
|
+
XXX1: Achse ist im Antriebssystem als Servoantrieb vorhanden.
|
147
|
+
XXX2: Achse ist im Antriebssystem als Frequenzumrichterantrieb vorhanden.
|
148
|
+
|
149
|
+
|
150
|
+
Zehner- und Hunderterstelle: Motortyp
|
151
|
+
|
152
|
+
|
153
|
+
X00X = NORD_MOTOR_037
|
154
|
+
X01X = NORD_MOTOR_075
|
155
|
+
X02X = LENZE_063C32
|
156
|
+
X03X = LENZE_047C22
|
157
|
+
X04X = LENZE_063C22
|
158
|
+
X05X = INTERROLL_TM111_037_2_081
|
159
|
+
X06X = INTERROLL_TM082_012_2_056
|
160
|
+
X07X = LENZE_063C22_GEBER
|
161
|
+
X08X = LENZE_063C22_POSI
|
162
|
+
X17X = INTERROLL_111_2P_037_133V
|
163
|
+
X18X = INTERROLL_111_2P_037_133V_GEBER
|
164
|
+
X19X = INTERROLL_111_2P_037_133V_POSI
|
165
|
+
X20X = INTERROLL_111_2P_037_133V_GEBER_AUF_C400
|
166
|
+
X21X = HARMONIC_DRIVE_FHA_11C_D200_GEBER
|
167
|
+
|
168
|
+
|
169
|
+
Tausenderstelle:
|
170
|
+
|
171
|
+
|
172
|
+
0XXX = ohne PTC
|
173
|
+
1XXX = mit PTC
|
124
174
|
|
125
175
|
paper_roll_drive_distance_revolution:
|
126
176
|
name: "Bahnantrieb Weg/Umdrehung [mm]"
|
@@ -134,7 +184,7 @@ de:
|
|
134
184
|
name: "Bahnantrieb Getriebefaktor Nenner"
|
135
185
|
comment: &COMMON_GEAR_OUT "Anzahl der Getriebez�hne abtriebseitig"
|
136
186
|
|
137
|
-
|
187
|
+
blade_drive_selection:
|
138
188
|
name: "Messerwelle abgew�hlt=0/Servo=1/FU=2"
|
139
189
|
comment: *COMMON_DRIVE_CONFIG
|
140
190
|
|
@@ -150,7 +200,7 @@ de:
|
|
150
200
|
name: "Messerwelle Getriebefaktor Nenner"
|
151
201
|
comment: *COMMON_GEAR_OUT
|
152
202
|
|
153
|
-
|
203
|
+
paper_feed_drive_selection:
|
154
204
|
name: "Blattantrieb abgew�hlt=0/Servo=1/FU=2"
|
155
205
|
comment: *COMMON_DRIVE_CONFIG
|
156
206
|
|
@@ -166,7 +216,7 @@ de:
|
|
166
216
|
name: "Blattantrieb Getriebefaktor Nenner"
|
167
217
|
comment: *COMMON_GEAR_OUT
|
168
218
|
|
169
|
-
|
219
|
+
transport_drive_selection:
|
170
220
|
name: "Portionsauflageband abgew�hlt=0/Servo=1/FU=2"
|
171
221
|
comment: *COMMON_DRIVE_CONFIG
|
172
222
|
|
@@ -186,7 +236,7 @@ de:
|
|
186
236
|
name: "Portionsauflageband Bandl�nge"
|
187
237
|
comment: "Gesamte Bandl�nge des Portionsauflagebandes.\nAngabe erfolgt in Millimeter."
|
188
238
|
|
189
|
-
|
239
|
+
infeed_drive_selection:
|
190
240
|
name: "Einlegeband abgew�hlt=0/Servo=1/FU=2"
|
191
241
|
comment: *COMMON_DRIVE_CONFIG
|
192
242
|
|
@@ -204,4 +254,6 @@ de:
|
|
204
254
|
|
205
255
|
infeed_drive_belt_length:
|
206
256
|
name: "Einlegeband Bandl�nge"
|
207
|
-
comment:
|
257
|
+
comment: |
|
258
|
+
Gesamte Bandl�nge des Einlegebandes.
|
259
|
+
Angabe erfolgt in Millimeter.
|
@@ -103,7 +103,43 @@ en:
|
|
103
103
|
1: Negative continuously signal - enables by 0V\n
|
104
104
|
2: Positiv continuously signal - enables by 12V"
|
105
105
|
|
106
|
-
|
106
|
+
source_parameter_working_velocity:
|
107
|
+
name: "Parametersource for conveyor velocity"
|
108
|
+
comment: |
|
109
|
+
This parameter defines the programme parameter whose value will be used to determine the conveyor velocity.
|
110
|
+
|
111
|
+
|
112
|
+
0: Line velocity
|
113
|
+
|
114
|
+
12: Weighing velocity
|
115
|
+
14: Line velocity
|
116
|
+
|
117
|
+
|
118
|
+
Nevertheless the velocity value will be internally validated.
|
119
|
+
|
120
|
+
roll_bracket_active:
|
121
|
+
name: "Rollbracket active"
|
122
|
+
comment: |
|
123
|
+
Configuration of roll brake.
|
124
|
+
|
125
|
+
|
126
|
+
0: Deselect the roll brake.
|
127
|
+
|
128
|
+
1: Select the roll brake.
|
129
|
+
|
130
|
+
|
131
|
+
Default: 1.
|
132
|
+
|
133
|
+
|
134
|
+
factor_activation_point_roll_bracket:
|
135
|
+
name: "Factor activation point rollbracket"
|
136
|
+
comment: |
|
137
|
+
Factor for activation point of roll brake.
|
138
|
+
|
139
|
+
|
140
|
+
If active, roll brake will be activated beneath lower loop position. This parameter allows to move this activation point towards the upper loop position. Movement is given in percent and relates to the distance between lower and upper loop position.
|
141
|
+
|
142
|
+
paper_roll_drive_selection:
|
107
143
|
name: "Paper roll drive - Select/Deselect"
|
108
144
|
comment: &COMMON_DRIVE_CONFIG "Unit�s Place: 'Select/Deselect drive'\n
|
109
145
|
\n
|
@@ -145,7 +181,7 @@ en:
|
|
145
181
|
name: "Paper roll drive - Gear OUT"
|
146
182
|
comment: &COMMON_GEAR_OUT "Number of teeth - drive shaft sided."
|
147
183
|
|
148
|
-
|
184
|
+
blade_drive_selection:
|
149
185
|
name: "Blade drive - Select/Deselect"
|
150
186
|
comment: *COMMON_DRIVE_CONFIG
|
151
187
|
|
@@ -161,7 +197,7 @@ en:
|
|
161
197
|
name: "Blade drive - Gear OUT"
|
162
198
|
comment: *COMMON_GEAR_OUT
|
163
199
|
|
164
|
-
|
200
|
+
paper_feed_drive_selection:
|
165
201
|
name: "Paper feed drive - Select/Deselect"
|
166
202
|
comment: *COMMON_DRIVE_CONFIG
|
167
203
|
|
@@ -177,7 +213,7 @@ en:
|
|
177
213
|
name: "Paper feed drive - Gear OUT"
|
178
214
|
comment: *COMMON_GEAR_OUT
|
179
215
|
|
180
|
-
|
216
|
+
transport_drive_selection:
|
181
217
|
name: "Transport drive - Select/Deselect"
|
182
218
|
comment: *COMMON_DRIVE_CONFIG
|
183
219
|
|
@@ -197,7 +233,7 @@ en:
|
|
197
233
|
name: "Transport drive - Length of belt [mm]"
|
198
234
|
comment: "Specify the length of the transport conveyor [in mm]"
|
199
235
|
|
200
|
-
|
236
|
+
infeed_drive_selection:
|
201
237
|
name: "Infeed drive - Select/Deselect"
|
202
238
|
comment: *COMMON_DRIVE_CONFIG
|
203
239
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
class Array
|
4
|
+
# Splits _self_ in arrays with maximal size of _len_ and returns an array with this arrays.
|
5
|
+
# :call-seq:
|
6
|
+
# array%(len) -> an_array of arrays
|
7
|
+
# [1,2,3,4,5,6] % 2 => [[1,2], [3,4], [5,6]]
|
8
|
+
def % len
|
9
|
+
inject([]) do |ary, x|
|
10
|
+
ary << [] if [*ary.last].nitems % len == 0
|
11
|
+
ary.last << x
|
12
|
+
ary
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
module SetupConfiguration
|
2
4
|
|
3
5
|
def self.description_ranges()
|
4
|
-
[
|
6
|
+
[0..199, 200..599, 600..1299]
|
5
7
|
end
|
6
8
|
|
7
9
|
def self.parameter_range()
|
@@ -16,6 +18,7 @@ class SetupConfiguration::Suite
|
|
16
18
|
attr_accessor :categories
|
17
19
|
attr_accessor :settings
|
18
20
|
attr_accessor :name
|
21
|
+
attr_accessor :abbreviation
|
19
22
|
|
20
23
|
def initialize
|
21
24
|
self.categories= Hash.new { |hash, key| hash[key] = [] }
|
@@ -47,7 +50,7 @@ class SetupConfiguration::Suite
|
|
47
50
|
|
48
51
|
# Gets all known parameters.
|
49
52
|
def parameters()
|
50
|
-
categories.values.flatten
|
53
|
+
categories.values.flatten.sort
|
51
54
|
end
|
52
55
|
|
53
56
|
#
|
@@ -79,6 +82,10 @@ class SetupConfiguration::Suite
|
|
79
82
|
#
|
80
83
|
def validate_params()
|
81
84
|
|
85
|
+
categories.each() do |key, value|
|
86
|
+
throw RuntimeError.new("ERROR: category '#{key}' contains more than 150 parameters. Reduce parameter count.") if value.size >150
|
87
|
+
end
|
88
|
+
|
82
89
|
keys=[]
|
83
90
|
numbers=[]
|
84
91
|
#valid parameter numbers start at 1
|
@@ -86,17 +93,17 @@ class SetupConfiguration::Suite
|
|
86
93
|
|
87
94
|
self.parameters().each() do |p|
|
88
95
|
|
89
|
-
|
96
|
+
puts "WARNING: parameter number 404 is reserved for machine type. you are using it for '#{p.key}'." if p.number.eql?(404)
|
97
|
+
throw RuntimeError.new("ERROR: parameter number '#{p.number}' not supported. Number must be in range #{valid_param_numbers}.") unless valid_param_numbers.member?(p.number)
|
90
98
|
|
91
99
|
if keys.include? p.key
|
92
|
-
# todo error handling
|
93
100
|
throw RuntimeError.new("ERROR: parameter key '#{p.key}' defined more than once")
|
94
101
|
else
|
95
102
|
keys << p.key
|
96
103
|
end
|
97
104
|
|
105
|
+
|
98
106
|
if numbers.include? p.number
|
99
|
-
# todo error handling
|
100
107
|
throw RuntimeError.new("ERROR: parameter number '#{p.number}' defined more than once")
|
101
108
|
else
|
102
109
|
numbers << p.number
|
@@ -115,10 +122,11 @@ class SetupConfiguration::Setting
|
|
115
122
|
attr_reader :balance_maximum
|
116
123
|
|
117
124
|
def initialize
|
118
|
-
@minimum=
|
119
|
-
@maximum=
|
120
|
-
@balance_minimum=
|
121
|
-
@balance_maximum=
|
125
|
+
@minimum=0..0
|
126
|
+
@maximum=0..0
|
127
|
+
@balance_minimum=0..0
|
128
|
+
@balance_maximum=0..0
|
129
|
+
@machine_types=[]
|
122
130
|
end
|
123
131
|
|
124
132
|
def min(range)
|
@@ -136,6 +144,22 @@ class SetupConfiguration::Setting
|
|
136
144
|
def balance_max(range)
|
137
145
|
@balance_maximum=range
|
138
146
|
end
|
147
|
+
|
148
|
+
def machine_type(name, number, range)
|
149
|
+
machine_type = SetupConfiguration::MachineType.new(name, number, range)
|
150
|
+
@machine_types << machine_type
|
151
|
+
# generates a method with given machine type name in a module
|
152
|
+
# this module is included in Parameter class so machine type dependencies can be
|
153
|
+
# given with machine type names (in DSL) instead of binary numbers
|
154
|
+
SetupConfiguration::ParameterMachineTypeBridge.send(:define_method, name) do
|
155
|
+
machine_type.binary_number
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
def machine_types
|
160
|
+
@machine_types.sort {|a, b| a.sequence_number <=> b.sequence_number}
|
161
|
+
end
|
162
|
+
|
139
163
|
end
|
140
164
|
|
141
165
|
class SetupConfiguration::ParameterFactory
|
@@ -149,8 +173,7 @@ class SetupConfiguration::ParameterFactory
|
|
149
173
|
def param(parameter, number, ¶meter_def)
|
150
174
|
# puts "executed param in Parameters: #{parameter}"
|
151
175
|
# evaluate given block in Parameter context and return new parameter
|
152
|
-
p = SetupConfiguration::Parameter.new(parameter)
|
153
|
-
p.number=(number)
|
176
|
+
p = SetupConfiguration::Parameter.new(parameter, number)
|
154
177
|
p.instance_eval(¶meter_def) if parameter_def
|
155
178
|
params << p
|
156
179
|
end
|
@@ -158,18 +181,21 @@ class SetupConfiguration::ParameterFactory
|
|
158
181
|
end
|
159
182
|
|
160
183
|
class SetupConfiguration::Parameter
|
184
|
+
include Enumerable
|
185
|
+
include SetupConfiguration::ParameterMachineTypeBridge
|
161
186
|
|
162
187
|
attr_accessor :key
|
163
188
|
attr_accessor :number
|
164
189
|
attr_reader :dependency
|
165
190
|
attr_reader :machine_type
|
166
191
|
|
167
|
-
def initialize(name)
|
192
|
+
def initialize(name, number)
|
168
193
|
# depends upon no other parameter
|
169
194
|
@dependency=:none
|
170
195
|
# valid on all machines
|
171
196
|
@machine_type=0
|
172
197
|
@key= name
|
198
|
+
@number=number
|
173
199
|
end
|
174
200
|
|
175
201
|
def depends_on(dependency)
|
@@ -180,4 +206,33 @@ class SetupConfiguration::Parameter
|
|
180
206
|
@machine_type=machine_type
|
181
207
|
end
|
182
208
|
|
209
|
+
def <=>(parameter)
|
210
|
+
self.number <=> parameter.number
|
211
|
+
end
|
212
|
+
|
213
|
+
end
|
214
|
+
|
215
|
+
class SetupConfiguration::MachineType
|
216
|
+
include Enumerable
|
217
|
+
|
218
|
+
attr_reader :name
|
219
|
+
attr_reader :range
|
220
|
+
attr_reader :sequence_number
|
221
|
+
attr_reader :binary_number
|
222
|
+
|
223
|
+
def initialize(name, sequence_number, range)
|
224
|
+
@name=name
|
225
|
+
@range=range
|
226
|
+
@sequence_number=sequence_number
|
227
|
+
if @sequence_number <= 0
|
228
|
+
@binary_number=0
|
229
|
+
else
|
230
|
+
@binary_number=2**(@sequence_number-1)
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
def <=>(machine_type)
|
235
|
+
self.range.first <=> machine_type.range.first
|
236
|
+
end
|
237
|
+
|
183
238
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
module SetupConfiguration::Generator
|
2
4
|
@output_path=""
|
3
5
|
|
@@ -56,13 +58,12 @@ module SetupConfiguration::Generator
|
|
56
58
|
end
|
57
59
|
|
58
60
|
def translate(number, &extractor)
|
59
|
-
#todo use suite as singleton!
|
60
61
|
p=self.suite.find_param_by_number(number)
|
61
62
|
if p
|
62
63
|
key=p.key
|
63
64
|
translation = SetupConfiguration::Translation::Translator.new().translate(key, @lang)
|
64
65
|
if extractor
|
65
|
-
extractor.call( translation)
|
66
|
+
extractor.call( *translation )
|
66
67
|
else
|
67
68
|
translation
|
68
69
|
end
|
@@ -101,7 +102,9 @@ module SetupConfiguration::Generator
|
|
101
102
|
number << param.number
|
102
103
|
depends << depends_on(param.dependency)
|
103
104
|
end
|
104
|
-
|
105
|
+
#TODO compute value for max_number_parameters_per_tab of value maximum_numbers_per_category
|
106
|
+
max_number_parameters_per_tab=50
|
107
|
+
[depends, machine_type, number].collect(){ |arr| (arr%(max_number_parameters_per_tab)) .collect(){|a| prepare(a)}}
|
105
108
|
end
|
106
109
|
|
107
110
|
:private
|
@@ -189,6 +192,77 @@ module SetupConfiguration::Generator
|
|
189
192
|
end
|
190
193
|
|
191
194
|
|
195
|
+
|
196
|
+
class SetupConfiguration::SetupCodeBinding < SetupConfiguration::Generator::TemplateBinding
|
197
|
+
|
198
|
+
def initialize
|
199
|
+
super
|
200
|
+
end
|
201
|
+
|
202
|
+
def parameters
|
203
|
+
suite.parameters
|
204
|
+
end
|
205
|
+
|
206
|
+
#
|
207
|
+
# Offset for setup parameter numbers. This offset is added to a parameter number when evaluated in controller.
|
208
|
+
#
|
209
|
+
def parameter_offset
|
210
|
+
1300
|
211
|
+
end
|
212
|
+
|
213
|
+
def key(symbol)
|
214
|
+
s=symbol.to_s
|
215
|
+
delimiter='_'
|
216
|
+
s.split(delimiter).collect(){|splitter| splitter.capitalize}.join(delimiter).ljust(longest_key_length)
|
217
|
+
end
|
218
|
+
|
219
|
+
:private
|
220
|
+
|
221
|
+
def longest_key_length
|
222
|
+
# find the length of the longest word
|
223
|
+
unless @longest
|
224
|
+
longest = parameters.inject(0) do |memo,param|
|
225
|
+
memo >= param.key.to_s.length ? memo : param.key.to_s.length
|
226
|
+
end
|
227
|
+
@longest=longest + 5
|
228
|
+
end
|
229
|
+
@longest
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
class SetupConfiguration::SetupCodeGenerator
|
234
|
+
|
235
|
+
def generate(suite, output_path)
|
236
|
+
setup_code=SetupConfiguration::SetupCodeBinding.new
|
237
|
+
setup_code.output="LOGCODE#{suite.name.to_s.upcase}SETUP.EXP"
|
238
|
+
setup_code.suite=suite
|
239
|
+
|
240
|
+
if template then
|
241
|
+
rhtml = ERB.new( template, nil, "<>")
|
242
|
+
|
243
|
+
File.open(File.join(output_path, setup_code.output), "w") do |f|
|
244
|
+
f << rhtml.result(setup_code.get_binding)
|
245
|
+
end
|
246
|
+
else
|
247
|
+
puts "WARNING: No template found. Generation of #{setup_code.output} aborted."
|
248
|
+
end
|
249
|
+
|
250
|
+
|
251
|
+
end
|
252
|
+
|
253
|
+
:private
|
254
|
+
def template
|
255
|
+
template=File.join(File.dirname(__FILE__), "templates", "logcodesetup.exp.erb")
|
256
|
+
if File.file?(template)
|
257
|
+
File.read(template)
|
258
|
+
else
|
259
|
+
puts "WARNING: Template file #{template} expected but not found"
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
end
|
264
|
+
|
265
|
+
|
192
266
|
class SetupConfiguration::SuiteGenerator
|
193
267
|
include SetupConfiguration::Generator
|
194
268
|
|
@@ -247,6 +321,8 @@ class SetupConfiguration::SuiteGenerator
|
|
247
321
|
puts "WARNING: No template found. Generation of #{bind.output} aborted."
|
248
322
|
end
|
249
323
|
|
324
|
+
SetupConfiguration::SetupCodeGenerator.new.generate(self.suite, output_path)
|
325
|
+
|
250
326
|
end
|
251
327
|
end
|
252
328
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
(* @NESTEDCOMMENTS := 'Yes' *)
|
2
|
+
(* @PATH := '\/Display' *)
|
3
|
+
TYPE LogCode<%= suite.name.to_s.capitalize %>Setup :
|
4
|
+
(
|
5
|
+
|
6
|
+
(* WARNING: This file is generated - do not edit it.
|
7
|
+
Edit instead the machine setup parameter description. *)
|
8
|
+
|
9
|
+
<% parameters.each do | parameter | %>
|
10
|
+
SUP_<%= suite.abbreviation.to_s.upcase %>_<%= key(parameter.key) %>:= <%= parameter.number + parameter_offset %><% unless parameters.last.eql?(parameter) then %><%= "," %><% end %><% end %>
|
11
|
+
|
12
|
+
);
|
13
|
+
END_TYPE
|
14
|
+
|
15
|
+
(* @END_DECLARATION := '0' *)
|
@@ -17,22 +17,18 @@ END_WAAG_MIN=<%= settings.balance_minimum.last %>
|
|
17
17
|
BEGIN_WAAG_MAX=<%= settings.balance_maximum.first %>
|
18
18
|
END_WAAG_MAX=<%= settings.balance_maximum.last %>
|
19
19
|
|
20
|
-
[MASCHINENTYP]
|
21
|
-
|
22
|
-
BEGIN_TYP1=1000
|
23
|
-
BEGIN_TYP2=2000
|
24
|
-
BEGIN_TYP3=3000
|
25
|
-
BEGIN_TYP4=4000
|
20
|
+
[MASCHINENTYP]<% settings.machine_types.each do |machine_type| %>
|
21
|
+
BEGIN_TYP<%= machine_type.sequence_number %>=<%= machine_type.range.first %><% end %>
|
26
22
|
|
27
23
|
;(0..16)
|
28
24
|
;generate param names as comment
|
29
|
-
[PARAMANZEIGE]<% categories.each_with_index do |category, index| %><%
|
30
|
-
2CF<%= index%>a=<%= dependencies %>
|
31
|
-
1CF<%= index%>a=<%= machine_types %>
|
32
|
-
TAB<%= index%>a=<%= parameters %>
|
33
|
-
2CF<%= index%>b
|
34
|
-
1CF<%= index%>b
|
35
|
-
TAB<%= index%>b
|
36
|
-
2CF<%= index%>c
|
37
|
-
1CF<%= index%>c
|
38
|
-
TAB<%= index%>c
|
25
|
+
[PARAMANZEIGE]<% categories.each_with_index do |category, index| %><% dependencies, machine_types, parameters = param_infos(category) %>
|
26
|
+
2CF<%= index%>a=<%= dependencies[0] %>
|
27
|
+
1CF<%= index%>a=<%= machine_types[0] %>
|
28
|
+
TAB<%= index%>a=<%= parameters[0] %>
|
29
|
+
2CF<%= index%>b=<%= dependencies[1] %>
|
30
|
+
1CF<%= index%>b=<%= machine_types[1] %>
|
31
|
+
TAB<%= index%>b=<%= parameters[1] %>
|
32
|
+
2CF<%= index%>c=<%= dependencies[2] %>
|
33
|
+
1CF<%= index%>c=<%= machine_types[2] %>
|
34
|
+
TAB<%= index%>c=<%= parameters[2] %><% end %>
|
data/lib/setup_configuration.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
module SetupConfiguration
|
2
4
|
end
|
3
5
|
|
4
|
-
def SetupConfiguration(name, &block)
|
6
|
+
def SetupConfiguration(name, abbreviation=name, &block)
|
5
7
|
suite=SetupConfiguration::Suite.instance
|
6
8
|
suite.name=name
|
9
|
+
suite.abbreviation=abbreviation
|
7
10
|
suite.instance_eval(&block)
|
8
11
|
suite.validate_params()
|
9
12
|
rescue
|
@@ -15,6 +18,8 @@ require 'singleton'
|
|
15
18
|
require 'erb'
|
16
19
|
require 'fileutils'
|
17
20
|
require 'i18n'
|
21
|
+
require File.expand_path(File.dirname(__FILE__) + '/setup_configuration/array')
|
22
|
+
require File.expand_path(File.dirname(__FILE__) + '/setup_configuration/parameter_machinetype_bridge')
|
18
23
|
require File.expand_path(File.dirname(__FILE__) + '/setup_configuration/setup_config')
|
19
24
|
require File.expand_path(File.dirname(__FILE__) + '/setup_configuration/suite_generator')
|
20
25
|
require File.expand_path(File.dirname(__FILE__) + '/setup_configuration/translation')
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.dirname(__FILE__) + "/../test_helper"
|
3
|
+
|
4
|
+
class MachineTypeTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
context "A Machine Type" do
|
7
|
+
setup do
|
8
|
+
@all_machines = SetupConfiguration::MachineType.new(:all_machines, 0, 0..999)
|
9
|
+
@machine_one = SetupConfiguration::MachineType.new(:machine_one, 1, 1000..1999)
|
10
|
+
@machine_three = SetupConfiguration::MachineType.new(:machine_one, 3, 3000..3999)
|
11
|
+
end
|
12
|
+
|
13
|
+
should "return its name" do
|
14
|
+
assert_equal :all_machines, @all_machines.name
|
15
|
+
end
|
16
|
+
|
17
|
+
should "return its machine type number range" do
|
18
|
+
assert_equal 0..999, @all_machines.range
|
19
|
+
end
|
20
|
+
|
21
|
+
should "return its sequence number" do
|
22
|
+
assert_equal 0, @all_machines.sequence_number
|
23
|
+
assert_equal 1, @machine_one.sequence_number
|
24
|
+
assert_equal 3, @machine_three.sequence_number
|
25
|
+
end
|
26
|
+
|
27
|
+
should "return its binary number" do
|
28
|
+
assert_equal 0, @all_machines.binary_number
|
29
|
+
assert_equal 1, @machine_one.binary_number
|
30
|
+
assert_equal 4, @machine_three.binary_number
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.dirname(__FILE__) + "/../test_helper"
|
3
|
+
|
4
|
+
class ParameterTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
context "A Parameter" do
|
7
|
+
setup do
|
8
|
+
@parameter = SetupConfiguration::Parameter.new(:drive_config, 42)
|
9
|
+
end
|
10
|
+
|
11
|
+
should "return its name" do
|
12
|
+
assert_equal :drive_config, @parameter.key
|
13
|
+
end
|
14
|
+
|
15
|
+
should "return its number" do
|
16
|
+
assert_equal 42, @parameter.number
|
17
|
+
end
|
18
|
+
|
19
|
+
should "return its default machine type" do
|
20
|
+
assert_equal 0, @parameter.machine_type
|
21
|
+
end
|
22
|
+
|
23
|
+
should "return its default parameter dependency" do
|
24
|
+
assert_equal :none, @parameter.dependency
|
25
|
+
end
|
26
|
+
|
27
|
+
context "with a defined machine type" do
|
28
|
+
setup do
|
29
|
+
@parameter.for_machine_type 13
|
30
|
+
end
|
31
|
+
|
32
|
+
should "return its given machine type" do
|
33
|
+
assert_equal 13, @parameter.machine_type
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
context "with a defined parameter dependency" do
|
39
|
+
setup do
|
40
|
+
@parameter.depends_on :machine_virtual
|
41
|
+
end
|
42
|
+
|
43
|
+
should "return its given parameter dependency" do
|
44
|
+
assert_equal :machine_virtual, @parameter.dependency
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: machine_setup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- robi-wan
|
@@ -9,8 +9,8 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
13
|
-
default_executable: setup_config_gen
|
12
|
+
date: 2010-02-23 00:00:00 +01:00
|
13
|
+
default_executable: setup_config_gen
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: i18n
|
@@ -20,12 +20,12 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.3.
|
23
|
+
version: 0.3.2
|
24
24
|
version:
|
25
25
|
description: Helps generating configuration files for machine setup parameters.
|
26
26
|
email: robi-wan@suyu.de
|
27
27
|
executables:
|
28
|
-
- setup_config_gen
|
28
|
+
- setup_config_gen
|
29
29
|
extensions: []
|
30
30
|
|
31
31
|
extra_rdoc_files:
|
@@ -39,18 +39,23 @@ files:
|
|
39
39
|
- Rakefile
|
40
40
|
- TODO
|
41
41
|
- VERSION
|
42
|
-
- bin/setup_config_gen
|
42
|
+
- bin/setup_config_gen
|
43
43
|
- examples/underleaver/underleaver.setup.param
|
44
44
|
- examples/underleaver/underleaver.setup.param.de.yml
|
45
45
|
- examples/underleaver/underleaver.setup.param.en.yml
|
46
46
|
- lib/setup_configuration.rb
|
47
|
+
- lib/setup_configuration/array.rb
|
48
|
+
- lib/setup_configuration/parameter_machinetype_bridge.rb
|
47
49
|
- lib/setup_configuration/setup_config.rb
|
48
50
|
- lib/setup_configuration/suite_generator.rb
|
49
51
|
- lib/setup_configuration/templates/deutsch.lng.erb
|
50
52
|
- lib/setup_configuration/templates/english.lng.erb
|
53
|
+
- lib/setup_configuration/templates/logcodesetup.exp.erb
|
51
54
|
- lib/setup_configuration/templates/mps3.ini.erb
|
52
55
|
- lib/setup_configuration/translation.rb
|
53
56
|
- setup.rb
|
57
|
+
- test/setup_configuration/machine_type_test.rb
|
58
|
+
- test/setup_configuration/parameter_test.rb
|
54
59
|
- test/setup_configuration/setup_configuration_test.rb
|
55
60
|
- test/test_helper.rb
|
56
61
|
has_rdoc: true
|
@@ -83,4 +88,6 @@ specification_version: 3
|
|
83
88
|
summary: Generating configuration for machine setup parameters.
|
84
89
|
test_files:
|
85
90
|
- test/test_helper.rb
|
91
|
+
- test/setup_configuration/machine_type_test.rb
|
92
|
+
- test/setup_configuration/parameter_test.rb
|
86
93
|
- test/setup_configuration/setup_configuration_test.rb
|
data/bin/setup_config_gen.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
param_def=ARGV[0]
|
3
|
-
|
4
|
-
throw RuntimeError.new("parameter definition nicht angegeben") if param_def.nil?
|
5
|
-
throw RuntimeError.new("parameter definition existiert nicht") unless File.file?(param_def)
|
6
|
-
|
7
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
8
|
-
require 'setup_configuration'
|
9
|
-
|
10
|
-
# load file with parameter dsl
|
11
|
-
load param_def
|
12
|
-
|
13
|
-
# get reference to suite instance which holds parameter configuration
|
14
|
-
suite=SetupConfiguration::Suite.instance
|
15
|
-
|
16
|
-
#set output path
|
17
|
-
generator = SetupConfiguration::SuiteGenerator.new()
|
18
|
-
generator.output_path=File.dirname(param_def)
|
19
|
-
|
20
|
-
# load files with translations
|
21
|
-
SetupConfiguration::Translation.translation_files(suite.name).each() do |t|
|
22
|
-
trans_file=File.join(File.dirname(param_def), t)
|
23
|
-
if File.file?(trans_file)
|
24
|
-
SetupConfiguration::Translation::Translator.i18n_load_path(trans_file)
|
25
|
-
else
|
26
|
-
puts "WARNING: expected file with translations '#{trans_file}' not found."
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
generator.generate()
|