DynExp
Highly flexible laboratory automation for dynamically changing experiments.
Loading...
Searching...
No Matches
Laser.h
Go to the documentation of this file.
1// This file is part of DynExp.
2
8#pragma once
9
10#include "stdafx.h"
11#include "Instrument.h"
12
13namespace DynExpInstr
14{
15 class Laser;
16
61
66 {
67 public:
74 enum class FrequencyUnitType {
75 Hz,
76 nm,
77 };
78
85 enum class IntensityUnitType {
86 Power_W
87 };
88
94 static const char* FrequencyUnitTypeToStr(const FrequencyUnitType& Unit);
95
101 static const char* IntensityUnitTypeToStr(const IntensityUnitType& Unit);
102
113
114 LaserData() = default;
115 virtual ~LaserData() = default;
116
117 void SetFrequencyValue(double Frequency) noexcept { this->Frequency = Frequency; }
118 auto GetFrequencyValue() const noexcept { return Frequency; }
119 void SetIntensityValue(double Intensity) noexcept { this->Intensity = Intensity; }
120 auto GetIntensityValue() const noexcept { return Intensity; }
121 void SetScanRangeValue(double ScanRange) noexcept { this->ScanRange = ScanRange; }
122 auto GetScanRangeValue() const noexcept { return ScanRange; }
123 void SetScanRateValue(double ScanRate) noexcept { this->ScanRate = ScanRate; }
124 auto GetScanRateValue() const noexcept { return ScanRate; }
125
130 auto GetLaserState() const noexcept { return GetLaserStateChild(); }
131
132 private:
133 void ResetImpl(dispatch_tag<InstrumentDataBase>) override final;
135
140 virtual LaserStateType GetLaserStateChild() const noexcept = 0;
142
143 double Frequency = 0.0;
144 double Intensity = 0.0;
145 double ScanRange = 0.0;
146 double ScanRate = 0.0;
147 };
148
152 class LaserParams : public DynExp::InstrumentParamsBase
153 {
154 public:
159 LaserParams(DynExp::ItemIDType ID, const DynExp::DynExpCore& Core) : InstrumentParamsBase(ID, Core) {}
160
161 virtual ~LaserParams() = 0;
162
163 virtual const char* GetParamClassTag() const noexcept override { return "LaserParams"; }
164
165 private:
168
169 DummyParam Dummy = { *this };
170 };
171
176 {
177 public:
180
181 LaserConfigurator() = default;
182 virtual ~LaserConfigurator() = 0;
183 };
184
189 {
190 public:
194
203
204 constexpr static auto Name() noexcept { return "Laser"; }
205 constexpr static auto Category() noexcept { return "I/O"; }
206
210 Laser(const std::thread::id OwnerThreadID, DynExp::ParamsBasePtrType&& Params)
211 : InstrumentBase(OwnerThreadID, std::move(Params)) {}
212
213 virtual ~Laser() = 0;
214
215 virtual std::string GetName() const override { return Name(); }
216 virtual std::string GetCategory() const override { return Category(); }
217
218 virtual std::chrono::milliseconds GetTaskQueueDelay() const override { return std::chrono::milliseconds(50); }
219
224
229
235
241 virtual double GetMinFrequency() const { return GetMaxFrequency(); }
242
247 virtual double GetMaxFrequency() const = 0;
248
254 virtual double GetMinIntensity() const { return GetMaxIntensity(); }
255
260 virtual double GetMaxIntensity() const = 0;
261
267 virtual double GetMinScanRange() const { return 0.0; }
268
274 virtual double GetMaxScanRange() const { return 0.0; }
275
281 virtual double GetMinScanRate() const { return 0.0; }
282
288 virtual double GetMaxScanRate() const { return 0.0; }
289
295 virtual double GetModeHopFreeTuningRange() const { return 0.0; }
297
304
309 virtual void SetFrequency(double Frequency, DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const = 0;
310
316 virtual void SetIntensity(double Intensity, DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const = 0;
317
323 virtual void SetScanRange(double ScanRange, DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const = 0;
324
330 virtual void SetScanRate(double ScanRate, DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const = 0;
331
336 virtual void Enable(DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const = 0;
337
342 virtual void Disable(DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const = 0;
343
350 virtual void ScanContinuously(DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const;
351
358 virtual void DisableScan(DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const;
360
361 private:
362 void ResetImpl(dispatch_tag<InstrumentBase>) override final;
363 virtual void ResetImpl(dispatch_tag<Laser>) = 0;
364 };
365}
Implementation of DynExp instrument objects.
Configurator class for Laser.
Definition Laser.h:176
Data class for Laser.
Definition Laser.h:66
static const char * IntensityUnitTypeToStr(const IntensityUnitType &Unit)
Returns a descriptive string of a respective intensity unit to be e.g. used in the UI.
Definition Laser.cpp:18
double ScanRate
Current scan rate.
Definition Laser.h:146
FrequencyUnitType
Supported laser frequency units.
Definition Laser.h:74
auto GetScanRateValue() const noexcept
Getter for ScanRate.
Definition Laser.h:124
virtual ~LaserData()=default
virtual LaserStateType GetLaserStateChild() const noexcept=0
Returns the laser's current state.
void SetScanRangeValue(double ScanRange) noexcept
Setter for ScanRange.
Definition Laser.h:121
double Frequency
Current frequency.
Definition Laser.h:143
LaserStateType
Possible laser states.
Definition Laser.h:106
@ Startup
The laser is warming up.
@ Error
The laser is in an error state.
@ EmissionEnabledConstant
The laser is emitting in constant mode.
@ EmissionEnabledScanning
The laser is emitting in scan mode.
@ Ready
The laser is ready for emission.
void SetFrequencyValue(double Frequency) noexcept
Setter for Frequency.
Definition Laser.h:117
void ResetImpl(dispatch_tag< InstrumentDataBase >) override final
Definition Laser.cpp:27
auto GetFrequencyValue() const noexcept
Getter for Frequency.
Definition Laser.h:118
double Intensity
Current intensity.
Definition Laser.h:144
virtual void ResetImpl(dispatch_tag< LaserData >)
Definition Laser.h:134
IntensityUnitType
Supported laser intensity units.
Definition Laser.h:85
static const char * FrequencyUnitTypeToStr(const FrequencyUnitType &Unit)
Returns a descriptive string of a respective frequency unit to be e.g. used in the UI.
Definition Laser.cpp:8
void SetScanRateValue(double ScanRate) noexcept
Setter for ScanRate.
Definition Laser.h:123
auto GetScanRangeValue() const noexcept
Getter for ScanRange.
Definition Laser.h:122
auto GetLaserState() const noexcept
Returns the laser's current state.
Definition Laser.h:130
void SetIntensityValue(double Intensity) noexcept
Setter for Intensity.
Definition Laser.h:119
double ScanRange
Current scan range.
Definition Laser.h:145
auto GetIntensityValue() const noexcept
Getter for Intensity.
Definition Laser.h:120
Parameter class for Laser.
Definition Laser.h:153
LaserParams(DynExp::ItemIDType ID, const DynExp::DynExpCore &Core)
Constructs the parameters for a Laser instance.
Definition Laser.h:159
void ConfigureParamsImpl(dispatch_tag< InstrumentParamsBase >) override final
Definition Laser.h:166
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...
Definition Laser.h:163
virtual void ConfigureParamsImpl(dispatch_tag< LaserParams >)
Called by DynExp::ParamsBase::ConfigureParams() as a starting point for the tag dispatch mechanism to...
Definition Laser.h:167
Defines a task for deinitializing an instrument within an instrument inheritance hierarchy....
Definition Laser.h:39
void ExitFuncImpl(dispatch_tag< ExitTaskBase >, DynExp::InstrumentInstance &Instance) override final
Definition Laser.h:40
virtual void ExitFuncImpl(dispatch_tag< ExitTask >, DynExp::InstrumentInstance &Instance)
Deinitializes the respective instrument within the instrument inheritance hierarchy....
Definition Laser.h:45
Defines a task for initializing an instrument within an instrument inheritance hierarchy....
Definition Laser.h:26
void InitFuncImpl(dispatch_tag< InitTaskBase >, DynExp::InstrumentInstance &Instance) override final
Definition Laser.h:27
virtual void InitFuncImpl(dispatch_tag< InitTask >, DynExp::InstrumentInstance &Instance)
Initializes the respective instrument within the instrument inheritance hierarchy....
Definition Laser.h:32
Defines a task for updating an instrument within an instrument inheritance hierarchy....
Definition Laser.h:52
void UpdateFuncImpl(dispatch_tag< UpdateTaskBase >, DynExp::InstrumentInstance &Instance) override final
Definition Laser.h:53
virtual void UpdateFuncImpl(dispatch_tag< UpdateTask >, DynExp::InstrumentInstance &Instance)
Updates the respective instrument within the instrument inheritance hierarchy. Call UpdateFuncImpl() ...
Definition Laser.h:58
Meta instrument for a laser.
Definition Laser.h:189
static constexpr auto Name() noexcept
Every derived class has to redefine this function.
Definition Laser.h:204
virtual double GetMinIntensity() const
Determines the minimal emission intensity. The default implementation returns GetMaxIntensity() which...
Definition Laser.h:254
virtual void Enable(DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0
Enables emission in constant mode.
virtual double GetMaxIntensity() const =0
Determines the maximal emission intensity.
virtual std::string GetCategory() const override
Returns the category of this Object type.
Definition Laser.h:216
virtual void ResetImpl(dispatch_tag< Laser >)=0
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every de...
virtual double GetMinScanRange() const
Determines the minimal frequency scan range. The default implementation returns 0....
Definition Laser.h:267
Laser(const std::thread::id OwnerThreadID, DynExp::ParamsBasePtrType &&Params)
Constructs an instrument instance.
Definition Laser.h:210
virtual double GetModeHopFreeTuningRange() const
Determines the mode hop free tuning range. The default implementation returns 0.0,...
Definition Laser.h:295
virtual double GetMinFrequency() const
Determines the minimal emission frequency. The default implementation returns GetMaxFrequency() which...
Definition Laser.h:241
virtual double GetMaxScanRange() const
Determines the maximal frequency scan range. The default implementation returns 0....
Definition Laser.h:274
virtual double GetMaxScanRate() const
Determines the maximal frequency scan rate. The default implementation returns 0.0,...
Definition Laser.h:288
virtual std::chrono::milliseconds GetTaskQueueDelay() const override
Specifies in which time intervals the instrument's task queue runs to handle pending tasks.
Definition Laser.h:218
virtual std::string GetName() const override
Returns the name of this Object type.
Definition Laser.h:215
virtual void SetIntensity(double Intensity, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0
Sets the laser's output intensity.
virtual LaserData::IntensityUnitType GetIntensityUnit() const =0
Determines the intensity unit.
virtual double GetMaxFrequency() const =0
Determines the maximal emission frequency.
virtual void SetScanRate(double ScanRate, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0
Sets the laser's frequency scan rate.
virtual void Disable(DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0
Disables emission.
virtual LaserData::FrequencyUnitType GetFrequencyUnit() const =0
Determines the frequency unit.
virtual void SetFrequency(double Frequency, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0
Sets the laser's emission frequency.
virtual void SetScanRange(double ScanRange, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0
Sets the laser's frequency scan range.
static constexpr auto Category() noexcept
Every derived class has to redefine this function.
Definition Laser.h:205
virtual double GetMinScanRate() const
Determines the minimal frequency scan rate. The default implementation returns 0.0,...
Definition Laser.h:281
DynExp's core class acts as the interface between the user interface and DynExp's internal data like ...
Definition DynExpCore.h:127
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...
Definition Instrument.h:480
Configurator class for InstrumentBase.
Definition Instrument.h:464
Data structure to contain data which is synchronized in between different threads....
Definition Instrument.h:135
Refer to ParamsBase::dispatch_tag.
Definition Instrument.h:146
Defines data for a thread belonging to a InstrumentBase instance. Refer to RunnableInstance.
Definition Instrument.h:813
Refer to ParamsBase::dispatch_tag.
Definition Object.h:2018
Dummy parameter which is to be owned once by parameter classes that do not contain any other paramete...
Definition Object.h:522
Tag for function dispatching mechanism within this class used when derived classes are not intended t...
Definition Object.h:349
Type owning a callback function which is invoked when a task has finished, failed,...
Definition Instrument.h:978
Defines a task for updating an instrument within an instrument inheritance hierarchy....
Refer to DynExp::ParamsBase::dispatch_tag.
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.
Definition Object.h:1807
size_t ItemIDType
ID type of objects/items managed by DynExp.
Accumulates include statements to provide a precompiled header.