Relacs
0.9.8
|
#include <simulator.h>
Public Member Functions | |
Simulator (void) | |
Simulator (Model &sim) | |
~Simulator (void) | |
Model * | model (void) |
void | setModel (Model *sim) |
void | clearModel (void) |
virtual int | read (InList &data) |
virtual int | stopRead (void) |
virtual int | write (OutData &signal, bool setsignaltime=true) |
virtual int | write (OutList &signal, bool setsignaltime=true) |
virtual int | waitForWrite (void) |
virtual int | stopWrite (void) |
virtual double | getSignal (void) |
virtual int | directWrite (OutData &signal, bool setsignaltime=true) |
virtual int | directWrite (OutList &signal, bool setsignaltime=true) |
virtual int | writeZero (int channel, int device) |
virtual void | stop (void) |
Public Member Functions inherited from Acquire | |
Acquire (void) | |
virtual | ~Acquire (void) |
int | addInput (AnalogInput *ai) |
int | inputsSize (void) const |
int | inputIndex (const string &ident) const |
const AnalogInput * | inputDevice (int deviceindex) const |
const InList & | inputTraces (int deviceindex) const |
void | clearInputs (void) |
void | closeInputs (void) |
int | addOutput (AnalogOutput *ao) |
int | outputsSize (void) const |
int | outputIndex (const string &ident) const |
void | clearOutputs (void) |
void | closeOutputs (void) |
void | setSignalDelay (int device, double delay) |
int | addAttLine (Attenuate *att, const string &device="", int channel=-1) |
int | attLinesSize (void) const |
void | clearAttLines (void) |
void | closeAttLines (void) |
void | addOutTrace (const string &name, int device, int channel, double scale=1.0, const string &unit="", double value=0.0, double maxrate=-1.0, const string &modality="") |
void | addOutTraces (void) |
int | outTracesSize (void) const |
int | outTraceIndex (const string &name) const |
string | outTraceName (int index) const |
Attenuate * | outTraceAttenuate (int index) |
const Attenuate * | outTraceAttenuate (int index) const |
const TraceSpec & | outTrace (int index) const |
const TraceSpec & | outTrace (const string &name) const |
int | applyOutTrace (OutData &signal) const |
int | applyOutTrace (OutList &signal) const |
void | clearOutTraces (void) |
void | addStimulusEvents (InList &data, EventList &events) |
void | addRestartEvents (InList &data, EventList &events) |
void | inTraces (vector< TraceSpec > &traces) |
void | clear (void) |
void | close (void) |
void | initSync (void) |
SyncModes | syncMode (void) const |
string | syncModeStr (void) const |
double | bufferTime (void) const |
void | setBufferTime (double time) |
double | updateTime (void) const |
void | setUpdateTime (double time) |
virtual int | testRead (InList &data) |
string | readError (void) const |
virtual int | restartRead (void) |
virtual int | waitForRead (void) |
bool | isReadRunning (void) const |
int | getRawData (InList &data, EventList &events, double &signaltime, double mintracetime, double prevsignal) |
int | waitForData (double &signaltime) |
void | lockRead (void) |
void | unlockRead (void) |
int | adjustFlag (void) const |
void | setAdjustFlag (int flag) |
int | maxVoltages (const InData &data, vector< double > &ranges) const |
int | maxValues (const InData &data, vector< double > &ranges) const |
int | setGain (const InData &data, int gainindex) |
int | adjustGain (const InData &data, double maxvalue) |
int | adjustGain (const InData &data, double minvalue, double maxvalue) |
bool | gainChanged (void) const |
virtual int | activateGains (void) |
virtual int | testWrite (OutData &signal) |
virtual int | testWrite (OutList &signal) |
bool | isWriteRunning (void) const |
void | lockWrite (void) |
void | unlockWrite (void) |
virtual int | writeZero (int index) |
virtual int | writeZero (const string &trace) |
double | signalTime (void) const |
string | writeError (void) const |
double | minLevel (int trace) const |
double | minLevel (const string &trace) const |
double | maxLevel (int trace) const |
double | maxLevel (const string &trace) const |
void | levels (int trace, vector< double > &l) const |
void | levels (const string &trace, vector< double > &l) const |
double | minIntensity (int trace, double frequency=0.0) const |
double | minIntensity (const string &trace, double frequency=0.0) const |
double | maxIntensity (int trace, double frequency=0.0) const |
double | maxIntensity (const string &trace, double frequency=0.0) const |
void | intensities (int trace, vector< double > &ints, double frequency=0.0) const |
void | intensities (const string &trace, vector< double > &ints, double frequency=0.0) const |
Protected Member Functions | |
virtual int | restartRead (vector< AOData * > &aos, bool directao, bool updategains) |
Protected Member Functions inherited from Acquire | |
string | currentTime (void) |
Additional Inherited Members | |
Public Types inherited from Acquire | |
enum | SyncModes { NoSync, StartSync, AISync } |
Protected Attributes inherited from Acquire | |
vector< AIData > | AI |
QSemaphore | AISemaphore |
QReadWriteLock | ReadMutex |
QWaitCondition | ReadWait |
InList | InTraces |
double | PreviousTime |
int | NumEmptyData |
int | AdjustFlag |
vector< AOData > | AO |
QSemaphore | AOSemaphore |
QReadWriteLock | WriteMutex |
int | LastDevice |
double | LastWrite |
double | LastDuration |
double | LastDelay |
double | SignalTime |
EventData * | SignalEvents |
EventData * | RestartEvents |
SyncModes | SyncMode |
vector< AttData > | Att |
vector< TraceSpec > | OutTraces |
double | BufferTime |
double | UpdateTime |
Static Protected Attributes inherited from Acquire | |
static const string | SyncModeStrs [3] |
static const TraceSpec | DummyTrace |
Simulation of Acquire.
void setModel | ( | Model * | sim | ) |
Set the model to sim.
Referenced by RELACSWidget::RELACSWidget().
void clearModel | ( | void | ) |
Clear the Model.
|
virtual |
Start analog input with the settings given by data. Returns 0 on success, negative numbers otherwise. Possible errors are indicated by the error state of data.
Reimplemented from Acquire.
References InList::add(), InList::addError(), InList::addErrorStr(), Acquire::AIData::AI, Acquire::AI, Acquire::AISemaphore, Acquire::AISync, Acquire::AO, AnalogInput::bipolarRange(), Acquire::BufferTime, DaqError::Busy, InList::clear(), InList::failed(), Acquire::InTraces, Model::isRunning(), Acquire::LastWrite, relacs::max(), DaqError::MultiplePriorities, DaqError::NoDevice, Acquire::OutTraces, Acquire::PreviousTime, EventData::push(), Acquire::ReadMutex, Acquire::ReadWait, Acquire::RestartEvents, InList::setDevice(), InList::setReadTime(), InList::setRestart(), InList::setUpdateTime(), Acquire::SignalTime, InList::size(), Acquire::SyncMode, AnalogInput::unipolarRange(), DaqError::Unknown, Acquire::updateTime(), Acquire::UpdateTime, and Acquire::WriteMutex.
|
virtual |
Stop simulation.
Reimplemented from Acquire.
References Acquire::ReadWait.
Referenced by Simulator::stop().
|
virtual |
Output of a signal signal.
Reimplemented from Acquire.
References DaqError::addAttError(), DaqError::addError(), Acquire::AdjustFlag, Acquire::AO, Acquire::applyOutTrace(), Acquire::Att, DaqError::Busy, OutData::carrierFreq(), OutData::channel(), DaqError::clearError(), InList::delMode(), OutData::device(), OutData::duration(), DaqError::failed(), Acquire::gainChanged(), OutData::intensity(), Acquire::InTraces, Acquire::LastDelay, Acquire::LastDuration, Acquire::LastWrite, OutData::level(), OutData::MuteIntensity, DaqError::NoDevice, DaqError::NoIntensity, OutData::noIntensity(), OutData::noLevel(), Acquire::NoSync, relacs::pow(), OutData::priority(), OutData::restart(), Acquire::restartRead(), OutData::setDevice(), OutData::setIntensity(), OutData::setLevel(), OutData::setScale(), Acquire::StartSync, Acquire::SyncMode, and Acquire::WriteMutex.
|
virtual |
Reimplemented from Acquire.
References OutList::addError(), Acquire::AdjustFlag, Acquire::AO, Acquire::applyOutTrace(), Acquire::Att, DaqError::Busy, OutList::clearError(), InList::delMode(), OutList::failed(), Acquire::gainChanged(), Acquire::InTraces, Acquire::LastDelay, Acquire::LastDuration, Acquire::LastWrite, DaqError::MultipleDelays, OutData::MuteIntensity, DaqError::NoData, DaqError::NoDevice, DaqError::NoIntensity, Acquire::NoSync, relacs::pow(), Acquire::restartRead(), OutList::setDelay(), OutList::setDevice(), OutList::size(), Acquire::StartSync, Acquire::SyncMode, and Acquire::WriteMutex.
|
virtual |
Wait for analog output to be finished.
Reimplemented from Acquire.
References Model::waitOnSignals().
|
virtual |
|
virtual |
Check for a new signal time and return it.
Reimplemented from Acquire.
References Acquire::LastDelay, Acquire::LastDuration, Acquire::LastWrite, EventData::push(), and Acquire::SignalEvents.
|
virtual |
Direct output of a single data value as specified by signal to the DAQ boards.
Reimplemented from Acquire.
References DaqError::addAttError(), DaqError::addError(), Acquire::AdjustFlag, Acquire::AO, Acquire::applyOutTrace(), Acquire::Att, DaqError::Busy, OutData::carrierFreq(), OutData::channel(), DaqError::clearError(), InList::delMode(), OutData::device(), OutData::duration(), DaqError::failed(), Acquire::gainChanged(), OutData::intensity(), Acquire::InTraces, Acquire::LastDelay, Acquire::LastDuration, Acquire::LastWrite, OutData::level(), OutData::MuteIntensity, DaqError::NoDevice, DaqError::NoIntensity, OutData::noIntensity(), OutData::noLevel(), Acquire::NoSync, relacs::pow(), OutData::priority(), OutData::restart(), Acquire::restartRead(), AnalogOutput::Running, OutData::setDevice(), OutData::setIntensity(), OutData::setLevel(), OutData::setScale(), Acquire::StartSync, Acquire::SyncMode, and Acquire::WriteMutex.
|
virtual |
Direct output of single data values as specified by signal to different channels of the DAQ boards.
Reimplemented from Acquire.
References OutList::addError(), Acquire::AdjustFlag, Acquire::AO, Acquire::applyOutTrace(), Acquire::Att, DaqError::Busy, OutList::clearError(), InList::delMode(), OutList::failed(), Acquire::gainChanged(), Acquire::InTraces, DaqError::InvalidDelay, Acquire::LastDelay, Acquire::LastDuration, Acquire::LastWrite, DaqError::MultipleDelays, DaqError::MultiplePriorities, OutData::MuteIntensity, DaqError::NoData, DaqError::NoDevice, DaqError::NoIntensity, Acquire::NoSync, relacs::pow(), Acquire::restartRead(), AnalogOutput::Running, OutList::setDelay(), OutList::setDevice(), OutList::setPriority(), OutList::size(), Acquire::StartSync, Acquire::SyncMode, and Acquire::WriteMutex.
|
virtual |
Set the output of channel channel on device device to zero. Returns 0 on success or a negative number on error.
Reimplemented from Acquire.
References Acquire::AO, Acquire::currentTime(), DaqError::error(), DaqError::errorStr(), Acquire::OutTraces, OutData::setChannel(), OutData::setTrace(), DaqError::success(), and Acquire::WriteMutex.
|
virtual |
Stop all activity.
Reimplemented from Acquire.
References Simulator::stopRead(), and Simulator::stopWrite().
|
protectedvirtual |
Restart data aquisition and write signals pending on devices in aos. If still running, stop analog input first. If directao, then the analog output signals are scheduled for direct outut. If updategains, the input gains are updated as well.
Reimplemented from Acquire.
References InList::addMode(), Acquire::AdjustFlag, Acquire::AIData::AI, Acquire::AI, AnalogInput::bipolarRange(), InList::currentTime(), InList::delMode(), Acquire::AIData::Gains, Acquire::InTraces, relacs::max(), Acquire::PreviousTime, EventData::push(), Acquire::ReadMutex, Acquire::RestartEvents, InList::setRestart(), Acquire::AIData::Traces, and AnalogInput::unipolarRange().