Francesco Pistone
/
FORIGO_Modula_V6_R2C_DE_HwV5
vo
variables.hpp@5:3b95bbfe2dc9, 2018-07-04 (annotated)
- Committer:
- nerit
- Date:
- Wed Jul 04 05:51:03 2018 +0000
- Revision:
- 5:3b95bbfe2dc9
- Parent:
- 4:d32258ec411f
- Child:
- 6:3fca0ca1949e
Quinconce gestito con doppio sincro da master e versione installata nella macchina per Olanda a 3 elementi
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nerit | 0:1e09cd7d66b4 | 1 | int zeroRequestBuf=0; |
nerit | 0:1e09cd7d66b4 | 2 | int runRequestBuf=0; |
nerit | 0:1e09cd7d66b4 | 3 | |
nerit | 0:1e09cd7d66b4 | 4 | // define cycle variable related to the external command |
nerit | 0:1e09cd7d66b4 | 5 | int oldTractorSpeedRead=0; |
nerit | 0:1e09cd7d66b4 | 6 | int startCycle=0; // activate motors and functions |
nerit | 0:1e09cd7d66b4 | 7 | int enableCycle=0; // enable regular cycle |
nerit | 0:1e09cd7d66b4 | 8 | int zeroCycle=0; // azzeramento motori richiesto |
nerit | 0:1e09cd7d66b4 | 9 | int OldStartCycle=0; // use for triggering command change |
nerit | 0:1e09cd7d66b4 | 10 | int OldEnableCycle=0; |
nerit | 0:1e09cd7d66b4 | 11 | int oldZeroCycle=0; // memoria azzeramento motori su richiesta |
nerit | 0:1e09cd7d66b4 | 12 | int zeroCycleEnd=0; // ciclo di azzeramento completato |
nerit | 0:1e09cd7d66b4 | 13 | int zeroTrigger=0; |
nerit | 0:1e09cd7d66b4 | 14 | int TBzeroPinInput=0; // segnale invertito micro tamburo |
nerit | 0:1e09cd7d66b4 | 15 | int seedWheelZeroPinInput=0; // segnale invertito sensore ruota di semina |
nerit | 0:1e09cd7d66b4 | 16 | int SD_faultA=0; |
nerit | 0:1e09cd7d66b4 | 17 | int SD_faultB=0; |
nerit | 0:1e09cd7d66b4 | 18 | int DC_brake=1; |
nerit | 0:1e09cd7d66b4 | 19 | int DC_forward=1; |
nerit | 0:1e09cd7d66b4 | 20 | |
nerit | 0:1e09cd7d66b4 | 21 | |
nerit | 0:1e09cd7d66b4 | 22 | int oldFaseLavoro=0; |
nerit | 0:1e09cd7d66b4 | 23 | |
nerit | 0:1e09cd7d66b4 | 24 | // define logic internal variables |
nerit | 0:1e09cd7d66b4 | 25 | double tractorSpeed_MtS_timed=0.0f; // tractor speed calculated from pulse interval time |
nerit | 0:1e09cd7d66b4 | 26 | double speedForDisplay[5]={0.0f,0.0f,0.0f,0.0f,0.0f}; |
nerit | 0:1e09cd7d66b4 | 27 | double totalSpeed=0.0f; |
nerit | 0:1e09cd7d66b4 | 28 | double OLDpulseSpeedInterval=1000.01f; // tractor speed calculated from pulse interval time |
nerit | 0:1e09cd7d66b4 | 29 | double pulseDistance=0.0f; // linear space between pulse |
nerit | 0:1e09cd7d66b4 | 30 | double pulseDistanceCalc=0.0f; |
nerit | 0:1e09cd7d66b4 | 31 | double speedPerimeter=0.0f; // perimeter of tractor speed wheel |
nerit | 0:1e09cd7d66b4 | 32 | double seedPerimeter=0.0f; // perimeter of seed wheel |
nerit | 0:1e09cd7d66b4 | 33 | double mediaSpeed[5]={0.0f,0.0f,0.0f,0.0f,0.0f}; |
nerit | 0:1e09cd7d66b4 | 34 | int pntMedia=0; |
nerit | 0:1e09cd7d66b4 | 35 | int actualPulseReadTimer=0; // timer read at previous pulse |
nerit | 0:1e09cd7d66b4 | 36 | double pulseSpeedInterval=0.0f; // delta time of pulse |
nerit | 0:1e09cd7d66b4 | 37 | int lastPulseRead=0; |
nerit | 0:1e09cd7d66b4 | 38 | int oldLastPulseRead=0; |
nerit | 0:1e09cd7d66b4 | 39 | int pulseRised=0; // pulse from speed wheel occured. Define when is possible to determine speed of up down motor. |
nerit | 0:1e09cd7d66b4 | 40 | int pulseRised1 = 0; |
nerit | 0:1e09cd7d66b4 | 41 | int pulseRised2 = 0; |
nerit | 0:1e09cd7d66b4 | 42 | // Set from interrupt routine and Reset from main after up down motor speed calculated |
nerit | 0:1e09cd7d66b4 | 43 | double rapportoRuote = 0.0f; |
nerit | 0:1e09cd7d66b4 | 44 | double TBrpm = 0.0f; |
nerit | 0:1e09cd7d66b4 | 45 | double TBfrequency = 0.0f; |
nerit | 0:1e09cd7d66b4 | 46 | double TBperiod = 0.0f; |
nerit | 0:1e09cd7d66b4 | 47 | double oldPeriodoTB = 0.0f; |
nerit | 0:1e09cd7d66b4 | 48 | int SDzeroCyclePulse=0; |
nerit | 0:1e09cd7d66b4 | 49 | int TBzeroCyclePulse=0; |
nerit | 0:1e09cd7d66b4 | 50 | int SDzeroed=0; |
nerit | 0:1e09cd7d66b4 | 51 | int TBzeroed=0; |
nerit | 0:1e09cd7d66b4 | 52 | int oldOnSDzero=0; |
nerit | 0:1e09cd7d66b4 | 53 | int oldOnTBzero=0; |
nerit | 0:1e09cd7d66b4 | 54 | int oldOffSDzero=0; |
nerit | 0:1e09cd7d66b4 | 55 | int oldOffTBzero=0; |
nerit | 0:1e09cd7d66b4 | 56 | int SDzeroPinTrig=0; |
nerit | 0:1e09cd7d66b4 | 57 | int TBzeroPinTrig=0; |
nerit | 0:1e09cd7d66b4 | 58 | int SDzeroDebounced=0; |
nerit | 0:1e09cd7d66b4 | 59 | int SDrunZero=0; |
nerit | 0:1e09cd7d66b4 | 60 | int TBrunZero=0; |
nerit | 0:1e09cd7d66b4 | 61 | int syncroCheck=0; |
nerit | 0:1e09cd7d66b4 | 62 | double memoStepTB=0.0f; |
nerit | 0:1e09cd7d66b4 | 63 | double erroreSyncro=0.0f; |
nerit | 0:1e09cd7d66b4 | 64 | double errorePercentuale=1.0f; |
nerit | 0:1e09cd7d66b4 | 65 | int oldSeedWheelZeroPinInput=0; |
nerit | 0:1e09cd7d66b4 | 66 | int oldTBzeroPinInput=0; |
nerit | 0:1e09cd7d66b4 | 67 | int stopCicloTB = 0; |
nerit | 0:1e09cd7d66b4 | 68 | int startCicloTB = 0; |
nerit | 0:1e09cd7d66b4 | 69 | int cicloTbinCorso = 0; |
nerit | 0:1e09cd7d66b4 | 70 | int beccoPronto =0; |
nerit | 0:1e09cd7d66b4 | 71 | int memoIntraPick=0; |
nerit | 0:1e09cd7d66b4 | 72 | |
nerit | 0:1e09cd7d66b4 | 73 | double realSpeed = 0.0f; |
nerit | 0:1e09cd7d66b4 | 74 | double realGiroSD = 0.0f; |
nerit | 0:1e09cd7d66b4 | 75 | double tempoBecco = 0.0f; |
nerit | 0:1e09cd7d66b4 | 76 | double frequenzaReale = 0.0f; |
nerit | 0:1e09cd7d66b4 | 77 | double semiPeriodoReale = 0.0f; |
nerit | 0:1e09cd7d66b4 | 78 | double tempoTraBecchi_mS = 0.0f; |
nerit | 0:1e09cd7d66b4 | 79 | double tempoGiroSD = 0.0f; |
nerit | 0:1e09cd7d66b4 | 80 | |
nerit | 0:1e09cd7d66b4 | 81 | // variable for speed and step calculation |
nerit | 0:1e09cd7d66b4 | 82 | uint32_t prePosSD=0; // actual position of seed wheel (step of motor) |
nerit | 0:1e09cd7d66b4 | 83 | uint32_t SDactualPosition=0; // actual position of seed wheel (step of motor) |
nerit | 0:1e09cd7d66b4 | 84 | uint32_t TBactualPosition=0; |
nerit | 5:3b95bbfe2dc9 | 85 | uint32_t posForQuinc=0; |
nerit | 0:1e09cd7d66b4 | 86 | |
nerit | 0:1e09cd7d66b4 | 87 | int cycleStopRequest=0; // when cycle end request the zero of SD and UD |
nerit | 0:1e09cd7d66b4 | 88 | |
nerit | 0:1e09cd7d66b4 | 89 | double duty_DC=0.0f; |
nerit | 0:1e09cd7d66b4 | 90 | double oldDuty_DC=0.0f; |
nerit | 0:1e09cd7d66b4 | 91 | |
nerit | 0:1e09cd7d66b4 | 92 | double dcActualDuty = 0.0f; // valore di lavoro del duty cycle |
nerit | 4:d32258ec411f | 93 | double olddcActualDuty = 0.0f; // valore di lavoro del duty cycle |
nerit | 0:1e09cd7d66b4 | 94 | double correzione = 0.0f; |
nerit | 0:1e09cd7d66b4 | 95 | double periodo =0.0f; |
nerit | 0:1e09cd7d66b4 | 96 | double ePpos = 0.0f; |
nerit | 0:1e09cd7d66b4 | 97 | int aspettaStart=1; |
nerit | 0:1e09cd7d66b4 | 98 | int countCicli=0; |
nerit | 0:1e09cd7d66b4 | 99 | uint32_t fase = 0; |
nerit | 0:1e09cd7d66b4 | 100 | |
nerit | 0:1e09cd7d66b4 | 101 | int clocca=0; |
nerit | 0:1e09cd7d66b4 | 102 | int enableSpeed=0; |
nerit | 0:1e09cd7d66b4 | 103 | double speedOfSeedWheel =0.0f; |
nerit | 0:1e09cd7d66b4 | 104 | int lowSpeed = 0; |
nerit | 0:1e09cd7d66b4 | 105 | double valore=0.0f; |
nerit | 0:1e09cd7d66b4 | 106 | //char val1[8]={0,0,0,0,0,0,0,0}; |
nerit | 0:1e09cd7d66b4 | 107 | |
nerit | 0:1e09cd7d66b4 | 108 | uint8_t enableSimula=0; |
nerit | 0:1e09cd7d66b4 | 109 | uint8_t speedSimula=0; |
nerit | 0:1e09cd7d66b4 | 110 | uint8_t avviaSimula=0; |
nerit | 0:1e09cd7d66b4 | 111 | double oldSimulaSpeed=0.0f; |
nerit | 0:1e09cd7d66b4 | 112 | int selezionato =0; |
nerit | 0:1e09cd7d66b4 | 113 | int simOk=0; |
nerit | 0:1e09cd7d66b4 | 114 | |
nerit | 0:1e09cd7d66b4 | 115 | float SD_CurrentAnalog=0.0f; // valore di corrente sull'ingresso |
nerit | 0:1e09cd7d66b4 | 116 | float SD_CurrentScaled=0.0f; // valore di corrente convertito in scala |
nerit | 0:1e09cd7d66b4 | 117 | float SD_CurrentFactor=40.0f; // fattore di scala sensore 40mV/A |
nerit | 0:1e09cd7d66b4 | 118 | float SD_CurrentPeak=0.0f; // valore massimo corrente |
nerit | 0:1e09cd7d66b4 | 119 | float SD_CurrentMid=0.0f; // valore medio corrente |
nerit | 0:1e09cd7d66b4 | 120 | float SD_CurrentLast=0.0f; // valore precedente corrente |
nerit | 0:1e09cd7d66b4 | 121 | float SD_CurrentStart=0.0f; // valore a vuoto corrente (circa il 50% della tensione di alimentazione del sensore) |
nerit | 0:1e09cd7d66b4 | 122 | bool reduceCurrent=false; |
nerit | 0:1e09cd7d66b4 | 123 | bool incrementCurrent=false; |
nerit | 0:1e09cd7d66b4 | 124 | double boostDcOut=0.0f; |
nerit | 0:1e09cd7d66b4 | 125 | |
nerit | 0:1e09cd7d66b4 | 126 | float SD_analogMatrix[21]={0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f}; |
nerit | 0:1e09cd7d66b4 | 127 | int SD_analogIndex[11]={0,0,0,0,0,0,0,0,0,0}; |
nerit | 0:1e09cd7d66b4 | 128 | int frenata=0; |
nerit | 0:1e09cd7d66b4 | 129 | int accensione=1; |
nerit | 0:1e09cd7d66b4 | 130 | double SDsectorStep =0.0f; |
nerit | 0:1e09cd7d66b4 | 131 | double TBsectorStep = 0.0f; |
nerit | 0:1e09cd7d66b4 | 132 | double KcorT = 0.0f; |
nerit | 0:1e09cd7d66b4 | 133 | |
nerit | 0:1e09cd7d66b4 | 134 | int trigSD=0; |
nerit | 0:1e09cd7d66b4 | 135 | int trigTB=0; |
nerit | 0:1e09cd7d66b4 | 136 | int inhibit=0; |
nerit | 0:1e09cd7d66b4 | 137 | int trigCicli=0; |
nerit | 0:1e09cd7d66b4 | 138 | int avvicinamento=0; |
nerit | 0:1e09cd7d66b4 | 139 | int lowSpeedRequired=0; |
nerit | 0:1e09cd7d66b4 | 140 | |
nerit | 0:1e09cd7d66b4 | 141 | uint8_t alarmHighRegister=0x00; |
nerit | 0:1e09cd7d66b4 | 142 | uint8_t alarmLowRegister=0x00; |
nerit | 0:1e09cd7d66b4 | 143 | double TBgiroStep=0.0f; |
nerit | 0:1e09cd7d66b4 | 144 | int firstStart=1; |
nerit | 0:1e09cd7d66b4 | 145 | int timeHole=0; |
nerit | 0:1e09cd7d66b4 | 146 | int memoTimeHole=0; |
nerit | 0:1e09cd7d66b4 | 147 | int lockStart=0; |
nerit | 0:1e09cd7d66b4 | 148 | |
nerit | 0:1e09cd7d66b4 | 149 | uint8_t quincStart=0; |
nerit | 0:1e09cd7d66b4 | 150 | uint8_t oldQuincIn=0; |
nerit | 0:1e09cd7d66b4 | 151 | double scostamento = 0.0f; |
nerit | 0:1e09cd7d66b4 | 152 | uint8_t quincEnable=0; |
nerit | 0:1e09cd7d66b4 | 153 | uint8_t quincCnt=0; |
nerit | 0:1e09cd7d66b4 | 154 | double percento=0.0f; |
nerit | 0:1e09cd7d66b4 | 155 | uint32_t masterSinc=0; |
nerit | 5:3b95bbfe2dc9 | 156 | uint32_t mast2_Sinc=0; |
nerit | 0:1e09cd7d66b4 | 157 | bool quincClock=false; |
nerit | 1:e88bf5011af6 | 158 | double oldQuincTimeSD=0.0f; |
nerit | 4:d32258ec411f | 159 | uint8_t sincroQui=0; |
nerit | 4:d32258ec411f | 160 | uint8_t quincPIDminus=0; |
nerit | 4:d32258ec411f | 161 | uint8_t quincPIDplus=0; |
nerit | 4:d32258ec411f | 162 | uint8_t quincLIMminus=0; |
nerit | 4:d32258ec411f | 163 | uint8_t quincLIMplus=0; |
nerit | 4:d32258ec411f | 164 | double memoCorrCorr=0.0f; |
nerit | 5:3b95bbfe2dc9 | 165 | double speedFromMaster=0.0f; |
nerit | 5:3b95bbfe2dc9 | 166 | uint8_t quincSector=0; |
nerit | 5:3b95bbfe2dc9 | 167 | uint8_t canDataCheck=0; |
nerit | 5:3b95bbfe2dc9 | 168 | double tempoBecchiPerQuinc=0.0f; |
nerit | 5:3b95bbfe2dc9 | 169 | int countPicks=0; |
nerit | 4:d32258ec411f | 170 | |
nerit | 5:3b95bbfe2dc9 | 171 | bool canDataCheckEnable=false; |
nerit | 5:3b95bbfe2dc9 | 172 | int speedFromPick = 1; // definisce se il controllo di velocità della ruota di semina è gestita dai becchi (set a 1) o dai fori sul disco (set a 0) |
nerit | 5:3b95bbfe2dc9 | 173 | bool encoder=false; |
nerit | 4:d32258ec411f | 174 | |
nerit | 0:1e09cd7d66b4 | 175 | // se indefinito utilizza il tamburo ortogonale per i semi di zucca |
nerit | 0:1e09cd7d66b4 | 176 | double stepGrado = 0.0f; |
nerit | 0:1e09cd7d66b4 | 177 | double TBfaseStep =0.0f; |
nerit | 0:1e09cd7d66b4 | 178 | int tamburoStandard=1; // tamburo parallelo alla ruota di semina |
nerit | 0:1e09cd7d66b4 | 179 | double angoloPh=7.0f; |
nerit | 0:1e09cd7d66b4 | 180 | double angoloAv=0.0f; |
nerit | 0:1e09cd7d66b4 | 181 | |
nerit | 0:1e09cd7d66b4 | 182 | uint8_t checkSDrotation=0; |
nerit | 0:1e09cd7d66b4 | 183 | uint8_t comandiDaCan=0; |
nerit | 0:1e09cd7d66b4 | 184 | uint8_t azzeraDaCan=0; |
nerit | 0:1e09cd7d66b4 | 185 | uint8_t loadDaCan=0; |
nerit | 0:1e09cd7d66b4 | 186 | uint8_t loadDaCanInCorso=0; |
nerit | 0:1e09cd7d66b4 | 187 | uint8_t cntCellsForLoad=0; |
nerit | 0:1e09cd7d66b4 | 188 | uint8_t trigRepos=0; |
nerit | 0:1e09cd7d66b4 | 189 | uint8_t forzaFase=0; |
nerit | 0:1e09cd7d66b4 | 190 | uint8_t erroreTamburo=0; |
nerit | 0:1e09cd7d66b4 | 191 | uint8_t cntCellsForReload=0; |
nerit | 0:1e09cd7d66b4 | 192 | uint8_t cntTbError=0; |
nerit | 0:1e09cd7d66b4 | 193 | |
nerit | 0:1e09cd7d66b4 | 194 | uint8_t cellsCounterLow=0; |
nerit | 0:1e09cd7d66b4 | 195 | uint8_t cellsCounterHig=0; |
nerit | 0:1e09cd7d66b4 | 196 | uint8_t pickCounterLow=0; |
nerit | 0:1e09cd7d66b4 | 197 | uint8_t pickCounterHig=0; |
nerit | 0:1e09cd7d66b4 | 198 | |
nerit | 0:1e09cd7d66b4 | 199 | uint8_t all_semiFiniti = 0; // semi finiti (generato dal relativo sensore) |
nerit | 0:1e09cd7d66b4 | 200 | uint8_t all_pickSignal = 0; // errore segnale becchi (generato dal tempo tra un becco ed il successivo) |
nerit | 0:1e09cd7d66b4 | 201 | uint8_t all_cellSignal = 0; // errore segnale celle (generato dal sensore tamburo ) |
nerit | 0:1e09cd7d66b4 | 202 | uint8_t all_lowBattery = 0; // allarme batteria (valore interno di tritecnica) |
nerit | 0:1e09cd7d66b4 | 203 | uint8_t all_overCurrDC = 0; // sovracorrente motore DC (generato dal sensore di corrente) |
nerit | 0:1e09cd7d66b4 | 204 | uint8_t all_stopSistem = 0; // sistema in stop (a tempo con ruota ferma) |
nerit | 0:1e09cd7d66b4 | 205 | uint8_t all_upElements = 0; // elementi sollevati (generato dal relativo sensore) |
nerit | 0:1e09cd7d66b4 | 206 | uint8_t all_noSeedOnCe = 0; // fallanza di semina (manca il seme nella cella) |
nerit | 0:1e09cd7d66b4 | 207 | uint8_t all_cfgnErrors = 0; // errore di configurazione (incongruenza dei parametri impostati) |
nerit | 0:1e09cd7d66b4 | 208 | uint8_t all_noDcRotati = 0; // ruota di semina bloccata (arriva la velocità ma non i becchi) |
nerit | 0:1e09cd7d66b4 | 209 | uint8_t all_noStepRota = 0; // tamburo di semina bloccato (comando il tamburo ma non ricevo il sensore) |
nerit | 0:1e09cd7d66b4 | 210 | uint8_t all_speedError = 0; // errore sensore velocità (tempo impulsi non costante) |
nerit | 0:1e09cd7d66b4 | 211 | uint8_t all_noSpeedSen = 0; // mancanza segnale di velocità (sento i becchi ma non la velocita) |
nerit | 0:1e09cd7d66b4 | 212 | uint8_t all_no_Zeroing = 0; // mancato azzeramento sistema (generato dal timeout del comando motore DC) |
nerit | 0:1e09cd7d66b4 | 213 | uint8_t all_genericals = 0; // allarme generico |
nerit | 0:1e09cd7d66b4 | 214 | uint8_t resetComandi=0; |
nerit | 0:1e09cd7d66b4 | 215 |