#include <OnlineAverager.h>
Public Member Functions | |
OnlineAverager () | |
OnlineAverager (unsigned numInputPorts) | |
virtual | ~OnlineAverager () |
virtual int | nAnalogInputPorts () const |
virtual int | nAnalogOutputPorts () const |
virtual PortType | outputPortType (port_t p) const |
virtual PortType | inputPortType (port_t p) const |
virtual int | reset (double dt) |
Called at the beginning of a simulation at t=0. | |
virtual int | advance (AdvanceInfo const &ai) |
Calculate the next state and output/propagate the result to succesors/outgoing objects. | |
virtual double | getAnalogOutput (analog_port_id_t port=0) const |
Return the analog value currently associated with the given port. | |
virtual void | setAnalogInput (double value, analog_port_id_t port=0) |
Analog input to given port. | |
Public Attributes | |
double | mean |
Instantaneous mean of analog values that arrive at the input ports [range=(-1e6,1e6)]. | |
double | std |
Instantaneous standard deviation of analog values that arrive at the input ports [range=(-1e6,1e6)]. | |
Protected Attributes | |
unsigned | n_input_ports |
double | sum |
double | sum2 |
Definition at line 8 of file OnlineAverager.h.
OnlineAverager::OnlineAverager | ( | ) |
Definition at line 3 of file OnlineAverager.cpp.
OnlineAverager::OnlineAverager | ( | unsigned | numInputPorts | ) |
Definition at line 7 of file OnlineAverager.cpp.
OnlineAverager::~OnlineAverager | ( | ) | [virtual] |
Definition at line 12 of file OnlineAverager.cpp.
int OnlineAverager::nAnalogInputPorts | ( | ) | const [virtual] |
Reimplemented from SimObject.
Definition at line 15 of file OnlineAverager.cpp.
References n_input_ports.
int OnlineAverager::nAnalogOutputPorts | ( | ) | const [virtual] |
SimObject::PortType OnlineAverager::outputPortType | ( | port_t | p | ) | const [virtual] |
Reimplemented from SimObject.
Definition at line 26 of file OnlineAverager.cpp.
References SimObject::analog, and SimObject::undefined.
SimObject::PortType OnlineAverager::inputPortType | ( | port_t | p | ) | const [virtual] |
Reimplemented from SimObject.
Definition at line 34 of file OnlineAverager.cpp.
References SimObject::analog, n_input_ports, and SimObject::undefined.
int OnlineAverager::advance | ( | AdvanceInfo const & | ) | [virtual] |
Calculate the next state and output/propagate the result to succesors/outgoing objects.
The return value of advance contains several bits of information which can be decoded with the bit masks ADVANCEFLAG_* like ADVANCEFLAG_HASSPIKED and ADVANCEFLAG_DEACTIVATE.
Reimplemented from SimObject.
Definition at line 51 of file OnlineAverager.cpp.
References mean, n_input_ports, std, sum, and sum2.
double OnlineAverager::getAnalogOutput | ( | analog_port_id_t | port = 0 |
) | const [virtual] |
Return the analog value currently associated with the given port.
Reimplemented from SimObject.
Definition at line 60 of file OnlineAverager.cpp.
void OnlineAverager::setAnalogInput | ( | double | value, | |
analog_port_id_t | port = 0 | |||
) | [virtual] |
Analog input to given port.
Reimplemented from SimObject.
Definition at line 70 of file OnlineAverager.cpp.
Instantaneous mean of analog values that arrive at the input ports [range=(-1e6,1e6)].
Definition at line 40 of file OnlineAverager.h.
Referenced by advance(), getAnalogOutput(), and reset().
Instantaneous standard deviation of analog values that arrive at the input ports [range=(-1e6,1e6)].
Definition at line 43 of file OnlineAverager.h.
Referenced by advance(), getAnalogOutput(), and reset().
unsigned OnlineAverager::n_input_ports [protected] |
Definition at line 46 of file OnlineAverager.h.
Referenced by advance(), inputPortType(), and nAnalogInputPorts().
double OnlineAverager::sum [protected] |
Definition at line 48 of file OnlineAverager.h.
Referenced by advance(), reset(), and setAnalogInput().
double OnlineAverager::sum2 [protected] |
Definition at line 49 of file OnlineAverager.h.
Referenced by advance(), reset(), and setAnalogInput().