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