INOS
cinosbasecontrol.h
Go to the documentation of this file.
1 //******************************************************************************
27 //******************************************************************************
28 
29 #ifndef INC_CINOSBASECONTROL_H
30 #define INC_CINOSBASECONTROL_H
31 
32 //------------------------------------------------------------------------------
33 // defines
34 //------------------------------------------------------------------------------
35 //
36 #define DF_INOS_BASE_CONTROL_DBT "INOS-BASE-CONTROL"// db table name
37 //
38 // --- controller states -------------------------------------------------------
39 //
40 #define DF_INOS_CONTROL_STATE_PEACE 0 // peace
41 #define DF_INOS_CONTROL_STATE_ACTIVATING 1 // activating
42 #define DF_INOS_CONTROL_STATE_ACTIVE 2 // active
43 #define DF_INOS_CONTROL_STATE_INACTIVATING 3 // inactivating
44 //
45 // --- controller sub states ---------------------------------------------------
46 //
47 // sub states for state ACTIVE
48 #define DF_INOS_CONTROL_SUBSTATE_ACTIVE_HALT 0 // active halt
49 #define DF_INOS_CONTROL_SUBSTATE_ACTIVE_RUN 1 // active run
50 #define DF_INOS_CONTROL_SUBSTATE_ACTIVE_UMOVE 2 // active micro move (used by safety)
51 //
52 // --- controller errors -------------------------------------------------------
53 //
54 // Base mcrobot error number 0x4003Nxxx
55 //
56 #define ER_INOS_BASE_CONTROL_MCROBOT_ERROR_BASE 0x00000000 // sac like controllers
57 #define ER_INOS_GSB_CONTROL_MCROBOT_ERROR_BASE 0x40031300 // gsb like controllers
58 #define ER_INOS_SL2_CONTROL_MCROBOT_ERROR_BASE 0x40032300 // sl2 like controllers
59 #define ER_INOS_HSSI_CONTROL_MCROBOT_ERROR_BASE 0x40033300 // hssi like controllers
60 //
61 #define ER_INOS_CONTROL_POSCHK 0x00000001 // controller pos check error
62 #define ER_INOS_CONTROL_POSOVR 0x00000002 // pos channel overrun detected
63 #define ER_INOS_CONTROL_OSCICHK 0x00000004 // oscillation detected
64 #define ER_INOS_CONTROL_ENBMISSING 0x00000008 // enable missing
65 #define ER_INOS_CONTROL_HOMEFAILED 0x00000010 // homing failed
66 #define ER_INOS_CONTROL_SAFE_SYNCFAILED 0x00000020 // safe sync failed
67 #define ER_INOS_CONTROL_WATCHDOG 0x00000040 // fieldbus watchdog detected
68 #define ER_INOS_CONTROL_POWER_FAILURE 0x00000080// Power failure
69 #define ER_INOS_CONTROL_POSCHN 0x00001000 // no pos channel available
70 #define ER_INOS_CONTROL_ACTIVATE 0x00002000 // activation error
71 #define ER_INOS_CONTROL_EXTERN 0x00004000 // external controller error
72 #define ER_INOS_CONTROL_OFFLINE 0x00008000 // pos channel offline
73 //
74 // --- controller warnings -----------------------------------------------------
75 //
76 #define WR_INOS_CONTROL_INTLIMIT 0x00000001 // integrator limit reached
77 #define WR_INOS_CONTROL_FSLIMIT 0x00000002 // full scale limit reached
78 #define WR_INOS_CONTROL_EXTERN 0x00004000 // external controller warning
79 //
80 // --- controller flags --------------------------------------------------------
81 //
82 #define DF_INOS_BASE_CONTROL_FLAG_CHK_POS 0x00000001 // check position error
83 #define DF_INOS_BASE_CONTROL_FLAG_SIM_POS 0x00000002 // simulate actual position
84 #define DF_INOS_BASE_CONTROL_FLAG_SIM_OUT 0x00000004 // simulate output
85 #define DF_INOS_BASE_CONTROL_FLAG_SIM_ACT 0x00000008 // simulate activate
86 #define DF_INOS_BASE_CONTROL_FLAG_ENB_NRD 0x00000010 // enable noise reduction
87 #define DF_INOS_BASE_CONTROL_FLAG_DEAD_INC 0x00000020 // Add dead time caused by the "fieldbus delays" (cycletime + fieldbustime + residual). Resulting Deadtime = DeadTime (from dt2 file) + "fieldbus delays"
88 #define DF_INOS_BASE_CONTROL_FLAG_ENB_SYN 0x00000040 // enable sync
89 #define DF_INOS_BASE_CONTROL_FLAG_ENB_NRM 0x00000080 // enable norm
90 #define DF_INOS_BASE_CONTROL_FLAG_POS_OVRS 0x00000100 // poschannel overrun supervision
91 #define DF_INOS_BASE_CONTROL_FLAG_FFV_100 0x00000200 // feed forward V 100% based
92 #define DF_INOS_BASE_CONTROL_FLAG_NO_PID 0x00000400 // No pid calculation. Implicitly '1' if "feed forward V 100%"=1 and "Without master position error"=0
93 #define DF_INOS_BASE_CONTROL_FLAG_POS_ABS 0x00000800 // position channel contains absolute encoder positions, e.g. used during axis init
94 #define DF_INOS_BASE_CONTROL_FLAG_NO_MPE 0x00001000 // Without master position error: do not send master position (maspos) error to controller
95 #define DF_INOS_BASE_CONTROL_FLAG_POSEX 0x00002000 // Support 2nd position channel (PositionEx). Usually enabled if a 2nd position measurment system is available
96 #define DF_INOS_BASE_CONTROL_FLAG_INIT_V_ADJ_DIS 0x00004000 // Do not adjust axis init speed even if "feed forward V 100% based" is disabled.
97 #define DF_INOS_BASE_CONTROL_FLAG_DEAD_INC2 0x00008000 // Add dead time caused by the "fieldbus delays" by another formula (0.5*cycletime + fieldbustime + residual). Resulting Deadtime = DeadTime (from dt2 file) + "fieldbus delays"
98 #define DF_INOS_BASE_CONTROL_FLAG_LIFETIME 0x00010000 // lifetime distance support
99 #define DF_INOS_BASE_CONTROL_FLAG_NRM_POS 0x00020000 // norm to only positive values
100 #define DF_INOS_BASE_CONTROL_FLAG_DISTANCE_CODED_CALIB 0x00040000 // supports distance coded calib
101 #define DF_INOS_BASE_CONTROL_FLAG_INC_FRACT 0x00080000 // fractional increments support
102 #define DF_INOS_BASE_CONTROL_FLAG_POWER 0x00100000 // power failure supervision
103 // 0x01000000 // RESERVED for subclasses
104 // 0x02000000 // RESERVED for subclasses
105 // 0x04000000 // RESERVED for subclasses
106 // 0x08000000 // RESERVED for subclasses
107 #define DF_INOS_BASE_CONTROL_FLAG_ENB_SAFE_SYNC 0x40000000 // temporarly enabled safe sync
108 #define DF_INOS_BASE_CONTROL_FLAG_DIS_SERR 0x80000000 // temporarly disable Serr calculation
109 //
110 // --- controller options ------------------------------------------------------
111 //
115 #define DF_INOS_BASE_CONTROL_OPT_DEAD_INC 0x00000001
116 
118 #define DF_INOS_BASE_CONTROL_OPT_POS_OVRS 0x00000002
119 
122 #define DF_INOS_BASE_CONTROL_OPT_FFV_100 0x00000004
123 
126 #define DF_INOS_BASE_CONTROL_OPT_NO_PID 0x00000008
127 
129 #define DF_INOS_BASE_CONTROL_OPT_POS_ABS 0x00000010
130 
134 #define DF_INOS_BASE_CONTROL_OPT_NO_MPE 0x00000020
135 
138 #define DF_INOS_BASE_CONTROL_OPT_POSEX 0x00000040
139 
142 #define DF_INOS_BASE_CONTROL_OPT_INIT_V_ADJ_DIS 0x00000080
143 
146 #define DF_INOS_BASE_CONTROL_OPT_DEAD_INC2 0x00000100
147 
151 #define DF_INOS_BASE_CONTROL_OPT_DISTANCE_CODED_CALIB 0x00000200
152 
154 #define DF_INOS_BASE_CONTROL_OPT_CUSTOMER1_SYNC_INTERFACE 0x00000400
155 
159 #define DF_INOS_BASE_CONTROL_OPT_LIMIT_OUT 0x00000800
160 
164 #define DF_INOS_BASE_CONTROL_OPT_IGNORE_CYCLEID 0x00001000
165 
167 #define DF_INOS_BASE_CONTROL_OPT_INC_FRACT 0x00002000
168 
172 #define DF_INOS_BASE_CONTROL_OPT_EXT_POS_ERR 0x00004000
173 
175 #define DF_INOS_BASE_CONTROL_OPT_POWER_FAILURE 0x00008000
176 //
177 //------------------------------------------------------------------------------
178 // includes
179 //------------------------------------------------------------------------------
180 //
181 // system
182 #include <cinosprocessimage.h>
183 #include <inco_com.h>
184 //
185 // C++
186 //
187 // project
188 #ifdef INOS_SAFETY_SUPPORT
189 #include <cinosjerkramp.h>
190 #endif // INOS_SAFETY_SUPPORT
191 //
192 //------------------------------------------------------------------------------
193 //--- structures ---------------------------------------------------------------
194 //------------------------------------------------------------------------------
195 //
201 {
204  inosName64 m_cName;
205 
209  inosName64 m_cPosName;
210 
214  inosName64 m_cDacName;
215 
220  inosName64 m_cEnbName;
221 
226  inosName64 m_cPowerName;
227 
231  inosName m_cUnit;
232 
238  real64 m_rCycleTime;
239 
246  real64 m_rDeadTime;
247 
250  real64 m_rSmax;
251 
255  real64 m_rSmaxRun;
256 
260 
264 
266  real64 m_rSINOSBaseControl_Internal0[2];
268 
286  uint32 m_uOptions;
287 
291  uint8 m_uDigits;
292 
295  uint8 m_uVfilter;
296 
301 
303  uint8 m_rSINOSBaseControl_Internal1;
305 
311 
312  // constructor
314 };
315 //------------------------------------------------------------------------------
316 // forward declarations
317 //------------------------------------------------------------------------------
318 //
319 struct SINOSRampData;
320 struct SINOSRampDataEx;
321 class CINOSOscillationDetector;
322 
323 
324 //------------------------------------------------------------------------------
325 // class definition
326 //------------------------------------------------------------------------------
327 //
329 {
330  //--- user interface ---------------------------------------------------
331 
332  // public member functions
333  public :
334 
335  // constructor/destructor
336 
337  explicit CINOSBaseControl(SINOSBaseControl* apDesc);
338  //; constructor
339  virtual ~CINOSBaseControl();
340  //; destructor
341  static CINOSBaseControl* GetControl(const char* apAxisName,
342  const char* apControlType);
343  //; create controller and return pointer to it
344 
348  virtual uint32 Connect();
349 
350  // activate / inactivate
351 
352  virtual void Activate(bool abCheckPos = true, bool abSimulatePos = false,
353  bool abSimulateOut = false, bool abSimulateAct = false);
354  //; activate controller
355  virtual void InActivate();
356  //; inactivate controller
357 
358  // pull
359 
360  ICACHE virtual uint32 Pull(SINOSRampDataEx* apData);
361  //; follow apData
362  ICACHE virtual uint32 Pull(real64 arPosition, real64 arVelocity,
363  real64 arAcceleration, real64 arJerk);
364  //; follow arPosition with arVelocity and arAcceleration
365 
366  virtual void GetCmdPosition(real64& arPosition);
367  //; get commanded position
368  virtual void GetCmdVelocity(real64& arVelocity);
369  //; get commanded velocity
370  virtual void GetCmdAcceleration(real64& arAcceleration);
371  //; get commanded acceleration
372  virtual void GetCmdJerk(real64& arJerk);
373  //; get commanded jerk
374  ICACHE virtual void SetActPosition(real64 arPosition);
375  //; set actual position to arPosition
376  ICACHE virtual void AdjActPosition(real64 arPosition);
377  //; set actual position to arPosition
378  ICACHE virtual void GetActPosition(real64& arPosition);
379  //; get position
380  ICACHE virtual void GetActPositionEx(real64& arPosition);
381  //; get position ex
382  INOS_INLINE void GetActPositionFst(real64& arPosition)
383  { arPosition = m_rSact; };
385  virtual void GetActVelocity(real64& arVelocity, bool abFiltered = false);
386  //; get actual velocity
387  virtual void GetActAcceleration(real64& arAcceleration);
388  //; get actual acceleration
389  virtual void GetActJerk(real64& arJerk);
390  //; get actual jerk
391  virtual void GetActPosError(real64& arPosError);
392  //; get actual position error
393  virtual void GetActVelocityError(real64& arVelocityError, bool abFiltered = false);
394  //; get actual velocity error
395 
396  virtual uint32 GetParam(const char* apName, real64& arResult);
397  //; universal get parameter with apName to arResult and return error code
398  virtual volatile real64* GetParamAdr(const char* apName);
399  //; universal get address of parameter with aName or NULL if not found
400  virtual uint32 SetParam(const char* apName, real64 arValue);
401  //; universal set parameter with apName to arValue and return error code
402  virtual void SetIncsPerUnit(real64 arIncs);
403  //; set number of incs per unit
404  virtual void SetUnitsPerInc(real64 arUnits);
405  //; set number of units per inc
406  virtual void OnGearRatioChanged(){};
407  //; called whenever the axis gear ratio has changed, it gives the controller
408  //; the chance to recalculate internal values if necessary
409 
410  void SetFlag(uint32 auFlag)
411  { INOS_OR(m_uFlag, auFlag);};
412  //; set controller flags
413  void ClrFlag(uint32 auFlag)
414  { INOS_AND(m_uFlag, ~auFlag);};
415  //; clear controller flags
416  uint32 GetFlag() const
417  { return m_uFlag;};
418  //; get controller flags
419  const char* GetType()
420  { return m_pType; };
421  //; get controller state
422  ICACHE virtual uint32 GetState();
423  //; get controller state
424  ICACHE virtual uint32 GetState(uint32& auSubState);
425  //; get controller state and sub state
426  virtual uint32 SetError(uint32 auError);
427  //; set controller error and return old ones
428  ICACHE virtual uint32 GetError(bool abResolveExternal = false);
429  //; get controller error
430  ICACHE virtual uint64 GetErrorEx(bool abResolveExternal = false);
431  //; get extended controller error
432  ICACHE virtual real64 GetPosError()
433  { return m_rSerr; }
434  //; get controller error
435  virtual bool IsErrorFatal();
436  //; return true if error is fatal
437  virtual uint32 GetWarning(bool abResolveExternal = false);
438  //; get controller warning
439  virtual uint64 GetWarningEx(bool abResolveExternal = false);
440  //; get extended controller warning
441  virtual void AcceptError(uint64 auError=0xffffffffffffffffLL);
442  //; accept controller error (auError=0xffffffff -> accept all errors)
443  virtual void AcceptWarning(uint64 auWarning=0xffffffffffffffffLL);
444  //; accept controller warning (auWarning=0xffffffff -> accept all warnings)
445 
446  virtual bool Sync(real64 arPosition);
447  //; enable sync mechanism and set pos to arPosition on sync
448  ICACHE virtual void AbortSync();
449  //; abort sync mechanism
450  virtual bool GetZeroImpuls();
451  //; return state of 'zero impuls' input
452  virtual void GetSyncPos(real64& arSyncPos)
453  { arSyncPos = m_rSyncPos;};
454  //; return actual sync pos
455  virtual void SetSyncPos(real64 arSyncPos);
456  //; set sync pos
457  virtual void GetSyncCnt(uint32& auSyncCnt)
458  { auSyncCnt = m_uSyncCnt;};
459  //; return actual sync counter
460  virtual void SetSyncCnt(uint32 auSyncCnt)
461  { m_uSyncCnt = auSyncCnt;};
462  //; set sync pos
463  virtual void GetSyncCor(real64& arSyncCor)
464  { arSyncCor = m_rSyncCor;};
465  //; return actual sync counter
466  virtual void SetNormPos(real64 arNormPos);
467  //; set norm pos
468  void SetPathS(real64 arSpath)
469  { m_rSpath = arSpath; };
470 
472  void SetLifetimeDistance(real64 arDistance);
474  void GetLifetimeDistance(real64& arDistance);
475 
476  ICACHE virtual void SetAxisEnable(bool abEnable);
477  //; enable/disable axis
478  ICACHE virtual bool GetAxisEnable();
479  //; get axis enable state
480  ICACHE virtual bool GetAxisEnabled();
481  //; get axis enabled state
482  ICACHE virtual bool GetAxisReady();
483  //; get axis ready state
484  ICACHE virtual void SetSyncEnable(bool abEnable);
485  //; enable/disable sync
486  ICACHE virtual bool GetSyncEnabled();
487  //; get sync enabled state
488  ICACHE virtual void ResetSync();
489  //; disable sync/synced
490  ICACHE virtual void ResetEnabled();
491  //; disable enabled
492  ICACHE virtual void SetControlOut(real64 arControl);
493  //; set control output
494  ICACHE virtual void SetSerrorOut(real64 arError);
495  //; set error output
496  virtual bool GetAutoComRequested();
497  //; return true if autocommutation requested
498  virtual void OnActivated(){};
499  //; called at activating -> active
500  virtual void OnInActivated(){};
501  //; called at active -> activating -> activated
502 
503  virtual void BorderRelaxStart();
504  //; inform controller about a touched border
505  virtual void BorderRelaxStop();
506  //; inform controller about border relax time has expired
507 
508  ICACHE virtual void SetCoupled(bool abCoupled);
509  //; set coupled
510  ICACHE virtual bool GetCoupled();
511  //; get coupled
512 
513  virtual bool SafeSyncEnable();
514  //; enable safe syncing mechanism and return true if available
515  virtual void SafeSyncDisable();
516  //; disable safe syncing mechanism
517  virtual bool SafeSyncCheck()
518  //; return true if safe sync was successful
519  {
520  return (m_pInpSyncDeltaOk && m_pInpSyncDeltaOk->Test());
521  }
522  virtual bool SafeSyncAvailable()
523  //; return true if safe sync is available
524  {
525  return (nullptr != m_pInpSyncDeltaOk);
526  }
527 
528  virtual void GetCycleTime(real64& arCycleTime, bool abOversampled=false);
529  //; get controller cycle time [sec]
530  virtual void SetCycleTime(real64 arCycleTime);
531  //; set controller cycle time [sec]
532  virtual uint8 GetOversampling()
533  { return m_uOversampling;};
534  //; get controller oversampling factor
535  virtual uint16 GetCycleNumber();
536  //; get controller cycle number
537  virtual uint16 GetCycleId();
538  //; get controller cycle id
539  virtual uint8 GetBusId();
540  //; get controller bus id
541  virtual void SetDeadTime(real64 arDeadTime);
542  //; set dead time [sec]
543  virtual void GetDeadTime(real64& arDeadTime);
544  //; set dead time [sec]
545 
546  virtual CINOSPosChannel* GetPosChannel();
547  //; return pointer to my pos channel or NULL if not yet available
548  virtual CINOSBit* GetOutActivate()
549  //; return pointer to my activation output (if available)
550  { return m_pOutActivate;}
551  virtual CINOSBit* GetPowerReady()
552  //; return pointer to my Ucc input (if available)
553  { return m_pInpUccOk;}
554  virtual bool IsOnline() const;
555  //; \return true if the poschannel is online. false otherwise. The
556  //; poschannel is online, when the poschannel's slave is physically
557  //; connected to the master.
558  //; \note So far, once a poschannel was online, it'll always be
559  //; online (due to the fact that the poschannel will not be deleted
560  //; when its slave is being disconnected from the bus). This
561  //; behaviour may change in the future.
562 
563  virtual CINCOObject* GetRegister();
564  //; do inco registration and return pointer to it
565 
566  virtual uint32 GetMcRobotBaseCode()
567  { return ER_INOS_BASE_CONTROL_MCROBOT_ERROR_BASE; };
568 
569  const char* GetAxisName() const
570  { return m_pDesc->m_cName; }
571 
573  void SetAxisEnableInput(const char* apInputName);
575  void GetAxisEnableInput(char* apResult, uint32 auSize) const;
576 
578  void SetAxisPowerInput(const char* apInputName);
580  void GetAxisPowerInput(char* apResult, uint32 auSize) const;
581 
582  #ifdef INOS_SAFETY_SUPPORT
583  // safety related
584 
585  virtual bool MoveMicro();
586  //; initiate a micro move used to prevent a sincoshalt safety error
587  //; \return true if the move was successfully initiated
588 
589  virtual bool CalcMoveMicroParams(CINOSBaseRamp* apRamp);
590  //; (pre-)calculates parameters related to micro moves
591  //; based on the current safety configuration
592  //; \return true if all parameters successfully calculated
593 
594  virtual bool IsMoveMicroSupported(bool abVerbose = false);
595  //; checks whether micro moves are supported with the current
596  //; system configuration
597  //; \param abVerbose flag indicating if additional info
598  //; should be traced if micro moves not supported
599 
600  #endif // INOS_SAFETY_SUPPORT
601 
602  //--- internals --------------------------------------------------------
603 
604  friend class CINOSPhysicalAxis;
605  friend class CINCODelayToHalt;
606  friend class CINCODeadTimeMs;
607  friend class CINCOactSEx;
608  friend class CINCOlifeS;
609  friend void _INI_0400_CINOSBaseControl();
610 
611  // protected member functions
612  protected:
613  virtual void Reset();
614  //; reset controller values (called whenever the controller is
615  //; switched on)
616  virtual void Control();
617  //; do a control cycle
618  virtual void Activating() {};
619  //; called during activation
620  virtual void InActivating() {};
621  //; called during inactivation
622  void iCalcDeadTime();
623  //; calc m_rDeadTime from m_rDeadTimeMs
624  real64 GetSyncCor()
625  { return m_rSyncCor;};
626  //; return sync correction
627  int64 iCalcSinc(real64 arPosition);
628  //; calc inc's from pos
629  ICACHE real64 iCalcSact(int64 aiPosition);
630  //; calc pos from inc's
631  ICACHE real64 iCalcSactEx(int64 aiPositionEx);
632  //; calc pos ex from inc's
633  ICACHE void iCalcSerr();
634  //; calc pos from inc's
635  bool HasExtendedErrorWarning();
636  //; return true if external controller supports extended errors/warnings
637  ICACHE uint32 iGetError()
638  { return (uint32) m_uError; };
639  //; get controller error
640  ICACHE uint32 iGetWarning()
641  { return (uint32) m_uWarning; };
642  //; get controller warning
643  void iRegisterTrqCurrent();
644  //; register trq current
645  virtual void UpdateCycleId(uint16 auCycleId);
646  //; update cycle id the axis controller is running in
647  void SetMaxVelocity(real64 arVmax)
648  {if (arVmax > REAL64(0.0)) m_rVmax_1 = REAL64(1.0)/arVmax; else m_rVmax_1 = REAL64(0.0);}
650  bool iSetAxisEnableInput();
652  bool iSetAxisPowerInput();
653 
654  // public member methods but just for internal use
655  public :
656  virtual const char* GetStateText();
657  //; get pointer to actual state text
658 
659  // protected members
660  protected:
661  uint32 m_uState;
662  //; actual state
663  uint32 m_uSubState;
664  //; actual sub state
665  uint64 m_uError;
666  //; actual errors
667  uint64 m_uWarning;
668  //; actual warnings
669  uint32 m_uFlag;
670  //; actual flags
671  uint32 m_uFlagCpy;
672  //; copy of actual flags
673  bool m_bStartup;
674  //; startup flag
675 
676  // pointers
677 
678  CINCOObject* m_pRegister;
679  //; pointer to inco registration
680  CINCOObject* m_pError;
681  //; pointer to inco registration of errors
682  CINCOObject* m_pWarning;
683  //; pointer to inco registration of warnings
684  CINCOObject* m_pFlag;
685  //; pointer to inco registration of flags
686  CINCOObject* m_pCmd;
687  //; pointer to inco registration of commanded values
688  CINCOObject* m_pAct;
689  //; pointer to inco registration of actual values
690  CINCOObject* m_pLife;
691  //; pointer to inco registration of lifetime values
692  CINCOObject* m_pErr;
693  //; pointer to inco registration of error values
694  CINCOObject* m_pMax;
695  //; pointer to inco registration of max values
696  CINCOObject* m_pMisc;
697  //; pointer to inco registration of miscelanselous values
698  CINOSPosChannel* m_pPosChannel;
699  //; pointer to according pos channel
700  CINOSPosChannel* m_pPosChannelEx;
701  //; pointer to according pos channel ex
702  uint32* m_pPosConfig;
703  //; pointer to pos channel config
704  uint32* m_pPosOffline;
705  //; pointer to pos channel offline config
706  int32* m_pPosPosition;
707  //; pointer to pos channel position
708  int32* m_pPosPositionEx;
709  //; pointer to pos channel position ex
710  SINOSBaseControl* m_pDesc;
711  //; pointer to controller descriptor
712  const char* m_pType;
713  //; controller type
714  CINOSBus* m_pBus{};
715  //; pointer to the fieldbus that handles at least the pos channel
716  uint8 m_uBusCategory{};
717  //; fieldbus category of the pos channel
718 
719  // new style pointers
720 
737 
756 
771 
774 
775  // cfg masks
776 
783 
784  // cycle time
785 
786  real64 m_rCycleTime;
787  //; cycle time in s
788  real64 m_rCycleTimeMs;
789  //; cycle time in ms
790  real64 m_rDeadTime;
791  //; dead time in s
792  real64 m_rDeadTimeMs;
793  //; dead time in ms
794  real64 m_rDelayToHalt;
795  //; delay [ms] before switching from run to halt parameters
796  uint16 m_uCycleId;
797  //; cycle id
798  uint8 m_uOversampling;
799  //; oversampling
800 
801  // commanded values
802 
803  real64 m_rScmd;
804  //; commanded position
805  real64 m_rVcmd;
806  //; commanded velocity
807  real64 m_rAcmd;
808  //; commanded acceleration
809  real64 m_rJcmd;
810  //; commanded jerk
811  real64 m_rSpath;
812  //; original position (used together with movepath functionality)
813 
814  // actual values
815 
816  real64 m_rSact;
817  //; actual position
818  real64 m_rSactEx;
819  //; actual position ex
820  real64 m_rSactExOffset;
821  //; actual position ex offset
822  real64 m_rSactDiff;
823  //; actual position - actual position ex
824  real64 m_rVact;
825  //; actual velocity
826  real64 m_rVactFiltered;
827  //; actual filtered velocity
828  real64 m_rAact;
829  //; actual acceleration
830  real64 m_rJact;
831  //; actual jerk
832 
833  // lifetime values
834 
837 
838  // error values
839 
840  real64 m_rSerr;
841  //; actual position error
842  real64 m_rVerr;
843  //; actual velocity error
844  real64 m_rVerrFiltered;
845  //; actual filtered velocity error
846  real64 m_rSmax;
847  //; max. allowed position error
848  real64 m_rSmaxRun;
849  //; factor to calculate max. allowed position error at move
850  //; maxSerr = m_rSmax*(1.0 + m_rSmaxRun*(V/Vmax))
851  real64 m_rSmaxAct;
852  //; actual max. allowed position error
853  real64 m_rVmax_1;
854  //; 1.0/m_rVmax
855  real64 m_rSerrMax;
856  //; max. reached position error
857  real64 m_rSerrMin;
858  //; min. reached position error
859  real64 m_rSerrMaxPos;
860  //; max. reached position error in positive direction
861  real64 m_rSerrMinPos;
862  //; min. reached position error in positive direction
863  real64 m_rSerrMaxNeg;
864  //; max. reached position error in negative direction
865  real64 m_rSerrMinNeg;
866  //; min. reached position error in negative direction
867 
868  // extended position error calculation
869 
870  uint16 m_uCmdMsk{};
871  uint16 m_uCmdWrt{};
872  uint16 m_uCmdDdT{};
873  uint16 m_uCmdWait{};
874  real64 m_rCmdT{};
875  SINOSRampData* m_pCmdBuf{};
876 
877  // factors
878 
879  real64 m_rKnf_s;
880  //; factor : inc = pos * m_rKnf_s
881  real64 m_rKnf_1s;
882  //; factor : pos = inc * m_rKnf_1s
883  real64 m_rKnf_1sEx;
884  //; factor : posex = inc * m_rKnf_1sEx
885  real64 m_rKnf_1v;
886  //; factor : pos/s = inc/t * m_rKnf_1v
887  real64 m_rKnf_1vf;
888  //; factor : pos/s = inc/t * m_rKnf_1v / filter size
889  real64 m_rKnf_1a;
890  //; factor : pos/s^2 = inc/t^2 * m_rKnf_1a
891 
892  int64 m_iPosition;
893  //; internal 64 bit position
894  real64 m_rPositionFract;
895  //; internal fractional part of m_iPosition
896  int64 m_iPositionEx;
897  //; internal 64 bit positionex
898  int32 m_iOldS;
899  //; old S [inc]
900  int32 m_iOldSEx;
901  //; old S ex[inc]
902  int32 m_iOlderS;
903  //; older S [inc]
904  int32* m_pSarray;
905  //; pointer to S array (used for V filter
906  uint16 m_uSarraySize;
907  //; size of S array
908  uint16 m_uSarrayIndex;
909  //; index in S array
910  uint32 m_uCharacteristics;
911  //; inco registration characteristics
912  uint32 m_uDelayToHalt;
913  //; delay [ticks] before switching from run to halt parameters
914  int32 m_iDelayToHalt;
915  //; actual delay [ticks]
916 
917  // sync data
918  real64 m_rSyncPos;
919  //; requested sync position
920  real64 m_rSyncCor;
921  //; correction made at sync
922  uint32 m_uSyncCnt;
923  //; number of sync's made
924  int32 m_iSyncInc;
925  //; requested sync position [inc]
926  real64 m_rNormPos;
927  //; requested norm position
928  uint32 m_uNormInc;
929  //; norm incs
930  static char m_cStateCombo[494];
931  //; controller state INCO item text. Use 494 (=defMaxDataLength). I
932  //; fear to include inco_com.h here, that's why a plain number is
933  //; used)
934 
935  // extended error/warning handling
936 
937  enum {
938  eExtErWrUnknown,
939  eExtErWrNo,
940  eExtErWrYes
941  } m_eExtErWr;
942 
943  // local copy of sync enable
944  bool m_bSyncEnb;
945 
946  // oscillation checking
947  CINOSOscillationDetector* m_pOsciChk;
948 
949  // enable supervision
950  uint32* m_pDiEnable = nullptr;
951  uint32 m_uDiEnableMask = 0;
952  inosName64 m_cDiEnable{};
953 
954  // power failure supervision
955  uint32* m_pDiPower = nullptr;
956  uint32 m_uDiPowerMask = 0;
957  inosName64 m_cDiPower{};
958  uint32* m_pDiUccOk = nullptr;
959  uint32 m_uDiUccOkMask = 0;
960 
961  // safety
962  #ifdef INOS_SAFETY_SUPPORT
963 
964  // micromove related members
965  CINOSJerkRamp m_MicroMoveRamp {};
966  //; ramp used to pre-calculate micromoves
967  bool m_bMicroMoveParamsValid = false;
968  //; flag indicating if micromove params are valid
969  bool m_bMicroMoveReturning = false;
970  //; flag indicating if micromove is in the "move back" phase
971  real64 m_rMicroMoveDistance = 0;
972  //; relative distance (one-way) for micromoves [axis units]
973 
974  #endif // INOS_SAFETY_SUPPORT
975 
976  // allow dynamic object handling (new/delete)
978 };
979 
980 //------------------------------------------------------------------------------
981 // helper macros
982 //------------------------------------------------------------------------------
983 
984 #define INOS_BASECONTROL_UPDATE_CMD_BUFFER()\
985  if (nullptr != m_pCmdBuf) {\
986  m_uCmdWrt = (m_uCmdWrt + 1) & m_uCmdMsk;\
987  m_pCmdBuf[m_uCmdWrt].m_rS = apData->m_rS;\
988  m_pCmdBuf[m_uCmdWrt].m_rV = apData->m_rV;\
989  m_pCmdBuf[m_uCmdWrt].m_rA = apData->m_rA;\
990  m_pCmdBuf[m_uCmdWrt].m_rJ = apData->m_rJ;\
991  }\
992 
993 //------------------------------------------------------------------------------
994 // class registration
995 //------------------------------------------------------------------------------
996 
997 typedef CINOSBaseControl *(*TCreateControl)(const char* apAxisName);
998 
1000 {
1001  // after this function you can register new controllers
1002  friend void _INI_0000_CINOSBaseControl();
1003 
1004  //--- internals --------------------------------------------------------
1005 
1006  // private members
1007 private:
1008  // pointer to the first registered controller
1009  static CINOSRegisterBaseControl* m_pFirst;
1010  // pointer to the next controller
1011  CINOSRegisterBaseControl* m_pNext;
1012  // create funtion for the controller
1013  TCreateControl m_pCreate;
1014  // controller type name
1015  const char* m_pControlType;
1016 
1017  //--- user interface ---------------------------------------------------
1018 
1019 public:
1020  // register a new controller type
1021  CINOSRegisterBaseControl(TCreateControl apFunction,
1022  const char* apControlType);
1023 
1024  // create and return and new controller instance
1025  static CINOSBaseControl* GetControl(const char* apAxisName,
1026  const char* apControlType);
1027 };
1028 
1029 //------------------------------------------------------------------------------
1030 // end of file
1031 //------------------------------------------------------------------------------
1032 
1033 #endif // INC_CINOSBASECONTROL_H
CINOSBus
Definition: cinosbus.h:564
SINOSBaseControl::m_cName
inosName64 m_cName
Axis name.
Definition: cinosbasecontrol.h:204
CINOSBaseControl::m_pOutPosRelax
CINOSBit * m_pOutPosRelax
pointer to pos relax (used at border)
Definition: cinosbasecontrol.h:734
CINOSBaseControl
Definition: cinosbasecontrol.h:328
CINOSBaseControl::m_pOutSyncEnb
CINOSBit * m_pOutSyncEnb
pointer to sync enable output
Definition: cinosbasecontrol.h:724
CINOSBaseControl::m_pOutSerror
CINOSDacChannel * m_pOutSerror
pointer to error output
Definition: cinosbasecontrol.h:764
CINOSBaseControl::m_iLifetimeDistance
int64 m_iLifetimeDistance
lifetime distance in inc
Definition: cinosbasecontrol.h:836
CINOSBaseControl::iSetAxisEnableInput
bool iSetAxisEnableInput()
set name of axis enable input
CINOSBaseControl::m_pInpUccOk
CINOSBit * m_pInpUccOk
pointer to ucc ok input
Definition: cinosbasecontrol.h:755
CINOSBaseControl::m_pOutCoupled
CINOSBit * m_pOutCoupled
pointer to coupled
Definition: cinosbasecontrol.h:736
CINOSBaseControl::m_pOutSpeedRaw
void * m_pOutSpeedRaw
pointer to speed output
Definition: cinosbasecontrol.h:760
CINOSBaseControl::m_pInpSynced
CINOSBit * m_pInpSynced
pointer to synced input
Definition: cinosbasecontrol.h:749
SINOSBaseControl::m_uOversampling
uint8 m_uOversampling
Requested oversampling, e.g. axis sampling rate is 96kHz and fieldbus cycle time 16kHz -> oversamplin...
Definition: cinosbasecontrol.h:300
CINOSBaseControl::m_pOutTrqCurrent
CINOSDacChannel * m_pOutTrqCurrent
pointer to trqcurrent output
Definition: cinosbasecontrol.h:770
INOS_OR
#define INOS_OR(variable, mask)
Definition: inosmacro.h:201
CINOSBaseControl::SetAxisEnableInput
void SetAxisEnableInput(const char *apInputName)
set name of axis enable input
CINOSBit
Definition: cinosbit.h:53
SINOSBaseControl::m_rCycleTime
real64 m_rCycleTime
Axis cycletime the controller generator should work with [ms]. Do not configure this value in modern ...
Definition: cinosbasecontrol.h:238
SINOSRampData
ramp data
Definition: cinosbaseramp.h:601
cinosprocessimage.h
Short comment.
SINOSBaseControl::m_uDigits
uint8 m_uDigits
Number of digits to use in INCO explorer. This parameter has no functional meaning and has just displ...
Definition: cinosbasecontrol.h:291
CINOSBaseControl::m_pInpFatalError
CINOSBit * m_pInpFatalError
pointer to fatal error input
Definition: cinosbasecontrol.h:747
CINOSBaseControl::m_pInpAutoCom
CINOSBit * m_pInpAutoCom
pointer to autocom input
Definition: cinosbasecontrol.h:741
INOS_INLINE
#define INOS_INLINE
Definition: inosdefine.h:60
CINOSBaseControl::m_uMaskCfgError
uint32 m_uMaskCfgError
error mask
Definition: cinosbasecontrol.h:778
SINOSBaseControl::m_uVfilter
uint8 m_uVfilter
Size of requested speed filter.
Definition: cinosbasecontrol.h:295
CINOSBaseControl::SetLifetimeDistance
void SetLifetimeDistance(real64 arDistance)
set lifetime distance (only used at startup by either mcrobot or user code)
CINOSBaseControl::GetAxisPowerInput
void GetAxisPowerInput(char *apResult, uint32 auSize) const
get name of power input
CINOSPosChannel
Definition: cinosposchannel.h:58
CINOSBaseControl::iSetAxisPowerInput
bool iSetAxisPowerInput()
set name of axis ucc ok input
SINOSBaseControl::m_cPowerName
inosName64 m_cPowerName
Optional power input channel name. This parameter can be used to define the name of a digital input,...
Definition: cinosbasecontrol.h:226
CINOSBaseRamp
Definition: cinosbaseramp.h:751
CINOSAdcChannel
Definition: cinosadcchannel.h:52
CINOSBaseControl::Connect
virtual uint32 Connect()
Connect control to hardware.
SINOSBaseControl::m_rSmax
real64 m_rSmax
Max. allowed position check error [unit].
Definition: cinosbasecontrol.h:250
SINOSBaseControl::m_cDacName
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:214
CINOSBaseControl::GetAxisEnableInput
void GetAxisEnableInput(char *apResult, uint32 auSize) const
get name of axis enable input
CINOSRegisterBaseControl
Definition: cinosbasecontrol.h:999
CINOSBaseControl::m_pInpSyncDeltaOk
CINOSBit * m_pInpSyncDeltaOk
pointer to syncdeltaok input
Definition: cinosbasecontrol.h:751
SINOSRampDataEx
extended ramp data
Definition: cinosbaseramp.h:616
CINOSBaseControl::m_pInpError
CINOSBit * m_pInpError
pointer to error input
Definition: cinosbasecontrol.h:745
CINOSBaseControl::m_pOutCurAdd
CINOSBit * m_pOutCurAdd
pointer to current add bit
Definition: cinosbasecontrol.h:730
CINOSBaseControl::m_pOutCurCmd
CINOSBit * m_pOutCurCmd
pointer to current cmd bit
Definition: cinosbasecontrol.h:732
SINOSBaseControl::m_cPosName
inosName64 m_cPosName
Position channel name. If working with Indel motor controllers this name is equal to the axis name.
Definition: cinosbasecontrol.h:209
INOS_AND
#define INOS_AND(variable, mask)
Definition: inosmacro.h:210
CINOSBaseControl::SetAxisPowerInput
void SetAxisPowerInput(const char *apInputName)
set name of power input
CINOSBaseControl::m_pOutCurLimit
CINOSBit * m_pOutCurLimit
pointer to currentlimit bit
Definition: cinosbasecontrol.h:728
CINOSBaseControl::m_pInpSync
CINOSBit * m_pInpSync
pointer to sync input
Definition: cinosbasecontrol.h:753
CINOSBaseControl::m_rOutSerrorRawGain
real64 m_rOutSerrorRawGain
serror raw gain
Definition: cinosbasecontrol.h:768
CINOSBaseControl::m_pOutActivate
CINOSBit * m_pOutActivate
pointer to activate output
Definition: cinosbasecontrol.h:722
SINOSBaseControl::m_rSmaxRun
real64 m_rSmaxRun
factor to calculate max. allowed position error at move maxSerr = m_rSmax*(1.0 + m_rSmaxRun*(V/Vmax))
Definition: cinosbasecontrol.h:255
SINOSBaseControl::m_cUnit
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:231
cinosjerkramp.h
CINOSJerkRamp declaration file.
CINOSBaseControl::m_rOutSpeedRawGain
real64 m_rOutSpeedRawGain
speed raw gain
Definition: cinosbasecontrol.h:762
CINOSBaseControl::m_uMaskCfgWarning
uint32 m_uMaskCfgWarning
warning mask
Definition: cinosbasecontrol.h:780
CINOSPhysicalAxis
Provides physical aka real axis functionality.
Definition: cinosphysicalaxis.h:286
SINOSBaseControl::m_rMicroMoveTime
real64 m_rMicroMoveTime
Duration used for a 'micromove' in milliseconds (one-way, e.g. moving there and back again takes twic...
Definition: cinosbasecontrol.h:310
SINOSBaseControl::m_uOptions
uint32 m_uOptions
Controller options, see DF_INOS_BASE_CONTROL_OPT_DEAD_INC, DF_INOS_BASE_CONTROL_OPT_POS_OVRS,...
Definition: cinosbasecontrol.h:286
CINOSBaseControl::GetActVelocity
virtual void GetActVelocity(real64 &arVelocity, bool abFiltered=false)
get actual position fast
CINOSBaseControl::m_uMaskCfgSynced
uint32 m_uMaskCfgSynced
synced mask
Definition: cinosbasecontrol.h:782
CINOSBaseControl::m_pInpActivated
CINOSBit * m_pInpActivated
pointer to activated input
Definition: cinosbasecontrol.h:739
CINOSBaseControl::m_pInpWarning
CINOSBit * m_pInpWarning
pointer to warning input
Definition: cinosbasecontrol.h:743
SINOSBaseControl::m_rDeadTime
real64 m_rDeadTime
Controller dead time [ms]. is calculated incrementally to the fieldbus delays if option DF_INOS_BASE_...
Definition: cinosbasecontrol.h:246
SINOSBaseControl::m_rDelayToHalt
real64 m_rDelayToHalt
Delay [ms] before the controller should switch from run to halt parameters.
Definition: cinosbasecontrol.h:259
CINOSBaseControl::GetLifetimeDistance
void GetLifetimeDistance(real64 &arDistance)
get current lifetime distance
CINOSBaseControl::m_pOutSpeed
CINOSDacChannel * m_pOutSpeed
pointer to speed output
Definition: cinosbasecontrol.h:758
CINOSBaseControl::m_pInpTrqCurrent
CINOSAdcChannel * m_pInpTrqCurrent
pointer to trqcurrent input
Definition: cinosbasecontrol.h:773
DECLARE_DYNAMIC
#define DECLARE_DYNAMIC(aClass)
Definition: cinospartitionmemory.h:328
SINOSBaseControl
Descriptor structure used to configure a controller. It is usually defined in a corresponding xxx....
Definition: cinosbasecontrol.h:200
SINOSBaseControl::m_rPosExUnitsPerInc
real64 m_rPosExUnitsPerInc
Units per increment factor for a possible extended position channel.
Definition: cinosbasecontrol.h:263
CINOSJerkRamp
definition of the CINOSJerkRamp class
Definition: cinosjerkramp.h:71
SINOSBaseControl::m_cEnbName
inosName64 m_cEnbName
Optional enable input channel name. This parameter can be used to define the name of a digital input,...
Definition: cinosbasecontrol.h:220
CINOSDacChannel
Definition: cinosdacchannel.h:51
CINOSBaseControl::m_pOutSerrorRaw
void * m_pOutSerrorRaw
pointer to error output
Definition: cinosbasecontrol.h:766
CINOSBaseControl::m_pOutSyncEnbEx
CINOSBit * m_pOutSyncEnbEx
pointer to extended sync enable output
Definition: cinosbasecontrol.h:726