redshift 1.3.24 → 1.3.30

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +49 -0
  3. data/RELEASE-NOTES +34 -3
  4. data/Rakefile +81 -0
  5. data/bench/bench +1 -1
  6. data/bench/formula.rb +2 -3
  7. data/examples/pid.rb +6 -6
  8. data/examples/robots/lib/shell-world.rb +1 -1
  9. data/examples/scheduler.rb +6 -1
  10. data/ext/redshift/dvector-float/dvector-float.c +184 -0
  11. data/ext/redshift/dvector-float/dvector-float.h +36 -0
  12. data/ext/redshift/dvector-float/dvector-float.rb +33 -0
  13. data/ext/redshift/dvector-float/extconf.rb +2 -0
  14. data/lib/redshift/redshift.rb +5 -5
  15. data/lib/redshift/target/c/component-gen.rb +1 -1
  16. data/lib/redshift/target/c/flow-gen.rb +1 -1
  17. data/lib/redshift/target/c/flow/delay.rb +1 -1
  18. data/lib/redshift/target/c/world-gen.rb +101 -101
  19. data/lib/redshift/util/isaac.rb +2 -2
  20. data/lib/redshift/util/tkar-driver.rb +1 -1
  21. data/test/test.rb +1 -1
  22. data/test/test_buffer.rb +2 -2
  23. data/test/test_connect.rb +2 -2
  24. data/test/test_connect_parallel.rb +2 -2
  25. data/test/test_connect_strict.rb +4 -5
  26. data/test/test_constant.rb +2 -4
  27. data/test/test_delay.rb +2 -2
  28. data/test/test_derivative.rb +2 -2
  29. data/test/test_discrete.rb +2 -4
  30. data/test/test_discrete_isolated.rb +2 -4
  31. data/test/test_dvector-float.rb +110 -0
  32. data/test/test_dvector.rb +15 -17
  33. data/test/test_exit.rb +2 -4
  34. data/test/test_flow.rb +2 -4
  35. data/test/test_flow_link.rb +2 -4
  36. data/test/test_flow_sub.rb +2 -4
  37. data/test/test_flow_trans.rb +23 -25
  38. data/test/test_inherit.rb +2 -4
  39. data/test/test_inherit_event.rb +2 -4
  40. data/test/test_inherit_flow.rb +2 -4
  41. data/test/test_inherit_link.rb +2 -4
  42. data/test/test_inherit_setup.rb +2 -4
  43. data/test/test_inherit_state.rb +2 -4
  44. data/test/test_inherit_transition.rb +2 -4
  45. data/test/test_numerics.rb +2 -4
  46. data/test/test_queue.rb +3 -3
  47. data/test/test_queue_alone.rb +2 -2
  48. data/test/test_reset.rb +2 -4
  49. data/test/test_setup.rb +2 -4
  50. data/test/test_strict_continuity.rb +2 -4
  51. data/test/test_strict_reset_error.rb +2 -4
  52. data/test/test_strictness_error.rb +2 -4
  53. data/test/test_sync.rb +2 -2
  54. data/test/test_world.rb +2 -4
  55. metadata +80 -106
  56. data/.bnsignore +0 -27
  57. data/.gitignore +0 -9
  58. data/README +0 -25
  59. data/TODO +0 -431
  60. data/bench/aug17-ruby19.bench +0 -86
  61. data/bench/aug17.bench +0 -86
  62. data/bench/aug7.bench +0 -86
  63. data/bench/prof.html +0 -0
  64. data/examples/robots/README +0 -49
  65. data/ext/redshift/util/isaac/extconf.rb +0 -2
  66. data/ext/redshift/util/isaac/isaac.c +0 -129
  67. data/ext/redshift/util/isaac/rand.c +0 -140
  68. data/ext/redshift/util/isaac/rand.h +0 -61
  69. data/rakefile +0 -50
data/.bnsignore DELETED
@@ -1,27 +0,0 @@
1
- # The list of files that should be ignored by Mr Bones.
2
- # Lines that start with '#' are comments.
3
- #
4
- # A .gitignore file can be used instead by setting it as the ignore
5
- # file in your Rakefile:
6
- #
7
- # PROJ.ignore_file = '.gitignore'
8
- #
9
- # For a project with a C extension, the following would be a good set of
10
- # exclude patterns (uncomment them if you want to use them):
11
- # *.[oa]
12
- # *~
13
- announcement.txt
14
- coverage
15
- doc
16
- pkg
17
- *.bck
18
- *.so
19
- *.o
20
- ext/*/*/Makefile
21
- ext/*/*/*/Makefile
22
- misc
23
- junk
24
- tmp
25
- */tmp
26
- */*/tmp
27
- */junk
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- *.bck
2
- /pkg
3
- junk
4
- tmp
5
- *.o
6
- *.so
7
- /ext/*/*/Makefile
8
- /ext/*/*/*/Makefile
9
- /rdoc/*
data/README DELETED
@@ -1,25 +0,0 @@
1
- = RedShift
2
-
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
-
5
- There's no documentation yet, but it will be at http://redshift.sourceforge.net and http://redshift.rubyforge.org. For now, start with the examples.
6
-
7
- == Requirements
8
-
9
- RedShift needs ruby 1.8.x and a compatible C compiler. If you can build native gems, you're all set.
10
-
11
- Some of the examples also use Ruby/Tk and the tkar gem.
12
-
13
- == Env vars
14
-
15
- If you have a multicore system and are using the gnu toolchain, set
16
-
17
- REDSHIFT_MAKE_ARGS='-j -l2'
18
-
19
- or some variation. You'll find that rebuilds of your simulation code go faster.
20
-
21
- ----
22
-
23
- Copyright (C) 2001-2010, Joel VanderWerf, vjoel@users.sourceforge.net
24
- Distributed under the Ruby license. See www.ruby-lang.org.
25
-
data/TODO DELETED
@@ -1,431 +0,0 @@
1
- Publishing RedShift
2
- ===================
3
-
4
- core for 1.3 release
5
-
6
- clean up world (save/load etc)
7
- tracer
8
- event value conditions in sync clause?
9
- sync :client => check(:accept){|val| val==self}
10
- # from sync-queue.rb
11
-
12
- doc, tutorial, web site
13
-
14
- clean up tests, examples
15
-
16
- user tools
17
- zeno and other debuggers
18
- shell
19
- visualization interfaces: tkar, gnuplot, opengl
20
-
21
- benchmarks
22
- - compare with stateflow and simulink examples
23
- - try to scale these examples up
24
- - compare with Ptolemy -- ask devs for good benchmarks
25
-
26
- packaging and project mgmt
27
- - windows w/ several compilers
28
-
29
- notify
30
- - shift-dev folks, hs researchers (e.g., Joao Hispanha, Ed Lee)
31
- - contacts who have expressed interest in redshift or shift
32
- - others:
33
- http://www.dis.anl.gov/exp/cas/index.html
34
- http://www.artcompsci.org
35
- Sylvain Joyeux (esp. re: distributed simulation)
36
- Martin Fowler (see http://martinfowler.com/dslwip/)
37
-
38
- publicize
39
- - http://path.berkeley.edu/shift/
40
- (this is still the first google hit for "hybrid system simulation")
41
- - ruby-talk, sciruby
42
- - comp.simulation, comp.soft-sys.(matlab|ptolemy), scs.org
43
- - paper?
44
-
45
- funding
46
- - nsf or sbir
47
- - need to emphasize research goals:
48
- - distributed hybrid simulation
49
- - further optimizations like strict
50
- - approach potential users in industry
51
- - GM, with wrapping for CarSim dll
52
-
53
- long-term goals
54
- - multiple clocks and threshold crossing detection, as in:
55
- http://repository.upenn.edu/ese_papers/123/
56
- - vector-valued signals
57
- - need proper C parsing first
58
- - user-friendly interface and related tools
59
- - distributed simulation (HLA. CERTI?)
60
- - library of integrators/flows and components
61
- - jruby/jvm port (and use duby for actions etc)
62
- - import models from simulink, Ptolemy, HSIF, etc.
63
- - interface at run time with simulink etc.
64
- - redshift as simulink block
65
- - rt code generation?
66
- - HLA support for interoperability
67
-
68
- backronym: Ruby-based Efficient Deterministic SHIFT
69
-
70
-
71
-
72
-
73
- To do
74
- =====
75
-
76
- Project
77
-
78
- Subversion, gems, etc.
79
-
80
- Docs and tutorial
81
-
82
- Bugs
83
-
84
- Make sure the arrays used internally are not shared:
85
- call rb_ary_modify() before setting len or etc.
86
-
87
- what happens if an exception (or throw or break) happens inside
88
- of a block during discrete_update? (e.g. an action, reset, or
89
- guard block)
90
-
91
- Syntax
92
-
93
- better sync syntax to avoid the :l=>:e, :l=>:f prob
94
- sync {l.e, l.f} ?
95
-
96
- should define, for each link, a TransitionParser method which returns
97
- a dummy link object that responds to #event and returns
98
- a dummy event that responds to #==(value) so that you can write
99
-
100
- guard link_var.some_event == 123
101
-
102
- instead of
103
-
104
- [:link_var, :some_event, 123]
105
-
106
- should be possible to allow:
107
-
108
- reset x => ... instead of reset :x => ...
109
-
110
- replace strictly_* with strict_* and alias back for compat
111
-
112
- express flows, guards, etc, in ruby syntax and use something to parse:
113
-
114
- nodedump/nodewrap
115
-
116
- ripper
117
-
118
- "expansion.rb"
119
-
120
- vars are class methods returning Var obejcts
121
-
122
- resets and even assignment to cont-vars can use '<<'
123
-
124
- equations can use '=='
125
-
126
- reset syntax:
127
-
128
- reset do
129
- x 3
130
- y "x+2"
131
- z { (x-y).abs }
132
-
133
- check for symbol conflicts
134
- user attributes may conflict with Component's attrs
135
- ditto for flows and other methods defined in subclasses
136
- can we 'hook' method def and attr def to check for conflict?
137
- or just use a consistent naming scheme to keep internals separate?
138
-
139
- flow /Foo.*/ ...
140
- matches on name of states
141
-
142
- Semantics
143
-
144
- export event _to_ comp? and sync on event alone w/o link?
145
- export [:e, 4] => :lnk # sender
146
- sync :e # receiver
147
-
148
- add check for values of event after sync
149
- (and then repeat sync loop)
150
- "sync :l => {:e => 3}" or better syntax
151
-
152
- option to initialize all float vars to NaN?
153
-
154
- ideas from Verilog?
155
-
156
- ideas from DEVS? (http://moncs.cs.mcgill.ca/people/tfeng/thesis/node12.html)
157
-
158
- "Buffer" could be used for:
159
-
160
- - recurrence relations/ difference equations:
161
-
162
- recurrence " x = x[-0.1] + x[-0.2] "
163
-
164
- - input data (possibly interpolated) from table/file/etc
165
-
166
- - output to data (or file) faster than ruby array of double
167
-
168
- ( record " expr " => file ? )
169
-
170
- Use NArray of doubles for this?
171
-
172
- Better: array of ptr to 1K blocks of float/double
173
-
174
- Per state syntax:
175
-
176
- some_state.record var => "expr"
177
-
178
- var refers to array of bocks of raw data
179
-
180
- expr is evaled after discrete update
181
-
182
- - need a language for piping data streams:
183
-
184
- src | x | integrate | ... | dst
185
-
186
- register event observers:
187
- on comp=>event do ... end
188
-
189
- Does permissive make sense?
190
-
191
- inheritance among states:
192
-
193
- "state Foo has everything that Bar has, plus ...."
194
-
195
- a transition that can happen only once per discrete step, to easily
196
- prevent zeno pb (useful for utility transitions, such as output)
197
-
198
- better: a "pre-strict" var that can only get reset once per step
199
-
200
- per-state strictness?
201
-
202
- if guard "strictvar && something" is checked and strictvar is false,
203
- then the guard doesn't need to be checked again, regardless of "something"
204
- similarly for: guard "strictvar"; guard "something"
205
-
206
- "finalizers" for components -- called when component exits, world
207
- is finalized, or app quits
208
-
209
- more generally, code that executes when a given state is entered:
210
-
211
- state Exit do
212
- # do some finalization stuff here
213
- end
214
-
215
- Or:
216
-
217
- entering SomeState do...end
218
- exiting SomeState do...end
219
-
220
- Maybe this is better handled by adding another state (PreSomeState)
221
-
222
- abstract classes (no code generated)
223
-
224
- input events (in place of interrupts?)
225
-
226
- as opposed to normal events, which are output (pull vs. push)
227
-
228
- but does this mean arriving events are queued?
229
-
230
- this would be useful for timers so that client component doesn't
231
- have to manage a ref to the timer
232
-
233
- wait/sleep
234
-
235
- in a transition, saying "sleep n" says that the component will not
236
- check guards for the rest of that discrete update and for n time units.
237
-
238
- exception handler clauses in transitions (or use interrupts?)
239
- on LockFailed { |var, value| ... }
240
-
241
- state stack:
242
- a transition (or interrupt) can push the current state or pop back
243
- to a previously saved state (like Kader's idea)
244
- syntax:
245
- transition ... do
246
- push [or pop, in which case the dest. state is ignored]
247
- end
248
-
249
- interrupts
250
- a way of enabling a transition without evaluating guards
251
- -faster
252
- can do sender-receiver, rather than broadcast
253
- can register with global interrupt manager
254
- notify after T seconds
255
- notify when global event happens (like what?)
256
- receive in any state, switch to new state optional (push ok)
257
- synchronous in the sense that no other components act in between
258
- the send and receive, and the receiver action happens before the
259
- sender action finishes (?)
260
- but not parallel assignment
261
- based on methods
262
- in sender's action clause: 'x.foo args'
263
- in receiver:
264
- interrupt :foo => NewState do
265
- action { |args| ...}
266
- event ...
267
- end
268
-
269
- signals
270
- maybe better than interrupts, more general
271
-
272
- transition ... do
273
- signal value => receiver_collection, ...
274
- end
275
-
276
- on value do ... end
277
-
278
- is this better than a simple method call?
279
- yes: can implement queue
280
-
281
- discrete evolution
282
- more flexibility:
283
- start actions as well as finish actions
284
- (before/after)
285
- enter and exit blocks for each state
286
- start_when and finish_when to implement sync
287
- transitions like in statechart
288
- parametric transitions?
289
- attach :all, ...
290
- syncronization
291
- explicit?
292
-
293
- exceptions
294
- catch them if they arise in action
295
- pass them on to handler where?
296
-
297
- might be better not to raise or rb_raise, but to call redshift_error on the
298
- world class, which the class could override as needed
299
-
300
- Component#teardown called after exit
301
- maybe #setup should only be called at last moment before running,
302
- so that setup clauses can be added later
303
-
304
- Implementation
305
-
306
- use static functions where possible
307
-
308
- decouple expr code from particular states/transitions so that
309
- two state can share code
310
- changing state name doesn't cause (much) recompile
311
- etc.
312
-
313
- option to dump all C code to one file (amalgam), so compiler can optimize more
314
-
315
- improve performance of event and local storage by using native (NVector)
316
- where possible, but keeping ruby array for ruby values
317
-
318
- remove -g (if not debug) from CFLAGS
319
- add -march=i686 -msse2 -mfpmath=sse (keep -fPIC?)
320
- or whatever current hw is (how to determine that?)
321
-
322
- possible to use only 1 tmp value for rk4?
323
-
324
- optimization: no ContState object, just a pointer in the comp. shadow struct
325
- could point to area at end of component's shadow struct
326
-
327
- revert to on-demand var evaluation during continuous update?
328
-
329
- optimization: transitive closure of strict sleep, based on declaration
330
- that prevents setters
331
-
332
- optimization: weaken "strict" so that resets can apply at end of
333
- discrete update, but still get all the optimizations (see bench/discrete.rb)
334
-
335
- - a new kind of flow that applies an "impulse" to a strict var at the
336
- beginning of the next cont step, or
337
-
338
- - a declaration that a var becomes strict for the rest of the discrete
339
- step
340
-
341
- Allow c-coded actions:
342
-
343
- transition do
344
- action " func(self, x*2, lnk.y) "
345
- end
346
-
347
- cdef <<END
348
- func(SelfShadowClass *self, double arg1, double arg2) {
349
- ...
350
- }
351
- END
352
-
353
- Debug mode that uses hooks to add extra checking:
354
-
355
- - rollover check for d_tick, step_count
356
-
357
- - check_strict (and make it *not* the default)
358
-
359
- Instead of caching flow function in each cont var, maybe just have pointer
360
- to a single per state object? This can also have the outgoing transitions,
361
- and so __update_cache can be somewhat faster.
362
-
363
- share mark and free funcs where possible (e.g., guards)
364
-
365
- guards should not be written in numerical order (".._0", "..._1"), but
366
- in a more meaningful way so that changing order doesn't force recompile
367
-
368
- unified internal repr. for phases
369
-
370
- insert a mnemonic for quick detection of phase type in discrete update
371
-
372
- distribute Init_clib better
373
-
374
- break flow-gen.rb and world-gen.rb into several files each
375
- flow-gen files can be loaded on demand as flow types are needed
376
- most of world-gen can be a .c file used as a template
377
-
378
- optimization
379
- profiling
380
- use valgrind, gprof, etc. to profile the C code
381
- compare with shift, matlab
382
-
383
- compile time error checking:
384
- translate C compiler error (e.g. bad result type in expr) to ruby exception
385
-
386
- run time error checking
387
- more 'if $DEBUG ...' checks
388
- catch definition of flows after commit, etc.
389
-
390
- exception handling
391
- syntax and math errors, esp. in flows, guards
392
- use Exception classes
393
-
394
- error messages
395
-
396
- Current file/line position must be saved by many constructs, e.g. reset,
397
- so that it can be shown later if there is an error message
398
-
399
- use ", []" to avoid showing backtrace when it is not helpful
400
-
401
- exceptions in C code sometimes don't give symbolic info, like var names
402
-
403
- check against ruby 1.9
404
-
405
- replace RARRAY(x)->len with RARRAY_LEN(x)
406
-
407
- libtcc backend
408
-
409
- dot backend (see file in lib dir)
410
-
411
- optimization: split diff_list for different integrators, so comps with
412
- only euler flows don't get iterated over as much
413
-
414
- User interface
415
-
416
- yaml and pp outputs
417
-
418
- Tools
419
-
420
- profiler mixin for World (also an executable script?)
421
-
422
- debugger mixin for World (also an executable script?)
423
-
424
- generalize the irb-shell.rb and TO4230 shells, and make RedShift::Shell
425
-
426
- use this in ZenoDebugger, too
427
-
428
- can this be a mixin for World
429
-
430
- general vis interface using TkCanvas/tkar or opengl
431
-