15 class LockinAmplifier;
20 namespace LockinAmplifierDefs
175 namespace LockinAmplifierTasks
281 virtual bool IsEnabled() const noexcept {
return true; }
300 virtual std::pair<double, double>
GetInputLoad() const noexcept {
return std::make_pair(-1, -1); }
326 void ResetImpl(dispatch_tag<DataStreamInstrumentData>)
override final;
359 virtual const char*
GetParamClassTag() const noexcept
override {
return "LockinAmplifierParams"; }
366 "Determines whether the parameters saved to the instrument are applied automatically on instrument initialization",
false, AutoApplyParamsType::DoNotApply };
454 constexpr
static auto Name() noexcept {
return "Lock-in Amplifier"; }
455 constexpr
static auto Category() noexcept {
return "I/O"; }
468 virtual std::chrono::milliseconds
GetTaskQueueDelay()
const override {
return std::chrono::milliseconds(100); }
514 virtual
void SetSensitivity(
double Sensitivity,
DynExp::TaskBase::CallbackType CallbackFunc =
nullptr) const = 0;
529 virtual
void SetPhase(
double Phase,
DynExp::TaskBase::CallbackType CallbackFunc =
nullptr) const = 0;
553 virtual
void SetFilterOrder(uint8_t FilterOrder,
DynExp::TaskBase::CallbackType CallbackFunc =
nullptr) const;
587 virtual
void SetSamplingRate(
double SamplingRate,
DynExp::TaskBase::CallbackType CallbackFunc =
nullptr) const;
596 virtual
void SetEnable(
bool Enable,
DynExp::TaskBase::CallbackType CallbackFunc =
nullptr) const;
604 virtual
void ForceTrigger(
DynExp::TaskBase::CallbackType CallbackFunc =
nullptr) const;
630 virtual std::unique_ptr<DynExp::InitTaskBase>
MakeInitTask()
const override {
return DynExp::MakeTask<LockinAmplifierTasks::InitTask>(); }
631 virtual std::unique_ptr<DynExp::ExitTaskBase>
MakeExitTask()
const override {
return DynExp::MakeTask<LockinAmplifierTasks::ExitTask>(); }
632 virtual std::unique_ptr<DynExp::UpdateTaskBase>
MakeUpdateTask()
const override {
return DynExp::MakeTask<LockinAmplifierTasks::UpdateTask>(); }
Implementation of a data stream meta instrument and of data streams input/output devices might work o...
Implements a circular data stream based on Util::circularbuf using samples of type BasicSample.
Configurator class for DataStreamInstrument.
Data class for DataStreamInstrument.
Parameter class for DataStreamInstrument.
Defines a task for deinitializing an instrument within an instrument inheritance hierarchy....
Defines a task for initializing an instrument within an instrument inheritance hierarchy....
Defines a task for updating an instrument within an instrument inheritance hierarchy....
Implementation of the data stream meta instrument, which is a base class for all instruments reading/...
Configurator class for LockinAmplifier.
virtual ~LockinAmplifierConfigurator()=0
LockinAmplifierConfigurator()=default
Data class for LockinAmplifier.
virtual LockinAmplifierDefs::TriggerModeType GetTriggerMode() const noexcept
Getter for the lock-in amplifier's trigger mode.
virtual bool IsEnabled() const noexcept
Returns true if the lock-in amplifier's demodulator is enabled, false otherwise.
virtual void ResetImpl(dispatch_tag< LockinAmplifierData >)
virtual void SetFilterOrder(uint8_t FilterOrder) noexcept
Setter for the filter order/quality of the lock-in amplifier's low-poss filter.
virtual void SetSensitivity(double Sensitivity) noexcept=0
Setter for the lock-in amplifier's sensitivity/amplification setting.
double GetAcquisitionTime() const
Determines the duration of a single acquisition in seconds using GetSamplingRate() and DataStreamBase...
virtual std::pair< double, double > GetInputLoad() const noexcept
Indicates the load at the lock-in amplifier's physical signal input in negative and positive directio...
virtual void SetSamplingRate(double SamplingRate) noexcept
Setter for the lock-in amplifier's sampling rate in samples/s.
virtual double GetTimeConstant() const noexcept=0
Getter for the time constant in seconds of the lock-in amplifier's low-poss filter.
virtual double GetAcquisitionProgress() const noexcept
Determines the progress of the current data acquisition.
virtual ~LockinAmplifierData()=default
virtual bool IsOverloaded() const noexcept
Indicates whether the lock-in amplifier's physical signal input is overloaded by e....
virtual void SetTriggerMode(LockinAmplifierDefs::TriggerModeType TriggerMode) noexcept
Setter for the lock-in amplifier's trigger mode.
virtual double GetOscillatorFrequency() const noexcept
Indicates the oscillator frequency the lock-in amplifier demodulates the measured signal at.
virtual LockinAmplifierDefs::TriggerEdgeType GetTriggerEdge() const noexcept
Getter for the lock-in amplifier's trigger edge.
LockinAmplifierData(size_t BufferSizeInSamples)
Constructs a LockinAmplifierData instance.
virtual void SetSignalType(LockinAmplifierDefs::SignalType SignalType) noexcept=0
Setter for the lock-in amplifier's signal coordinate type to write to the data stream.
virtual void SetPhase(double Phase) noexcept=0
Setter for the phase in rad of the lock-in amplifier's demodulator.
virtual double GetPhase() const noexcept=0
Getter for the phase in rad of the lock-in amplifier's demodulator.
virtual double GetSamplingRate() const noexcept
Getter for the lock-in amplifier's sampling rate in samples/s.
virtual void SetTriggerEdge(LockinAmplifierDefs::TriggerEdgeType TriggerEdge) noexcept
Setter for the lock-in amplifier's trigger edge.
virtual LockinAmplifierDefs::SignalType GetSignalType() const noexcept=0
Getter for the lock-in amplifier's signal coordinate type to write to the data stream.
virtual void SetTimeConstant(double TimeConstant) noexcept=0
Setter for the time constant in seconds of the lock-in amplifier's low-poss filter.
virtual void SetEnable(uint8_t Enable) noexcept
Enables (pass true) or disables (pass false) the lock-in amplifier's demodulator.
virtual uint8_t GetFilterOrder() const noexcept
Getter for the filter order/quality of the lock-in amplifier's low-poss filter.
virtual double GetSensitivity() const noexcept=0
Getter for the lock-in amplifier's sensitivity/amplification setting.
void ResetImpl(dispatch_tag< DataStreamInstrumentData >) override final
Parameter class for LockinAmplifier.
virtual const char * GetParamClassTag() const noexcept override
This function is intended to be overridden once in each derived class returning the name of the respe...
Param< double > Sensitivity
Parameter to store the lock-in amplifier's sensitivity/amplification setting.
Param< double > SamplingRate
Parameter to store the lock-in amplifier's sampling rate in samples/s.
Param< AutoApplyParamsType > AutoApplyParams
Parameter to indicate whether to apply parameters stored here to the instrument when it is started....
virtual ~LockinAmplifierParams()=0
Param< LockinAmplifierDefs::TriggerEdgeType > TriggerEdge
Parameter to store the lock-in amplifier's trigger edge.
Param< double > Phase
Parameter to store the phase in rad of the lock-in amplifier's demodulator.
Param< double > TimeConstant
Parameter to store the time constant in seconds of the lock-in amplifier's low-poss filter.
AutoApplyParamsType
Type to determine whether to apply parameters stored here to the lock-in amplifier when the instrumen...
@ AutoApply
Parameters are applied automatically when the instrument is started.
@ DoNotApply
Parameters are not applied automatically when the instrument is started.
void ConfigureParamsImpl(dispatch_tag< DataStreamInstrumentParams >) override final
Called by DynExp::ParamsBase::ConfigureParams() as a starting point for the tag dispatch mechanism to...
Param< bool > Enable
Parameter to store whether the lock-in amplifier's demodulator is enabled.
virtual void ConfigureParamsImpl(dispatch_tag< LockinAmplifierParams >)
Called by DynExp::ParamsBase::ConfigureParams() as a starting point for the tag dispatch mechanism to...
Param< unsigned int > FilterOrder
Parameter to store the filter order/quality of the lock-in amplifier's low-poss filter.
Param< LockinAmplifierDefs::TriggerModeType > TriggerMode
Parameter to store the lock-in amplifier's trigger mode.
static Util::TextValueListType< AutoApplyParamsType > AutoApplyParamsTypeStrList()
Maps description strings to the AutoApplyParamsType enum's items.
Param< LockinAmplifierDefs::SignalType > Signal
Parameter to store the lock-in amplifier's signal coordinate type to write to the data stream.
LockinAmplifierParams(DynExp::ItemIDType ID, const DynExp::DynExpCore &Core)
Constructs the parameters for a LockinAmplifier instance.
Defines a task for deinitializing an instrument within an instrument inheritance hierarchy....
void ExitFuncImpl(dispatch_tag< DataStreamInstrumentTasks::ExitTask >, DynExp::InstrumentInstance &Instance) override final
Deinitializes the respective instrument within the instrument inheritance hierarchy....
virtual void ExitFuncImpl(dispatch_tag< ExitTask >, DynExp::InstrumentInstance &Instance)
Deinitializes the respective instrument within the instrument inheritance hierarchy....
Defines a task for initializing an instrument within an instrument inheritance hierarchy....
virtual void InitFuncImpl(dispatch_tag< InitTask >, DynExp::InstrumentInstance &Instance)
Initializes the respective instrument within the instrument inheritance hierarchy....
void InitFuncImpl(dispatch_tag< DataStreamInstrumentTasks::InitTask >, DynExp::InstrumentInstance &Instance) override final
Initializes the respective instrument within the instrument inheritance hierarchy....
Defines a task for updating an instrument within an instrument inheritance hierarchy....
virtual void UpdateFuncImpl(dispatch_tag< UpdateTask >, DynExp::InstrumentInstance &Instance)
Updates the respective instrument within the instrument inheritance hierarchy. Call UpdateFuncImpl() ...
void UpdateFuncImpl(dispatch_tag< DataStreamInstrumentTasks::UpdateTask >, DynExp::InstrumentInstance &Instance) override final
Updates the respective instrument within the instrument inheritance hierarchy. Call UpdateFuncImpl() ...
Meta instrument for a lock-in amplifier based on the data stream meta instrument.
virtual void AutoAdjustPhase(DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Makes the lock-in amplifier automatically set its demodulator's phase.
virtual void SetTriggerEdge(LockinAmplifierDefs::TriggerEdgeType TriggerEdge, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Sets the lock-in amplifier's trigger edge.
virtual void SetSignalType(LockinAmplifierDefs::SignalType SignalType, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0
Sets the lock-in amplifier's signal coordinate type to read out.
virtual const char * GetSensitivityUnitString() const noexcept=0
Determines the unit of the lock-in amplifier's sensitivity/amplification setting and returns a human-...
virtual void ForceTrigger(DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Forces (starts) the data acquisition ignoring the trigger.
virtual std::chrono::milliseconds GetTaskQueueDelay() const override
Specifies in which time intervals the instrument's task queue runs to handle pending tasks.
virtual std::unique_ptr< DynExp::InitTaskBase > MakeInitTask() const override
Factory function for an init task (InitTaskBase). Override to define the desired initialization task ...
virtual void SetTriggerMode(LockinAmplifierDefs::TriggerModeType TriggerMode, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Sets the lock-in amplifier's trigger mode.
constexpr static auto Name() noexcept
Every derived class has to redefine this function.
virtual std::string GetCategory() const override
Returns the category of this Object type.
virtual void ApplyFromParamsImpl(dispatch_tag< LockinAmplifier >) const =0
Refer to ApplyFromParams(). Using tag dispatch mechanism to ensure that ApplyFromParamsImpl() of ever...
void ResetImpl(dispatch_tag< DataStreamInstrument >) override final
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every de...
virtual void SetFilterOrder(uint8_t FilterOrder, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Sets the filter order/quality of the lock-in amplifier's low-poss filter.
virtual void SetSensitivity(double Sensitivity, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0
Sets the lock-in amplifier's sensitivity/amplification.
virtual void SetSamplingRate(double SamplingRate, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Sets the lock-in amplifier's sampling rate.
LockinAmplifier(const std::thread::id OwnerThreadID, DynExp::ParamsBasePtrType &&Params)
Constructs an instrument instance.
virtual void AutoAdjustSensitivity(DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Makes the lock-in amplifier automatically set its sensitivity/amplification.
virtual void SetPhase(double Phase, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0
Sets the phase of the lock-in amplifier's demodulator.
virtual ~LockinAmplifier()=0
virtual std::unique_ptr< DynExp::UpdateTaskBase > MakeUpdateTask() const override
Factory function for an update task (UpdateTaskBase). Override to define the desired update task in d...
virtual void PersistDataToParamsImpl(dispatch_tag< LockinAmplifier >) const
Refer to PersistDataToParams(). Using tag dispatch mechanism to ensure that PersistDataToParamsImpl()...
constexpr static auto Category() noexcept
Every derived class has to redefine this function.
virtual std::unique_ptr< DynExp::ExitTaskBase > MakeExitTask() const override
Factory function for an exit task (ExitTaskBase). Override to define the desired deinitialization tas...
virtual void SetEnable(bool Enable, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Enables or disables the lock-in amplifier's demodulator.
virtual void SetTimeConstant(double TimeConstant, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0
Sets the time constant of the lock-in amplifier's low-poss filter.
virtual std::string GetName() const override
Returns the name of this Object type.
void ApplyFromParams() const
Applies the lock-in amplifier settings stored in the instrument parameters to the physical device....
void PersistDataToParams() const
Retrieves the current lock-in amplifier settings and stores them in the instrument parameters to save...
DynExp's core class acts as the interface between the user interface and DynExp's internal data like ...
Defines a task for deinitializing an instrument within an instrument inheritance hierarchy....
Refer to DynExp::ParamsBase::dispatch_tag.
Defines a task for initializing an instrument within an instrument inheritance hierarchy....
Refer to DynExp::ParamsBase::dispatch_tag.
Base class for instruments. Instruments comprise virtual devices (meta instruments) and physial devic...
Configurator class for InstrumentBase.
Data structure to contain data which is synchronized in between different threads....
Refer to ParamsBase::dispatch_tag.
Defines data for a thread belonging to a InstrumentBase instance. Refer to RunnableInstance.
Parameter class for InstrumentBase.
const std::thread::id OwnerThreadID
Thread id of the thread which has constructed (and owns) this Object instance.
const ParamsBasePtrType Params
Pointer to the parameter class instance belonging to this Object instance.
Refer to ParamsBase::dispatch_tag.
const ItemIDType ID
ID of the Object this parameter class instance belongs to.
const DynExpCore & Core
Reference to DynExp's core.
Tag for function dispatching mechanism within this class used when derived classes are not intended t...
Defines a task for updating an instrument within an instrument inheritance hierarchy....
Refer to DynExp::ParamsBase::dispatch_tag.
TriggerEdgeType
Type to determine at which edge of a trigger signal to trigger. Not a strongly-typed enum to allow us...
@ Rise
Trigger on rising edge.
@ UnknownEdge
Trigger edge not specified.
@ Fall
Trigger on falling edge.
SignalType
Type specifying different signal coordinates a lock-in amplifier can record. Not a strongly-typed enu...
@ R
Radial component of the signal in polar coordinates.
@ Y
Y component of the signal in cartesian coordinates.
@ X
X component of the signal in cartesian coordinates.
@ Theta
Phase component of the signal in polar coordinates.
TriggerModeType
Type to determine the trigger mode. Not a strongly-typed enum to allow using the enumeration in a Dyn...
@ ExternSingle
Run once after an external trigger signal has been detected.
@ UnknownMode
Trigger mode not specified.
@ Continuous
Run continuously disabling the trigger.
DynExp's instrument namespace contains the implementation of DynExp instruments which extend DynExp's...
DynExp's main namespace contains the implementation of DynExp including classes to manage resources (...
std::unique_ptr< ParamsBase > ParamsBasePtrType
Alias for a pointer to the parameter system base class ParamsBase.
size_t ItemIDType
ID type of objects/items managed by DynExp.
std::vector< std::pair< TextType, ValueType > > TextValueListType
Type of a list containing key-value pairs where key is a text of type Util::TextType.
Accumulates include statements to provide a precompiled header.
Type describing a recorded lock-in sample in cartesian coordinates. Must be trivially copyable.
constexpr LockinResultCartesian() noexcept=default
Default-constructs a LockinResultCartesian instance.
DataType Y
Y component of the signal in cartesian coordinates.
DataType X
X component of the signal in cartesian coordinates.
double DataType
Data type used to store the sample.
Type describing a recorded lock-in sample in polar coordinates. Must be trivially copyable.
double DataType
Data type used to store the sample.
constexpr LockinResultPolar() noexcept=default
Default-constructs a LockinResultPolar instance.
DataType R
Radial component of the signal in polar coordinates.
DataType Theta
Phase component of the signal in polar coordinates.
Type describing a recorded lock-in sample independent of the coordinate system. Must be trivially cop...
LockinResultCartesian CartesianResult
Representation of the recorded sample in cartesian coordinates.
uint8_t Channel
Channel of the lock-in amplifier this sample has been recorded with.
constexpr LockinSample() noexcept=default
Default-constructs a LockinSample instance.
void UpdatePolar() noexcept
Updates PolarResult based on CartesianResult.
DataType Time
Time in seconds this sample has been recorded at.
DataType GetDisambiguatedValue(SignalType Signal) const noexcept
Retrieves the sample value represented as the coordinate specified by Signal.
LockinResultPolar PolarResult
Representation of the recorded sample in polar coordinates.
void UpdateCartesian() noexcept
Updates CartesianResult based on PolarResult.
double DataType
Data type used to store the sample (value and time)