void bamCore::beginCal(){ // if(calMode=="normal"){ // qDebug() << "readCurrent()"; // readCurrent(); // emit setProgressBar(20); // //calN_Target(); // emit setProgressBar(36); // qDebug() << "calPhi()"; // calPhi(); // emit setProgressBar(52); // qDebug() << "calN_Prod()"; // calN_Prod(); // emit setProgressBar(68); // qDebug() << "calSigma()"; // calSigma(); // emit setProgressBar(84); // qDebug() << "calNofT()"; // //calNofT(); // emit setProgressBar(100); // emit finished(); // } if(calMode=="creator"){ qDebug() << "Read Current ..."; readCurrent(); qDebug() << "Calculating Phi ..."; calPhi(); qDebug() << "Calculating produced nuclei ... "; calN_Prod(); qDebug() << "Calculating crosssection ..."; calSigma(); emit finished(); } }
void CONFEH::getMeasurements( float &storageVoltage, float &solarVoltage, float &solarCurrent ) { // Configure LTC2990 for Current-Voltage-Voltage measurement (using 1 ohm sense resistor) setLTC_Config( celsius, single, V1_V2V3V4, 1, 0 ); triggerConversion(); // Read the storage voltage if ( storageType == DLC ) readVoltage( storageVoltage, Voltage_V3 ); else if ( storageType == BAT ) readVoltage( storageVoltage, Voltage_V4 ); // Read the solar current readCurrent( solarCurrent, Current_V12 ); // Check for LTC3105 reset condition if ( solarCurrent < 0.001 ) { // Reset LTC3105 setLTC3105_EN( false ); setLTC3105_EN( true ); } // Re-configure LTC2990 for pure voltage measurement setLTC_Config( celsius, single, V1V2V3V4, 1, 0 ); triggerConversion(); // Read the solar voltage readVoltage( solarVoltage, Voltage_V1 ); }
float Alltrax::readBatteryCurrent() { //returns the output battery Current // "Battery current may be calculated as a percentage of output current, // assuming continuous motor currrent. Convert THROT_POS to decimal, then // Ibattery = (THROT_POS / 256) * OUTPUT_CURR_H,L" //Pre: None //Post: returns the Output Battery current as a float // -1 if there was an error float OutCur = readCurrent(); int throttle = readThrottle(); throttle = throttle/256; float batteryCurrent = throttle * OutCur; return batteryCurrent; }
void Controller25::device_loop(Command command){ if (time.elapsed (100)) { // subtract the last reading: total= total - readings[index]; // read from the sensor: readings[index] = readBrdCurrent(A0); // add the reading to the total: total= total + readings[index]; // advance to the next position in the array: index = index + 1; // if we're at the end of the array... if (index >= numReadings) // ...wrap around to the beginning: index = 0; // calculate the average: average = total / numReadings; } if (onesecondtimer.elapsed (1000)){ readTemp(); Serial.print(F("BRDT:")); Serial.print(celsiusTempRead); Serial.print(';'); Serial.print(F("SC1I:")); Serial.print(readCurrent(A3)); Serial.print(';'); Serial.print(F("SC2I:")); Serial.print(readCurrent(A2)); Serial.print(';'); Serial.print(F("SC3I:")); Serial.print(readCurrent(A1)); Serial.print(';'); Serial.print(F("BRDI:")); Serial.print(readBrdCurrent(A0)); Serial.print(';'); Serial.print(F("BT1I:")); Serial.print(readCurrent(A6)); Serial.print(';'); Serial.print(F("BT2I:")); Serial.print(readCurrent(A5)); Serial.print(';'); Serial.print(F("BRDV:")); Serial.print(read20Volts(A4)); Serial.print(';'); Serial.print(F("AVCC:")); Serial.print(readVcc()); Serial.println(';'); } // send voltage and current if (statustime2.elapsed(100)) { capedata::VOUT = read20Volts(A4); capedata::IOUT = readBrdCurrent(A0); capedata::FMEM = freeMemory(); // capedata::ATMP = GetTemp(); capedata::UTIM = millis(); } }
void CControllerBoard::Update( CCommand& commandIn ) { if( time.HasElapsed( 100 ) ) { // subtract the last reading: total = total - readings[index]; // read from the sensor: readings[index] = readBrdCurrent( A0 ); // add the reading to the total: total = total + readings[index]; // advance to the next position in the array: index = index + 1; // if we're at the end of the array... if( index >= numReadings ) // ...wrap around to the beginning: { index = 0; } // calculate the average: average = total / numReadings; } if( onesecondtimer.HasElapsed( 1000 ) ) { readTemp(); Serial.print( F( "BRDT:" ) ); Serial.print( celsiusTempRead ); Serial.print( ';' ); Serial.print( F( "SC1I:" ) ); Serial.print( readCurrent( A3 ) ); Serial.print( ';' ); Serial.print( F( "SC2I:" ) ); Serial.print( readCurrent( A2 ) ); Serial.print( ';' ); Serial.print( F( "SC3I:" ) ); Serial.print( readCurrent( A1 ) ); Serial.print( ';' ); Serial.print( F( "BRDI:" ) ); Serial.print( readBrdCurrent( A0 ) ); Serial.print( ';' ); Serial.print( F( "BT1I:" ) ); Serial.print( readCurrent( A6 ) ); Serial.print( ';' ); Serial.print( F( "BT2I:" ) ); Serial.print( readCurrent( A5 ) ); Serial.print( ';' ); Serial.print( F( "BRDV:" ) ); Serial.print( read20Volts( A4 ) ); Serial.print( ';' ); Serial.print( F( "AVCC:" ) ); Serial.print( readVcc() ); Serial.println( ';' ); } // Update Cape Data voltages and currents if( statustime2.HasElapsed( 100 ) ) { NDataManager::m_capeData.VOUT = read20Volts( A4 ); // #315: deprecated: this is the same thing as BRDI: NDataManager::m_capeData.IOUT = readBrdCurrent( A0 ); // Total current draw from batteries: NDataManager::m_capeData.BTTI = readCurrent( A5 ) + readCurrent( A6 ); NDataManager::m_capeData.FMEM = util::FreeMemory(); NDataManager::m_capeData.UTIM = millis(); } }