redshift 1.3.28 → 1.3.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -3
- data/RELEASE-NOTES +7 -3
- data/examples/pid.rb +6 -6
- data/examples/robots/lib/shell-world.rb +1 -1
- data/examples/scheduler.rb +6 -1
- data/lib/redshift/redshift.rb +5 -5
- data/lib/redshift/util/tkar-driver.rb +1 -1
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec932d5d5f5e197edab9937d3032d5ca8133f8fd
|
4
|
+
data.tar.gz: 07317699aa39e485291098dda37a1540924c66aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b9af94beb0f3480c4b05ae9299016c8e073cea3cbf73f67afa99bc53f3d8cfc5d7742f596d7d219d7bdc82fe11c03ce2471c9152fb56ffe4fbb442c1a7c7839
|
7
|
+
data.tar.gz: a1017985179957c14476f74591ad24791ac37040bbd6cdb6cf0670e5544e7dba84dc6508b524876010d99ece518090e997507b5fba6e6ce0df3e3e0986055b06
|
data/README.md
CHANGED
@@ -2,14 +2,22 @@
|
|
2
2
|
|
3
3
|
A framework for simulation of networks of hybrid automata, similar to SHIFT and Lambda-SHIFT. Includes ruby-based DSL for defining simulation components, and ruby/C code generation and runtime.
|
4
4
|
|
5
|
-
|
5
|
+
RedShift is for simulating digital devices operating in an analog world. It's also for simulating any system that exhibits a mix of discrete and continuous behavior.
|
6
|
+
|
7
|
+
There's not much [documentation](doc) yet, but plenty of [examples](examples). Some of the original SHIFT papers are available: [Shift: A Formalism and a Programming Language for Dynamic Networks of Hybrid Automata]( http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.32.5913&rep=rep1&type=pdf).
|
6
8
|
|
7
9
|
## Requirements ##
|
8
10
|
|
9
|
-
RedShift needs ruby 1.8.
|
11
|
+
RedShift needs ruby (1.8, 1.9, 2.0, 2.1) and a compatible C compiler. If you can build native gems, you're all set.
|
10
12
|
|
11
13
|
Some of the examples also use Ruby/Tk and the tkar gem.
|
12
14
|
|
15
|
+
## Installation ##
|
16
|
+
|
17
|
+
Install as gem:
|
18
|
+
|
19
|
+
gem install redshift
|
20
|
+
|
13
21
|
## Env vars ##
|
14
22
|
|
15
23
|
If you have a multicore system and are using the gnu toolchain, set
|
@@ -18,8 +26,22 @@ If you have a multicore system and are using the gnu toolchain, set
|
|
18
26
|
|
19
27
|
or some variation. You'll find that rebuilds of your simulation code go faster.
|
20
28
|
|
29
|
+
|
30
|
+
What is RedShift?
|
31
|
+
-----------------
|
32
|
+
|
33
|
+
RedShift combines *dataflow* programming (for continuous variables) with *actor*-based programming (for discrete events, states, and variables, and also for continuous variables).
|
34
|
+
|
35
|
+
Examples
|
36
|
+
--------
|
37
|
+
|
38
|
+
See the [examples](examples) dir.
|
39
|
+
|
40
|
+
The [RedCloud](https://github.com/vjoel/redcloud) project is based on RedShift.
|
41
|
+
|
42
|
+
|
21
43
|
----
|
22
44
|
|
23
|
-
Copyright (C) 2001-
|
45
|
+
Copyright (C) 2001-2014, Joel VanderWerf, mailto:vjoel@users.sourceforge.net
|
24
46
|
Distributed under the Ruby license. See www.ruby-lang.org.
|
25
47
|
|
data/RELEASE-NOTES
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
redshift 1.3.28
|
2
2
|
|
3
|
+
- gemspec specifies dvector-float extension
|
4
|
+
|
5
|
+
redshift 1.3.28
|
6
|
+
|
3
7
|
- update .gitignore
|
4
8
|
- fixes for ruby 2.1
|
5
9
|
- modernize rakefile: release tasks
|
@@ -34,7 +38,7 @@ redshift 1.3.23
|
|
34
38
|
- compatible with ruby-1.9.2
|
35
39
|
|
36
40
|
- renamed Random module to RandomDistribution to avoid conflict
|
37
|
-
|
41
|
+
|
38
42
|
redshift 1.3.22
|
39
43
|
|
40
44
|
- handling of env vars is more consistent
|
@@ -127,7 +131,7 @@ redshift 1.3.13
|
|
127
131
|
|
128
132
|
redshift 1.3.12
|
129
133
|
|
130
|
-
- Fixed bug with explicitly assigning an array to a
|
134
|
+
- Fixed bug with explicitly assigning an array to a
|
131
135
|
delay buffer.
|
132
136
|
|
133
137
|
- Raise if time_step changes while using delay.
|
@@ -212,7 +216,7 @@ redshift 1.2.41
|
|
212
216
|
- Improved message for reset type error.
|
213
217
|
|
214
218
|
- Link vars can now be declared without a type (defaults to Component).
|
215
|
-
|
219
|
+
|
216
220
|
- Fixed Queue behavior when #unpop called with SimultaneousQueueEntries.
|
217
221
|
|
218
222
|
- Added examples and tests.
|
data/examples/pid.rb
CHANGED
@@ -9,14 +9,14 @@ srand(12345)
|
|
9
9
|
# Variable with discrete and continuous perturbation.
|
10
10
|
class Plant < Component
|
11
11
|
continuous :x => 0, :t => 1
|
12
|
-
|
12
|
+
|
13
13
|
link :control => :Control # fwd ref to undefined class Control
|
14
|
-
|
14
|
+
|
15
15
|
flow do
|
16
16
|
diff " x' = control.output + sin(t) "
|
17
17
|
diff " t' = -1 "
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
transition do
|
21
21
|
guard "t <= 0"
|
22
22
|
action do
|
@@ -30,14 +30,14 @@ end
|
|
30
30
|
class Control < Component
|
31
31
|
continuous :set_point => 2.0
|
32
32
|
continuous :p_out, :i_out, :d_out, :output
|
33
|
-
|
33
|
+
|
34
34
|
# Gains
|
35
35
|
constant :k_p => 1.0,
|
36
36
|
:k_i => 1.0,
|
37
37
|
:k_d => 1.0
|
38
|
-
|
38
|
+
|
39
39
|
link :plant => Plant
|
40
|
-
|
40
|
+
|
41
41
|
flow do
|
42
42
|
algebraic " error = set_point - plant.x "
|
43
43
|
algebraic " p_out = k_p * error "
|
data/examples/scheduler.rb
CHANGED
@@ -18,10 +18,14 @@ class Scheduler < RedShift::Component
|
|
18
18
|
|
19
19
|
class Request
|
20
20
|
include Comparable
|
21
|
+
|
21
22
|
attr_accessor :time, :queue, :message
|
23
|
+
|
22
24
|
def <=>(other)
|
23
25
|
self.time <=> other.time
|
24
26
|
end
|
27
|
+
|
28
|
+
# Scheduled request: at given +time+, send +message+ to +queue+.
|
25
29
|
def initialize time, queue, message
|
26
30
|
@time, @queue, @message = time, queue, message
|
27
31
|
end
|
@@ -29,6 +33,7 @@ class Scheduler < RedShift::Component
|
|
29
33
|
|
30
34
|
EPSILON = 1E-12 # float fuzziness, if timestep is 0.1, for example
|
31
35
|
|
36
|
+
# Schedule the sending of +message+ to +queue+, after +delta_t+ elapses.
|
32
37
|
# Returns the request object for use with unschedule
|
33
38
|
def schedule_message delta_t, queue, message
|
34
39
|
req = Request.new(time + delta_t - EPSILON, queue, message)
|
@@ -82,7 +87,7 @@ class Client < RedShift::Component
|
|
82
87
|
|
83
88
|
transition Enter => Waiting do
|
84
89
|
action do
|
85
|
-
puts "scheduling message at #{world.clock} sec"
|
90
|
+
puts "scheduling message at #{world.clock} sec to run after #{delay} sec"
|
86
91
|
scheduler.schedule_message delay, wakeup, "Time to wake up, snoozebrain!"
|
87
92
|
end
|
88
93
|
end
|
data/lib/redshift/redshift.rb
CHANGED
@@ -69,8 +69,8 @@ end
|
|
69
69
|
|
70
70
|
module RedShift
|
71
71
|
include Math
|
72
|
-
|
73
|
-
VERSION = '1.3.
|
72
|
+
|
73
|
+
VERSION = '1.3.29'
|
74
74
|
|
75
75
|
Infinity = Math::Infinity
|
76
76
|
|
@@ -87,7 +87,7 @@ module RedShift
|
|
87
87
|
$REDSHIFT_DEBUG = setting
|
88
88
|
end
|
89
89
|
end
|
90
|
-
|
90
|
+
|
91
91
|
# Returns a list of all worlds (instances of RedShift::World and subclasses),
|
92
92
|
# or just those descending from +world_class+.
|
93
93
|
# Not very efficient, since it uses <tt>ObjectSpace.each_object</tt>, but
|
@@ -99,7 +99,7 @@ module RedShift
|
|
99
99
|
end
|
100
100
|
|
101
101
|
# class Warning < Exception; end
|
102
|
-
#
|
102
|
+
#
|
103
103
|
# # Warn with string str and skipping n stack frames.
|
104
104
|
# def warn str, n = 0
|
105
105
|
# warning = sprintf "\nWarning: #{str}\n\t#{caller(n).join("\n\t")}\n"
|
@@ -112,7 +112,7 @@ module RedShift
|
|
112
112
|
# module_function :warn
|
113
113
|
|
114
114
|
@library_calls = []
|
115
|
-
|
115
|
+
|
116
116
|
# Defer a block until just after the library ruby code is loaded, but before
|
117
117
|
# commit. Necessary for defining inline C functions or shadow_attrs. Note that
|
118
118
|
# a whole require statement could be placed inside the with_library block.
|
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redshift
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel VanderWerf
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cgen
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: tkar
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: prng-isaac
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: A framework for simulation of networks of hybrid automata, similar to
|
@@ -60,6 +60,7 @@ executables: []
|
|
60
60
|
extensions:
|
61
61
|
- ext/redshift/buffer/extconf.rb
|
62
62
|
- ext/redshift/dvector/extconf.rb
|
63
|
+
- ext/redshift/dvector-float/extconf.rb
|
63
64
|
extra_rdoc_files:
|
64
65
|
- README.md
|
65
66
|
- RELEASE-NOTES
|
@@ -211,7 +212,7 @@ files:
|
|
211
212
|
- test/test_strictness_error.rb
|
212
213
|
- test/test_sync.rb
|
213
214
|
- test/test_world.rb
|
214
|
-
homepage:
|
215
|
+
homepage: https://github.com/vjoel/redshift
|
215
216
|
licenses: []
|
216
217
|
metadata: {}
|
217
218
|
post_install_message:
|
@@ -220,7 +221,7 @@ rdoc_options:
|
|
220
221
|
- "--line-numbers"
|
221
222
|
- "--inline-source"
|
222
223
|
- "--title"
|
223
|
-
-
|
224
|
+
- RedShift
|
224
225
|
- "--main"
|
225
226
|
- README.md
|
226
227
|
- "--output"
|
@@ -239,8 +240,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
240
|
- !ruby/object:Gem::Version
|
240
241
|
version: '0'
|
241
242
|
requirements: []
|
242
|
-
rubyforge_project:
|
243
|
-
rubygems_version: 2.
|
243
|
+
rubyforge_project:
|
244
|
+
rubygems_version: 2.4.1
|
244
245
|
signing_key:
|
245
246
|
specification_version: 4
|
246
247
|
summary: Simulation of hybrid automata
|