math - get amount of Days until a dam "Event" in java -
i'm running issue making formula calculating amount of days take dam either empty, or fill. in public class called dam.
basically have:
int capacity = 3538000; // acreft int storage = 1796250; // acreft int inflowrate = 1050; // cubic-ft/sec int outflowrate = 2530; // cubic-ft/sec
and make if-else
statement saying like:
if(inflow > outflow) { //formula here } else if (outflow > inflow) { //formula here } else { return -1; // if dam inflow/outflow equal basically, "holding." }
how go formula here? if start off with;
if(outflow > inflow) { int data = outflow - inflow; // still in cubic-ft per sec // convert data acresft? using sort of conversion variable? // using new variable converted data * storage..? // times second in day (86400 seconds, variable established @ top of program.) }
this may pretty rough read, didn't want upload whole file here.
i take meaning of variable below
capacity total volume of water can hold storage total volume of water holds inflow volume of water flowing dam per second outflow volume of water flowing out of dam per second int flow_rate_difference = 0 ; long dam_fill_seconds = 0; long dam_empty_seconds = 0; if(inflow > outflow) { //we have calculate amount of seconds take fill dam // 1 acre foot = 43560.0004435. taking 43560 plz use full value if require more accuracy // conversion taken http://www.convertunits.com/from/cubic+foot/to/acre+foot // total capacity 3538000acrefoot // current capacity = total capacity - stored capacity ie (3538000-1796250) acrefoot // current capacity in cubic foot (3538000-1796250)*43560 // @ same second water flowing , out of dam . if inflow higher difference have calculate flow_rate_difference = inflowrate - outflowrate; // total sec required fill dam current capacity / flow_rate_difference dam_fill_seconds = (3538000-1796250)*43560/flow_rate_difference ; } if (outflow > inflow ) { //time dam empty flow_rate_difference = outflowrate-inflowrate; //here need take stored capacity dam_empty_seconds = storage*43560/flow_rate_difference; }
Comments
Post a Comment