Francesco Pistone
/
FORIGO_Modula_V6_R2_DE_2019
new
Embed:
(wiki syntax)
Show/hide line numbers
variables.hpp
00001 /* 00002 variabili generali di programma e set iniziali 00003 */ 00004 00005 // SET INIZIALI DI MACCHINA 00006 bool canDataCheckEnable=false; // a true per attivare il controllo del quinconce anche con dati CAN 00007 int speedFromPick = 0; // definisce se il controllo di velocità della ruota di semina è gestita dai becchi (set a 1) o dai fori sul disco (set a 0) 00008 bool encoder; // true quando montato motore DC con encoder incorporato 00009 // NOTA: SE ENCODER=TRUE ALLORA SPEEDFROMPICK DEVE ESSERE MESSO A 0 00010 int tamburoStandard=1; // a 1 per tamburo parallelo alla ruota di semina, a 0 per zucca 00011 00012 bool tankLevelEnable = false; 00013 bool seedSensorEnable=false; 00014 bool stendiNylonEnable=false; 00015 bool currentCheckEnable=false; 00016 uint8_t cellsCountSet=1; 00017 00018 // VARIABILI DI PROGRAMMA 00019 int zeroRequestBuf=0; 00020 int runRequestBuf=0; 00021 00022 // define cycle variable related to the external command 00023 int oldTractorSpeedRead=0; 00024 int startCycle=0; // activate motors and functions 00025 int enableCycle=0; // enable regular cycle 00026 int zeroCycle=0; // azzeramento motori richiesto 00027 int OldStartCycle=0; // use for triggering command change 00028 int OldEnableCycle=0; 00029 int oldZeroCycle=0; // memoria azzeramento motori su richiesta 00030 int zeroCycleEnd=0; // ciclo di azzeramento completato 00031 int zeroTrigger=0; 00032 int TBzeroPinInput=0; // segnale invertito micro tamburo 00033 int seedWheelZeroPinInput=0; // segnale invertito sensore ruota di semina 00034 int SD_faultA=0; 00035 int SD_faultB=0; 00036 int DC_brake=1; // comando gestione frenatura motore DC 00037 int DC_forward=1; // comando gestione direzione motore DC 00038 00039 int oldFaseLavoro=0; 00040 00041 // define logic internal variables 00042 double tractorSpeed_MtS_timed=0.0f; // tractor speed calculated from pulse interval time 00043 double speedForDisplay[5]={0.0f,0.0f,0.0f,0.0f,0.0f}; 00044 double totalSpeed=0.0f; 00045 double OLDpulseSpeedInterval=1000.01f; // tractor speed calculated from pulse interval time 00046 double pulseDistance=0.0f; // linear space between pulse 00047 double pulseDistanceCalc=0.0f; 00048 double speedPerimeter=0.0f; // perimeter of tractor speed wheel 00049 double seedPerimeter=0.0f; // perimeter of seed wheel 00050 double mediaSpeed[5]={0.0f,0.0f,0.0f,0.0f,0.0f}; 00051 int pntMedia=0; 00052 int actualPulseReadTimer=0; // timer read at previous pulse 00053 double pulseSpeedInterval=0.0f; // delta time of pulse 00054 int lastPulseRead=0; 00055 int oldLastPulseRead=0; 00056 int pulseRised=0; // pulse from speed wheel occured. Define when is possible to determine speed of up down motor. 00057 int pulseRised1 = 0; 00058 int pulseRised2 = 0; 00059 00060 double rapportoRuote = 0.0f; 00061 double TBrpm = 0.0f; 00062 double TBfrequency = 0.0f; 00063 double TBperiod = 0.0f; 00064 double oldPeriodoTB = 0.0f; 00065 int SDzeroCyclePulse=0; 00066 int TBzeroCyclePulse=0; 00067 int SDzeroed=0; 00068 int TBzeroed=0; 00069 int oldOnSDzero=0; 00070 int oldOnTBzero=0; 00071 int oldOffSDzero=0; 00072 int oldOffTBzero=0; 00073 int SDzeroPinTrig=0; 00074 int TBzeroPinTrig=0; 00075 int SDzeroDebounced=0; 00076 int SDrunZero=0; 00077 int TBrunZero=0; 00078 int syncroCheck=0; 00079 double memoStepTB=0.0f; 00080 double erroreSyncro=0.0f; 00081 double errorePercentuale=1.0f; 00082 int oldSeedWheelZeroPinInput=0; 00083 int oldTBzeroPinInput=0; 00084 int stopCicloTB = 0; 00085 int startCicloTB = 0; 00086 int cicloTbinCorso = 0; 00087 int beccoPronto =0; 00088 int memoIntraPick=0; 00089 00090 double realSpeed = 0.0f; 00091 double realGiroSD = 0.0f; 00092 double tempoBecco = 0.0f; 00093 double frequenzaReale = 0.0f; 00094 double semiPeriodoReale = 0.0f; 00095 double tempoTraBecchi_mS = 0.0f; 00096 double tempoGiroSD = 0.0f; 00097 00098 // variable for speed and step calculation 00099 uint32_t prePosSD=0; // actual position of seed wheel (step of motor) 00100 uint32_t SDactualPosition=0; // actual position of seed wheel (step of motor) 00101 uint32_t TBactualPosition=0; 00102 uint32_t posForQuinc=0; 00103 00104 int cycleStopRequest=0; // when cycle end request the zero of SD and UD 00105 00106 double duty_DC=0.0f; 00107 double oldDuty_DC=0.0f; 00108 00109 double dcActualDuty = 0.0f; // valore di lavoro del duty cycle 00110 double olddcActualDuty = 0.0f; // valore di lavoro del duty cycle 00111 double correzione = 0.0f; 00112 double periodo =0.0f; 00113 double ePpos = 0.0f; 00114 int aspettaStart=1; 00115 int countCicli=0; 00116 uint32_t fase = 0; 00117 00118 int clocca=0; 00119 int enableSpeed=0; 00120 double speedOfSeedWheel =0.0f; 00121 int lowSpeed = 0; 00122 double valore=0.0f; 00123 //char val1[8]={0,0,0,0,0,0,0,0}; 00124 00125 uint8_t enableSimula=0; 00126 uint8_t speedSimula=0; 00127 uint8_t avviaSimula=0; 00128 double oldSimulaSpeed=0.0f; 00129 int selezionato =0; 00130 int simOk=0; 00131 00132 float SD_CurrentAnalog=0.0f; // valore di corrente sull'ingresso 00133 float SD_CurrentScaled=0.0f; // valore di corrente convertito in scala 00134 float SD_CurrentFactor=40.0f; // fattore di scala sensore 40mV/A 00135 float SD_CurrentPeak=0.0f; // valore massimo corrente 00136 float SD_CurrentMid=0.0f; // valore medio corrente 00137 float SD_CurrentLast=0.0f; // valore precedente corrente 00138 float SD_CurrentStart=0.0f; // valore a vuoto corrente (circa il 50% della tensione di alimentazione del sensore) 00139 bool reduceCurrent=false; 00140 bool incrementCurrent=false; 00141 double boostDcOut=0.0f; 00142 00143 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}; 00144 int SD_analogIndex[11]={0,0,0,0,0,0,0,0,0,0}; 00145 int frenata=0; 00146 int accensione=1; 00147 double SDsectorStep =0.0f; 00148 double TBsectorStep = 0.0f; 00149 double KcorT = 0.0f; 00150 00151 int trigSD=0; 00152 int trigTB=0; 00153 int inhibit=0; 00154 int trigCicli=0; 00155 int avvicinamento=0; 00156 int lowSpeedRequired=0; 00157 00158 uint8_t alarmHighRegister=0x00; 00159 uint8_t alarmLowRegister=0x00; 00160 double TBgiroStep=0.0f; 00161 int firstStart=1; 00162 int noSDzeroRequest=0; 00163 int timeHole=0; 00164 int memoTimeHole=0; 00165 int lockStart=0; 00166 00167 uint8_t quincStart=0; 00168 uint8_t oldQuincIn=0; 00169 double scostamento = 0.0f; 00170 uint8_t quincEnable=0; 00171 uint8_t quincCnt=0; 00172 double percento=0.0f; 00173 uint32_t masterSinc=0; 00174 uint32_t mast2_Sinc=0; 00175 bool quincClock=false; 00176 double oldQuincTimeSD=0.0f; 00177 uint8_t sincroQui=0; 00178 uint8_t quincPIDminus=0; 00179 uint8_t quincPIDplus=0; 00180 uint8_t quincLIMminus=0; 00181 uint8_t quincLIMplus=0; 00182 double memoCorrCorr=0.0f; 00183 double speedFromMaster=0.0f; 00184 uint8_t quincSector=0; 00185 uint8_t canDataCheck=0; 00186 double tempoBecchiPerQuinc=0.0f; 00187 int countPicks=0; 00188 uint8_t quinconceActive=0; 00189 uint8_t oldQuinconceOut=0; 00190 00191 double stepGrado = 0.0f; 00192 double TBfaseStep =0.0f; 00193 double angoloPh=7.0f; 00194 double angoloAv=0.0f; 00195 00196 uint8_t checkSDrotation=0; 00197 uint8_t comandiDaCan=0; 00198 uint8_t azzeraDaCan=0; 00199 uint8_t loadDaCan=0; 00200 uint8_t loadDaCanInCorso=0; 00201 uint8_t cntCellsForLoad=0; 00202 uint8_t trigRepos=0; 00203 uint8_t forzaFase=0; 00204 uint8_t erroreTamburo=0; 00205 uint8_t cntCellsForReload=0; 00206 uint8_t cntTbError=0; 00207 00208 uint8_t cellsCounterLow=0; 00209 uint8_t cellsCounterHig=0; 00210 uint8_t pickCounterLow=0; 00211 uint8_t pickCounterHig=0; 00212 uint8_t seedSee=0; 00213 00214 uint8_t all_semiFiniti = 0; // semi finiti (generato dal relativo sensore) 00215 uint8_t all_pickSignal = 0; // errore segnale becchi (generato dal tempo tra un becco ed il successivo) 00216 uint8_t all_cellSignal = 0; // errore segnale celle (generato dal sensore tamburo ) 00217 uint8_t all_lowBattery = 0; // allarme batteria (valore interno di tritecnica) 00218 uint8_t all_overCurrDC = 0; // sovracorrente motore DC (generato dal sensore di corrente) 00219 uint8_t all_stopSistem = 0; // sistema in stop (a tempo con ruota ferma) 00220 uint8_t all_upElements = 0; // elementi sollevati (generato dal relativo sensore) 00221 uint8_t all_noSeedOnCe = 0; // fallanza di semina (manca il seme nella cella) 00222 uint8_t all_cfgnErrors = 0; // errore di configurazione (incongruenza dei parametri impostati) 00223 uint8_t all_noDcRotati = 0; // ruota di semina bloccata (arriva la velocità ma non i becchi) 00224 uint8_t all_noStepRota = 0; // tamburo di semina bloccato (comando il tamburo ma non ricevo il sensore) 00225 uint8_t all_speedError = 0; // errore sensore velocità (tempo impulsi non costante) 00226 uint8_t all_noSpeedSen = 0; // mancanza segnale di velocità (sento i becchi ma non la velocita) 00227 uint8_t all_no_Zeroing = 0; // mancato azzeramento sistema (generato dal timeout del comando motore DC) 00228 uint8_t all_genericals = 0; // allarme generico 00229 uint8_t resetComandi=0; 00230 00231 uint32_t spazioCoperto=0;
Generated on Wed Jul 13 2022 15:20:30 by 1.7.2