Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Calculate key metrics on backend #269

Open
suyashkumar opened this issue Jan 15, 2018 · 2 comments
Open

Calculate key metrics on backend #269

suyashkumar opened this issue Jan 15, 2018 · 2 comments
Assignees

Comments

@suyashkumar
Copy link
Collaborator

We should calculate efficiency calculations on the backend. @aforbis-stokes had the following snippet to inform the calculations to be made:

// Script for diagnostics
#define HXCI A0 // Heat Exchanger Cold Inlet
#define HXCO A1 // Heat Exchanger Cold Output
#define HTR A2  // Heater
#define HXHI A3 // Heat Exchanger Hot Inlet
#define HXHO A4 // Heat Exchanger Hot Outlet
#define PUMP D0
#define VALVE D1
#define IGNITOR D2
#define BUCKET C4
#define STEP D6
#define DIR D5
#define SLEEP D3
#define UP B5
#define DOWN C3
#define RESET C2
#define SD_CS_PIN B3
#define SD_CD_PIN B4
#define SD_DI_PIN B2
#define SD_DO_PIN B1
#define SD_CLK_PIN B0
//New definitions
#define DH // Dome height [cm], user input
#define CX_DH // Dome height cross-sectional area [cm2]
#define Q_WASTE // Waste (liquid) flow
#define Q_GAS // Biogas flow, [ccm], user input
#define TB_volume 0.325 // Tipping bucket volume conversion, L/tip
#define ValveStatus // Gas valve status, 1=open, 0=closed
#define C_p 4.19 // [kJ/L/degC]
#define U_gas 36.8 // Energy concent of methane [kJ/L]
#define CH4 0.60 // Fraction of biogas in methane
#define CODconc 42 // gCOD/Lwaste, based on location and flush volume
#define HTR_volume 8.7 // [L]

//Calculate the following for each day:
Q_WASTE = tips*TB_volume / last_publish_time
Biogas_used = AVG(ValveStatus)*AVG(Q_GAS) // [L]
Biogas_prod = ((DH1-DH0)*CX_DH + Q_GAS*AVG(ValveStatus)*(t1-t0)) / (t1-t0)
  //Gas production as fxn of change of storage volume and gas usage for given day
  //"1" and "0" are based manual entries for current day and previous day
Yield = Biogas_prod / (Q_WASTE/CODconc) //[Lgas/gCOD]
Heater_power = (tempHTR-tempHXCO)*Q_WASTE*C_p // measured gain, [kJ/d] convert to [W]
Gas_power = (Biogas_used*CH4*U_gas) // theo. power input, [kJ/d] convert to [W]
Heater_effic = Heater_power/Gas_power // efficiency of full heater (not burner)
HXcold_power = (HXCO-HXCI)*Q_WASTE*C_p // power gain in HX, [kJ/d] convert to [W]
HXhot_power_loss = (HXHO-HXHI)*Q_WASTE*C_p // power loss from HXhot, [kJ/d] convert to [W]
HX_effic = HXcold_power/HXhot_power_loss // How much heat goes from hot to cold
HX_recovery_effic = HXcold_power/Heater_power // How much of total heat is recovered
  if tips = 0 && ValveStatus=0 for 30 min
    then Loss = (HTR1-HTR0)*HTR_volume*C_p / (t1-t0) // decrease in temp over last 30 min
Burner_effic = (Heater_power+Loss) / Gas_power

//On-demand variables for troubleshooting
All temps & ValveStatus
Burner_effic // provide for last 6 readings
  //use AVG(Loss) of last 20 values
  //consider interrupt function for troubleshooting, read every 20s instead of 2.5 min
Heater_effic

//Error logs
if tempHTR < 62 for 15 minutes
if Heater_effic < 50
if Burner_effic < 75
if Q_WASTE < 0.5*OPTIMAL_FLOW*24 //OPTIMAL_FLOW is set in main in [L/hr]
if Q_WASTE < 2.0*OPTIMAL_FLOW*24 //OPTIMAL_FLOW is set in main in [L/hr]
@mlp6 mlp6 self-assigned this May 21, 2018
@mlp6
Copy link
Owner

mlp6 commented May 21, 2018

@aforbis-stokes can you share what are using to currently do the calculations above? it is a spreadsheet?

Where do you want these error logs to be dumped?

@aforbis-stokes
Copy link
Collaborator

All of my calculations now are through a spreadsheet. I dump the data pull from the Suyash site in my spreadsheet, and copy in the field-recorded data.

Where do the Philippines (SD-based system) error logs go? I assumed these logs can go there. I am not as familiar with those as @Graham-H-Miller is. He's running the Philippines project, and I have not gone through the error logs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants