DynExp
Highly flexible laboratory automation for dynamically changing experiments.
NenionLeakvalveF3.h
Go to the documentation of this file.
1 // This file is part of DynExp.
2 
9 #pragma once
10 
11 #include "stdafx.h"
12 #include "DynExpCore.h"
13 #include "MetaInstruments/Stage.h"
14 
15 namespace DynExpInstr
16 {
17  class NenionLeakvalveF3;
18 
19  namespace NenionLeakvalveF3Tasks
20  {
22  {
24 
26  };
27 
29  {
31 
33  };
34 
36  {
38 
40  };
41 
42  class SetHomeTask final : public DynExp::TaskBase
43  {
45  };
46 
47  class ReferenceTask final : public DynExp::TaskBase
48  {
49  public:
51 
52  private:
54  };
55 
56  class SetVelocityTask final : public DynExp::TaskBase
57  {
58  public:
60 
61  private:
63 
65  };
66 
67  class MoveToHomeTask final : public DynExp::TaskBase
68  {
69  public:
71 
72  private:
74  };
75 
76  class MoveAbsoluteTask final : public DynExp::TaskBase
77  {
78  public:
81 
82  private:
84 
86  };
87 
88  class MoveRelativeTask final : public DynExp::TaskBase
89  {
90  public:
93 
94  private:
96 
98  };
99 
100  class StopMotionTask final : public DynExp::TaskBase
101  {
102  virtual DynExp::TaskResultType RunChild(DynExp::InstrumentInstance& Instance) override;
103  };
104  }
105 
107  {
109 
110  public:
112 
114  virtual ~NenionLeakvalveF3Data() = default;
115 
116  auto GetNenionLeakvalveF3Status() const noexcept { return NenionLeakvalveF3Status; }
117 
118  auto GetHomePosition() const noexcept { return HomePosition; }
120 
122 
123  private:
124  void ResetImpl(dispatch_tag<PositionerStageData>) override final;
126 
127  virtual bool IsMovingChild() const noexcept override { return NenionLeakvalveF3Status == NenionLeakvalveF3StatusType::Moving; }
128  virtual bool HasArrivedChild() const noexcept override { return NenionLeakvalveF3Status == NenionLeakvalveF3StatusType::Arrived; }
129  virtual bool HasFailedChild() const noexcept override;
130  virtual bool IsReferencedChild() const noexcept override { return true; }
131 
135  };
136 
138  {
139  public:
141  virtual ~NenionLeakvalveF3Params() = default;
142 
143  virtual const char* GetParamClassTag() const noexcept override { return "NenionLeakvalveF3Params"; }
144 
146  "HardwareAdapter", "Serial port", "Underlying hardware adapter of this instrument", DynExpUI::Icons::HardwareAdapter };
147 
148  private:
151  };
152 
154  {
155  public:
158 
160  virtual ~NenionLeakvalveF3Configurator() = default;
161 
162  private:
163  virtual DynExp::ParamsBasePtrType MakeParams(DynExp::ItemIDType ID, const DynExp::DynExpCore& Core) const override { return DynExp::MakeParams<NenionLeakvalveF3Configurator>(ID, Core); }
164  };
165 
167  {
168  public:
172 
173  constexpr static auto Name() noexcept { return "Nenion Leakvalve F3"; }
174 
176  virtual ~NenionLeakvalveF3() {}
177 
178  virtual std::string GetName() const override { return Name(); }
179 
180  virtual std::chrono::milliseconds GetTaskQueueDelay() const override { return std::chrono::milliseconds(200); }
181 
182  virtual PositionerStageData::PositionType GetMinPosition() const noexcept override { return 1; }
183  virtual PositionerStageData::PositionType GetMaxPosition() const noexcept override { return 40000; }
184  virtual PositionerStageData::PositionType GetResolution() const noexcept override { return 1; }
185  virtual PositionerStageData::PositionType GetMinVelocity() const noexcept override { return 10; }
186  virtual PositionerStageData::PositionType GetMaxVelocity() const noexcept override { return 40000; }
187  virtual PositionerStageData::PositionType GetDefaultVelocity() const noexcept override { return 4000; }
188 
190 
191  virtual void SetHome() const override { MakeAndEnqueueTask<NenionLeakvalveF3Tasks::SetHomeTask>(); }
192  virtual void Reference([[maybe_unused]] DirectionType Direction = DirectionType::Forward, DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const override { MakeAndEnqueueTask<NenionLeakvalveF3Tasks::ReferenceTask>(CallbackFunc); }
193  virtual void SetVelocity(PositionerStageData::PositionType Velocity) const override { MakeAndEnqueueTask<NenionLeakvalveF3Tasks::SetVelocityTask>(Velocity); }
194 
195  virtual void MoveToHome(DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const override { MakeAndEnqueueTask<NenionLeakvalveF3Tasks::MoveToHomeTask>(CallbackFunc); }
196  virtual void MoveAbsolute(PositionerStageData::PositionType Position, DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const override { MakeAndEnqueueTask<NenionLeakvalveF3Tasks::MoveAbsoluteTask>(Position, CallbackFunc); }
197  virtual void MoveRelative(PositionerStageData::PositionType Position, DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const override { MakeAndEnqueueTask<NenionLeakvalveF3Tasks::MoveRelativeTask>(Position, CallbackFunc); }
198  virtual void StopMotion() const override { MakeAndEnqueueTask<NenionLeakvalveF3Tasks::StopMotionTask>(); }
199 
200  private:
201  virtual void OnErrorChild() const override;
202 
203  void ResetImpl(dispatch_tag<PositionerStage>) override final;
205 
206  virtual std::unique_ptr<DynExp::InitTaskBase> MakeInitTask() const override { return DynExp::MakeTask<NenionLeakvalveF3Tasks::InitTask>(); }
207  virtual std::unique_ptr<DynExp::ExitTaskBase> MakeExitTask() const override { return DynExp::MakeTask<NenionLeakvalveF3Tasks::ExitTask>(); }
208  virtual std::unique_ptr<DynExp::UpdateTaskBase> MakeUpdateTask() const override { return DynExp::MakeTask<NenionLeakvalveF3Tasks::UpdateTask>(); }
209  };
210 }
Defines DynExp's core module as an interface between the UI and DynExp objects.
Implementation of a meta instrument to control single-axis positioner stages.
virtual DynExp::ParamsBasePtrType MakeParams(DynExp::ItemIDType ID, const DynExp::DynExpCore &Core) const override
Override to make derived classes call DynExp::MakeParams with the correct configurator type derived f...
virtual void ResetImpl(dispatch_tag< NenionLeakvalveF3Data >)
void SetHomePosition(PositionType HomePosition) noexcept
virtual bool HasArrivedChild() const noexcept override
Returns whether the stage has arrived at its destiny position (result of HasArrivedChild())
auto GetNenionLeakvalveF3Status() const noexcept
virtual ~NenionLeakvalveF3Data()=default
DynExp::LinkedObjectWrapperContainer< DynExp::SerialCommunicationHardwareAdapter > HardwareAdapter
NenionLeakvalveF3StatusType NenionLeakvalveF3Status
void ResetImpl(dispatch_tag< PositionerStageData >) override final
Refer to DynExp::InstrumentDataBase::Reset(). Using tag dispatch mechanism to ensure that ResetImpl()...
virtual bool HasFailedChild() const noexcept override
Returns whether the stage is in an error state, i.e. moving has failed (result of HasFailedChild())
virtual bool IsMovingChild() const noexcept override
Returns whether the stage is currently moving (result of IsMovingChild())
virtual bool IsReferencedChild() const noexcept override
Returns whether a closed-loop positioner knows its position in respect to its zero point (result of I...
NenionLeakvalveF3Params(DynExp::ItemIDType ID, const DynExp::DynExpCore &Core)
void ConfigureParamsImpl(dispatch_tag< PositionerStageParams >) override final
Called by DynExp::ParamsBase::ConfigureParams() as a starting point for the tag dispatch mechanism to...
virtual void ConfigureParamsImpl(dispatch_tag< NenionLeakvalveF3Params >)
Param< DynExp::ObjectLink< DynExp::SerialCommunicationHardwareAdapter > > HardwareAdapter
virtual ~NenionLeakvalveF3Params()=default
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...
virtual void ExitFuncImpl(dispatch_tag< ExitTask >, DynExp::InstrumentInstance &Instance)
void ExitFuncImpl(dispatch_tag< PositionerStageTasks::ExitTask >, DynExp::InstrumentInstance &Instance) override final
Deinitializes the respective instrument within the instrument inheritance hierarchy....
virtual void InitFuncImpl(dispatch_tag< InitTask >, DynExp::InstrumentInstance &Instance)
void InitFuncImpl(dispatch_tag< PositionerStageTasks::InitTask >, DynExp::InstrumentInstance &Instance) override final
Initializes the respective instrument within the instrument inheritance hierarchy....
const PositionerStageData::PositionType Position
MoveAbsoluteTask(PositionerStageData::PositionType Position, CallbackType CallbackFunc) noexcept
virtual DynExp::TaskResultType RunChild(DynExp::InstrumentInstance &Instance) override
Runs the task. Override RunChild() to define a derived task's action(s). Any exception leaving RunChi...
MoveRelativeTask(PositionerStageData::PositionType Position, CallbackType CallbackFunc) noexcept
virtual DynExp::TaskResultType RunChild(DynExp::InstrumentInstance &Instance) override
Runs the task. Override RunChild() to define a derived task's action(s). Any exception leaving RunChi...
const PositionerStageData::PositionType Position
MoveToHomeTask(CallbackType CallbackFunc) noexcept
virtual DynExp::TaskResultType RunChild(DynExp::InstrumentInstance &Instance) override
Runs the task. Override RunChild() to define a derived task's action(s). Any exception leaving RunChi...
ReferenceTask(CallbackType CallbackFunc) noexcept
virtual DynExp::TaskResultType RunChild(DynExp::InstrumentInstance &Instance) override
Runs the task. Override RunChild() to define a derived task's action(s). Any exception leaving RunChi...
virtual DynExp::TaskResultType RunChild(DynExp::InstrumentInstance &Instance) override
Runs the task. Override RunChild() to define a derived task's action(s). Any exception leaving RunChi...
SetVelocityTask(PositionerStageData::PositionType Velocity) noexcept
const PositionerStageData::PositionType Velocity
virtual DynExp::TaskResultType RunChild(DynExp::InstrumentInstance &Instance) override
Runs the task. Override RunChild() to define a derived task's action(s). Any exception leaving RunChi...
virtual DynExp::TaskResultType RunChild(DynExp::InstrumentInstance &Instance) override
Runs the task. Override RunChild() to define a derived task's action(s). Any exception leaving RunChi...
virtual void UpdateFuncImpl(dispatch_tag< UpdateTask >, DynExp::InstrumentInstance &Instance)
void UpdateFuncImpl(dispatch_tag< PositionerStageTasks::UpdateTask >, DynExp::InstrumentInstance &Instance) override final
Updates the respective instrument within the instrument inheritance hierarchy. Call UpdateFuncImpl() ...
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 MoveToHome(DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const override
Moves the positioner to its stored home position. Also refer to SetHome().
virtual void MoveRelative(PositionerStageData::PositionType Position, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const override
Moves the positioner to a position relative to its current position. The position offset Steps has to...
virtual void MoveAbsolute(PositionerStageData::PositionType Position, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const override
Moves the positioner to an absolute position in its native units. Do divide units of PositionerStageD...
virtual std::chrono::milliseconds GetTaskQueueDelay() const override
Specifies in which time intervals the instrument's task queue runs to handle pending tasks.
PositionerStageData::PositionType EnforcePositionLimits(PositionerStageData::PositionType Position) const
NenionLeakvalveF3(const std::thread::id OwnerThreadID, DynExp::ParamsBasePtrType &&Params)
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 SetHome() const override
Stores the positioner's home position. Also refer to MoveToHome().
constexpr static auto Name() noexcept
virtual void SetVelocity(PositionerStageData::PositionType Velocity) const override
Sets the positioner's velocity in its native units. Do divide units of PositionerStageData::Velocity ...
virtual void OnErrorChild() const override
Derived classes can perform critical shutdown actions after an error has occurred....
virtual PositionerStageData::PositionType GetDefaultVelocity() const noexcept override
Returns the stage's default velocity in nm/s if the stage supports SI units, in steps/s otherwise.
virtual void Reference([[maybe_unused]] DirectionType Direction=DirectionType::Forward, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const override
virtual PositionerStageData::PositionType GetMinVelocity() const noexcept override
Returns the minimal velocity the stage can move with in nm/s if the stage supports SI units,...
virtual void ResetImpl(dispatch_tag< NenionLeakvalveF3 >)
virtual PositionerStageData::PositionType GetMaxPosition() const noexcept override
Returns the maximal position the stage can move to in nm if the stage supports SI units,...
virtual PositionerStageData::PositionType GetMaxVelocity() const noexcept override
Returns the maximal velocity the stage can move with in nm/s if the stage supports SI units,...
virtual std::unique_ptr< DynExp::InitTaskBase > MakeInitTask() const override
Factory function for an init task (InitTaskBase). Override to define the desired initialization task ...
virtual std::string GetName() const override
Returns the name of this Object type.
void ResetImpl(dispatch_tag< PositionerStage >) override final
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every de...
virtual void StopMotion() const override
Stops any motion or position stabilization of the positioner immediately.
virtual PositionerStageData::PositionType GetMinPosition() const noexcept override
Returns the minimal position the stage can move to in nm if the stage supports SI units,...
virtual PositionerStageData::PositionType GetResolution() const noexcept override
Returns the stage's position resolution (precision) in nm if the stage supports SI units,...
Configurator class for PositionerStage.
Definition: Stage.h:142
Data class for PositionerStage.
Definition: Stage.h:66
signed long long PositionType
Numeric type to store the stage positions.
Definition: Stage.h:71
Parameter class for PositionerStage.
Definition: Stage.h:119
Defines a task for deinitializing an instrument within an instrument inheritance hierarchy....
Definition: Stage.h:39
Defines a task for initializing an instrument within an instrument inheritance hierarchy....
Definition: Stage.h:26
Defines a task for updating an instrument within an instrument inheritance hierarchy....
Definition: Stage.h:52
Implementation of a meta instrument to control single-axis positioner stages.
Definition: Stage.h:155
DirectionType
Type to determine the direction of the positioner stage's movements.
Definition: Stage.h:160
DynExp's core class acts as the interface between the user interface and DynExp's internal data like ...
Definition: DynExpCore.h:127
Refer to DynExp::ParamsBase::dispatch_tag.
Definition: Instrument.h:1151
Refer to DynExp::ParamsBase::dispatch_tag.
Definition: Instrument.h:1120
Base class for instruments. Instruments comprise virtual devices (meta instruments) and physial devic...
Definition: Instrument.h:451
Configurator class for InstrumentBase.
Definition: Instrument.h:435
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:772
Parameter class for InstrumentBase.
Definition: Instrument.h:401
const std::thread::id OwnerThreadID
Thread id of the thread which has constructed (and owns) this Object instance.
Definition: Object.h:2302
const ParamsBasePtrType Params
Pointer to the parameter class instance belonging to this Object instance.
Definition: Object.h:2303
Refer to ParamsBase::dispatch_tag.
Definition: Object.h:2018
const ItemIDType ID
ID of the Object this parameter class instance belongs to.
Definition: Object.h:1779
const auto & GetCore() const noexcept
Returns a reference to DynExp's core.
Definition: Object.h:1677
const DynExpCore & Core
Reference to DynExp's core.
Definition: Object.h:1780
Tag for function dispatching mechanism within this class used when derived classes are not intended t...
Definition: Object.h:349
Base class for all tasks being processed by instruments. The class must not contain public virtual fu...
Definition: Instrument.h:892
std::function< void(const TaskBase &, ExceptionContainer &)> CallbackType
Type of a callback function which is invoked when a task has finished, failed or has been aborted....
Definition: Instrument.h:939
TaskBase(CallbackType CallbackFunc=nullptr) noexcept
Constructs an instrument task.
Definition: Instrument.h:979
const CallbackType CallbackFunc
This callback function is called after the task has finished (either successfully or not) with a refe...
Definition: Instrument.h:1072
Defines the return type of task functions.
Definition: Instrument.h:824
Refer to DynExp::ParamsBase::dispatch_tag.
Definition: Instrument.h:1182
DynExp's instrument namespace contains the implementation of DynExp instruments which extend DynExp's...
Definition: Instrument.h:1254
constexpr auto HardwareAdapter
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.