// Here we use 'real encoder with direct microstepping'. Further the axis are scaled
// in this configuration, the PID gives 'speed' to iqCmd this is multiplied with 0.25 (SlipGain) to result in the phasePos
// The torque is constant given as idCmd
// the PID regulates the position by setting speed, if the motor is not at the desired position

// x einraster == -> x-N and x-S poles =2*x poles -> 1 rev = x*2048 ustep=phase_step
// changing the polarity from S-N-S (one pole cycle) are 2048 phase_step. phase_step is also called ustep

//Mot 1: Rotation stage LS Mecapion MDM-DC06DNC0H    32 poles = 1 rev = 16*2048=32768 phase_step
//Enc 1: Rotation stage LS Mecapion                  1 rev = 1048576 enc_steps

//Mot 2: Stage X Parker MX80L D11 25mm               one pole cycle = 13mm = 2048 phase_step
//Enc 2: Stage X Parker MX80L D11 inc_enc 20nm       one pole cycle = 13mm = 650000 enc_step (20nm/enc_step)

//Mot 3: Stage Y Parker MX80L D11 25mm               one pole cycle = 13mm = 2048 phase_step
//Enc 3: Stage Y Parker MX80L D11 inc_enc 20nm       one pole cycle = 13mm = 650000 enc_step (20nm/enc_step)

//Mot 4: Test Servo: Trinamic QBL 4208 motor                   8 poles 1 rev = 4*2048=8192 phase_step
//Enc 4: Test Servo: Incremental encoder mounted with motor 1  1 rev = 2000 enc count (500 inc_ quadrature encoder)
//Enc 5: Test Servo: Trinamic QBL 4208 hall sensor             1 rev = 24 enc count (hall sensor encoder)

//Mot 6: Test Stepper: Vextra PK244M                          200 poles 1 rev = 100*2048 phase_step (2 stepper motor)
//Enc 6: Test Stepper: inc_enc                                1 rev = 1600 enc_step

//Mot 7: Test Stepper: Vextra PK244M                           200 poles 1 rev = 100*2048 phase_step (2 stepper motor)
//Enc 7: Test Stepper: ssi_enc multiturn                       1 rev = 4096 enc_step

$$$***
!common()
//rot stage
//---------
//use 360'000 for 360 deg as motor unit
!encoder_sim(enc=1,tbl=9,mot=9,posSf=360000./32768)
!encoder_biss(enc=1,tbl=1,mot=1,numBits=20,posSf=360000./1048576)
!motor(mot=1,dirCur=200,contCur=500,peakCur=1000,timeAtPeak=.5,JogSpeed=8.,numPhase=3,invDir=True,servoSf=32768/360000.)
//#1j:90000 // = moves 90 deg


//Stage X Parker MX80L
//--------------------
//use um as motor unit
!encoder_sim(enc=2,tbl=10,mot=10,posSf=13000./2048)
!encoder_inc(enc=2,tbl=2,mot=2,posSf=13000./650000)
!motor(mot=2,dirCur=400,contCur=500,peakCur=2400,timeAtPeak=1,IiGain=1,IpfGain=0,IpbGain=2,JogSpeed=1.,numPhase=3,invDir=True,servoSf=2048/13000.)
//#2j:1000 -> moves 1000um


//Stage Y Parker MX80L
//--------------------
//use um as motor unit
!encoder_sim(enc=3,tbl=11,mot=11,posSf=13000./2048)
!encoder_inc(enc=3,tbl=3,mot=3,posSf=13000./650000)
!motor(mot=3,dirCur=400,contCur=500,peakCur=2400,timeAtPeak=1,IiGain=1,IpfGain=0,IpbGain=2,JogSpeed=1.,numPhase=3,invDir=True,servoSf=2048/13000.)
//#3j:1000 -> moves 1000um


//Test Servo: Trinamic QBL 4208 motor
//-----------------------------------
//use 360 for 360 deg as motor unit
!encoder_sim(enc=4,tbl=12,mot=12,posSf=360./8192)
!encoder_inc(enc=4,tbl=4,mot=4,posSf=360./2000) // incremental encoder
!encoder_inc(enc=5,tbl=13,mot=13,encctrl=15,posSf=360./24) //Hall sensor encoder
!motor(mot=4,dirCur=400,contCur=500,peakCur=1000,timeAtPeak=.5,JogSpeed=8.,numPhase=3,servoSf=8192/360.)
//#4j:360 -> moves 1 rev


//Test Stepper: Vextra PK244M inc_enc
//-----------------------------------
//use 360 for 360 deg as motor unit
!encoder_sim(enc=6,tbl=14,mot=14,posSf=360./204800)
!encoder_inc(enc=6,tbl=6,mot=6,posSf=360./1600)
!motor(mot=6,dirCur=200,contCur=400,peakCur=600,timeAtPeak=1,numPhase=2,invDir=False,servoSf=204800/360.)
//#6j:360 -> moves 1 rev


//Test Stepper: Vextra PK244M abs_enc
//-----------------------------------
//use 360 for 360 deg as motor unit -> JogSpeed=2048./204800*360
!encoder_sim(enc=7,tbl=7,mot=7,posSf=360./204800)
!encoder_ssi(enc=7,tbl=15,mot=15,numBits=25,posSf=360./4096)
!motor(mot=7,dirCur=100,contCur=400,peakCur=600,timeAtPeak=1,numPhase=2,invDir=False,servoSf=204800/360.,JogSpeed=3.6)
//#7j:360 -> moves 1 rev

