11 auto InstrParams = DynExp::dynamic_Params_cast<NenionLeakvalveF3>(Instance.
ParamsGetter());
12 auto InstrData = DynExp::dynamic_InstrumentData_cast<NenionLeakvalveF3>(Instance.
InstrumentDataGetter());
14 Instance.
LockObject(InstrParams->HardwareAdapter, InstrData->HardwareAdapter);
15 InstrData->HardwareAdapter->Clear();
18 *InstrData->HardwareAdapter <<
"E";
28 auto InstrData = DynExp::dynamic_InstrumentData_cast<NenionLeakvalveF3>(Instance.
InstrumentDataGetter());
33 *InstrData->HardwareAdapter <<
"H";
48 auto InstrData = DynExp::dynamic_InstrumentData_cast<NenionLeakvalveF3>(Instance.
InstrumentDataGetter());
49 bool UpdateError =
false;
53 std::string StateString;
58 StateString = InstrData->HardwareAdapter->WaitForLine(5);
59 }
while (!StateString.empty());
61 *InstrData->HardwareAdapter <<
"S";
66 StateString = InstrData->HardwareAdapter->WaitForLine(5);
67 }
while (!StateString.empty() && StateString[0] ==
'G');
68 if (StateString.size() < 3 || StateString[1] !=
'P')
71 switch (StateString[0])
95 InstrData->SetCurrentPosition(Util::StrToT<PositionerStageData::PositionType>(StateString.substr(2)));
102 if (InstrData->NumFailedStatusUpdateAttempts++ >= 3)
107 InstrData->NumFailedStatusUpdateAttempts = 0;
129 auto InstrData = DynExp::dynamic_InstrumentData_cast<NenionLeakvalveF3>(Instance.
InstrumentDataGetter());
131 InstrData->SetHomePosition(InstrData->GetCurrentPosition());
138 auto InstrData = DynExp::dynamic_InstrumentData_cast<NenionLeakvalveF3>(Instance.
InstrumentDataGetter());
140 *InstrData->HardwareAdapter <<
"N";
147 auto InstrData = DynExp::dynamic_InstrumentData_cast<NenionLeakvalveF3>(Instance.
InstrumentDataGetter());
149 InstrData->SetVelocity(Velocity);
156 auto InstrData = DynExp::dynamic_InstrumentData_cast<NenionLeakvalveF3>(Instance.
InstrumentDataGetter());
158 *InstrData->HardwareAdapter <<
"G" +
Util::ToStr(InstrData->GetHomePosition());
165 auto InstrData = DynExp::dynamic_InstrumentData_cast<NenionLeakvalveF3>(Instance.
InstrumentDataGetter());
168 *InstrData->HardwareAdapter <<
"G" +
Util::ToStr(NewPos);
175 auto InstrData = DynExp::dynamic_InstrumentData_cast<NenionLeakvalveF3>(Instance.
InstrumentDataGetter());
177 const auto NewPos =
static_cast<const NenionLeakvalveF3&
>(Instance.
GetOwner()).EnforcePositionLimits(InstrData->GetCurrentPosition() + Position);
178 *InstrData->HardwareAdapter <<
"G" +
Util::ToStr(NewPos);
185 auto InstrData = DynExp::dynamic_InstrumentData_cast<NenionLeakvalveF3>(Instance.
InstrumentDataGetter());
188 *InstrData->HardwareAdapter <<
"H";
196 NumFailedStatusUpdateAttempts = 0;
205 NenionLeakvalveF3Status == NenionLeakvalveF3StatusType::Moving ||
206 NenionLeakvalveF3Status == NenionLeakvalveF3StatusType::Arrived);
221 auto InstrData = DynExp::dynamic_InstrumentData_cast<NenionLeakvalveF3>(
GetInstrumentData());
224 *InstrData->HardwareAdapter <<
"H";
Implementation of an instrument to control the positioner stage of the Nenion Leakvalve F3 valve.
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())
void ExitFuncImpl(dispatch_tag< PositionerStageTasks::ExitTask >, DynExp::InstrumentInstance &Instance) override final
Deinitializes the respective instrument within the instrument inheritance hierarchy....
void InitFuncImpl(dispatch_tag< PositionerStageTasks::InitTask >, DynExp::InstrumentInstance &Instance) override final
Initializes the respective instrument within the instrument inheritance hierarchy....
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 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 DynExp::TaskResultType RunChild(DynExp::InstrumentInstance &Instance) override
Runs the task. Override RunChild() to define a derived task's action(s). Any exception leaving RunChi...
void UpdateFuncImpl(dispatch_tag< PositionerStageTasks::UpdateTask >, DynExp::InstrumentInstance &Instance) override final
Updates the respective instrument within the instrument inheritance hierarchy. Call UpdateFuncImpl() ...
PositionerStageData::PositionType EnforcePositionLimits(PositionerStageData::PositionType Position) const
NenionLeakvalveF3(const std::thread::id OwnerThreadID, DynExp::ParamsBasePtrType &&Params)
virtual void OnErrorChild() const override
Derived classes can perform critical shutdown actions after an error has occurred....
virtual PositionerStageData::PositionType GetMaxPosition() const noexcept override
Returns the maximal position the stage can move to in nm if the stage supports SI units,...
void ResetImpl(dispatch_tag< PositionerStage >) override final
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every de...
virtual PositionerStageData::PositionType GetMinPosition() const noexcept override
Returns the minimal position the stage can move to in nm if the stage supports SI units,...
signed long long PositionType
Numeric type to store the stage positions.
Implementation of a meta instrument to control single-axis positioner stages.
Refer to DynExp::ParamsBase::dispatch_tag.
Refer to DynExp::ParamsBase::dispatch_tag.
InstrumentDataTypeSyncPtrType GetInstrumentData(const std::chrono::milliseconds Timeout=GetInstrumentDataTimeoutDefault)
Locks the mutex of the instrument data class instance InstrumentData assigned to this InstrumentBase ...
Refer to ParamsBase::dispatch_tag.
Defines data for a thread belonging to a InstrumentBase instance. Refer to RunnableInstance.
const InstrumentBase::InstrumentDataGetterType InstrumentDataGetter
Getter for instrument's data. Refer to InstrumentBase::InstrumentDataGetterType.
Refer to ParamsBase::dispatch_tag.
const Object::ParamsGetterType ParamsGetter
Invoke to obtain the parameters (derived from ParamsBase) of Owner.
void UnlockObject(LinkedObjectWrapperContainer< ObjectT > &ObjectWrapperContainer)
Unlocks an Object instance stored in the LinkedObjectWrapperContainer ObjectWrapperContainer....
void LockObject(const ParamsBase::Param< ObjectLink< ObjectT >> &LinkParam, LinkedObjectWrapperContainer< ObjectT > &ObjectWrapperContainer, std::chrono::milliseconds Timeout=ObjectLinkBase::LockObjectTimeoutDefault)
Locks an Object instance referenced by a parameter LinkParam of type ParamsBase::Param< ObjectLink< O...
const auto & GetOwner() const noexcept
Returns Owner.
Defines the return type of task functions.
Refer to DynExp::ParamsBase::dispatch_tag.
Data to operate on is invalid for a specific purpose. This indicates a corrupted data structure or fu...
Thrown when an operation timed out before it could be completed, especially used for locking shared d...
DynExp's instrument namespace contains the implementation of DynExp instruments which extend DynExp's...
std::unique_ptr< ParamsBase > ParamsBasePtrType
Alias for a pointer to the parameter system base class ParamsBase.
std::string ToStr(const T &Value, int Precision=-1)
Converts a (numeric) value of type T to a std::string using operator<< of std::stringstream.
Accumulates include statements to provide a precompiled header.