1 """
2 Basic scalar EventProcessors
3
4 This file contains some EventProcessors that emit and accept scalar
5 events, e.g. pulses. These are not currently used in the sample
6 simulations, but can be useful for testing purposes and for controlling
7 other types of simulations.
8
9 $Id: basic.py 10672 2009-10-28 01:00:50Z ceball $
10 """
11 __version__='$Revision: 10672 $'
12
13 import param
14
15 from topo.base.simulation import EventProcessor,EPConnectionEvent
16
17
19 """
20 A simple pulse generator node.
21
22 Produces pulses (scalars) of a fixed amplitude at a fixed
23 frequency and phase. Period and phase are in units of simulation
24 time.
25 """
26
27 dest_ports=None
28
29 amplitude = param.Number(1.0,doc="The size of the pulse to generate.")
30
31 period = param.Number(1.0,bounds=(0.0,None),doc=
32 "The period with which to repeat the pulse. Must be greater than zero.")
33
34 phase = param.Number(0.0,doc=
35 "The time after starting the simulation to wait before sending the first pulse.")
36
41
47
48
75
76
78 """A simple unit that outputs the running sum of input received thus far."""
79
80 dest_ports=None
81
85
89
91 self.debug("process_current_time called, time =",self.simulation.time(),"value =",self.value)
92 if self.value:
93 self.debug("Sending output:",self.value)
94 self.send_output(data=self.value)
95 self.value = 0.0
96