Class: PeriodicScheduler::RealTimeToQuantizedSpaceProjection

Inherits:
Object
  • Object
show all
Defined in:
lib/periodic-scheduler.rb

Instance Method Summary collapse

Constructor Details

#initialize(quantum_size, quantization_rule) ⇒ RealTimeToQuantizedSpaceProjection

Returns a new instance of RealTimeToQuantizedSpaceProjection.



6
7
8
9
# File 'lib/periodic-scheduler.rb', line 6

def initialize(quantum_size, quantization_rule)
	@quantum_size = quantum_size
	@quantization_rule = quantization_rule
end

Instance Method Details

#project(value) ⇒ Object



11
12
13
# File 'lib/periodic-scheduler.rb', line 11

def project(value)
	@quantization_rule.call(value / @quantum_size)
end

#projection_error(value) ⇒ Object



19
20
21
# File 'lib/periodic-scheduler.rb', line 19

def projection_error(value)
	value - revers_project(project(value))
end

#revers_project(value) ⇒ Object



15
16
17
# File 'lib/periodic-scheduler.rb', line 15

def revers_project(value)
	value * @quantum_size
end