29#ifndef INC_CINOSBASECONTROL_H
30#define INC_CINOSBASECONTROL_H
36#define DF_INOS_BASE_CONTROL_DBT "INOS-BASE-CONTROL"
40#define DF_INOS_CONTROL_STATE_PEACE 0
41#define DF_INOS_CONTROL_STATE_ACTIVATING 1
42#define DF_INOS_CONTROL_STATE_ACTIVE 2
43#define DF_INOS_CONTROL_STATE_INACTIVATING 3
48#define DF_INOS_CONTROL_SUBSTATE_ACTIVE_HALT 0
49#define DF_INOS_CONTROL_SUBSTATE_ACTIVE_RUN 1
50#define DF_INOS_CONTROL_SUBSTATE_ACTIVE_UMOVE 2
56#define ER_INOS_BASE_CONTROL_MCROBOT_ERROR_BASE 0x00000000
57#define ER_INOS_GSB_CONTROL_MCROBOT_ERROR_BASE 0x40031300
58#define ER_INOS_SL2_CONTROL_MCROBOT_ERROR_BASE 0x40032300
59#define ER_INOS_HSSI_CONTROL_MCROBOT_ERROR_BASE 0x40033300
61#define ER_INOS_CONTROL_POSCHK 0x00000001
62#define ER_INOS_CONTROL_POSOVR 0x00000002
63#define ER_INOS_CONTROL_OSCICHK 0x00000004
64#define ER_INOS_CONTROL_ENBMISSING 0x00000008
65#define ER_INOS_CONTROL_HOMEFAILED 0x00000010
66#define ER_INOS_CONTROL_SAFE_SYNCFAILED 0x00000020
67#define ER_INOS_CONTROL_WATCHDOG 0x00000040
68#define ER_INOS_CONTROL_POSCHN 0x00001000
69#define ER_INOS_CONTROL_ACTIVATE 0x00002000
70#define ER_INOS_CONTROL_EXTERN 0x00004000
71#define ER_INOS_CONTROL_OFFLINE 0x00008000
75#define WR_INOS_CONTROL_INTLIMIT 0x00000001
76#define WR_INOS_CONTROL_FSLIMIT 0x00000002
77#define WR_INOS_CONTROL_EXTERN 0x00004000
81#define DF_INOS_BASE_CONTROL_FLAG_CHK_POS 0x00000001
82#define DF_INOS_BASE_CONTROL_FLAG_SIM_POS 0x00000002
83#define DF_INOS_BASE_CONTROL_FLAG_SIM_OUT 0x00000004
84#define DF_INOS_BASE_CONTROL_FLAG_SIM_ACT 0x00000008
85#define DF_INOS_BASE_CONTROL_FLAG_ENB_NRD 0x00000010
86#define DF_INOS_BASE_CONTROL_FLAG_DEAD_INC 0x00000020
87#define DF_INOS_BASE_CONTROL_FLAG_ENB_SYN 0x00000040
88#define DF_INOS_BASE_CONTROL_FLAG_ENB_NRM 0x00000080
89#define DF_INOS_BASE_CONTROL_FLAG_POS_OVRS 0x00000100
90#define DF_INOS_BASE_CONTROL_FLAG_FFV_100 0x00000200
91#define DF_INOS_BASE_CONTROL_FLAG_NO_PID 0x00000400
92#define DF_INOS_BASE_CONTROL_FLAG_POS_ABS 0x00000800
93#define DF_INOS_BASE_CONTROL_FLAG_NO_MPE 0x00001000
94#define DF_INOS_BASE_CONTROL_FLAG_POSEX 0x00002000
95#define DF_INOS_BASE_CONTROL_FLAG_INIT_V_ADJ_DIS 0x00004000
96#define DF_INOS_BASE_CONTROL_FLAG_DEAD_INC2 0x00008000
97#define DF_INOS_BASE_CONTROL_FLAG_LIFETIME 0x00010000
98#define DF_INOS_BASE_CONTROL_FLAG_NRM_POS 0x00020000
99#define DF_INOS_BASE_CONTROL_FLAG_DISTANCE_CODED_CALIB 0x00040000
100#define DF_INOS_BASE_CONTROL_FLAG_INC_FRACT 0x00080000
105#define DF_INOS_BASE_CONTROL_FLAG_ENB_SAFE_SYNC 0x40000000
106#define DF_INOS_BASE_CONTROL_FLAG_DIS_SERR 0x80000000
113#define DF_INOS_BASE_CONTROL_OPT_DEAD_INC 0x00000001
116#define DF_INOS_BASE_CONTROL_OPT_POS_OVRS 0x00000002
120#define DF_INOS_BASE_CONTROL_OPT_FFV_100 0x00000004
124#define DF_INOS_BASE_CONTROL_OPT_NO_PID 0x00000008
127#define DF_INOS_BASE_CONTROL_OPT_POS_ABS 0x00000010
132#define DF_INOS_BASE_CONTROL_OPT_NO_MPE 0x00000020
136#define DF_INOS_BASE_CONTROL_OPT_POSEX 0x00000040
140#define DF_INOS_BASE_CONTROL_OPT_INIT_V_ADJ_DIS 0x00000080
144#define DF_INOS_BASE_CONTROL_OPT_DEAD_INC2 0x00000100
149#define DF_INOS_BASE_CONTROL_OPT_DISTANCE_CODED_CALIB 0x00000200
152#define DF_INOS_BASE_CONTROL_OPT_CUSTOMER1_SYNC_INTERFACE 0x00000400
157#define DF_INOS_BASE_CONTROL_OPT_LIMIT_OUT 0x00000800
162#define DF_INOS_BASE_CONTROL_OPT_IGNORE_CYCLEID 0x00001000
165#define DF_INOS_BASE_CONTROL_OPT_INC_FRACT 0x00002000
170#define DF_INOS_BASE_CONTROL_OPT_EXT_POS_ERR 0x00004000
184#ifdef INOS_SAFETY_SUPPORT
256 real64 m_rSINOSBaseControl_Internal0[2];
293 uint8 m_rSINOSBaseControl_Internal1;
311class CINOSOscillationDetector;
332 const char* apControlType);
342 virtual void Activate(
bool abCheckPos =
true,
bool abSimulatePos =
false,
343 bool abSimulateOut =
false,
bool abSimulateAct =
false);
345 virtual void InActivate();
352 ICACHE
virtual uint32 Pull(real64 arPosition, real64 arVelocity,
353 real64 arAcceleration, real64 arJerk);
356 virtual void GetCmdPosition(real64& arPosition);
358 virtual void GetCmdVelocity(real64& arVelocity);
360 virtual void GetCmdAcceleration(real64& arAcceleration);
362 virtual void GetCmdJerk(real64& arJerk);
364 ICACHE
virtual void SetActPosition(real64 arPosition);
366 ICACHE
virtual void AdjActPosition(real64 arPosition);
368 ICACHE
virtual void GetActPosition(real64& arPosition);
370 ICACHE
virtual void GetActPositionEx(real64& arPosition);
372 INOS_INLINE void GetActPositionFst(real64& arPosition)
373 { arPosition = m_rSact; };
377 virtual void GetActAcceleration(real64& arAcceleration);
379 virtual void GetActJerk(real64& arJerk);
381 virtual void GetActPosError(real64& arPosError);
383 virtual void GetActVelocityError(real64& arVelocityError,
bool abFiltered =
false);
386 virtual uint32 GetParam(
const char* apName, real64& arResult);
388 virtual volatile real64* GetParamAdr(
const char* apName);
390 virtual uint32 SetParam(
const char* apName, real64 arValue);
392 virtual void SetIncsPerUnit(real64 arIncs);
394 virtual void SetUnitsPerInc(real64 arUnits);
396 virtual void OnGearRatioChanged(){};
400 void SetFlag(uint32 auFlag)
403 void ClrFlag(uint32 auFlag)
406 uint32 GetFlag()
const
409 const char* GetType()
412 ICACHE
virtual uint32 GetState();
414 ICACHE
virtual uint32 GetState(uint32& auSubState);
416 virtual uint32 SetError(uint32 auError);
418 ICACHE
virtual uint32 GetError(
bool abResolveExternal =
false);
420 ICACHE
virtual uint64 GetErrorEx(
bool abResolveExternal =
false);
422 ICACHE
virtual real64 GetPosError()
425 virtual bool IsErrorFatal();
427 virtual uint32 GetWarning(
bool abResolveExternal =
false);
429 virtual uint64 GetWarningEx(
bool abResolveExternal =
false);
431 virtual void AcceptError(uint64 auError=0xffffffffffffffffLL);
433 virtual void AcceptWarning(uint64 auWarning=0xffffffffffffffffLL);
436 virtual bool Sync(real64 arPosition);
438 ICACHE
virtual void AbortSync();
440 virtual bool GetZeroImpuls();
442 virtual void GetSyncPos(real64& arSyncPos)
443 { arSyncPos = m_rSyncPos;};
445 virtual void SetSyncPos(real64 arSyncPos);
447 virtual void GetSyncCnt(uint32& auSyncCnt)
448 { auSyncCnt = m_uSyncCnt;};
450 virtual void SetSyncCnt(uint32 auSyncCnt)
451 { m_uSyncCnt = auSyncCnt;};
453 virtual void GetSyncCor(real64& arSyncCor)
454 { arSyncCor = m_rSyncCor;};
456 virtual void SetNormPos(real64 arNormPos);
458 void SetPathS(real64 arSpath)
459 { m_rSpath = arSpath; };
466 ICACHE
virtual void SetAxisEnable(
bool abEnable);
468 ICACHE
virtual bool GetAxisEnable();
470 ICACHE
virtual bool GetAxisEnabled();
472 ICACHE
virtual bool GetAxisReady();
474 ICACHE
virtual void SetSyncEnable(
bool abEnable);
476 ICACHE
virtual bool GetSyncEnabled();
478 ICACHE
virtual void ResetSync();
480 ICACHE
virtual void ResetEnabled();
482 ICACHE
virtual void SetControlOut(real64 arControl);
484 ICACHE
virtual void SetSerrorOut(real64 arError);
486 virtual bool GetAutoComRequested();
488 virtual void OnActivated(){};
490 virtual void OnInActivated(){};
493 virtual void BorderRelaxStart();
495 virtual void BorderRelaxStop();
498 ICACHE
virtual void SetCoupled(
bool abCoupled);
500 ICACHE
virtual bool GetCoupled();
503 virtual bool SafeSyncEnable();
505 virtual void SafeSyncDisable();
507 virtual bool SafeSyncCheck()
512 virtual bool SafeSyncAvailable()
518 virtual void GetCycleTime(real64& arCycleTime,
bool abOversampled=
false);
520 virtual void SetCycleTime(real64 arCycleTime);
522 virtual uint8 GetOversampling()
523 {
return m_uOversampling;};
525 virtual uint16 GetCycleNumber();
527 virtual uint16 GetCycleId();
529 virtual uint8 GetBusId();
531 virtual void SetDeadTime(real64 arDeadTime);
533 virtual void GetDeadTime(real64& arDeadTime);
544 virtual bool IsOnline()
const;
553 virtual CINCOObject* GetRegister();
556 virtual uint32 GetMcRobotBaseCode()
557 {
return ER_INOS_BASE_CONTROL_MCROBOT_ERROR_BASE; };
559 const char* GetAxisName()
const
567 #ifdef INOS_SAFETY_SUPPORT
570 virtual bool MoveMicro();
579 virtual bool IsMoveMicroSupported(
bool abVerbose =
false);
590 friend class CINCODelayToHalt;
591 friend class CINCODeadTimeMs;
592 friend class CINCOactSEx;
593 friend class CINCOlifeS;
594 friend void _INI_0400_CINOSBaseControl();
598 virtual void Reset();
601 virtual void Control();
603 virtual void Activating() {};
605 virtual void InActivating() {};
607 void iCalcDeadTime();
610 {
return m_rSyncCor;};
612 int64 iCalcSinc(real64 arPosition);
614 ICACHE real64 iCalcSact(int64 aiPosition);
616 ICACHE real64 iCalcSactEx(int64 aiPositionEx);
618 ICACHE
void iCalcSerr();
620 bool HasExtendedErrorWarning();
622 ICACHE uint32 iGetError()
623 {
return (uint32) m_uError; };
625 ICACHE uint32 iGetWarning()
626 {
return (uint32) m_uWarning; };
628 void iRegisterTrqCurrent();
630 virtual void UpdateCycleId(uint16 auCycleId);
632 void SetMaxVelocity(real64 arVmax)
633 {
if (arVmax > REAL64(0.0)) m_rVmax_1 = REAL64(1.0)/arVmax;
else m_rVmax_1 = REAL64(0.0);}
639 virtual const char* GetStateText();
661 CINCOObject* m_pRegister;
663 CINCOObject* m_pError;
665 CINCOObject* m_pWarning;
667 CINCOObject* m_pFlag;
673 CINCOObject* m_pLife;
679 CINCOObject* m_pMisc;
685 uint32* m_pPosConfig;
687 uint32* m_pPosOffline;
689 int32* m_pPosPosition;
691 int32* m_pPosPositionEx;
699 uint8 m_uBusCategory{};
771 real64 m_rCycleTimeMs;
775 real64 m_rDeadTimeMs;
777 real64 m_rDelayToHalt;
781 uint8 m_uOversampling;
803 real64 m_rSactExOffset;
809 real64 m_rVactFiltered;
827 real64 m_rVerrFiltered;
842 real64 m_rSerrMaxPos;
844 real64 m_rSerrMinPos;
846 real64 m_rSerrMaxNeg;
848 real64 m_rSerrMinNeg;
877 real64 m_rPositionFract;
889 uint16 m_uSarraySize;
891 uint16 m_uSarrayIndex;
893 uint32 m_uCharacteristics;
895 uint32 m_uDelayToHalt;
897 int32 m_iDelayToHalt;
913 static char m_cStateCombo[494];
930 CINOSOscillationDetector* m_pOsciChk;
933 uint32* m_pDiEnable =
nullptr;
934 uint32 m_uDiEnableMask = 0;
935 inosName64 m_cDiEnable{};
938 #ifdef INOS_SAFETY_SUPPORT
943 bool m_bMicroMoveParamsValid =
false;
945 bool m_bMicroMoveReturning =
false;
947 real64 m_rMicroMoveDistance = 0;
960#define INOS_BASECONTROL_UPDATE_CMD_BUFFER()\
961 if (nullptr != m_pCmdBuf) {\
962 m_uCmdWrt = (m_uCmdWrt + 1) & m_uCmdMsk;\
963 m_pCmdBuf[m_uCmdWrt].m_rS = apData->m_rS;\
964 m_pCmdBuf[m_uCmdWrt].m_rV = apData->m_rV;\
965 m_pCmdBuf[m_uCmdWrt].m_rA = apData->m_rA;\
966 m_pCmdBuf[m_uCmdWrt].m_rJ = apData->m_rJ;\
978 friend void _INI_0000_CINOSBaseControl();
989 TCreateControl m_pCreate;
991 const char* m_pControlType;
998 const char* apControlType);
1002 const char* apControlType);
CINOSJerkRamp declaration file.
#define DECLARE_DYNAMIC(aClass)
Definition cinospartitionmemory.h:328
Definition cinosadcchannel.h:53
Definition cinosbasecontrol.h:319
uint32 m_uMaskCfgSynced
synced mask
Definition cinosbasecontrol.h:765
virtual void GetActVelocity(real64 &arVelocity, bool abFiltered=false)
get actual position fast
CINOSBit * m_pOutActivate
pointer to activate output
Definition cinosbasecontrol.h:705
real64 m_rOutSerrorRawGain
serror raw gain
Definition cinosbasecontrol.h:751
CINOSBit * m_pInpActivated
pointer to activated input
Definition cinosbasecontrol.h:722
CINOSDacChannel * m_pOutTrqCurrent
pointer to trqcurrent output
Definition cinosbasecontrol.h:753
CINOSBit * m_pInpSynced
pointer to synced input
Definition cinosbasecontrol.h:732
uint32 m_uMaskCfgWarning
warning mask
Definition cinosbasecontrol.h:763
CINOSBit * m_pOutCurLimit
pointer to currentlimit bit
Definition cinosbasecontrol.h:711
CINOSBit * m_pInpWarning
pointer to warning input
Definition cinosbasecontrol.h:726
CINOSBit * m_pOutCurAdd
pointer to current add bit
Definition cinosbasecontrol.h:713
CINOSBit * m_pOutCurCmd
pointer to current cmd bit
Definition cinosbasecontrol.h:715
void SetLifetimeDistance(real64 arDistance)
set lifetime distance (only used at startup by either mcrobot or user code)
CINOSDacChannel * m_pOutSpeed
pointer to speed output
Definition cinosbasecontrol.h:741
CINOSBit * m_pOutSyncEnbEx
pointer to extended sync enable output
Definition cinosbasecontrol.h:709
void SetAxisEnableInput(const char *apInputName)
set name of axis enable input
int64 m_iLifetimeDistance
lifetime distance in inc
Definition cinosbasecontrol.h:819
CINOSBit * m_pOutPosRelax
pointer to pos relax (used at border)
Definition cinosbasecontrol.h:717
CINOSBit * m_pInpSync
pointer to sync input
Definition cinosbasecontrol.h:736
void GetLifetimeDistance(real64 &arDistance)
get current lifetime distance
real64 m_rOutSpeedRawGain
speed raw gain
Definition cinosbasecontrol.h:745
uint32 m_uMaskCfgError
error mask
Definition cinosbasecontrol.h:761
virtual uint32 Connect()
Connect control to hardware.
CINOSBit * m_pInpUccOk
pointer to ucc ok input
Definition cinosbasecontrol.h:738
CINOSBit * m_pInpAutoCom
pointer to autocom input
Definition cinosbasecontrol.h:724
CINOSDacChannel * m_pOutSerror
pointer to error output
Definition cinosbasecontrol.h:747
CINOSBit * m_pInpSyncDeltaOk
pointer to syncdeltaok input
Definition cinosbasecontrol.h:734
void * m_pOutSerrorRaw
pointer to error output
Definition cinosbasecontrol.h:749
CINOSBit * m_pInpError
pointer to error input
Definition cinosbasecontrol.h:728
CINOSBit * m_pInpFatalError
pointer to fatal error input
Definition cinosbasecontrol.h:730
CINOSBit * m_pOutSyncEnb
pointer to sync enable output
Definition cinosbasecontrol.h:707
CINOSAdcChannel * m_pInpTrqCurrent
pointer to trqcurrent input
Definition cinosbasecontrol.h:756
bool iSetAxisEnableInput()
set name of axis enable input
void GetAxisEnableInput(char *apResult, uint32 auSize) const
get name of axis enable input
CINOSBit * m_pOutCoupled
pointer to coupled
Definition cinosbasecontrol.h:719
void * m_pOutSpeedRaw
pointer to speed output
Definition cinosbasecontrol.h:743
Definition cinosbaseramp.h:752
Definition cinosbus.h:600
Definition cinosdacchannel.h:52
definition of the CINOSJerkRamp class
Definition cinosjerkramp.h:72
Provides physical aka real axis functionality.
Definition cinosphysicalaxis.h:286
Definition cinosposchannel.h:59
Definition cinosbasecontrol.h:976
#define INOS_INLINE
Definition inosdefine.h:60
#define INOS_OR(variable, mask)
Definition inosmacro.h:201
#define INOS_AND(variable, mask)
Definition inosmacro.h:210
Descriptor structure used to configure a controller. It is usually defined in a corresponding xxx....
Definition cinosbasecontrol.h:197
real64 m_rCycleTime
Axis cycletime the controller generator should work with [ms]. Do not configure this value in modern ...
Definition cinosbasecontrol.h:228
uint8 m_uOversampling
Requested oversampling, e.g. axis sampling rate is 96kHz and fieldbus cycle time 16kHz -> oversamplin...
Definition cinosbasecontrol.h:290
inosName m_cUnit
Axis unit, e.g. m, mm, deg, ... The string has no special meaning and is just for displaying purposes...
Definition cinosbasecontrol.h:221
real64 m_rSmaxRun
factor to calculate max. allowed position error at move maxSerr = m_rSmax*(1.0 + m_rSmaxRun*(V/Vmax))
Definition cinosbasecontrol.h:245
inosName64 m_cPosName
Position channel name. If working with Indel motor controllers this name is equal to the axis name.
Definition cinosbasecontrol.h:205
real64 m_rSmax
Max. allowed position check error [unit].
Definition cinosbasecontrol.h:240
real64 m_rMicroMoveTime
Duration used for a 'micromove' in milliseconds (one-way, e.g. moving there and back again takes twic...
Definition cinosbasecontrol.h:300
uint8 m_uVfilter
Size of requested speed filter.
Definition cinosbasecontrol.h:285
real64 m_rPosExUnitsPerInc
Units per increment factor for a possible extended position channel.
Definition cinosbasecontrol.h:253
real64 m_rDelayToHalt
Delay [ms] before the controller should switch from run to halt parameters.
Definition cinosbasecontrol.h:249
real64 m_rDeadTime
Controller dead time [ms]. is calculated incrementally to the fieldbus delays if option DF_INOS_BASE_...
Definition cinosbasecontrol.h:236
inosName64 m_cEnbName
Optional enable input channel name. This parameter can be used to define the name of a digital input,...
Definition cinosbasecontrol.h:216
uint8 m_uDigits
Number of digits to use in INCO explorer. This parameter has no functional meaning and has just displ...
Definition cinosbasecontrol.h:281
inosName64 m_cDacName
Optional dac channel name. This parameter is only used if one uses a stone aged analog interface to a...
Definition cinosbasecontrol.h:210
inosName64 m_cName
Axis name.
Definition cinosbasecontrol.h:200
uint32 m_uOptions
Controller options, see DF_INOS_BASE_CONTROL_OPT_DEAD_INC, DF_INOS_BASE_CONTROL_OPT_POS_OVRS,...
Definition cinosbasecontrol.h:276
extended ramp data
Definition cinosbaseramp.h:617
ramp data
Definition cinosbaseramp.h:602