INOS
cinosbaseramp.h
Go to the documentation of this file.
1 //******************************************************************************
27 //******************************************************************************
28 
29 #ifndef INC_CINOSBASERAMP_H
30 #define INC_CINOSBASERAMP_H
31 
32 //------------------------------------------------------------------------------
33 // defines
34 //------------------------------------------------------------------------------
35 //
36 #define DF_INOS_BASE_RAMP_DBT "INOS-BASE-RAMP"// db table name
37 #define DF_INOS_BASE_RAMP_TRQ_LIMIT_ACC_DBT "INOS-BASE-RAMP-TRQ-LIMIT-ACC" // db table name
38 #define DF_INOS_BASE_RAMP_TRQ_LIMIT_DEC_DBT "INOS-BASE-RAMP-TRQ-LIMIT-DEC" // db table name
39 //
40 #define DF_INOS_RAMP_MAX_JERK 4 // max. number of supported jerks
41 //
42 // --- ramp states -------------------------------------------------------------
43 //
44 #define DF_INOS_RAMP_STATE_PEACE 0 // state 'peace'
45 #define DF_INOS_RAMP_STATE_BREAK 1 // state 'break'
46 #define DF_INOS_RAMP_STATE_RUNNING 2 // state 'running'
47 #define DF_INOS_RAMP_STATE_PULLING 3 // state 'pulling'
48 #define DF_INOS_RAMP_STATE_STOPPING 4 // state 'stopping'
49 //
50 // --- ramp errors -------------------------------------------------------------
51 //
52 #define ER_INOS_RAMP_POSRANGE 0x00000001 // position out of range
53 #define ER_INOS_RAMP_FAILED 0x00000002 // requested command failed
54 #define ER_INOS_RAMP_MIM_RANGE 0x00000004 // position out of range during mov in move
55 #define ER_INOS_RAMP_OVERSAMPLING 0x00000008 // number of samples was not a
56  // multiple of oversampling number
57 #define ER_INOS_RAMP_VMAX_REACHED 0x00000010 // allowed Vmax reached
58 #define ER_INOS_RAMP_MOVE_NOT_IN_CACHE 0x00000020 // trajectory was not in cache as expected
59 #define ER_INOS_RAMP_CORE_MISMATCH 0x00000040 // core mismatch
60 //
61 #define DF_INOS_RAMP_MAX_ERR 32 // max. number of errors
62 //
63 // --- ramp warnings -----------------------------------------------------------
64 //
65 #define WR_INOS_RAMP_MIM_DEC 0x00000001 // move in move during deceleration
66 #define WR_INOS_RAMP_CORE_MISMATCH 0x00000002 // core mismatch
67 //
68 // --- ramp flags --------------------------------------------------------------
69 //
70 #define DF_INOS_BASE_RAMP_FLAG_CHK_LIMITS 0x00000001 // check position limits
71 #define DF_INOS_BASE_RAMP_FLAG_ENB_BASE 0x00000002 // take base class geni
72 #define DF_INOS_BASE_RAMP_FLAG_ENB_TRQLIMIT 0x00000004 // enable torque limitation
73 #define DF_INOS_BASE_RAMP_FLAG_DIS_MIM 0x00000008 // disable 'move in move'
74 #define DF_INOS_BASE_RAMP_FLAG_LIMIT_MOVE 0x00000010 // limit move to min/max instead of range error
75 #define DF_INOS_BASE_RAMP_FLAG_DIS_MIM_DEC 0x00000020 // disable 'move in move' if axis is in deceleration already
76 #define DF_INOS_BASE_RAMP_FLAG_SET_CACHE_EPSILON 0x00000040 // set cache epsilon == ramp epsilon
77 #define DF_INOS_BASE_RAMP_FLAG_OPT_MIM 0x00000080 // enable optimized move in move handling
78 #define DF_INOS_BASE_RAMP_FLAG_CHK_LIMITS_IN_SEG 0x00000200 // check position limits within segments
79 #define DF_INOS_BASE_RAMP_FLAG_BACKLASH 0x00000400 // do backlash compensation
80 #define DF_INOS_BASE_RAMP_FLAG_FORCE_BACKLASH 0x00000800// do always a backlash move at target position
81 #define DF_INOS_BASE_RAMP_FLAG_IGNORE_LIMITS_AT_STOP 0x00001000// always ignore soft limits at stop
82 #define DF_INOS_BASE_RAMP_FLAG_LOOK_AHEAD 0x00002000 // enable look ahead (used e.g. for move in move on slow targets)
83 #define DF_INOS_BASE_RAMP_FLAG_CACHE_ONLY 0x00004000 // consume trajectory from ramp cache only. Reject move request with a failure in case of a cache miss
84 #define DF_INOS_BASE_RAMP_FLAG_IGNORE_VMAX 0x00008000 // ignore Vmax reached error (should only be used for testing purposes)
85 #define DF_INOS_BASE_RAMP_FLAG_IGNORE_JERK 0x00010000 // ignore cmdJ to speed up move calculation
86 #define DF_INOS_BASE_RAMP_FLAG_IGNORE_CORE 0x00020000 // ignore core mismatch failure (should only be used in desperate situations)
87 #define DF_INOS_BASE_RAMP_FLAG_NO_PULL_ADJ 0x00040000 // do not adjust pull positions
88 #define DF_INOS_BASE_RAMP_FLAG_OVRS_LAST 0x00800000 // restore last oversampled value
89 #define DF_INOS_BASE_RAMP_FLAG_SLOW_SPEED 0x01000000 // slowmotion is done with only speed reduction
90 #define DF_INOS_BASE_RAMP_FLAG_SHAPE_CALC 0x02000000 // internal flag used for shape calculation
91 #define DF_INOS_BASE_RAMP_FLAG_SETUPMODE 0x04000000 // setup mode active
92 #define DF_INOS_BASE_RAMP_FLAG_JOB_SLOW 0x08000000 // use job slowmotion in 'move in move'
93 #define DF_INOS_BASE_RAMP_FLAG_CACHE_FLUSH 0x10000000 // force a cache flush at next move
94 #define DF_INOS_BASE_RAMP_FLAG_CRS_PEACE 0x20000000 // geni requests peace during critical section
95 #define DF_INOS_BASE_RAMP_FLAG_CRS_ACTIVE 0x40000000 // critical section active
96 #define DF_INOS_BASE_RAMP_FLAG_ENABLED 0x80000000 // ramp geni is enabled
97 //
98 // no caching
99 #define DF_INOS_BASE_RAMP_FLAG_NO_CACHE (DF_INOS_BASE_RAMP_FLAG_SETUPMODE|DF_INOS_BASE_RAMP_FLAG_BACKLASH)
100 //
101 // --- cache critical flags (changing them -> cache flush) ---------------------
102 //
103 #define DF_INOS_BASE_RAMP_FLAG_CACHE_CRITICAL \
104  (DF_INOS_BASE_RAMP_FLAG_ENB_BASE | DF_INOS_BASE_RAMP_FLAG_ENB_TRQLIMIT | DF_INOS_BASE_RAMP_FLAG_CACHE_FLUSH)
105 //
106 // --- ramp options ------------------------------------------------------------
107 //
110 #define DF_INOS_BASE_RAMP_OPT_CHK_LIMITS 0x00000001
111 
114 #define DF_INOS_BASE_RAMP_OPT_ENB_BASE 0x00000002
115 
117 #define DF_INOS_BASE_RAMP_OPT_ENB_TRQLIMIT 0x00000004 // enable torque limitation
118 
120 #define DF_INOS_BASE_RAMP_OPT_DIS_MIM 0x00000008
121 
126 #define DF_INOS_BASE_RAMP_OPT_LIMIT_MOVE 0x00000010
127 
129 #define DF_INOS_BASE_RAMP_OPT_DIS_MIM_DEC 0x00000020
130 
133 #define DF_INOS_BASE_RAMP_OPT_OPT_MIM 0x00000080
134 
136 #define DF_INOS_BASE_RAMP_OPT_TRQ_LIMIT 0x00000100
137 
139 #define DF_INOS_BASE_RAMP_OPT_BACKLASH 0x00000400
140 
142 #define DF_INOS_BASE_RAMP_OPT_FORCE_BACKLASH 0x00000800
143 
145 #define DF_INOS_BASE_RAMP_OPT_IGNORE_LIMITS_AT_STOP 0x00001000
146 
152 #define DF_INOS_BASE_RAMP_OPT_LOOK_AHEAD 0x00002000
153 
155 #define DF_INOS_BASE_RAMP_OPT_IGNORE_VMAX 0x00008000
156 
159 #define DF_INOS_BASE_RAMP_OPT_IGNORE_CORE 0x00020000
160 
167 #define DF_INOS_BASE_RAMP_OPT_NO_PULL_ADJ 0x00040000
168 //
169 // --- ramp data flags ---------------------------------------------------------
170 //
171 #define DF_INOS_BASE_RAMP_DATA_FLAG_DEL 0x00000001 // structure has to be deleted
172 #define DF_INOS_BASE_RAMP_DATA_FLAG_LST 0x00000002 // last block in chain
173 //
174 // --- others ------------------------------------------------------------------
175 //
176 #define DF_INOS_RAMP_JERK_ALL 0xFFFFFFFF // jerk number for all jerks
177 #ifdef INOS_SLOWMOTION_ZERO_SUPPORT
178 #define DF_INOS_RAMP_MIN_SLOW REAL64(0.0000) // min. allowed slowmotion factor
179 #else
180 #define DF_INOS_RAMP_MIN_SLOW REAL64(0.0001) // min. allowed slowmotion factor
181 #endif
182 #define DF_INOS_RAMP_MAX_SLOW REAL64(2.0000) // max. allowed slowmotion factor
183 #define DF_INOS_RAMP_EPS_V_STOP REAL64(1.0e-6) // epsilon value used to determine when a velocity reaches zero during a stop
184 //
185 // --- max. velocity flags -----------------------------------------------------
186 //
187 enum {
188  eMaxVelocityNone = 0x00000000,
189  eMaxVelocityIgnoreSetup = 0x00000001,
190  eMaxVelocityIgnoreSLS = 0x00000002,
191 };
192 //
193 //------------------------------------------------------------------------------
194 // includes
195 //------------------------------------------------------------------------------
196 //
197 // system
198 #ifdef INOS_RAMP_DLL
199 #include <_inos.h>
200 #else
201 #include <inos.h>
202 #endif
203 #ifdef INOS_SAFETY_SUPPORT
204 #include <cinossafetyconfig.h>
205 #endif
206 //
207 // C++
208 //
209 // project
210 //
211 //------------------------------------------------------------------------------
212 //--- structures ---------------------------------------------------------------
213 //------------------------------------------------------------------------------
214 //
220 {
223  inosName64 m_cName;
224 
228  inosName m_cUnit;
229 
235  real64 m_rCycleTime;
236 
239  real64 m_rScmd;
240 
244  real64 m_rVcmd;
245 
249  real64 m_rAcmd;
250 
254  real64 m_rBcmd;
255 
260  real64 m_rCcmd;
261 
265  real64 m_rJcmd;
266 
271  real64 m_rJbcmd;
272 
277  real64 m_rJm1cmd;
278 
283  real64 m_rJm2cmd;
284 
289  real64 m_rJecmd;
290 
293  real64 m_rBemg;
294 
299  real64 m_rJemg;
300 
305  real64 m_rJeemg;
306 
310  real64 m_rSmin;
311 
315  real64 m_rSmax;
316 
319  real64 m_rVmin;
320 
323  real64 m_rVmax;
324 
327  real64 m_rVmaxSetup;
328 
331  real64 m_rVmaxInit;
332 
337  real64 m_rVtrq;
338 
341  real64 m_rAmin;
342 
345  real64 m_rAmax;
346 
354  real64 m_rAmaxPull;
355 
358  real64 m_rArms;
359 
364  real64 m_rAtrq;
365 
368  real64 m_rBmin;
369 
372  real64 m_rBmax;
373 
378  real64 m_rBtrq;
379 
382  real64 m_rCmin;
383 
386  real64 m_rCmax;
387 
390  real64 m_rJmin;
391 
394  real64 m_rJmax;
395 
404  real64 m_rMiMTol;
405 
415  real64 m_rBacklash;
416 
420 
423  real64 m_rSLSValue;
424 
427  real64 m_rSLSJerk;
428 
443  uint32 m_uOptions;
444 
448  uint8 m_uDigits;
449 
455 
458  uint8 m_uSLSType;
459 
461  uint8 m_uInternal0[1];
463 
464  // constructor
465  SINOSBaseRamp();
466 };
467 
468 // generic param extension
469 #if defined(INOS_AXIS_EXTENSION_SUPPORT)
470 struct SINOSParamSetExtension
471 {
473  uint32 m_uId;
475  char m_cName[32];
477  SINOSParamSetExtension* m_pNext;
478 
480  SINOSParamSetExtension(uint32 auId, const char* apName)
481  : m_uId(auId), m_cName{0}, m_pNext(0)
482  { inos_strncpy(m_cName, apName, sizeof(m_cName));};
484  virtual ~SINOSParamSetExtension(){};
485 
487  uint32 GetId() const
488  { return m_uId; };
490  const char* GetName() const
491  { return &m_cName[0]; };
493  virtual SINOSParamSetExtension& operator=(const SINOSParamSetExtension& src)
494  {
495  // we do not need to copy anything, because this operator is only called
496  // if id and name are already equal, see SINOSRampParam::CloneExtensions in
497  // cinosbaseramp.cpp
498  return *this;
499  }
501  virtual SINOSParamSetExtension* Clone() = 0;
503  virtual CINCOObject* CreateInco() = 0;
504 
505  // dynamic object
506  DECLARE_DYNAMIC(SINOSParamSetExtension);
507 };
508 #endif
509 
512 {
513  // ramp param flags
514  enum {
515  eFlgFix = 0x00000001, // speed set is fixed (ignore slowmotion, ...)
516  eFlgOk = 0x00000002, // speed set is ok checked already
517  eFlgTim = 0x00000004, // required time for the move is m_rTime [sec]
518  eFlgP5 = 0x00000008, // use a P5 for the move
519  eFlgWindow = 0x00000010, // use position type 'window'
520  eFlgWindowOpt = 0x00000020, // use position type 'windowopt'
521  eFlgEco = 0x00000040, // use a ecological params
522  eFlgAwayLight = 0x00000080, // move with disabled torque limitation
523  // and jerks = 0.0 at move away from border to speed up calculation
524  eFlgIgnoreLimits = 0x00000100, // ignore position limits
525  eFlgTriggerReduced = 0x00000200,// MoveEx trigger only active with reduced speed
526  eFlgIgnoreCache = 0x00000400,// ignore ramp cache. useful to avoid interference between concurrent calculation and move calls.
527  eFlgTemporary = 0x80000000, // temporary structure
528  };
530  real64 m_rVcmd;
532  real64 m_rAcmd;
534  real64 m_rBcmd;
536  real64 m_rCcmd;
538  real64 m_rJcmd[DF_INOS_RAMP_MAX_JERK];
540  real64 m_rJCcmd;
542  real64 m_rTime;
545  real64 m_rSlow;
547  uint32 m_uFlags = 0;
550  { m_uFlags |= eFlgTemporary; }
553  { return (m_uFlags & eFlgTemporary)!=0; }
556  { m_uFlags |= eFlgIgnoreCache; }
559  { m_uFlags &= ~eFlgIgnoreCache; }
562  { return (m_uFlags & eFlgIgnoreCache)!=0; }
563  #if !defined(INOS_AXIS_EXTENSION_SUPPORT)
564  uint32 m_uDummy;
566  #else
567  struct SINOSParamSetExtension* m_pExtension;
570  SINOSRampParam();
572  SINOSRampParam(const SINOSRampParam& aParam);
574  ~SINOSRampParam();
575  // assignment operator
576  SINOSRampParam& operator= (const SINOSRampParam& src);
578  void Copy(const SINOSRampParam& src);
580  void DestroyExtensions();
582  void CloneExtensions(const SINOSRampParam& src);
584  void AddExtension(SINOSParamSetExtension* apExtension);
586  void RemoveExtension(const char* apName);
588  SINOSParamSetExtension* GetExtension(uint32 auId)
589  {
590  // search
591  SINOSParamSetExtension* ext = m_pExtension;
592  while (ext){
593  // found ?
594  if (ext->m_uId == auId) {
595  // found
596  return ext;
597  } // end if
598  ext = ext->m_pNext;
599  }
600  // not found
601  return 0;
602  }
603  #endif
604 
607 };
608 
611 {
613  real64 m_rS;
615  real64 m_rV;
617  real64 m_rA;
619  real64 m_rJ;
620  // allow new/delete
621  DECLARE_DYNAMIC(SINOSRampData);
622 };
623 
626 {
628  uint32 m_uFlags;
631  // allow new/delete
632  DECLARE_DYNAMIC(SINOSRampDataEx);
633 };
634 
636 typedef struct{
637  real64 m_rAccelerationTime;
638  real64 m_rMoveTime;
639  real64 m_rConstTime;
640  real64 m_rDecelerationTime;
642 
645 {
647  inosName32 m_cName;
649  uint32 m_uNumber;
651  uint32 m_uDummy;
653  real64 m_rV;
655  real64 m_rA;
656 };
657 
660 {
661 };
662 
665 {
666 };
667 
670 {
672  uint32 m_uNumber;
674  uint32 m_uDummy;
676  real64* m_rV;
678  real64* m_rA;
679 
681  explicit SINOSBaseRampTrqLimit(uint32 auNumber = 0);
686 
688  bool operator ==(const SINOSBaseRampTrqLimit &b) const
689  {
690  if (m_uNumber != b.m_uNumber) return false;
691  for (uint32 i=0; i<m_uNumber; i++){
692  if (m_rV[i] != b.m_rV[i]) return false;
693  if (m_rA[i] != b.m_rA[i]) return false;
694  }
695  return true;
696  }
697 };
698 
699 //------------------------------------------------------------------------------
700 // class definition
701 //------------------------------------------------------------------------------
702 //
703 class CINOSBaseRamp;
704 #ifndef INOS_RAMP_DLL
706 {
707  //--- user interface ---------------------------------------------------
708 
709  // public member functions
710  public :
711 
712  #if defined(INOS_AXIS_EXTENSION_SUPPORT)
713  void AddExtension(SINOSParamSetExtension* apExtension);
716  void RemoveExtension(const char* apName);
717  #endif
718 
720  virtual CINCOObject* GetRegister(CINOSBaseRamp* apRamp);
721 
722  //--- internals --------------------------------------------------------
723 
724  // public but just for internal use
725  public:
726  explicit CINOSBaseRampParamSet(SINOSRampParam* apParam = 0);
727  //; constructor
729  //; copy constructor. Note: m_pRegister will not be copied,
730  //; it'll be initialized to NULL.
731  CINOSBaseRampParamSet& operator=(
732  const CINOSBaseRampParamSet& aOther);
733  //; assignment operator. Note that this function does not alter
734  //; m_pRegister!
735  virtual ~CINOSBaseRampParamSet();
736  //; destructor
737  SINOSRampParam m_Param{};
738  //; ramp params
739  CINCOObject* m_pRegister;
740  //; pointer to inco registration of set
741 
742  // allow dynamic object handling (new/delete)
743  DECLARE_DYNAMIC(CINOSBaseRampParamSet);
744 };
745 #endif
746 
747 //------------------------------------------------------------------------------
748 // class definition
749 //------------------------------------------------------------------------------
750 //
751 class CINOSRampJob;
752 class CINOSRampJobPart;
753 class CINOSRampCache;
754 class CINOSRampSeg;
755 class CINOSRampSegTra;
756 class CINOSRampSegCns;
757 class CINOSRampSegPos;
758 class CINOSMapping;
759 class CINOSBus;
761 {
762  //--- user interface ---------------------------------------------------
763 
764  public:
765 
766  // constructor/destructor
767 
768  explicit CINOSBaseRamp(SINOSBaseRamp* apDesc);
769  //; constructor
770  virtual ~CINOSBaseRamp();
771  //; destructor
772  const char* GetName();
773  //; get axis generator name
774  const char* GetType();
775  //; get ramp generator type
776  static uint32 GetVersion();
777  //; get ramp generator version
778  #ifndef INOS_RAMP_DLL
779  static CINOSBaseRamp* GetRamp(const char* apAxisName, const char* apRampType);
780  //; create ramp and return pointer to it (gets ramp properties from
781  //; database table
782  static CINOSBaseRamp* GetRamp(const char* apType);
783  //; create ramp of type 'apType' return pointer to it or NULL if 'apType'
784  //; not available
785  #endif
786 
787  enum EMoveFlags{
788  eFlgMoveNone= 0x00000000,
789  eFlgMoveWithoutDec1 = 0x00000001,
790  eFlgMoveWithoutDec2 = 0x00000002,
791  eFlgMoveWithoutDec3 = 0x00000004
792  };
793 
794  // moving functions
795 
796  virtual bool Move(real64 arPosition, SINOSRampParam* apParam = 0);
797  //; move to position with apParam values or actual commanded values if
798  //; apParam = 0 and return true if move was really started and false
799  //; if move was not started for some reason (e.g. nothing to move or
800  //; position range error)
801  virtual bool Move(real64 arPosition, real64 arSave1, real64 arSave2,
802  real64& arTime, SINOSRampParam* apParam1 = 0, SINOSRampParam* apParam2 = 0);
803  //; move to arPosition with apParam values in considering arSave1
804  //; and arSave2
805  virtual bool MoveApp(real64 arPosition, real64 arPositionVel, real64 arVelocity,
806  SINOSRampParam* apParam = 0, EMoveFlags aeFlags = eFlgMoveNone);
807  //; move to position with apParam, ensure after arPositionVel a
808  //; velocity that is smaller than or equal to arVelocity
809  virtual bool MoveDep(real64 arPosition, real64 arPositionVel, real64 arVelocity,
810  SINOSRampParam* apParam = 0);
811  //; move to position with apParam, ensure before arPositionVel a
812  //; velocity that is smaller than or equal to arVelocity
813  virtual bool Endless(bool abPositive = true, SINOSRampParam* apParam = 0);
814  //; start an endless move in the requested direction and return true
815  //; if really started
816  virtual bool Update(SINOSRampParam* apParam = 0);
817  //; update a running Move to apParam values or actual commanded values
818  //; if apParam = 0
819 
820 
825  virtual SINOSTimeCharacteristics GetTimeCharacteristics(real64 arPosition, real64 arDelta,
826  SINOSRampParam* apParam);
831  virtual SINOSTimeCharacteristics GetTimeCharacteristics(real64 arStartPosition, real64 arEndPosition,
832  real64 arDelta, SINOSRampParam* apParam);
833 
834 
835  virtual real64 GetMoveTime(real64 arPosition, real64 arDelta = REAL64(0.0),
836  SINOSRampParam* apParam = 0);
837  //; return time [sec] a Move(adPosition) needs until arPosition-arDelta
838  virtual real64 GetAccelerationTime(real64 arPosition, real64 arDelta = REAL64(0.0),
839  SINOSRampParam* apParam = 0);
840  //; return time [sec] a Move(adPosition) needs for the acceleration part
841  virtual real64 GetConstTime(real64 arPosition, real64 arDelta = REAL64(0.0),
842  SINOSRampParam* apParam = 0);
843  //; return time [sec] a Move(adPosition) needs for the const part
844  virtual real64 GetDecelerationTime(real64 arPosition, real64 arDelta = REAL64(0.0),
845  SINOSRampParam* apParam = 0);
846  //; return time [sec] a Move(adPosition) needs for the deceleration part
847 
848  virtual real64 GetMoveTime(real64 arStartPosition, real64 arEndPosition,
849  real64 arDelta, SINOSRampParam* apParam = 0);
850  //; return time [sec] a Move needs from arStartPosition
851  //; until arEndPosition-arDelta
852  virtual real64 GetAccelerationTime(real64 arStartPosition, real64 arEndPosition,
853  real64 arDelta, SINOSRampParam* apParam = 0);
854  //; return time [sec] a Move needs for the acceleration part
855  virtual real64 GetConstTime(real64 arStartPosition, real64 arEndPosition,
856  real64 arDelta, SINOSRampParam* apParam = 0);
857  //; return time [sec] a Move needs for the const part
858  virtual real64 GetDecelerationTime(real64 arStartPosition, real64 arEndPosition,
859  real64 arDelta, SINOSRampParam* apParam = 0);
860  //; return time [sec] a Move needs for the deceleration part
861 
862  virtual real64 GetMoveTime(real64 arStartPosition, real64 arEndPosition,
863  real64 arDelta, real64& arDeltaTime, SINOSRampParam* apParam = 0);
864  //; return time [sec] a Move needs from arStartPosition
865  //; until arEndPosition-arDelta
866 
867  virtual real64 GetMoveAppTime(real64 arPosition, real64 arPositionVel,
868  real64 arVelocity, real64 arDelta = REAL64(0.0), SINOSRampParam* apParam = 0);
869  //; return time [sec] an according MoveApp needs
870  virtual real64 GetMoveAppTime(real64 arStartPosition, real64 arEndPosition,
871  real64 arPositionVel, real64 arVelocity, real64 arDelta, SINOSRampParam* apParam = 0);
872  //; return time [sec] an according MoveApp needs
873  virtual real64 GetMoveDepTime(real64 arPosition, real64 arPositionVel,
874  real64 arVelocity, real64 arDelta = REAL64(0.0), SINOSRampParam* apParam = 0);
875  //; return time [sec] an according MoveDep needs
876  virtual real64 GetMoveDepTime(real64 arStartPosition, real64 arEndPosition,
877  real64 arPositionVel, real64 arVelocity, real64 arDelta, SINOSRampParam* apParam = 0);
878  //; return time [sec] an according MoveDep needs
879  virtual real64 GetMoveDist(real64 arTime, SINOSRampParam* apParam = 0);
880  //; return distance [unit] a Move progresses in arTime [sec]
881  virtual real64 GetMoveDist(real64 arPosition, real64 arTime,
882  SINOSRampParam* apParam = 0);
883  //; return distance [unit] a Move(arPosition) progresses in arTime [sec]
884  virtual real64 GetMoveDist(real64 arStartPosition, real64 arEndPosition,
885  real64 arTime, SINOSRampParam* apParam = 0);
886  //; return distance [unit] a Move from arStartPosition to arEndPosition
887  //; progresses in arTime [sec]
888  virtual uint64 GetStartTicks(real64 arDelta);
889  //; return absolut bus ticks the actual move reaches the start + arDelta
890  virtual uint64 GetTargetTicks()
891  //; return absolut bus ticks the actual move reaches the target
892  { return inos_atomic_gettickcount(&m_uTargetTicks);};
893  virtual uint64 GetTargetTicks(real64 arDelta);
894  //; return absolut bus ticks the actual move reaches the target - arDelta
895 
896  // segmentation moving functions
897 
898  virtual uint32 SegBegin(real64 arSlowMotion = REAL64(1.0), real64 arStartVelocity = REAL64(0.0));
899  //; start new segmentation move
900  virtual uint32 SegBegin(real64 arSlowMotion, real64 arStartPosition, real64 arStartVelocity);
901  //; start new segmentation move
902  virtual uint32 SegMove(real64 arPosition, real64 arVelocity = REAL64(0.0),
903  SINOSRampParam* apParam = 0, real64 arAcceleration = REAL64(0.0), real64 arDuration = REAL64(-1.0));
904  //; move to 'arPosition', the velocity in 'arPosition' has to be
905  //; 'arVelocity' and the acceleration arAcceleration.
906  //; The duration (tim can be stretched by arDuration != -1.0
907  //; The base implementation only supports = -1.0
908  virtual uint32 SegMoveResult()
909  //; get result of last seg move
910  { return m_eSegMoveResult;};
911  virtual uint32 SegConst(real64 arPosition);
912  //; move to 'arPosition' with the actual velocity
913  virtual uint32 SegPos(real64 arTime);
914  //; stay at 'arPosition' for arTime
915  virtual uint32 SegPosSetTime(real64 arTime);
916  //; set the requested time of a previous added pos segment
917  virtual uint32 SegVelocity(real64 arVelocity, SINOSRampParam* apParam = 0);
918  //; stay at 'arPosition' for arTime
919  virtual real64 SegTime(bool abRoundedtoCycleTime=true);
920  //; return time [sec] the actual SegMove needs already
921  virtual uint32 GetSegEnd (real64& arS);
922  //; seg job must fit into cycle
923  virtual void SegJobMustFitInCycle (bool abMustFitInCycle);
924  //; get the end position of the segment
925  virtual uint32 SegRun();
926  //; run actual segmentation move
927  virtual CINOSRampJob* GetSegJob()
928  { return m_pSegJob;};
929 
930  // pulling methods
931 
932  virtual void Pull(real64 arS, real64 arV, real64 arA, real64 arJ);
933  //; add s, v, a, j to the actual pull list (starts pull if not yet done)
934  virtual void Pull(SINOSRampData& aData);
935  //; add aData to the actual pull list (starts pull if not yet done)
936  virtual void Pull(SINOSRampDataEx* apData);
937  //; add apData to the actual pull list (starts pull if not yet done)
938  //; apData IS deleted after processed
939  //; \note Be aware of the following: If an axis is in 'pulling' state
940  //; and the axis was not 'running' before (i.e. m_uNxtState is 'READY')
941  //; if FlushPull() is called, the ramp state will become 'READY'/'PEACE'
942  //; during the next call to GetData(). Be aware that, if after calling this
943  //; function, a task switch happens that cause the fieldbus task
944  //; calling GetData(), that function will immediately return
945  //; V,A,J = 0.0 - without properly ramping down these properties.
946  //; Among others, when this happens, calling EmergencyStop afterwards
947  //; doesn't do anything, because the ramp state is already 'READY'/'PEACE'.
948  virtual void FlushPull();
949  //; flush actual pending pull list
950  void Enable();
951  //; enable pull mode
952  void Disable()
953  //; disable pull mode (needed to be able to fill up pull list without
954  //; starting immediately)
955  { ClrFlag(DF_INOS_BASE_RAMP_FLAG_ENABLED);};
956 
957  // stop/break/continue functions
958 
959  virtual bool Stop(SINOSRampParam* apParam = 0);
960  //; stop move with acc/deceleration
961  virtual bool StopLive(real64 arSlowMotion = 1.0, SINOSRampParam* apParam = 0);
962  //; live stop move with acc/deceleration
963  virtual bool StopLiveDelta(real64 arDelta, real64 arSlowMotion = 1.0, SINOSRampParam* apParam = 0);
964  //; live stop move with acc/deceleration, the move should be stopped 'arDelta' after current position
965  virtual bool Stop(real64 arPosition, SINOSRampParam* apParam = 0);
966  //; stop move with acc/deceleration at adPosition
967  virtual bool Break(SINOSRampParam* apParam = 0);
968  //; break move with acc/deceleration (move still pending)
969  virtual bool BreakLive(SINOSRampParam* apParam = 0);
970  //; live break move with acc/deceleration (move still pending)
971  virtual bool Break(real64 arPosition, SINOSRampParam* apParam = 0);
972  //; break move with acc/deceleration at adPosition (move still
973  //; pending)
974  virtual bool EmergencyStop();
975  virtual bool EmergencyStop(SINOSRampParam* apParam);
976  virtual bool EmergencyStop(real64 arPosition, SINOSRampParam* apParam, bool abPosValid = true);
977  //; emergency stop as quick as possible
978  virtual void EmergencyStopLive();
979  virtual void EmergencyStopLive(SINOSRampParam* apParam);
980  //; emergency stop as quick as possible (do the calculation live)
981  virtual bool Continue(SINOSRampParam* apParam = 0);
982  //; continue paused move
983 
984  // set/get property functions
985 
986  enum ECmdFlags{
987  eFlgCmdNone = 0x00000000,
988  eFlgCmdPeak = 0x00000001
989  };
990 
991  virtual void SetCmdFlags(uint32 auFlags);
992  //; set commanded flags
993  ICACHE virtual void SetCmdPosition(real64 arPosition);
994  //; set commanded axis position
995  ICACHE virtual void GetCmdPosition(real64& arPosition);
996  //; get commanded axis position
997  virtual void SetCmdVelocity(real64 arVelocity);
998  //; set commanded velocity
999  virtual void GetCmdVelocity(real64& arVelocity, ECmdFlags aeFlags = eFlgCmdNone);
1000  //; get commanded velocity
1001  virtual void SetCmdAcceleration(real64 arAcceleration);
1002  //; set commanded acceleration
1003  virtual void GetCmdAcceleration(real64& arAcceleration, ECmdFlags aeFlags = eFlgCmdNone);
1004  //; get commanded acceleration
1005  virtual void SetCmdDeceleration(real64 arDeceleration);
1006  //; set commanded deceleration
1007  virtual void GetCmdDeceleration(real64& arDeceleration, ECmdFlags aeFlags = eFlgCmdNone);
1008  //; get commanded deceleration
1009  virtual void SetCmdCruiseleration(real64 arCruiseleration);
1010  //; set commanded cruiseleration
1011  virtual void GetCmdCruiseleration(real64& arCruiseleration);
1012  //; get commanded cruiseleration
1013  virtual void SetCmdJerk(real64 arJerk, uint32 auNumber = DF_INOS_RAMP_JERK_ALL);
1014  //; set commanded jerk
1015  virtual void GetCmdJerk(real64& arJerk, uint32 auNumber = 0);
1016  //; get commanded jerk
1017  virtual void SetCmdCruiseJerk(real64 arCruiseJerk);
1018  //; set commanded cruise jerk
1019  virtual void GetCmdCruiseJerk(real64& arCruiseJerk);
1020  //; get commanded jerk
1021  virtual void GetCmdRealJerk(real64& arJerk, uint32 auNumber = 0);
1022  //; get commanded real jerk and update a running move if requested
1023  virtual void SetCmdSlowMotion(real64 arSlowMotion, bool abUpdate = false);
1024  //; set commanded slowmotion factor
1025  virtual void SetCmdSlowMotion(real64 arSlowMotion, bool abUpdate, bool abStopping);
1026  //; set commanded slowmotion factor
1027  virtual void GetCmdSlowMotion(real64& arSlowMotion, SINOSRampParam* apParam = 0);
1028  //; get commanded slowmotion factor
1029  virtual void GetActSlowMotion(real64& arSlowMotion, SINOSRampParam* apParam = 0);
1030  //; get actual slowmotion factor (slowmotion>slowmotionmax?slowmotionmax : slowmotion)
1031  #ifdef INOS_SAFETY_SUPPORT
1032  virtual void GetSafetySlowMotion(real64& arSlowMotion, SINOSRampParam* apParam = 0);
1033  //; get safety slowmotion factor
1034  #endif
1035  virtual void SetCmdRelaxTime(real64 arRelaxTime);
1036  //; set commanded relax time
1037  virtual void GetCmdRelaxTime(real64& arRelaxTime);
1038  //; get commanded relax time
1039  virtual void SetEmgDeceleration(real64 arDeceleration);
1040  //; set commanded emergency deceleration
1041  virtual void GetEmgDeceleration(real64& arDeceleration);
1042  //; get commanded emergency deceleration
1043  virtual void SetEmgJerk(real64 arJerk);
1044  //; set commanded emergency jerk
1045  virtual void SetEmgJerk(real64 arJerk, real64 arJerkEnd);
1046  //; set commanded emergency jerk
1047  virtual void GetEmgJerk(real64& arJerk);
1048  //; get commanded emergency jerk
1049  virtual void GetEmgJerk(real64& arJerk, real64& arJerkEnd);
1050  //; get commanded emergency jerk
1051  virtual void SetCmdParam(SINOSRampParam* apParam)
1052  { *m_pParam = *apParam; };
1053  //; get pointer to commanded parameters
1054  virtual SINOSRampParam* GetCmdParam()
1055  { return m_pParam; };
1056  //; get pointer to commanded parameters
1057  ICACHE virtual void SetActPosition(real64 arPosition);
1058  //; set actual axis position
1059  ICACHE virtual void AdjActPosition(real64 arPosition);
1060  //; adjust actual axis position
1061  ICACHE virtual void GetActPosition(real64& arPosition);
1062  //; get actual axis position
1063  ICACHE virtual void GetActPosition(real64& arPosition, uint64 auTicks);
1064  //; get actual axis position
1065  virtual void GetPullAdjPosition(real64& arPosition);
1066  //; get actual position adjust used in pull mode
1067  virtual void GetStopPosition(real64& arPosition, SINOSRampParam* apParam);
1068  //; get axis position if we would stop a running move
1069  virtual void GetBgnPosition(real64& arPosition)
1070  { arPosition = m_rSbgn;};
1071  //; get position the actual/last move/endless was started from
1072  virtual void SetActVelocity(real64 arVelocity);
1073  //; set actual velocity
1074  virtual void GetActVelocity(real64& arVelocity);
1075  //; get actual velocity
1076  virtual void SetActAcceleration(real64 arAcceleration);
1077  //; set actual acceleration
1078  virtual void GetActAcceleration(real64& arAcceleration);
1079  //; get actual acceleration
1080  virtual void SetActJerk(real64 arJerk);
1081  //; set actual jerk
1082  virtual void GetActJerk(real64& arJerk);
1083  //; get actual jerk
1084  virtual void SetAct(SINOSRampData& aAct);
1085  //; set actuals
1086  virtual void GetActSVAJ(SINOSRampData& arData, bool abIrqSafe = true);
1087  //; get all actuals
1088  virtual void AdjActTime(real64 arDelta);
1089  //; adjust actual move time
1090  virtual void SetMinPosition(real64 arPosition);
1091  //; set min. allowed position
1092  virtual void GetMinPosition(real64& apPosition) const;
1093  //; get min. allowed position
1094  virtual void SetMaxPosition(real64 arPosition);
1095  //; set max. allowed position
1096  virtual void GetMaxPosition(real64& arPosition) const;
1097  //; get max. allowed position
1098  virtual bool CheckPosition(real64& arPosition, bool abIgnoreMapping = false, SINOSRampParam* apParam = nullptr);
1099  //; return true if arPosition within the range or no range requested
1100  virtual void SetMaxVelocity(real64 arVelocity);
1101  //; set max. allowed velocity
1102  virtual void GetMaxVelocity(real64& arVelocity, uint32 auFlags = eMaxVelocityNone);
1103  //; get max. allowed velocity
1104  virtual void SetMaxSetupVelocity(real64 arVelocity);
1105  //; set max. allowed velocity in setup mode
1106  virtual void GetMaxSetupVelocity(real64& arVelocity);
1107  //; get max. allowed velocity in setup mode
1108  virtual void SetMaxInitVelocity(real64 arVelocity);
1109  //; set max. allowed velocity during initialization
1110  virtual void GetMaxInitVelocity(real64& arVelocity);
1111  //; get max. allowed velocity during initialization
1112  virtual void SetMinVelocity(real64 arVelocity);
1113  //; set min. allowed velocity
1114  virtual void GetMinVelocity(real64& arVelocity);
1115  //; get min. allowed velocity
1116  virtual void SetTrqVelocity(real64 arVelocity);
1117  //; set torque velocity
1118  virtual void GetTrqVelocity(real64& arVelocity);
1119  //; get torque velocity
1120  virtual void AdjustMinMaxValues (real64 arFactor);
1121  //; adjust min max values
1122  virtual void SetMinAcceleration(real64 arAcceleration);
1123  //; set min. allowed acceleration
1124  virtual void GetMinAcceleration(real64& arAcceleration);
1125  //; get min. allowed acceleration
1126  virtual void SetMaxAcceleration(real64 arAcceleration);
1127  //; set max. allowed acceleration
1128  virtual void GetMaxAcceleration(real64& arAcceleration);
1129  //; get max. allowed acceleration
1130  virtual void SetMaxAccelerationPull(real64 arAcceleration);
1131  //; set max. allowed acceleration during pull
1132  virtual void GetMaxAccelerationPull(real64& arAcceleration);
1133  //; get max. allowed acceleration during pull
1134  virtual void SetTrqAcceleration(real64 arAcceleration);
1135  //; set torque acceleration
1136  virtual void GetTrqAcceleration(real64& arAcceleration);
1137  //; get torque acceleration
1138  virtual void SetMinDeceleration(real64 arDeceleration);
1139  //; set min. allowed deceleration
1140  virtual void GetMinDeceleration(real64& arDeceleration);
1141  //; get min. allowed deceleration
1142  virtual void SetMaxDeceleration(real64 arDeceleration);
1143  //; set max. allowed deceleration
1144  virtual void GetMaxDeceleration(real64& arDeceleration);
1145  //; get max. allowed deceleration
1146  virtual void SetTrqDeceleration(real64 arDeceleration);
1147  //; set torque deceleration
1148  virtual void GetTrqDeceleration(real64& arDeceleration);
1149  //; get torque deceleration
1150  virtual void SetMinCruiseleration(real64 arCruiseleration);
1151  //; set min. allowed cruiseleration
1152  virtual void GetMinCruiseleration(real64& arCruiseleration);
1153  //; get min. allowed cruiseleration
1154  virtual void SetMaxCruiseleration(real64 arCruiseleration);
1155  //; set max. allowed cruiseleration
1156  virtual void GetMaxCruiseleration(real64& arCruiseleration);
1157  //; get max. allowed cruiseleration
1158  virtual void SetMinJerk(real64 arJerk);
1159  //; set min. allowed jerk
1160  virtual void GetMinJerk(real64& arJerk);
1161  //; get min. allowed jerk
1162  virtual void SetMaxJerk(real64 arJerk);
1163  //; set max. allowed jerk
1164  virtual void GetMaxJerk(real64& arJerk);
1165  //; get max. allowed jerk
1166 
1167  virtual void GetCycleTime(real64& arCycleTime);
1168  //; get ramp cycle time
1169  virtual void SetCycleTime(real64 arCycleTime);
1170  //; set ramp cycle time
1171  virtual uint8 GetOversampling();
1172  //; get oversampling factor
1173  virtual void SetOversampling(uint8 auOversampling);
1174  //; set oversampling factor
1175  virtual void GetCycleTimeUs(uint32& auCycleTime)
1176  { auCycleTime = m_uCycleTimeUs;};
1177  //; get ramp cycle time
1178  virtual void GetCycleTimeNs(uint32& auCycleTime)
1179  { auCycleTime = m_uCycleTimeNs;};
1180  //; get ramp cycle time
1181  virtual const char* GetUnit();
1182  //; get ramping base unit (e.g. mm, deg, ...)
1183  virtual void SetUnit(const char* apUnit);
1184  //; get ramping base unit (e.g. mm, deg, ...)
1185  #ifndef INOS_RAMP_DLL
1186  virtual uint32 GetCharacteristics();
1187  //; get ramping base unit inco characteristics
1188  virtual void SetCharacteristics(uint32 auCharacteristics);
1189  //; get ramping base unit inco characteristics
1190  virtual uint8 GetTypeChar() {return m_uTypeChar;};
1191  //; get type character, e.g. 'T' for temperature ramp
1192  virtual void SetTypeChar(uint8 auTypeChar) {m_uTypeChar = auTypeChar;};
1193  //; set type character, e.g. 'T' for temperature ramp
1194  virtual uint32 GetParam(const char* apName, real64& arResult);
1195  //; universal get parameter with apName to arResult and return error code
1196  virtual volatile real64* GetParamAdr(const char* apName);
1197  //; universal get address of parameter with aName or NULL if not found
1198  virtual uint32 SetParam(const char* apName, real64 arValue);
1199  //; universal set parameter with apName to arValue and return error code
1200  #endif
1201 
1202  void SetFlag(uint32 auFlag)
1203  { INOS_OR(m_uFlag, auFlag);};
1204  //; set ramp flags
1205  void ClrFlag(uint32 auFlag)
1206  { INOS_AND(m_uFlag, ~auFlag);};
1207  //; clear ramp flags
1208  uint32 GetFlag()
1209  { return m_uFlag & m_uFlagEnb;};
1210  //; get ramp flags
1211  void EnbFlag(uint32 auFlag)
1212  { INOS_OR(m_uFlagEnb, auFlag);};
1213  //; set ramp flags
1214  void DisFlag(uint32 auFlag)
1215  { INOS_AND(m_uFlagEnb, ~auFlag);};
1216 
1217  ICACHE void SetState(uint32 auState)
1218  {
1219  // set new state
1220  m_uState = auState;
1221  // state peace ?
1222  if (m_uState == DF_INOS_RAMP_STATE_PEACE) {
1223  // yes -> clear also m_pActParam to prevent e.g.
1224  // following Pulls from inheriting speed set properties
1225  // like input shaping or others
1226  m_pActParam = nullptr;
1227  } // end if
1228  };
1229  //; set ramp state
1230  ICACHE uint32 GetState()
1231  { return m_uState;};
1232  //; get ramp state
1233  virtual uint32 GetError();
1234  //; get ramp error
1235  virtual uint64 GetErrorEx();
1236  //; get ramp error
1237  virtual uint32 GetWarning();
1238  //; get ramp warning
1239  virtual uint64 GetWarningEx();
1240  //; get ramp warning
1241  virtual void AcceptError(uint32 auError=0xffffffff);
1242  //; accept ramp error (auError=0xffffffff -> accept all errors)
1243  virtual void AcceptWarning(uint32 auWarning=0xffffffff);
1244  //; accept ramp warning (auWarning=0xffffffff -> accept all warnings)
1245 
1246  ICACHE virtual void GetS(real64& arS);
1247  //; get actual S
1248  ICACHE virtual void GetSV(real64& arS, real64& arV);
1249  //; get actual S and V
1250  ICACHE virtual void GetSVA(real64& arS, real64& arV, real64& arA);
1251  //; get actual S, V and A
1252  ICACHE virtual void GetSVAJ(real64& arS, real64& arV, real64& arA, real64& arJ);
1253  //; get actual S, V, A and J
1254  ICACHE virtual SINOSRampDataEx* GetData();
1255  //; get actual S, V, A and J
1256  virtual void GetData (SINOSRampDataEx* apData, bool abSingleSample=false);
1257 
1258  // param set functions
1259  #ifndef INOS_RAMP_DLL
1260  virtual CINOSBaseRampParamSet* CloneParamSet();
1261  //; return a copy of the actual param set
1262  virtual void SelectParamSet(CINOSBaseRampParamSet* apSet);
1263  //; set actual param set to apSet
1264  virtual void PreDestroyRampParam(SINOSRampParam* apParam);
1265  //; use this method to inform geni, that we're about to destroy a previously
1266  //; used speed set
1267  #endif
1268 
1269  // caching functions
1270 
1271  void EnableCache(uint32 auSize = 32);
1272  //; create moving cache with size auSize if nessecary and enable it
1273  CINOSRampCache* EnableCache(CINOSRampCache* apCache);
1274  //; set actual moving cache to apCache and return old one or 0
1275  CINOSRampCache* DisableCache();
1276  //; disable moving cache and return old one
1277  void ReEnableCache();
1278  //; Reenables a previously disabled ramp cache. This function is
1279  //; useful if the cache feature has temporarily been disabled
1280  //; before (DisableCache). Note: This function has no effect if
1281  //; the ramp does not yet owns a cache object. Also: It's safe
1282  //; to call this function while the cache is already enabled.
1283  void FlushCache();
1284  //; flush moving cache
1285  void SetEpsilon(real64 arEpsilon);
1286  //; set new internal 'epsilon' (standard is = 0.0)
1287  void GetEpsilon(real64& arEpsilon)
1288  {arEpsilon = m_rEpsilon;};
1289  //; get internal 'epsilon'
1290  void SetCacheEpsilon(real64 arEpsilon);
1291  //; set new cache 'epsilon' (standard is = 0.0)
1292 
1293  // miscellaneous functions
1294 
1295  virtual CINOSBaseRamp* Clone();
1296  //; clone myself and return pointer to it
1297  #ifndef INOS_RAMP_DLL
1298  SINOSBaseRamp* GetRampDesc()
1299  { return m_pDesc;};
1300  //; return pointer to my ramp descritpor
1301  virtual CINCOObject* GetRegister(const char* apName = "Ramp");
1302  //; return pointer to my inco object
1303  void RegisterFlags(CINCOObject* apParent, uint32* auBase);
1304  //; register flags, used for real flags and flags enable.
1305  virtual CINCOObject* GetParamSetRegister(CINOSBaseRampParamSet* apSet);
1306  //; create registration for apSet and return pointer to it
1307  static CINCOObject* GetBaseParamSetRegister(CINOSBaseRampParamSet* apSet);
1308  //; create registration for apSet and return pointer to it
1309  #endif
1310 
1311  // safety move
1312 
1313  virtual void SetMoveSafeMin(real64 arMin, real64 arFact1=REAL64(0.0),
1314  real64 arFact2=REAL64(0.0));
1315  //; set move safe minimum : arMin=requested minimum,
1316  //; safe1=safe1+arFact(MoveSafeMin-calcedMin), safe2=dito
1317  virtual void ResetMoveSafeMin();
1318  //; reset move safe minimum
1319 
1320  // mapping
1321 
1322  void SetMapping(CINOSMapping* apMapping, uint32 auIndex)
1323  { m_pMapping = apMapping; m_uMappingIndex = auIndex;};
1324  //; set actual axis mapping
1325  void ResetMapping()
1326  { m_pMapping = 0; m_uMappingIndex = 0;};
1327  //; reset actual axis mapping
1328 
1329  // setup mode
1330 
1331  void EnableSetupMode();
1332  //; enable setup mode
1333  void DisableSetupMode();
1334  //; disable setup mode
1335  bool CheckSetupMode();
1336  //; return true if setup mode active and fullfilled
1337 
1340  {
1341  // locals
1342  real64 rAmax;
1343  // decide witch Amax to take
1344  if (m_rAmaxPull != REAL64(0.0))
1345  rAmax = m_rAmaxPull;
1346  else
1347  rAmax = m_rAmax;
1348  // max. allowed rest V = Amax * cycletime
1349  real64 rVzero = rAmax * m_rCycleTime;
1350  // underrun if no data and V!= 0.0
1351  return (m_pFstData == 0) && ((m_Act->m_rV > rVzero) || (m_Act->m_rV < -rVzero));
1352  }
1353 
1354  // torque limitation
1355 
1358  { m_pTrqLimitAcc = apLimit; };
1361  { return m_pTrqLimitAcc; };
1364  { m_pTrqLimitDec = apLimit; };
1367  { return m_pTrqLimitDec; };
1368 
1370  void UpdateTrqLimit();
1371 
1372  // multi core
1373 
1375  uint8 GetCoreId()
1376  { return m_uCoreId; };
1377 
1378  //--- internals --------------------------------------------------------
1379 
1380  friend class CINOSMapping;
1381  friend class CINOSShape;
1382  friend class CINOSBaseAxis;
1383  friend class CINOSPhysicalAxis;
1384  friend class CINOSBaseRampTest;
1385  friend class CINOSMcRobotCmdLinear;
1386  friend class CINOSRemoteControlWorker;
1387  friend void _INI_0400_CINOSBaseRamp();
1388 
1389  // public member methods but just for internal use
1390  public :
1391  virtual const char* GetStateText();
1392  //; get pointer to actual state text
1393  virtual CINOSRampJob* iMove(real64 arSbgn, real64 arSend, bool abReturnError,
1394  SINOSRampParam* apParam);
1395  //; create a move job from arSbgn to arSend with apParam parameters
1396  virtual CINOSRampJob* iMove(real64 arPosition, real64 arSave1, real64 arSave2,
1397  real64& arTime, SINOSRampParam* apParam1, SINOSRampParam* apParam2);
1398  //; create a move job from arSbgn to arSend with apParam parameters
1399  virtual CINOSRampJob* iMoveApp(real64 arSbgn, real64 arSend, real64 arSvel,
1400  real64 arVelocity, bool abReturnError, SINOSRampParam* apParam, EMoveFlags aeFlags);
1401  //; create a move job from arSbgn to arSend with apParam parameters
1402  virtual CINOSRampJob* iMoveDep(real64 arSbgn, real64 arSend, real64 arSvel,
1403  real64 arVelocity, bool abReturnError, SINOSRampParam* apParam);
1404  //; create a move job from arSbgn to arSend with apParam parameters
1405  virtual SINOSRampParam* CheckParam(SINOSRampParam* apOrgParam,
1406  SINOSRampParam* apTmpParam);
1407  //; check OrgParam for limits, if OrgParam has to be adjusted, copy
1408  //; them to tmp param, return pointer to result
1409  virtual void CopyParam(SINOSRampParam* apDstParam, SINOSRampParam*& apSrcParam);
1410  //; copy src params to dst params
1411 
1412  enum ECalcMoveResult {
1413  eClcMoveResOk = 0,
1414  eClcMoveResAdjusted = 1,
1415  eClcMoveResShrinked = 2,
1416  eClcMoveResFailed = 3,
1417  }; //; calc move result
1418 
1419  virtual ECalcMoveResult CalcMove(real64 arSlen, SINOSRampParam* apParam, CINOSRampSegTra*& apSegAcc,
1420  CINOSRampSegCns*& apSegCns, CINOSRampSegTra*& apSegDec, real64 arVbgn = REAL64(0.0),
1421  real64 arVend = REAL64(0.0), real64 arAbgn = REAL64(0.0),
1422  real64 arAend = REAL64(0.0), real64 arDuration = REAL64(-1.0));
1423  //; calc acc, cns and dec segments for a move to arS and return true
1424  //; if requested V was adjusted
1425  virtual void CalcMoveApp(real64 arS, real64 arSred, real64 arVred,
1426  SINOSRampParam* apParam, CINOSRampSegTra*& apAcc, CINOSRampSegCns*& apCns,
1427  CINOSRampSegTra*& apDec1, CINOSRampSegCns*& apDec2, CINOSRampSegTra*& apDec3);
1428  //; calc acc, cns and dec segments for a moveapp to arS
1429  virtual void CalcMoveDep(real64 arS, real64 arSred, real64 arVred,
1430  SINOSRampParam* apParam, CINOSRampSegTra*& apAcc1, CINOSRampSegCns*& apAcc2,
1431  CINOSRampSegTra*& apAcc3, CINOSRampSegCns*& apCns, CINOSRampSegTra*& apDec);
1432  //; calc acc, cns and dec segments for a movedep to arS
1433  virtual bool CalcStop(uint32 auNxtState, SINOSRampParam* apParam, bool abEmergency=false);
1434  //; calc dec segment for a stop and return true if a calculation was done
1435  virtual bool CalcStopLive(uint32 auNxtState, SINOSRampParam* apParam, bool abEmergency=false);
1436  //; calc dec segment for a stop and return true if a calculation was done
1437  virtual bool CalcStop(real64 arS, uint32 auNxtState, SINOSRampParam* apParam, bool abEmergency=false);
1438  //; calc acc, cns and dec segments for a stop at arS and return true
1439  //; if a calculation was done
1440  virtual real64 CalcEscape(real64 arSlen, SINOSRampParam* apParam);
1441  //; ...
1442  virtual bool iCalcApp(real64 arS, real64 arSred, real64 arVred, SINOSRampParam* apParam);
1443  //; calc acc, cns and dec segments for a moveapp at arS and return true
1444  //; if a calculation was done
1445  virtual void iStopping();
1446  //; calc live stopping
1447 
1448  enum ECalcSegTraType {
1449  eClcSegTraCompatible = 0,
1450  eClcSegTraAccelerate = 1,
1451  eClcSegTraDecelerate = 2,
1452  eClcSegTraMiddle = 3
1453  }; //; calc move result
1454 
1455  virtual CINOSRampSegTra* CalcSegTra(
1456  real64 arVb, // starting velocity
1457  real64 arAb, // starting acceleration
1458  real64 arVe, // ending velocity
1459  SINOSRampParam* apParam, // requested parameters
1460  CINOSRampSegTra* apResult=0,// result
1461  real64 arJb=REAL64(-1.0), // requested begin jerk
1462  real64 arJe=REAL64(-1.0), // requested end jerk
1463  ECalcSegTraType aeType = eClcSegTraCompatible
1464  );
1465  //; calc transition segment
1466  virtual void CalcSegApp(
1467  real64 arSr, // position of reduced velocity
1468  real64 arVr, // reduced velocity
1469  real64 arVb, // beginning velocity
1470  SINOSRampParam* apParam, // requested parameters
1471  CINOSRampSegTra*& apResult1,// result seg1
1472  CINOSRampSegCns*& apResult2,// result seg2
1473  CINOSRampSegTra*& apResult3,// result seg3
1474  uint32 auMoveInMove = 0
1475  );
1476  virtual void CalcSegDep(
1477  real64 arSr, // position of reduced velocity
1478  real64 arVr, // reduced velocity
1479  real64 arVe, // ending velocity
1480  SINOSRampParam* apParam, // requested parameters
1481  CINOSRampSegTra*& apResult1,// result seg1
1482  CINOSRampSegCns*& apResult2,// result seg2
1483  CINOSRampSegTra*& apResult3 // result seg3
1484  );
1485  //; calc transition segment
1486  CINOSRampSegCns* CalcSegCns(
1487  real64 arS, // requested length
1488  real64 arV, // requested velocity
1489  CINOSRampSegCns* aResult=0 // result
1490  );
1491  //; calc constant segment
1492  CINOSRampSegPos* CalcSegPos(
1493  real64 arS, // requested position
1494  real64 arT, // requested time
1495  CINOSRampSegPos* aResult=0 // result
1496  );
1497  //; calc position segment
1498  bool StartJob(CINOSRampJob* apJob);
1499  //; start apJob and return true if started
1500  bool ReleaseJob(CINOSRampJob* apJob);
1501  //; release job if its handled by me
1502  bool RestartJob();
1503  //; restart last given job return true if started
1504  CINOSRampJob* SwitchJob(CINOSRampJob* apJob, uint32 auNxtState,
1505  uint32 auBusTicks, bool bLookAhead = false);
1506  //; switch to apJob and return old job
1507  CINOSRampJob* GetActJob(bool abIncRefCounter = true);
1508  //; return pointer to actual job and increase job reference counter
1509  real64 RoundUpToCycleTime(real64 arTime);
1510  //; round arTime up to a multiple of cycletime
1511  real64 RoundToCycleTime(real64 arTime);
1512  //; round arTime to a multiple of cycletime
1513  uint64 RoundUpToBusTicks(real64 arTime);
1514  //; return number of bus ticks needed for arTime
1515  void SetBusTicksPerAxisTick(uint32 auBusTicksPerAxisTick)
1516  //; init target ticks calculation
1517  { m_uBusTicksPerAxisTick = auBusTicksPerAxisTick; };
1518 
1519  real64 CalcVmax(real64 adS, SINOSRampParam* apParam);
1520  //; calc max. allowed V for S
1521  double _vx(double p, double s, SINOSRampParam* apParam);
1522  //; helper function for CalcVmax
1523  double _vy(double s, SINOSRampParam* apParam);
1524  //; helper function for CalcVmax
1525  double _vz(double s, SINOSRampParam* apParam);
1526  //; helper function for CalcVmax
1527 
1528  bool IsGreater(real64 arA, real64 arB, bool bPos);
1529  //; return a > b sign dependent
1530 
1531  bool Enter(uint32 auState, bool abEqual=true);
1532  //; enter critical section
1533  bool Exit(bool abExitCode);
1534  //; exit critical section
1535 
1536  void SaveActParam(SINOSRampParam* apParam);
1537  //; save apParam in m_pActParam
1538 
1539  bool Sign(real64& arValue)
1540  //; return true if sign bit set
1541  { return (*((uint64*)&arValue)&0x8000000000000000LL) ? true : false;};
1542 
1544  void SetupTrqLimit(real64 arAmax, real64 arVmax, real64 arAtrq,
1545  real64 arVtrq, class CINCOTable* apPoints, SINOSBaseRampTrqLimit*& apLimit);
1547  void UpdatedMaximum(real64* apValue, real64 rOld, real64 rNew);
1549  void UpdateSlowMotion(real64 arFactor = REAL64(0.0));
1551  real64 GetRequestedJobSlowMotion(CINOSRampJob* apJob);
1552 
1554  uint32 GetJobOptions(bool abPositive);
1556  uint32 GetJobOptions(real64 arSbgn, real64 arSend);
1557 
1559  bool PrepareBacklash(bool abPositiveMoveDirection, real64& arBacklash);
1561  void AppendBacklash(CINOSRampJob* apJob, SINOSRampParam* apParam, real64 arBacklash);
1562 
1563  #ifdef INOS_SAFETY_SUPPORT
1564  virtual void SetSafetyFunction(ESafetyFunction auFunction, real64 arLimit, uint32 auDelay,
1566  bool abUpdate);
1568  virtual void SetSafetyFunction(ESafetyFunction auFunction);
1570  virtual real64 CalcSlsLimit(real64 arSlsLimit);
1572  void SetSLSVmax(real64 arSLSVmax)
1573  { m_rSLSVmax = arSLSVmax; m_rSLSValue = arSLSVmax; m_eSLSType = eSLSReduceFixed; };
1574  #endif
1575 
1576  #if defined(INOS_AXIS_EXTENSION_SUPPORT)
1577  void AddExtension(SINOSParamSetExtension* apExtension);
1580  void RemoveExtension(const char* apName);
1581 
1583  SINOSParamSetExtension* GetParamSetExtension(uint32 auExtensionId)
1584  {
1585  // get pointer to actual selected param set
1586  SINOSRampParam* act = m_pActParam;
1587  // available ?
1588  if (0 == act) {
1589  // no -> use default
1590  act = m_pParam;
1591  }
1592  // locals
1593  SINOSParamSetExtension* ext = act->m_pExtension;
1594  // find given extension
1595  while (ext) {
1596  // check id
1597  if (ext->m_uId == auExtensionId) {
1598  // found
1599  return ext;
1600  }
1601  // next
1602  ext = ext->m_pNext;
1603  } // end while
1604 
1605  // not available
1606  return 0;
1607  }
1608  #endif
1609 
1610  // protected member functions
1611  protected:
1612  void iCoreMismatchError();
1613  //; set core mismatch axis error
1614  void iCoreMismatchWarning();
1615  //; set core mismatch axis warning
1616 
1617  // protected members
1618  protected:
1619  uint32 m_uState;
1620  //; actual state
1621  uint32 m_uNxtState;
1622  //; next state
1623  uint32 m_uError;
1624  //; actual errors
1625  uint32 m_uWarning;
1626  //; actual warnings
1627  uint32 m_uFlag;
1628  //; actual flags
1629  uint32 m_uFlagEnb;
1630  //; actual flags enabled
1631  uint32 m_uFlagOld;
1632  //; actual flags at last move
1633  volatile uint32 m_uAlive;
1634  //; alive counter
1635  CINOSRampJob* m_pActJob;
1636  //; pointer to actual ramp job
1637  CINOSRampJob* m_pNxtJob;
1638  //; pointer to next ramp job
1639  CINOSRampJob* m_pBrkJob;
1640  //; pointer to paused ramp job
1641  CINOSRampJob* m_pSegJob;
1642  //; pointer to segmentation job
1643  CINOSRampSegPos* m_pSegPosLast;
1644  //; pointer to last added segpos segment
1645  CINOSRampCache* m_pCache;
1646  //; pointer to cache of jobs
1647  bool m_bCacheable;
1648  //; true if cache enabled
1649  bool m_bSetupModeOk;
1650  //; true if setup mode ok
1651  SINOSRampDataEx* m_pFstData;
1652  //; pointer to first ramp data structure in list
1653  SINOSRampDataEx* m_pLstData;
1654  //; pointer to last ramp data structure in list
1655  bool m_bDataValid;
1656  //; true if ramp data is valid
1657  SINOSBaseRamp* m_pDesc;
1658  //; pointer to object descriptor
1659  #ifndef INOS_RAMP_DLL
1660  CINCOObject* m_pRegister;
1661  //; pointer to inco registration
1662  CINCOObject* m_pCmd;
1663  //; pointer to inco registration of commanded values
1664  CINCOObject* m_pAct;
1665  //; pointer to inco registration of actual values
1666  CINCOObject* m_pMax;
1667  //; pointer to inco registration of max values
1668  CINCOObject* m_pProp;
1669  //; pointer to inco registration of properties
1670  CINCOObject* m_pError;
1671  //; pointer to inco registration of errors
1672  CINCOObject* m_pWarning;
1673  //; pointer to inco registration of warnings
1674  CINCOObject* m_pFlag;
1675  //; pointer to inco registration of flags
1676  CINCOObject* m_pFlagEnb;
1677  //; pointer to inco registration of flags enable
1678  uint32 m_uCharacteristics;
1679  //; inco registration characteristics
1680  uint8 m_uTypeChar;
1681  //; type character, e.g. 'T' for temperature
1682  #endif
1683  const char* m_pType;
1684  //; ramp type
1685  inosName32 m_cName;
1686  //; ramp name
1687  inosName m_cUnit;
1688  //; ramp unit
1689 
1690  // cycle time
1691 
1692  real64 m_rCycleTime;
1693  //; cycle time in sec
1694  real64 m_rCycleTimeOversampled;
1695  //; cycle time in sec inclusive oversampling factor
1696  real64 m_rCycleTime_1;
1697  //; 1/cycle time
1698  uint32 m_uCycleTimeUs;
1699  //; cycle time in us
1700  uint32 m_uCycleTimeNs;
1701  //; cycle time in ns
1702  uint8 m_uOversampling;
1703  //; oversampling factor
1704  real64 m_rMiMTol;
1705  //; move in move constant segment tolerance [sec]
1706  real64 m_rLastOvrs;
1707  //; last oversampled value
1708 
1709  // commanded values
1710 
1711  real64 m_rScmd;
1712  //; commanded position
1713  real64 m_rBemg;
1714  //; commanded emergency deceleration
1715  real64 m_rJemg;
1716  //; commanded emergency jerk (only valid before the deceleration phase)
1717  real64 m_rJeemg;
1718  //; commanded end emergency jerk (only valid before stop)
1719  real64 m_rPausedEnd;
1720  //; commanded end position at Break command (needed for Continue)
1721  SINOSRampParam* m_pParam;
1722  //; commanded acc,dec,vel,jerk
1723  SINOSRampParam* m_pActParam;
1724  //; commanded acc,dec,vel,jerk of actual running move
1725  SINOSRampParam* m_pStartParam;
1726  //; commanded acc,dec,vel,jerk at last startjob
1727  SINOSRampParam m_sSavParam;
1728  //; saved commanded acc,dec,vel,jerk of actual running move (this is
1729  //; only used if the given speed set pointed to stack memory of the
1730  //; calling task, if this is the case a copy is taken to avoid working
1731  //; with an invalid speedset pointer in later commands , e.g. Stop, ..)
1732  real64 m_rVpeak;
1733  //; peak velocity of current/last move
1734  real64 m_rApeak;
1735  //; peak acceleration of current/last move
1736  real64 m_rBpeak;
1737  //; peak deceleration of current/last move
1738 
1739  // segmentation moves
1740 
1741  real64 m_rSseg;
1742  //; requested position at end of actual segment
1743  real64 m_rVseg;
1744  //; requested velocity at end of actual segment
1745  real64 m_rAseg;
1746  //; requested velocity at end of actual segment
1747  ECalcMoveResult m_eSegMoveResult;
1748  //; result of last seg move
1749 
1750  // actual values
1751 
1752  real64 m_rAdjPos;
1753  //; actual requested position adjust
1754  SINOSRampDataEx* m_Act;
1755  //; actual values
1756  real64 m_rSbgn;
1757  //; position the actual/last move/endless was started from
1758 
1759  // min./max. values
1760 
1761  real64 m_rSmin;
1762  //; min. allowed position
1763  real64 m_rSmax;
1764  //; max. allowed position
1765  real64 m_rVmin;
1766  //; min. allowed velocity
1767  real64 m_rVmax;
1768  //; max. allowed velocity
1769  real64 m_rVmaxSetup;
1770  //; max. allowed velocity in setup mode
1771  real64 m_rVmaxInit;
1772  //; max. allowed velocity during initialization
1773  real64 m_rVmaxLimit;
1774  //; max. allowed velocity during pull (1.01*m_rVmax)
1775  real64 m_rVtrq;
1776  //; max. allowed velocity
1777  real64 m_rAmin;
1778  //; min. allowed acceleration
1779  real64 m_rAmax;
1780  //; max. allowed acceleration
1781  real64 m_rAmaxPull;
1782  //; max. allowed acceleration during pull
1783  real64 m_rArms;
1784  //; max. allowed rms acceleration
1785  real64 m_rAtrq;
1786  //; max. allowed acceleration
1787  real64 m_rBmin;
1788  //; min. allowed deceleration
1789  real64 m_rBmax;
1790  //; max. allowed deceleration
1791  real64 m_rBtrq;
1792  //; max. allowed deceleration
1793  real64 m_rCmin;
1794  //; min. allowed cruiseleration
1795  real64 m_rCmax;
1796  //; max. allowed cruiseleration
1797  real64 m_rJmin;
1798  //; min. allowed jerk
1799  real64 m_rJmax;
1800  //; max. allowed jerk
1801  real64 m_rEpsilon;
1802  //; calculation epsilon
1803 
1804  // torque limitation
1805 
1810 
1811  uint64 m_uTickCount;
1812  //; bus tickcount at last ramp handle
1813  // target ticks calculation
1814  uint64 m_uTargetTicks;
1815  //; bus tickcount the actual move reaches the target
1816  uint64 m_uStartTicks;
1817  //; bus tickcount at target ticks calculation
1818  uint64 m_uStartTicks_;
1819  //; bus tickcount at target ticks calculation
1820  uint32 m_uBusTicksPerAxisTick;
1821  //; number of bus ticks per axis tick
1822  uint32 m_uNxtTicks;
1823  //; number of ticks the next job needs
1824  uint16 m_uIterCount;
1825  //; iteration counter
1826  uint16 m_uIterCountMax;
1827  //; max. ever reached iteration counter
1828  uint16 m_uStopAliveDelta;
1829  //; number of alive ticks during stop calculation
1830  uint16 m_uStopAliveDeltaMax;
1831  //; max. ever reached alive delta
1832  int16 m_iStoppingState;
1833  //; stopping state
1834  real64 m_rStoppingJerk;
1835 
1837  CINOSRampSegTra* m_pStopLiveSeg;
1856 
1857  // move safe
1858  bool m_bMoveSafeMin;
1859  //; actual move safe min valid
1860  real64 m_rMoveSafeMin;
1861  //; actual move safe min
1862  real64 m_rMoveSafeFact1;
1863  //; actual move safe factor for safe1
1864  real64 m_rMoveSafeFact2;
1865  //; actual move safe factor for safe2
1866 
1867  // backlash
1868 
1870  enum {
1871  eFlgBacklashCompensationRequired = 0x00000001,
1872  };
1876  real64 m_rBacklash;
1879 
1880  // safety
1881 
1882  #ifdef INOS_SAFETY_SUPPORT
1883  enum ESLSType {
1885  eSLSReduceAbsolute = 0, // Vmax = m_rSafetyLimit - m_rSLSValue
1886  eSLSReducePercent = 1, // Vmax = m_rSafetyLimit * (100.0 - m_rSLSValue) / 100.0
1887  eSLSReduceFixed = 2, // Vmax = m_rSLSValue;
1888  };
1889  ESLSType m_eSLSType;
1891  real64 m_rSLSValue;
1893  real64 m_rSLSJerk;
1895  real64 m_rSLSVmax;
1896 
1898  ESafetyFunction m_eSafetyFunction;
1900  uint8 m_uSafetyType;
1902  real64 m_rSafetyLimit;
1904  uint32 m_uSafetyDelay;
1905  #endif
1906 
1907  // mapping
1908  CINOSMapping* m_pMapping;
1909  //; pointer to actual mapping
1910  uint32 m_uMappingIndex;
1911  //; index this axis has in the actual mapping
1912  static char m_cStateCombo[494];
1913  //; ramp state INCO item text. Use 494 (=defMaxDataLength). I fear
1914  //; to include inco_com.h here, that's why a plain number is used)
1915 
1916  // timing
1917 
1930 
1931  // multi core
1932  uint8 m_uCoreId = DF_INOS_CORE_DEFAULT;
1933 
1934  // allow dynamic object handling (new/delete)
1936 };
1937 
1938 
1939 //------------------------------------------------------------------------------
1940 // class registration
1941 //------------------------------------------------------------------------------
1942 
1943 typedef CINOSBaseRamp *(*TCreateRamp)(const char* apAxisName);
1944 
1946 {
1947  // after this function you can register new ramps
1948  friend void _INI_0000_CINOSBaseRamp();
1949 
1950  //--- internals --------------------------------------------------------
1951 
1952  // private members
1953 private:
1954  // pointer to the first registered ramp
1955  static CINOSRegisterBaseRamp* m_pFirst;
1956  // pointer to the next ramp
1957  CINOSRegisterBaseRamp* m_pNext;
1958  // create funtion for the ramp
1959  TCreateRamp m_pCreate;
1960  // ramp type name
1961  const char* m_pType;
1962 
1963  //--- user interface ---------------------------------------------------
1964 
1965 public:
1966  // register a new ramp type
1967  CINOSRegisterBaseRamp(TCreateRamp apFunction, const char* apRampType);
1968 
1969  // create and return and new ramp instance
1970  static CINOSBaseRamp* GetRamp(const char* apType);
1971  // create and return and new ramp instance
1972  static CINOSBaseRamp* GetRamp(const char* apAxisName, const char* apType);
1973 };
1974 
1975 //------------------------------------------------------------------------------
1976 //--- helper macros ------------------------------------------------------------
1977 //------------------------------------------------------------------------------
1978 //
1979 #if defined(INOS_MULTICORE)
1980 #define INOS_RAMP_CORE_MISMATCH_IS_ERROR(ret) \
1981 if ((m_uCoreId != DF_INOS_CORE_DEFAULT) && (::GetCoreId() != m_uCoreId)) { \
1982  if (!(GetFlag() & DF_INOS_BASE_RAMP_FLAG_IGNORE_CORE)) { \
1983  iCoreMismatchError(); \
1984  return ret; \
1985  } \
1986 }
1987 #define INOS_RAMP_CORE_MISMATCH_IS_WARNING(ret) \
1988 if ((m_uCoreId != DF_INOS_CORE_DEFAULT) && (::GetCoreId() != m_uCoreId)) { \
1989  if (!(GetFlag() & DF_INOS_BASE_RAMP_FLAG_IGNORE_CORE)) { \
1990  iCoreMismatchWarning(); \
1991  return ret; \
1992  } \
1993 }
1994 #else
1995 #define INOS_RAMP_CORE_MISMATCH_IS_ERROR(ret)
1996 #define INOS_RAMP_CORE_MISMATCH_IS_WARNING(ret)
1997 #endif
1998 
1999 //------------------------------------------------------------------------------
2000 //--- fast math functions ------------------------------------------------------
2001 //------------------------------------------------------------------------------
2002 //
2003 extern double inos_sqrt(double adValue);
2004 //
2005 //------------------------------------------------------------------------------
2006 // end of file
2007 //------------------------------------------------------------------------------
2008 
2009 #endif // INC_CINOSBASERAMP_H
CINOSBus
Definition: cinosbus.h:564
SINOSBaseRampTrqLimitPoint::m_uNumber
uint32 m_uNumber
point number
Definition: cinosbaseramp.h:649
SINOSBaseRamp
Descriptor structure used to configure a ramp. It is usually defined in a corresponding xxx....
Definition: cinosbaseramp.h:219
SINOSRampParam::GetIgnoreCache
bool GetIgnoreCache()
returns true if ramp cache is ignored
Definition: cinosbaseramp.h:561
CINOSBaseRampParamSet::GetRegister
virtual CINCOObject * GetRegister(CINOSBaseRamp *apRamp)
return pointer to my inco object
SINOSBaseRamp::m_uSLSType
uint8 m_uSLSType
: SLS reduction type, see also http://doc.indel.ch/doku.php?id=software:embedded:inos:safety
Definition: cinosbaseramp.h:458
SINOSBaseRamp::m_rSmax
real64 m_rSmax
Maximal allowed position [units]. If m_rSmin and m_rSmax are both 0.0, the software limits are switch...
Definition: cinosbaseramp.h:315
CINOSBaseRamp::AppendBacklash
void AppendBacklash(CINOSRampJob *apJob, SINOSRampParam *apParam, real64 arBacklash)
calculate backlash compensation
SINOSBaseRamp::m_rVmaxSetup
real64 m_rVmaxSetup
Maximal allowed velocity [units/s] in all setup modes.
Definition: cinosbaseramp.h:327
SINOSBaseRamp::m_rVcmd
real64 m_rVcmd
The default commanded velocity [units]. Used if one starts a move without any given speed set.
Definition: cinosbaseramp.h:244
CINOSBaseRamp::GetTrqLimitAcceleration
SINOSBaseRampTrqLimit * GetTrqLimitAcceleration()
get torque limit acceleration
Definition: cinosbaseramp.h:1360
SINOSTimeCharacteristics
time characteristics of a move
Definition: cinosbaseramp.h:636
SINOSBaseRamp::m_rBmax
real64 m_rBmax
Maximal allowed deceleration [units/s].
Definition: cinosbaseramp.h:372
SINOSBaseRamp::m_rCmax
real64 m_rCmax
Maximal allowed cruiseleration [units/s^2], see also m_rCcmd.
Definition: cinosbaseramp.h:386
SINOSBaseRamp::m_rVmin
real64 m_rVmin
Minimal allowed velocity [units/s].
Definition: cinosbaseramp.h:319
CINOSBaseRamp::m_rStopLivePos
real64 m_rStopLivePos
current stop live pos
Definition: cinosbaseramp.h:1851
SINOSRampParam::m_rBcmd
real64 m_rBcmd
commanded deceleration
Definition: cinosbaseramp.h:534
CINOSBaseRamp::m_uTimStopCalcMin
uint32 m_uTimStopCalcMin
minimal number of ticks used for CalcStop
Definition: cinosbaseramp.h:1927
CINOSBaseRamp::m_pTrqLimitAcc
SINOSBaseRampTrqLimit * m_pTrqLimitAcc
torque limit points acceleration
Definition: cinosbaseramp.h:1807
CINOSBaseRamp::UpdatedMaximum
void UpdatedMaximum(real64 *apValue, real64 rOld, real64 rNew)
called whenever a max value was changed
CINOSBaseRamp::m_uTimStopCalcMax
uint32 m_uTimStopCalcMax
maximal number of ticks used for CalcStop
Definition: cinosbaseramp.h:1929
SINOSRampParam::SetIgnoreCache
void SetIgnoreCache()
ignore ramp cache
Definition: cinosbaseramp.h:555
SINOSBaseRampTrqLimitPoint
torque limitation point
Definition: cinosbaseramp.h:644
SINOSBaseRampTrqLimit::m_uDummy
uint32 m_uDummy
alignment dummy
Definition: cinosbaseramp.h:674
SINOSBaseRamp::m_uOptions
uint32 m_uOptions
Ramp options, see DF_INOS_BASE_RAMP_OPT_CHK_LIMITS, DF_INOS_BASE_RAMP_OPT_ENB_BASE,...
Definition: cinosbaseramp.h:443
SINOSRampDataEx::m_uFlags
uint32 m_uFlags
structure flags
Definition: cinosbaseramp.h:628
SINOSBaseRamp::m_rSLSJerk
real64 m_rSLSJerk
: SLS jerk reduction value, see also http://doc.indel.ch/doku.php?id=software:embedded:inos:safety
Definition: cinosbaseramp.h:427
SINOSRampParam::m_rCcmd
real64 m_rCcmd
commanded cruiseleration
Definition: cinosbaseramp.h:536
CINOSBaseAxis
Provides axis functionality.
Definition: cinosbaseaxis.h:693
CINOSBaseRamp::m_rStopLiveTime
real64 m_rStopLiveTime
current stop live time
Definition: cinosbaseramp.h:1849
INOS_OR
#define INOS_OR(variable, mask)
Definition: inosmacro.h:201
SINOSBaseRamp::m_rCycleTime
real64 m_rCycleTime
Axis cycletime the trajectory generator should work with [ms]. Do not configure this value in modern ...
Definition: cinosbaseramp.h:235
CINOSBaseRamp::GetTrqLimitDeceleration
SINOSBaseRampTrqLimit * GetTrqLimitDeceleration()
get torque limit deceleration
Definition: cinosbaseramp.h:1366
CINOSBaseRamp::m_rStopLiveSegB
real64 m_rStopLiveSegB
current stop live tra seg B
Definition: cinosbaseramp.h:1841
SINOSBaseRampTrqLimit::SINOSBaseRampTrqLimit
SINOSBaseRampTrqLimit(uint32 auNumber=0)
constructor
SINOSRampData
ramp data
Definition: cinosbaseramp.h:610
SINOSBaseRamp::m_rJm1cmd
real64 m_rJm1cmd
The default commanded middle1 jerk [units/s^3]. Used if one starts a move without any given speed set...
Definition: cinosbaseramp.h:277
SINOSBaseRamp::m_rJeemg
real64 m_rJeemg
The end jerk [units/s^3] used in all emergency stop situations after the constant deceleration phase....
Definition: cinosbaseramp.h:305
CINOSBaseRamp::SetTrqLimitAcceleration
void SetTrqLimitAcceleration(SINOSBaseRampTrqLimit *apLimit)
set torque limit acceleration
Definition: cinosbaseramp.h:1357
CINOSBaseRamp::m_uTimStopCalcAct
uint32 m_uTimStopCalcAct
actual number of ticks used for CalcStop
Definition: cinosbaseramp.h:1925
SINOSBaseRamp::m_rCmin
real64 m_rCmin
Minimal allowed cruiseleration [units/s^2], see also m_rCcmd.
Definition: cinosbaseramp.h:382
SINOSBaseRampTrqLimit::~SINOSBaseRampTrqLimit
~SINOSBaseRampTrqLimit()
destructor
SINOSRampParam::GetTemporary
bool GetTemporary()
return true if structure is temporary
Definition: cinosbaseramp.h:552
CINOSBaseRamp::m_rStopLiveSegJ3
real64 m_rStopLiveSegJ3
current stop live tra seg J3
Definition: cinosbaseramp.h:1845
CINOSBaseRamp::PrepareBacklash
bool PrepareBacklash(bool abPositiveMoveDirection, real64 &arBacklash)
prepare backlash compensation
CINOSBaseRamp::m_uTimMoveCalcMin
uint32 m_uTimMoveCalcMin
minimal number of ticks used for CalcMove
Definition: cinosbaseramp.h:1921
SINOSBaseRampTrqLimit::m_rA
real64 * m_rA
acceleration
Definition: cinosbaseramp.h:678
SINOSRampParam::DECLARE_DYNAMIC
DECLARE_DYNAMIC(SINOSRampParam)
dynamic object handling
CINOSBaseRamp
Definition: cinosbaseramp.h:760
SINOSBaseRamp::m_rJmax
real64 m_rJmax
Maximal allowed jerk [units/s^3].
Definition: cinosbaseramp.h:394
SINOSBaseRamp::m_rMiMTol
real64 m_rMiMTol
Move in move constant speed tolerance [sec]. In 'Move in Move' situations the internal optimisation a...
Definition: cinosbaseramp.h:404
SINOSBaseRampTrqLimitPoint::m_rV
real64 m_rV
velocity
Definition: cinosbaseramp.h:653
CINOSBaseRamp::m_rBacklashSlowmotion
real64 m_rBacklashSlowmotion
configured backlash slowmotion
Definition: cinosbaseramp.h:1878
SINOSBaseRamp::m_rBtrq
real64 m_rBtrq
Maximal allowed torque deceleration [units/s^2]. This parameter is deprecated. One should work with t...
Definition: cinosbaseramp.h:378
SINOSBaseRamp::m_rJcmd
real64 m_rJcmd
The default commanded jerk [units/s^3]. Used if one starts a move without any given speed set.
Definition: cinosbaseramp.h:265
SINOSBaseRamp::m_rJmin
real64 m_rJmin
Minimal allowed jerk [units/s^3].
Definition: cinosbaseramp.h:390
CINOSBaseRamp::m_pStopLiveSeg
CINOSRampSegTra * m_pStopLiveSeg
current stop live tra seg
Definition: cinosbaseramp.h:1837
SINOSBaseRamp::m_rJbcmd
real64 m_rJbcmd
The default commanded begin jerk [units/s^3]. Used if one starts a move without any given speed set....
Definition: cinosbaseramp.h:271
CINOSBaseRamp::m_rStopLiveSegDelta
real64 m_rStopLiveSegDelta
current stop live tra seg delta
Definition: cinosbaseramp.h:1847
SINOSBaseRamp::m_uDigits
uint8 m_uDigits
Number of digits to use in INCO explorer. This parameter has no functional meaning and has just displ...
Definition: cinosbaseramp.h:448
SINOSRampDataEx
extended ramp data
Definition: cinosbaseramp.h:625
SINOSBaseRamp::m_rBemg
real64 m_rBemg
The deceleration [units/s^2] used in all emergency stop situations.
Definition: cinosbaseramp.h:293
SINOSBaseRamp::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: cinosbaseramp.h:228
CINOSBaseRamp::SetTrqLimitDeceleration
void SetTrqLimitDeceleration(SINOSBaseRampTrqLimit *apLimit)
set torque limit deceleration
Definition: cinosbaseramp.h:1363
SINOSBaseRamp::m_rAmin
real64 m_rAmin
Minimal allowed acceleration [units/s].
Definition: cinosbaseramp.h:341
CINOSBaseRamp::m_uTimMoveCalcMax
uint32 m_uTimMoveCalcMax
maximal number of ticks used for CalcMove
Definition: cinosbaseramp.h:1923
SINOSBaseRamp::m_cName
inosName64 m_cName
Axis name.
Definition: cinosbaseramp.h:223
SINOSBaseRamp::m_rBcmd
real64 m_rBcmd
The default commanded deceleration [units/s^2]. Used if one starts a move without any given speed set...
Definition: cinosbaseramp.h:254
CINOSBaseRamp::m_rStopLiveSlowMotion
real64 m_rStopLiveSlowMotion
current stop live slowmotion
Definition: cinosbaseramp.h:1855
SINOSBaseRamp::m_rBacklash
real64 m_rBacklash
If backlash compensation is enabled, see also DF_INOS_BASE_RAMP_OPT_BACKLASH this parameter defines t...
Definition: cinosbaseramp.h:415
CINOSBaseRamp::m_pTrqLimitDec
SINOSBaseRampTrqLimit * m_pTrqLimitDec
torque limit points deceleration
Definition: cinosbaseramp.h:1809
SINOSBaseRampTrqLimit::m_uNumber
uint32 m_uNumber
number of points
Definition: cinosbaseramp.h:672
CINOSBaseRamp::m_rStopLiveSegV
real64 m_rStopLiveSegV
current stop live tra seg V
Definition: cinosbaseramp.h:1839
INOS_AND
#define INOS_AND(variable, mask)
Definition: inosmacro.h:210
SINOSBaseRamp::m_uCacheSize
uint8 m_uCacheSize
Internal moving cache size. Calculating a requested trajectory can be time consuming To reduce the us...
Definition: cinosbaseramp.h:454
SINOSBaseRampTrqLimitPoint::m_rA
real64 m_rA
acceleration
Definition: cinosbaseramp.h:655
SINOSBaseRampTrqLimit::operator==
bool operator==(const SINOSBaseRampTrqLimit &b) const
equal operator
Definition: cinosbaseramp.h:688
SINOSRampParam::m_rVcmd
real64 m_rVcmd
commanded velocity
Definition: cinosbaseramp.h:530
SINOSRampParam::m_uFlags
uint32 m_uFlags
additional flags
Definition: cinosbaseramp.h:547
CINOSBaseRampParamSet
Definition: cinosbaseramp.h:705
SINOSBaseRamp::m_rVmax
real64 m_rVmax
Maximal allowed velocity [units/s].
Definition: cinosbaseramp.h:323
SINOSBaseRamp::m_rScmd
real64 m_rScmd
The default commanded position [units].
Definition: cinosbaseramp.h:239
CINOSBaseRamp::UpdateSlowMotion
void UpdateSlowMotion(real64 arFactor=REAL64(0.0))
update job slowmotion if nessecary
SINOSBaseRamp::m_rVmaxInit
real64 m_rVmaxInit
Maximal allowed velocity [units/s] during initialisation.
Definition: cinosbaseramp.h:331
SINOSBaseRamp::m_rJm2cmd
real64 m_rJm2cmd
The default commanded middle2 jerk [units/s^3]. Used if one starts a move without any given speed set...
Definition: cinosbaseramp.h:283
SINOSBaseRamp::m_rAmax
real64 m_rAmax
Maximal allowed acceleration [units/s^2].
Definition: cinosbaseramp.h:345
SINOSBaseRampTrqLimit::m_rV
real64 * m_rV
velocity
Definition: cinosbaseramp.h:676
SINOSRampParam::m_uDummy
uint32 m_uDummy
8 bytes alignment dummy
Definition: cinosbaseramp.h:565
SINOSBaseRamp::m_rAcmd
real64 m_rAcmd
The default commanded acceleration [units/s]. Used if one starts a move without any given speed set.
Definition: cinosbaseramp.h:249
SINOSRampParam::m_rJcmd
real64 m_rJcmd[4]
commanded jerks
Definition: cinosbaseramp.h:538
SINOSRampParam::ClrIgnoreCache
void ClrIgnoreCache()
do not ignore ramp cache
Definition: cinosbaseramp.h:558
SINOSRampData::m_rJ
real64 m_rJ
jerk
Definition: cinosbaseramp.h:619
CINOSRegisterBaseRamp
Definition: cinosbaseramp.h:1945
CINOSBaseRamp::CheckPullUnderrun
bool CheckPullUnderrun()
return true if pull would underrun
Definition: cinosbaseramp.h:1339
SINOSRampParam::m_rTime
real64 m_rTime
time (RMS: relax time, P5: move time)
Definition: cinosbaseramp.h:542
CINOSPhysicalAxis
Provides physical aka real axis functionality.
Definition: cinosphysicalaxis.h:288
SINOSRampParam::m_rAcmd
real64 m_rAcmd
commanded acceleration
Definition: cinosbaseramp.h:532
SINOSRampParam::m_rJCcmd
real64 m_rJCcmd
commanded cruise jerk
Definition: cinosbaseramp.h:540
SINOSBaseRamp::m_rAmaxPull
real64 m_rAmaxPull
Maximal allowed acceleration during pull [units/s^2] This value is also used to detect pull underruns...
Definition: cinosbaseramp.h:354
SINOSBaseRamp::m_rBmin
real64 m_rBmin
Minimal allowed deceleration [units/s].
Definition: cinosbaseramp.h:368
CINOSBaseRamp::m_rBacklash
real64 m_rBacklash
configured backlash
Definition: cinosbaseramp.h:1876
SINOSBaseRamp::m_rJemg
real64 m_rJemg
The jerk [units/s^3] used in all emergency stop situations before the deceleration phase....
Definition: cinosbaseramp.h:299
CINOSBaseRamp::GetCoreId
uint8 GetCoreId()
get core id the axis is running on
Definition: cinosbaseramp.h:1375
SINOSBaseRampTrqLimit
torque limitation
Definition: cinosbaseramp.h:669
CINOSBaseRamp::GetRequestedJobSlowMotion
real64 GetRequestedJobSlowMotion(CINOSRampJob *apJob)
get requested job slowmotion
CINOSBaseRamp::m_rStopLiveSegJ2
real64 m_rStopLiveSegJ2
current stop live tra seg J2
Definition: cinosbaseramp.h:1843
SINOSBaseRampTrqLimitPoint::m_cName
inosName32 m_cName
axis name
Definition: cinosbaseramp.h:647
CINOSBaseRamp::m_rStopLiveDelta
real64 m_rStopLiveDelta
current stop live delta
Definition: cinosbaseramp.h:1853
SINOSBaseRamp::m_rVtrq
real64 m_rVtrq
Maximal allowed torque velocity [units/s]. This parameter is deprecated. One should work with torque ...
Definition: cinosbaseramp.h:337
SINOSBaseRampTrqLimitPointDec
torque limitation point deceleration
Definition: cinosbaseramp.h:664
SINOSBaseRamp::m_rSmin
real64 m_rSmin
Minimal allowed position [units]. If m_rSmin and m_rSmax are both 0.0, the software limits are switch...
Definition: cinosbaseramp.h:310
SINOSBaseRampTrqLimitPoint::m_uDummy
uint32 m_uDummy
alignment dummy
Definition: cinosbaseramp.h:651
CINOSBaseRamp::m_uTimMoveCalcAct
uint32 m_uTimMoveCalcAct
actual number of ticks used for CalcMove
Definition: cinosbaseramp.h:1919
CINOSBaseRamp::SetupTrqLimit
void SetupTrqLimit(real64 arAmax, real64 arVmax, real64 arAtrq, real64 arVtrq, class CINCOTable *apPoints, SINOSBaseRampTrqLimit *&apLimit)
setup torque limit
DECLARE_DYNAMIC
#define DECLARE_DYNAMIC(aClass)
Definition: cinospartitionmemory.h:328
SINOSRampParam::SetTemporary
void SetTemporary()
mark structure as temporary
Definition: cinosbaseramp.h:549
SINOSBaseRamp::m_rArms
real64 m_rArms
Maximal allowed rms acceleration [units/s^2].
Definition: cinosbaseramp.h:358
SINOSBaseRampTrqLimitPointAcc
torque limitation point acceleration
Definition: cinosbaseramp.h:659
CINOSBaseRamp::GetJobOptions
uint32 GetJobOptions(bool abPositive)
get job options from given parameters
SINOSRampParam::m_rSlow
real64 m_rSlow
Definition: cinosbaseramp.h:545
SINOSRampParam
ramp parameters
Definition: cinosbaseramp.h:511
SINOSBaseRamp::m_rSLSValue
real64 m_rSLSValue
: SLS reduction value, see also http://doc.indel.ch/doku.php?id=software:embedded:inos:safety
Definition: cinosbaseramp.h:423
SINOSRampData::m_rV
real64 m_rV
velocity
Definition: cinosbaseramp.h:615
CINOSBaseRamp::UpdateTrqLimit
void UpdateTrqLimit()
update torque limit configuration
SINOSRampDataEx::m_pNext
SINOSRampDataEx * m_pNext
pointer to next data object in chain
Definition: cinosbaseramp.h:630
SINOSRampData::m_rA
real64 m_rA
acceleration
Definition: cinosbaseramp.h:617
SINOSBaseRamp::m_rAtrq
real64 m_rAtrq
Maximal allowed torque acceleration [units/s^2]. This parameter is deprecated. One should work with t...
Definition: cinosbaseramp.h:364
SINOSBaseRamp::m_rCcmd
real64 m_rCcmd
The default commanded cruiseleration [units/s^2]. The cruiseleration is used in move in move or speed...
Definition: cinosbaseramp.h:260
DF_INOS_CORE_DEFAULT
#define DF_INOS_CORE_DEFAULT
Definition: inosdefine.h:175
SINOSBaseRamp::m_rJecmd
real64 m_rJecmd
The default commanded end jerk [units/s^3]. Used if one starts a move without any given speed set....
Definition: cinosbaseramp.h:289
SINOSRampData::m_rS
real64 m_rS
position
Definition: cinosbaseramp.h:613
CINOSBaseRamp::GetTimeCharacteristics
virtual SINOSTimeCharacteristics GetTimeCharacteristics(real64 arPosition, real64 arDelta, SINOSRampParam *apParam)
Calculate time characteristics of a move.
CINOSBaseRamp::m_uBacklashFlags
uint32 m_uBacklashFlags
backlash flags
Definition: cinosbaseramp.h:1874
SINOSBaseRamp::m_rBacklashSlowmotion
real64 m_rBacklashSlowmotion
: Backlash compensation slowmotion factor, see also m_rBacklash
Definition: cinosbaseramp.h:419