Messa in campo 4 file - 26/06/2020 Francia

Dependencies:   mbed X_NUCLEO_IHM03A1_for

Fork of FORIGO_Modula_V7_3_VdcStep_maggio2020 by Francesco Pistone

Committer:
nerit
Date:
Mon Mar 25 15:42:04 2019 +0000
Revision:
13:d1030d4e51a8
Parent:
8:310f9e4eac7b
Child:
14:e2b5efa06c41
Inserito stabilizzazione velocit trattore dopo 5 secondi di lavoro e con variazione compresa tra -0,2 e +0,2mt/s. Aggiunto risincronizzazione encoder virtuale con encoder DC. Inserito controllo di corrente DC. Inserito interpolazione duty DC.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nerit 3:a469bbd294b5 1 // define constants
nerit 3:a469bbd294b5 2 const double Pi = 3.141592654f;
nerit 13:d1030d4e51a8 3 // l'encoder del DC produce 51 impulsi ogni 2 giri sull'albero lento
nerit 13:d1030d4e51a8 4 const double dcPulseTurn = 25.5f;
nerit 3:a469bbd294b5 5
nerit 3:a469bbd294b5 6 // define logic UI variables which NEED TO BE SET FROM UI
nerit 3:a469bbd294b5 7 // *** speed wheel
nerit 3:a469bbd294b5 8 double speedWheelDiameter = 0.300f; // variable for tractor speed calculation (need to be set from UI) ( Unit= meters )
nerit 3:a469bbd294b5 9 double speedWheelPulse = 18.0f; // variable which define the number of pulse each turn of tractor speed wheel (need to be set from UI)
nerit 3:a469bbd294b5 10 // *** seeding wheel
nerit 3:a469bbd294b5 11 double seedWheelDiameter = 0.75f; // seed wheel diameter setting
nerit 3:a469bbd294b5 12 double seedWheelMotorSteps = 3200.0f; // seed wheel motor steps without reduction (defined from driver)
nerit 3:a469bbd294b5 13 double seedWheelRPM=0.0f; // number of turn per minute of seed wheel
nerit 3:a469bbd294b5 14 double seedWhellFrequency=0.0f; // seed wheel frequency which is function of tractor speed
nerit 3:a469bbd294b5 15 double seedWheelPeriod=0.0f; // seed wheel pulse period
nerit 3:a469bbd294b5 16
nerit 3:a469bbd294b5 17 double deepOfSeed=0.00f; // deep of seeding
nerit 3:a469bbd294b5 18 double oldSeedWheelPeriod=0.0f;
nerit 8:310f9e4eac7b 19 double pickNumber = 8.0f; // numero di becchi installati sulla ruota di semina
nerit 5:2a3a64b52f54 20 double cellsNumber = 15.0f; // numero di celle del tamburo
nerit 3:a469bbd294b5 21
nerit 3:a469bbd294b5 22 double TBmotorSteps = 1600.0f; // TB wheel motor steps without reduction (defined from driver)
nerit 3:a469bbd294b5 23 //double TBreductionRatio = 1.65625f; // TB mechanical reduction ratio
nerit 3:a469bbd294b5 24 #if defined(Zucca)
nerit 3:a469bbd294b5 25 double TBreductionRatio = 3.00f; // TB mechanical reduction ratio
nerit 3:a469bbd294b5 26 #else
nerit 3:a469bbd294b5 27 double TBreductionRatio = 1.65625f; // TB mechanical reduction ratio
nerit 3:a469bbd294b5 28 #endif
nerit 3:a469bbd294b5 29 double SDreductionRatio =2.5714f; // seed wheel machanical reduction ratio
nerit 3:a469bbd294b5 30 double TBdeltaStep = 0.0f; // steps of advance for manage tb motor respect sd motor
nerit 3:a469bbd294b5 31 double K_WheelRPM =0.0f;
nerit 3:a469bbd294b5 32 double K_WhellFrequency=0.0f;
nerit 3:a469bbd294b5 33 double K_TBfrequency = 0.0f;
nerit 3:a469bbd294b5 34 double K_percentuale = 0.0f;
nerit 3:a469bbd294b5 35 double timeIntraPick = 0.0f;
nerit 3:a469bbd294b5 36 double teoryTimeIntraPick = 0.0f;
nerit 3:a469bbd294b5 37 double intraPickDistance = 0.0f;
nerit 3:a469bbd294b5 38
nerit 3:a469bbd294b5 39 uint16_t periodoSD = 1000;
nerit 3:a469bbd294b5 40 double dcStopDuty = 0.0f;
nerit 3:a469bbd294b5 41 double dcMinDuty = 0.0f; // definisce il duty cycle minimo alla partenza (corrisponde alla tensione minima di rotazione)
nerit 3:a469bbd294b5 42 double dcMaxDuty = 1.0f; // definisce il duty cycle al massimo della velocità
nerit 3:a469bbd294b5 43 double dcMinSpeed = 0.65f;
nerit 3:a469bbd294b5 44 double dcMaxSpeed = 1.00f;
nerit 3:a469bbd294b5 45 double dcStarting = 0.30f;
nerit 3:a469bbd294b5 46 double fixedStepGiroSD = 9000.0f; // numero di suddivisioni angolo giro della ruota di semina
nerit 8:310f9e4eac7b 47 double minWorkSpeed=0.19f;//0.138888f; //metri al secondo pari a 0,5Kmh
nerit 3:a469bbd294b5 48 double maxWorkSpeed=1.277777f; //metri al secondo pari a 4.6Kmh
nerit 3:a469bbd294b5 49 double tabComan[22]={0.25,0.255,0.260,0.265,0.27,0.28,0.3107,0.314,0.34,0.3655,0.391,0.4165,0.4335,0.459,0.51,0.5525,0.595};
nerit 3:a469bbd294b5 50 double tabSpeed[22]={0.10,0.14,0.19,0.22,0.25,0.28,0.33,0.36,0.41,0.45,0.49,0.55,0.59,0.62,0.75,0.80,0.82};
nerit 3:a469bbd294b5 51
nerit 3:a469bbd294b5 52 //double minPosSpeed=0.20f; // metri/secondo (0,20 = 0,72KmH)
nerit 8:310f9e4eac7b 53 double minSeedSpeed=0.18f; // attiva il LowSpeed mt/s (0,28 = 1,0KmH)
nerit 3:a469bbd294b5 54 double speedForCorrection=0.25f;
nerit 3:a469bbd294b5 55 int cicliAspettaStart = 2;
nerit 3:a469bbd294b5 56 double avvioGradi=5.0f;
nerit 3:a469bbd294b5 57 double angoloFase = 3.0f;