Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit RumenGut;
- interface
- uses Global;
- procedure NutrientSupply(ptrFeedDescriptions:PFeedsRecord;ptrAmount:PTAmount;
- ptrNutAbsorbed:PNutAbsorbedRecord);stdcall;
- procedure blood(ac, prop, but, pH, vol, RSA: Single; tslp: Integer;
- var Aac, Aprop, Abut: Single);
- //procedure fNDFandpH(pH,pHLast,FeedfNDFRate: Single;HourlyLoop: Integer;var fNDFRate: Single);
- function CalcLig(Diet: Integer;DMITMR: Single): Single;
- implementation
- uses
- Microbes, SysUtils, Windows, Math, SingleForm;
- //const
- //Microbes on solids have maintenance which goes up as pH goes down from 6.8
- //log106_8=0.000000158;
- //Microbes on liquids have maintenance which goes up as pH goes down from 6
- //log106_0=0.000001;
- //log105_2=0.0000063;
- {procedure fNDFandpH(pH,pHLast,FeedfNDFRate: Single;HourlyLoop: Integer;var fNDFRate: Single);
- const
- IncreasedRate=1.15;
- begin
- if pH<5.2 then
- fNDFRate:=0.0005
- else if pH<5.7 then
- begin
- if fNDFRate<(FeedfNDFRate*(1-(Power(10,-pH)-log106_8)/(log105_2-log106_8))) then
- begin
- fNDFRate:=(FeedfNDFRate*(1-(Power(10,-pH)-log106_8)/(log105_2-log106_8)));
- if fNDFRate=0 then fNDFRate:=(FeedfNDFRate*(1-(Power(10,-pH)-log106_8)/(log105_2-log106_8)));//(1-(6.2-pH)*1.1))
- end
- else
- begin
- fNDFRate:=(FeedfNDFRate*(1-(Power(10,-pH)-log106_8)/(log105_2-log106_8)));//; (1-(Power(10,-pH)-log106_2)/0.00000614))
- fNDFRateOutFor:=HourlyLoop;
- end;
- end
- else if pH>=5.7 then
- begin
- if fNDFRate=0 then fNDFRate:=0.0005;
- // if HourlyLoop>fNDFRateOutFor+4 then
- fNDFRate:=FNDFRate*IncreasedRate;
- if fNDFRate>FeedfNDFRate then fNDFRate:=FeedfNDFRate;
- end;
- // fNDFRate:=0;
- if fNDFRate<0.0005 then fNDFRate:=0.0005;
- end;}
- function CalcLig(Diet: Integer;DMITMR: Single): Single;
- var
- n: Integer;
- SDM,LIG,ForageDM,TMRForageDM,DMForage: Single;
- begin
- SDM:=0;
- LIG:=0;
- ForageDM:=0;TMRForageDM:=0;DMForage:=0;
- if not FSGrazingAll[rFeedInfo.Diet] then
- for n:=1 to rFeedInfo.iNoFeeds do
- if rFeedInfo.TMRFeed[n-1].pemNDF>3.5 then
- begin
- SDM:=SDM+StrToFloat(FeedOrder[n-1,7+Diet]);
- end;
- //Robotics
- if ChopLength then
- begin
- if FSGrazingAll[rFeedInfo.Diet] then DMITMR:=1;
- SDM:=DMITMR;
- if TMRRobotic then
- begin
- SDM:=SDM+rFeedInfo.RoboticPerMeal1*RoboticFeeds[rFeedInfo.Parlour]
- +rFeedInfo.RoboticPerMeal2*RoboticFeeds[rFeedInfo.Parlour];
- end
- else if FSParlour[rFeedInfo.Diet] then
- begin
- SDM:=SDM+rFeedInfo.ParlourPerMeal*ParlourFeeds[rFeedInfo.Parlour];
- end;
- SDM:=SDM/DMITMR*Thousand;
- end;
- {//Parlour
- if not rFeedInfo.ParlourFeed.GroundOrLong then
- begin
- SDM:=SDM+StrToFloat(FeedOrder[13,7+Diet]);
- end;}
- //Grazing
- if rFeedInfo.GrazingFeed.pemNDF>3.5 then
- begin
- SDM:=SDM+rFeedInfo.GrazingFeed.DM;
- end;
- if not FSGrazingAll[rFeedInfo.Diet] then
- for n:=1 to rFeedInfo.iNoFeeds do
- if rFeedInfo.TMRFeed[n-1].pemNDF>3.5 then
- begin
- LIG:=LIG+rFeedInfo.TMRFeed[n-1].unfermNDF*StrToFloat(FeedOrder[n-1,7+Diet])/SDM;
- ForageDM:=ForageDM+rFeedInfo.TMRFeed[n-1].DM
- *StrToFloat(FeedOrder[n-1,7+Diet])/SDM;
- end;
- {//Parlour
- if not rFeedInfo.ParlourFeed.GroundOrLong then
- begin
- LIG:=LIG+rFeedInfo.ParlourFeed.C3*StrToFloat(FeedOrder[13,7+Diet])/SDM;
- end; }
- //Grazing
- if rFeedInfo.GrazingFeed.pemNDF>3.5 then
- begin
- LIG:=LIG+rFeedInfo.GrazingFeed.unfermNDF*rFeedInfo.GrazingFeed.DM/SDM;
- ForageDM:=ForageDM+rFeedInfo.GrazingFeed.DM;
- end;
- for n := 0 to rFeedInfo.iNoFeeds-1 do
- if rFeedInfo.TMRFeed[n].pemNDF>3.5 then
- begin
- TMRForageDM:=TMRForageDM+rFeedInfo.TMRFeed[n].DM
- *StrToFloat(FeedOrder[n,7+Diet]);
- DMForage:=DMForage+StrToFloat(FeedOrder[n,7+Diet]);
- end;
- if DMForage>0 then TMRForageDM:=TMRForageDM/DMForage;
- if version1_01_16 then
- begin
- if TMRForageDM>30 then ForageDMBelow30Ppn:=1 else ForageDMBelow30Ppn:=34-TMRForageDM/0.88;
- if TMRForageDM<23 then ForageDMBelow30Ppn:=34-23/0.88;
- end
- else
- begin
- ForageDMBelow30Ppn:=1;
- end;
- CalcLig:=LIG/Thousand;
- end;
- procedure blood(ac, prop, but, pH, vol, RSA: Single; tslp: Integer;
- var Aac, Aprop, Abut: Single);
- //take concs (M) of ac, prop and but and calculate molar quantities absorbed
- const
- pKac=4.76;
- pKpr=4.87;
- pKbu=4.81;
- Kacu=0.48;
- Kacd=0.12;
- Kpru=0.67;
- Kprd=0.21;
- Kbuu=1.43;
- Kbud=0.15;
- var
- Facu,Fpru,Fbuu,Factor: Single;
- begin
- Factor:=RSA/100/tslp;//vary 400 - 1000 250
- if ph < 5 then ph := 5;
- Facu:=1/(1+power(10,pH-pKac));
- Fpru:=1/(1+power(10,pH-pKpr));
- Fbuu:=1/(1+power(10,pH-pKbu));
- Aac:=Factor*ac*(Kacu*Facu+Kacd*(1-Facu));{mol/tstep}
- Aprop:=Factor*prop*(Kpru*Fpru+Kprd*(1-Fpru));
- Abut:=Factor*but*(Kbuu*Fbuu+Kbud*(1-Fbuu));
- if Aac>ac*vol*0.4 then Aac:=ac*vol*0.4;//0.95
- if Aprop>prop*vol*0.4 then Aprop := prop*vol*0.4; {aac,aprop,abut mmol/h, ac,prop,but moles}
- if Abut>but*vol*0.4 then Abut := but*vol*0.4;
- if Aac<0 then Aac:=0;
- if Aprop<0 then Aprop:=0;
- if Abut<0 then Abut:=0;
- end;
- procedure NutrientSupply(ptrFeedDescriptions:PFeedsRecord;ptrAmount:PTAmount;
- ptrNutAbsorbed:PNutAbsorbedRecord);
- const
- StepsPerHour=10;
- MicMaint=1.63; //mmoles/g/hr
- BloodOsmol=280;
- CPToTP=1;//microbes don't produce any CP, just TP! 0.75;
- DigestibilityOfTP=0.8;//0.85;
- DigestibilityOfDUP=0.6;
- LPMult=0.11;
- SStarchToQStarchBR=0;//0.004411; //O.045 scaled down
- MicPassRate=2*0.00958; //0.1 scaled down 1.1^0.1-1
- RNH3=0.025;//0.07 //0.02 0.025 very sensitive to this
- SlowProteinToQuickProtein=0;//0.00489; //0.05 scaled down
- BicarbonateContentSaliva={0.75*}130+13.8; //meq 130 from bicarbonate, 13.8 equivalent from phosphate
- //FeedSaliva=0.25;
- LacticToGlucose=1;
- USPass=2;
- MicrobialProteinRate=0.5;
- MicNonCHO=0.8;
- MWN=14;
- ClearanceRatio=1.3;//1.3;
- //RatioLongtoTotal=0.5;
- pKCO2=7.74; pCO2=0.7;
- AvpH=10;//average out pH to 1 per hour
- PassageRateFactor=1.15; //to speed up flow of uNDF 11022013 Andy's comment was
- //that on high intakes they weren't getting enough milk
- MaxRuminationTime=780; //minutes of rumination per day
- var
- ParlourRobot: Boolean;
- Days1toEnd,Hours1to24,StepHours1toEnd,loopi,loopm,NumFoods,Line,n1,IndexPosn1,NH3Lim,
- FinalCount,count,iNoFeeds1,s,EatingStepsPerHour,counter: Integer;
- fNDF, iNDF, QStarch, DegCP, iDegCp,HourlyActualIntake,DailyIntake,
- SIfNDF, SIiNDF, SIStarch, SIDegCP, SIiDegCP, HGfNDF, HGiNDF,
- RNDF, RQStarch,RSStarch, RDegCP, PassfNDFtoSI, PassiNDFtoSI, PassQStarchtoSI,
- PassDegCPtoSI, PassiDegCPtoSI, PassfNDFOut, PassiNDFOut,FermfNDFinHG,
- TotalAmount,FermfNDFinRum, FermStarchinRum, FermDegCPinRum,LagCP,
- SupplementRatio,SupplementToEat,SolCP,FermSolCPinRum,RaCP,PassSolCPtoSI,
- LagNDF,fNDFLong,iNDFLong,DegCPLong,iDegCPLong,PassfNDFLongtoSI,PassiNDFLongtoSI,
- PassDegCPLongtoSI,PassiDegCPLongtoSI,FermfNDFLonginRum,FermDegCPLonginRum,
- fNDFLongBreakdown,iNDFLongBreakdown,DegCPLongBreakdown,iDegCPLongBreakdown,
- PassLagfNDFtoSI,PassLagiNDFtoSI,PassLagDegCPtoSI,PassLagiDegCPtoSI,
- PassLagSStarchtoSI,PassLagUSStarchtoSI,LagSStarch,PectinPS,PectinRate,
- SStarch,SStarchLong,USStarch,USStarchLong,UQStarch,PassUQStarchtoSI,
- PassSStarchLongtoSI,PassUSStarchLongtoSI,PassSStarchtoSI,PassUSStarchtoSI,
- SStarchLongBreakdown,USStarchLongBreakdown,SStarchToQStarchBreakdown,
- FermSStarchinRum,FermSStarchLonginRum,SProteinToQProteinSolubilisation,
- PassPectintoSI,FermPectininRum,HGPectinPS,PassPectinOut,FermPectininHG,
- LagSGlycerol,RSGlycerol,LagUrea,SlowReleaseNH3Rate: array of Single;
- SolCHO,SolsNDF,NH3Rum,Ash,H2O,Oil,AcLRum,AcSRum,PropLRum,PropSRum,ButLRum,ButSRum,
- CH4LRum,CH4SRum,MicRumLiquid,MicRumSolids,Lactate,MPOutOfRumen,
- RSolCHO,RSolCP,FermNDFRum,FermQStarchRum,FermSStarchRum,FermDegCPRum,FermNDFHG,FermLacticinRum,
- RLPass,RPPass,PassSolCHOtoSI,PassAshtoSI,SumPassDigCPtoSI,PassLactictoSI,
- PassOiltoSI,FermSolCHOinRum,HourlyPotentialIntake,SIMic,HGPPass,
- SISolCHO,SISolCP,SIOil,RumDM,QMicLiquidR,QMicSolidsR,QMicLaR,QAcR,QPrR,QBuR,QLaR,
- QCH4R,PassNH3toSI,BicarbonateFromSaliva,PAcR,PPrR,PBuR,PLaR,UnFermNDFRL,
- AcHG,PropHG,ButHG,CH4HG,MicHG,NH3HG,QMicHG,QAcHG,QPrHG,QBuHG,FermNH3inRum,
- QCH4HG,SIDigCHO,UnFermSolCHOL,UnFermSolCHOS,UnFermNDFRS,UnFermSolCHOHG,UnFermNDFHG,
- UnFermLacticAcidL,UnFermLacticAcidS,UnFermLacticAcidHG,PpnHexUsedL,PpnHexUsedS,PpnHexUsed,
- PpnHexFerm,pH,CAcR,CPrR,CBuR,CLaR,Protons,{NaHCO3,}DailyFlowSaliva,BicarbonateEaten,
- AbsAc,AbsPr,AbsBu,FreeWater,BoundWater,LiquidVolume,RestSaliva,LacLRum,LacSRum,
- ConcPPass,RConcPPass,FL,PassMultiplier,RumenOsmol,OsFlux,EatingSaliva,
- TotalRumenVol,OutFlow,Value,MaxDailyLoad,SumHourlyActualIntake,MTP,DUP,
- NonForageIntake,TotalSupplementToEat,FDM,DMI,MP,Ac,Pr,Bu,CH4,AbsOil,CHO,
- FaecalfNDF,FaecaliNDF,FaecalN,avDMI,avDMIGrazing,PpnForagePolySacFerm,UrinaryN,
- BloodUreaConc,UreaPoolSize,BodyWater,SumUndigestedProtein,
- SIUndigestedCP,FermProteinHG,QProteinHG,ConsumedVFA,ConsumedLactate,{HProduced,}dH,
- ConsumedNH3,EEsoFar,QAc,QPr,QBu,ProteinGrowth,PassLagSGlyceroltoSI,
- QCHO,QMTP,QDUP,QMP,Scalar,dQAcR,dQAcHG,dQPrR,dQPrHG,dQBuR,dQBuHG,dQLaR,HFSSiR,
- dSIDigCHO,dSIMic,dMP,dAbsOil,FeedWater,FermSolCPRum,SumPassSolCPtoSI,SolubleCP,
- HFSCiR,HFNiR,HFSiR,HSCPiR,HDCPiR,{HSCiR,HPSCiR,}HFNH3QiR,HFNH3SiR,HI,MicLacRum,MicLacHG,LacHG,
- PassSolsNDFtoSI,FermSolsNDFinRum,HGsNDF,FermsNDFHG,PasssNDFOut,AcidEaten,VolBlood,
- ElapsedTime,LPBR,AbsNH3,sss,EMNS,hEMNSh,dEMNS,MicGrowthLacRum,PassQMicLiquidR,
- PassQMicSolidsR,PassageFree,PassageBound,DM,RuminationSaliva,{dpH,}Acid,ProdLacAc,
- FNH3RumFree,FNH3RumSolid,FermNH3inRumFree,FermNH3inRumSolid,FreeProteinRatio,
- SolidProteinRatio,NH3UsedSolid,NH3UsedFree,StarchUsedFree,StarchUsedSolids,
- StarchUsedHG,pHLim,pHLast,DeathOfQMicLiquidR,DeathOfQMicSolidsR,DeathOfQMicHG,
- QDeadSolidMicrobes,QDeadLiquidMicrobes,FermDSMCHO,FermDLMCHO,FermDLMLip,FermDSMLip,
- FermDLMProt,FermDSMProt,RMicProt,SalivaFlow,UrineWater,WaterDrunk,PpnLaUttoRest,
- dUrineWater,dWaterDrunk,PassSIWater,PassWater,QMicLaUtR,MicLacUtRum,
- FermPectinRum,FermPectinHG,FaecalPectin,MonoPG_Glycerol,PassMPGtoSI,
- PassLagUreatoSI,RoboticPerMealPerFood,XSProtein,TMRDailyIntake,
- GrassDailyIntake,AlkabupHaAcidConsumed,AlkabupHaAcidConsumedPpn: Single;
- x,AcLaRum,PropLaRum,ButLaRum,CH4LaRum,FermNH3inRumFreeLa,DeathOfQMicLiquidRLa,
- QDeadLiquidMicrobesLa,FermDLaMCHO,FermDLaMProt,FermDLaMLip,PpnNH3,pnLaR,dUrinaryN,
- dAcid,dNaHCO3,SIMicCHO,SIMicLip,dSIMicCHO,dSIMicLip,Neutralised,CO2Produced,
- ppnNeutralised,DegradableTrueP,ProteinMilk,EnergyMilk,ParlourPerMealPerFood,
- LPBreakdownR,LongParticles,ShortParticles,ProtFromBody,MaxProtFromBody,
- SumProteinFromBody,MinimumUrineWater,DaysIntake,deNaHCO3,deHProduced,
- MolarNaHCO3,DissociatedAcidRatioVFA,DissociatedAcidRatioLactic,LipidGrowth,
- PassUnfermentedGlyceroltoSI,Glycerol,PassGlyceroltoSI,FermGlycerolinRumen,
- EnergyFromKetogenic,EnergyFromGlucogenic,RatioKetogenic:Single;
- FixedIntake,CanEatForage,IncreaseRumenFillUpper,Weeks1_12,MaxRum,MaxLPBR: Boolean;
- LagfNDFToEnter,LagiNDFToEnter,LagNDFEntryTime,
- LagSStarchEntryTime,LagSStarchToEnter,LagUSStarchToEnter,
- LagDegCPToEnter,LagiDegCPToEnter,LagCPEntryTime,
- LagSGlycerolToEnter,LagSGlycerolEntryTime,LagUreaEntryTime,
- LagUreaToEnter: array of array[1..24] of Single;
- pHOverTime: array[1..10] of Single;
- OxygenLevel,OxygenUsed,QYeast,YeastMaint,AcY,PropY,ButY,CH4Y,DeathYeast,
- deltaYeast,FermMonoPG_GlycerolinRum,TimeSpentEating,UnfermentedGlycerolSmall,
- {LongNDF,TotalNDF,}SlowReleaseNH3,LagParlourFeed,HalfRoboticDMI,LiqPerMeal,
- MaxLongParticles,TotalLongParticles,DMRatio,TotalRumDM: Single;
- ParlourCountLow,ParlourCountHigh,RoboticCountLow,RoboticCountHigh,
- LiquidCount: Integer;
- LPMultiplier: array of Single;
- begin
- WhyWontItWork:=0;WWIW:=0;
- MinimumUrineWater:=LactationDay1/StepsPerHour/HoursInDay;
- MicLacHG:=0;LacHG:=0;pHLast:=6.2;Weeks1_12:=False;ProportionNH3Free:=0.5;
- for n1:=1 to 24 do
- begin
- TLongNDFForage[n1]:=0;
- TNDFForage[n1]:=0;
- ULongNDFForage[n1]:=0;
- UNDFForage[n1]:=0;
- end;
- VolBlood:=Animal.LFEB*0.1;
- BodyWater:=Animal.Water;//kg
- //put NH3 from g/day to moles of urea per tstep
- ptrNutAbsorbed^.NH3:=ptrNutAbsorbed^.NH3/HoursInDay/StepsPerHour/(2*MWNH3);
- UreaPoolSize:=1;
- ptrNutAbsorbed^.RuminationTime:=1;
- BloodUreaConc:=0.005;//initial value of 5mM
- iNoFeeds1:=ptrFeedDescriptions^.iNoFeeds;
- NumFoods:=iNoFeeds1+ptrFeedDescriptions^.iParlour
- +ptrFeedDescriptions^.iGrazing
- +ptrFeedDescriptions^.iRobotic
- +ptrFeedDescriptions^.iLiquid; //length of array determines how many foods being fed
- //iRobotic sometimes set to 1 which means there is no Robotic!
- if ptrFeedDescriptions^.iRobotic=1 then NumFoods:=NumFoods-1;
- //iLiquid should be zero if not TMRRobotics otherwise NumFoods too high
- //if not TMRRobotic then
- // if ptrFeedDescriptions^.iLiquid=1 then NumFoods:=NumFoods-1;
- //NumFoods-counter = count for grazing
- if ptrFeedDescriptions^.iParlour>0 then
- counter:=PreMixParlourNo+ptrFeedDescriptions^.iRobotic+ptrFeedDescriptions^.iLiquid+1
- else counter:=1;
- //NumFoods has a number equivalent to iNoFeeds, and one for iGrazing and
- //one equivalent to iParlour. All arrays start at zero! So NumFoods-1 to give arrays
- //So for one tmr, one grazing and one parlour 1st is tmr, 2nd is grazing, 3rd is parlour
- ParlourCountHigh:=0;
- RoboticCountHigh:=0;
- if ptrFeedDescriptions^.iParlour>0 then
- begin
- ParlourCountLow:=iNoFeeds1+ptrFeedDescriptions^.iGrazing;
- ParlourCountHigh:=ParlourCountLow+ptrFeedDescriptions^.iParlour-1;
- end;
- if ptrFeedDescriptions^.iRobotic>0 then
- begin
- RoboticCountLow:=ParlourCountHigh+1;
- RoboticCountHigh:=RoboticCountLow+ptrFeedDescriptions^.iRobotic-1;
- end;
- if ptrFeedDescriptions^.iLiquid>0 then
- begin
- LiquidCount:=RoboticCountHigh+1;
- end;
- if TMRRobotic then
- ParlourHour[1]:=RoboticHour[1];
- SetLength(SlowReleaseNH3Rate,NumFoods);
- SetLength(LagUrea,NumFoods);
- SetLength(LagUreaToEnter,NumFoods);
- SetLength(LagUreaEntryTime,NumFoods);
- SetLength(RSGlycerol,NumFoods);
- SetLength(LagSGlycerol,NumFoods);
- SetLength(LagSGlycerolToEnter,NumFoods);
- SetLength(LagSGlycerolEntryTime,NumFoods);
- SetLength(LagfNDFToEnter,NumFoods);
- SetLength(LagiNDFToEnter,NumFoods);
- SetLength(LagNDFEntryTime,NumFoods);
- SetLength(LagSStarchToEnter,NumFoods);
- SetLength(LagUSStarchToEnter,NumFoods);
- SetLength(LagSStarchEntryTime,NumFoods);
- SetLength(LagDegCPToEnter,NumFoods);
- SetLength(LagiDegCPToEnter,NumFoods);
- SetLength(LagCPEntryTime,NumFoods);
- SetLength(PassLagfNDFtoSI,NumFoods);
- SetLength(PassLagSStarchtoSI,NumFoods);
- SetLength(PassLagUSStarchtoSI,NumFoods);
- SetLength(LagSStarch,NumFoods);
- SetLength(PassLagDegCPtoSI,NumFoods);
- SetLength(PassLagiNDFtoSI,NumFoods);
- SetLength(PassLagiDegCPtoSI,NumFoods);
- SetLength(fNDF,NumFoods); //use this to set up size of internal arrays
- SetLength(iNDF,NumFoods);
- SetLength(fNDFLong,NumFoods);
- SetLength(iNDFLong,NumFoods);
- SetLength(SStarch,NumFoods); //use this to set up size of internal arrays
- SetLength(USStarch,NumFoods);
- SetLength(SStarchLong,NumFoods);
- SetLength(USStarchLong,NumFoods);
- SetLength(UQStarch,NumFoods); //use this to set up size of internal arrays
- SetLength(LagNDF,NumFoods);
- SetLength(LagCP,NumFoods);
- SetLength(QStarch,NumFoods);
- SetLength(SolCP,NumFoods);
- SetLength(DegCP,NumFoods);
- SetLength(iDegCP,NumFoods);
- SetLength(DegCPLong,NumFoods);
- SetLength(iDegCPLong,NumFoods);
- SetLength(RNDF,NumFoods);
- SetLength(RQStarch,NumFoods);
- SetLength(RSStarch,NumFoods);
- SetLength(PectinPS,NumFoods);
- SetLength(PectinRate,NumFoods);
- SetLength(RDegCP,NumFoods);
- SetLength(RaCP,NumFoods);
- SetLength(SIfNDF,NumFoods);
- SetLength(SIiNDF,NumFoods);
- SetLength(SIStarch,NumFoods);
- SetLength(SIDegCP,NumFoods);
- SetLength(SIiDegCP,NumFoods);
- SetLength(PassPectintoSI,NumFoods);
- SetLength(PassfNDFtoSI,NumFoods);
- SetLength(PassiNDFtoSI,NumFoods);
- SetLength(PassfNDFLongtoSI,NumFoods);
- SetLength(PassiNDFLongtoSI,NumFoods);
- SetLength(PassQStarchtoSI,NumFoods);
- SetLength(PassSolCPtoSI,NumFoods);
- SetLength(PassDegCPtoSI,NumFoods);
- SetLength(PassiDegCPtoSI,NumFoods);
- SetLength(PassDegCPLongtoSI,NumFoods);
- SetLength(PassiDegCPLongtoSI,NumFoods);
- SetLength(FermfNDFinRum,NumFoods);
- SetLength(FermfNDFLonginRum,NumFoods);
- SetLength(FermStarchinRum,NumFoods);
- SetLength(FermSolCPinRum,NumFoods);
- SetLength(FermDegCPinRum,NumFoods);
- SetLength(FermDegCPLonginRum,NumFoods);
- SetLength(PassPectinOut,NumFoods);
- SetLength(PassfNDFOut,NumFoods);
- SetLength(PassiNDFOut,NumFoods);
- SetLength(HGPectinPS,NumFoods);
- SetLength(HGfNDF,NumFoods);
- SetLength(HGiNDF,NumFoods);
- SetLength(FermPectininHG,NumFoods);
- SetLength(FermfNDFinHG,NumFoods);
- SetLength(TotalAmount,iNoFeeds1);
- SetLength(HourlyActualIntake,NumFoods);
- SetLength(DailyIntake,NumFoods);
- SetLength(SupplementRatio,NumFoods);
- SetLength(SupplementToEat,NumFoods);
- SetLength(fNDFLongBreakdown,NumFoods);
- SetLength(iNDFLongBreakdown,NumFoods);
- SetLength(DegCPLongBreakdown,NumFoods);
- SetLength(iDegCPLongBreakdown,NumFoods);
- SetLength(PassSStarchLongtoSI,NumFoods);
- SetLength(PassUSStarchLongtoSI,NumFoods);
- SetLength(PassSStarchtoSI,NumFoods);
- SetLength(PassUSStarchtoSI,NumFoods);
- SetLength(PassUQStarchtoSI,NumFoods);
- SetLength(SStarchLongBreakdown,NumFoods);
- SetLength(USStarchLongBreakdown,NumFoods);
- SetLength(SStarchToQStarchBreakdown,NumFoods);
- SetLength(FermSStarchinRum,NumFoods);
- SetLength(FermSStarchLonginRum,NumFoods);
- SetLength(SProteinToQProteinSolubilisation,NumFoods);
- SetLength(FermPectininRum,NumFoods);
- SetLength(LPMultiplier,iNoFeeds1);
- LongForage:=False;
- for n1 := 0 to iNoFeeds1-1 do
- begin
- LPMultiplier[n1]:=1;
- if rFeedInfo.TMRFeed[n1].LongForage then
- begin
- LongForage:=True;
- LPMultiplier[n1]:=1.1;
- end;
- end;
- DrinkingTime:=[1,6,9,14,18,21];
- //if ptrFeedDescriptions^.Week=0 then
- // Animal.ProteinLoss:=Animal.PMat*0.2/Animal.Tstar*1.35
- //else
- // Animal.ProteinLoss:=Animal.ProteinLoss*0.8+Animal.PMat*0.2/Animal.Tstar*1.35*0.025;
- MaxProtFromBody:=Animal.PMat*0.2/Animal.Teestar;//Animal.ProteinLoss;
- ProtFromBody:=0;
- //SumProteinFromBody:=0;
- //for loopi:=0 to UpperLimit do
- // SumProteinFromBody:=SumProteinFromBody
- // +ptrNutAbsorbed^.ProteinFromBody[loopi];
- for loopi:=0 to NumFoods-1 do
- for loopm:=1 to HoursInDay do
- begin
- LagSGlycerolEntryTime[loopi,loopm]:=-1;
- LagNDFEntryTime[loopi,loopm]:=-1;
- LagSStarchEntryTime[loopi,loopm]:=-1;
- LagCPEntryTime[loopi,loopm]:=-1;
- end;
- fNDFRateOutFor:=0;FixedIntake:=True;// else FixedIntake:=False; //predicting intake - if true using predetermined intake
- SolCHO:=0; SolsNDF:=0; Ash:=0; Oil:=0;MaxDailyLoad:=0; MonoPG_Glycerol:=0;
- SISolCHO:=0; SISolCP:=0; SIOil:=0; AcLRum:=0; PropLRum:=0; Lactate:=0;
- ButLRum:=0; CH4LRum:=0; MicRumLiquid:=0; BoundWater:=0; SlowReleaseNH3:=0;
- AcSRum:=0;PropSRum:=0;ButSRum:=0;CH4SRum:=0;MicRumSolids:=0;LacLRum:=0;LacSRum:=0;
- AcLaRum:=0;PropLaRum:=0;ButLaRum:=0;CH4LaRum:=0;PassUnfermentedGlyceroltoSI:=0;
- SIMic:=0; FDM:=0; NH3HG:=0; MicHG:=0; CH4HG:=0; AcHG:=0; PropHG:=0;
- ButHG:=0; SIDigCHO:=0; pH:=7.2; CAcR:=0.1; CPrR:=0.035; CBuR:=0.02;
- OutFlow:=0;NonForageIntake:=0;DUP:=0;MTP:=0;FaecalN:=0;FaecalfNDF:=0;
- FaecaliNDF:=0;NH3Lim:=0;pHLim:=0;PpnForagePolySacFerm:=0;QAc:=0;QPr:=0;
- QBu:=0;QCHO:=0;QMTP:=0;QMP:=0;QDUP:=0; HGsNDF:=0;avDMIGrazing:=0;
- RuminationSaliva:=0;Protons:=0;{NaHCO3:=0.13*15*ptrFeedDescriptions^.RVol/10025;}DailyFlowSaliva:=0;
- QMicSolidsR:=10*ptrFeedDescriptions^.RVol;QMicLiquidR:=10*ptrFeedDescriptions^.RVol;
- QDeadSolidMicrobes:=0;LiquidCHO:=0;LiquidProt:=0;LiquidLip:=0;QMicHG:=0.1*ptrFeedDescriptions^.RVol;
- QDeadLiquidMicrobes:=0;QDeadLiquidMicrobesLa:=0;SIMicCHO:=0;SIMicLip:=0;
- ppnNeutralised:=1;LaUtCHO:=0;LaUtProt:=0;LaUtLip:=0;LaUtAsh:=0;TimeSpentEating:=0;
- MolarNaHCO3:=0.04;UnfermentedGlycerolSmall:=0;Glycerol:=0; HalfRoboticDMI:=1;
- MaxLongParticles:=0; MaxLPBR:=False;TotalLongParticles:=0; DMRatio:=0.5;
- //dPassGlycerol:=0;dGlycerol:=0;
- for loopi:=1 to 10 do pHOverTime[loopi]:=6.8;
- QMicLaUtR:=100*ptrFeedDescriptions^.RVol/100;
- QMicLaR:=30*ptrFeedDescriptions^.RVol/100;
- if ptrFeedDescriptions^.TMR then
- begin
- ptrFeedDescriptions^.RumSA:=251360*power(ptrFeedDescriptions^.RumFillUpper
- *ptrFeedDescriptions^.RVol/4189.333,0.667);// 'cm2
- end
- else
- begin
- // ptrFeedDescriptions^.RumFillUpper:=1.2;
- end;
- //initialise compartments by assuming first meal fills rumen, unless DMI has been
- //set - in which case use value from DMI that is passed in - it will be > 0
- if not FSGrazingAll[ptrFeedDescriptions^.Diet] then
- begin
- for loopi:=0 to iNoFeeds1-1 do //calculate total of amount array
- TotalAmount[loopi]:=TotalAmount[loopi]+
- ptrAmount^[loopi+(ptrFeedDescriptions^.Diet-1)*iNoFeeds1];
- end;
- if not FSGrazingAll[ptrFeedDescriptions^.Diet] then
- begin
- for loopi:=0 to iNoFeeds1-1 do MaxDailyLoad:=MaxDailyLoad+TotalAmount[loopi];
- for loopi:=0 to ptrFeedDescriptions^.iNoFeeds-1 do
- //Rumen Pools
- begin
- if FixedIntake then
- begin
- if ptrFeedDescriptions^.TMR then Scalar:=ptrFeedDescriptions^.RVol*0.15*0.4 else Scalar:=1; //0.5 to 10
- sss:=Scalar*TotalAmount[loopi]/MaxDailyLoad;
- if ptrFeedDescriptions^.Long then
- begin
- fNDF[loopi]:=(1-ptrFeedDescriptions^.TMRFeed[loopi].LargePartLag)*sss
- *ptrFeedDescriptions^.TMRFeed[loopi].fermNDF;
- iNDF[loopi]:=(1-ptrFeedDescriptions^.TMRFeed[loopi].LargePartLag)*sss
- *ptrFeedDescriptions^.TMRFeed[loopi].unfermNDF;
- fNDFLong[loopi]:=ptrFeedDescriptions^.TMRFeed[loopi].LargePartLag*sss
- *ptrFeedDescriptions^.TMRFeed[loopi].fermNDF;
- iNDFLong[loopi]:=ptrFeedDescriptions^.TMRFeed[loopi].LargePartLag*sss
- *ptrFeedDescriptions^.TMRFeed[loopi].unfermNDF;
- SStarch[loopi]:=(1-ptrFeedDescriptions^.TMRFeed[loopi].LargePartLag)*sss
- *ptrFeedDescriptions^.TMRFeed[loopi].SlowStarch;
- USStarch[loopi]:=(1-ptrFeedDescriptions^.TMRFeed[loopi].LargePartLag)*sss
- *ptrFeedDescriptions^.TMRFeed[loopi].UndegSStarch;
- SStarchLong[loopi]:=ptrFeedDescriptions^.TMRFeed[loopi].LargePartLag*sss
- *ptrFeedDescriptions^.TMRFeed[loopi].SlowStarch;
- USStarchLong[loopi]:=ptrFeedDescriptions^.TMRFeed[loopi].LargePartLag*sss
- *ptrFeedDescriptions^.TMRFeed[loopi].UndegSStarch;
- end
- else
- begin
- fNDF[loopi]:=sss*ptrFeedDescriptions^.TMRFeed[loopi].fermNDF;
- iNDF[loopi]:=sss*ptrFeedDescriptions^.TMRFeed[loopi].unfermNDF;
- SStarch[loopi]:=sss*ptrFeedDescriptions^.TMRFeed[loopi].SlowStarch;
- USStarch[loopi]:=sss*ptrFeedDescriptions^.TMRFeed[loopi].UndegSStarch;
- end;
- QStarch[loopi]:=sss*ptrFeedDescriptions^.TMRFeed[loopi].QuickStarch;
- UQStarch[loopi]:=sss*ptrFeedDescriptions^.TMRFeed[loopi].UndegQStarch;
- DegCP[loopi]:=sss*ptrFeedDescriptions^.TMRFeed[loopi].P2;
- iDegCP[loopi]:=sss*ptrFeedDescriptions^.TMRFeed[loopi].P3;
- SolCHO:=SolCHO+sss*ptrFeedDescriptions^.TMRFeed[loopi].C1;
- if ptrFeedDescriptions^.Pectins then
- begin
- SolsNDF:=0;
- PectinPS[loopi]:=sss*ptrFeedDescriptions^.TMRFeed[loopi].C1sNDF;
- end
- else
- begin
- if ptrFeedDescriptions^.ACHOintoWSCsNDF then
- SolsNDF:=SolsNDF+sss*ptrFeedDescriptions^.TMRFeed[loopi].C1sNDF
- else SolsNDF:=0;
- end;
- SolCP[loopi]:=sss*ptrFeedDescriptions^.TMRFeed[loopi].P1;
- Ash:=Ash+sss*ptrFeedDescriptions^.TMRFeed[loopi].Mins;
- Oil:=Oil+sss*ptrFeedDescriptions^.TMRFeed[loopi].EE;
- BoundWater:=BoundWater+fNDF[loopi]+iNDF[loopi]+QStarch[loopi];
- end;
- //SI Pools
- SIfNDF[loopi]:=0;
- SIiNDF[loopi]:=0;
- SIStarch[loopi]:=0;
- SIDegCP[loopi]:=0;
- SIiDegCP[loopi]:=0;
- end;
- end
- else
- begin
- Scalar:=ptrFeedDescriptions^.RVol*0.15*0.5;
- //Grazing is NumFoods-1 - PreMixParlourNo when iParlour is on.
- count:=NumFoods-counter;
- if ptrFeedDescriptions^.Long then
- begin
- fNDF[count]:=(1-ptrFeedDescriptions^.GrazingFeed.LargePartLag)*Scalar
- *ptrFeedDescriptions^.GrazingFeed.fermNDF;
- iNDF[count]:=(1-ptrFeedDescriptions^.GrazingFeed.LargePartLag)*Scalar
- *ptrFeedDescriptions^.GrazingFeed.unfermNDF;
- fNDFLong[count]:=ptrFeedDescriptions^.GrazingFeed.LargePartLag*Scalar
- *ptrFeedDescriptions^.GrazingFeed.fermNDF;
- iNDFLong[count]:=ptrFeedDescriptions^.GrazingFeed.LargePartLag*Scalar
- *ptrFeedDescriptions^.GrazingFeed.unfermNDF;
- SStarch[count]:=(1-ptrFeedDescriptions^.GrazingFeed.LargePartLag)*Scalar
- *ptrFeedDescriptions^.GrazingFeed.SlowStarch;
- USStarch[count]:=(1-ptrFeedDescriptions^.GrazingFeed.LargePartLag)*Scalar
- *ptrFeedDescriptions^.GrazingFeed.UndegSStarch;
- SStarchLong[count]:=ptrFeedDescriptions^.GrazingFeed.LargePartLag*Scalar
- *ptrFeedDescriptions^.GrazingFeed.SlowStarch;
- USStarchLong[count]:=ptrFeedDescriptions^.GrazingFeed.LargePartLag*Scalar
- *ptrFeedDescriptions^.GrazingFeed.UndegSStarch;
- end
- else
- begin
- fNDF[count]:=Scalar*ptrFeedDescriptions^.GrazingFeed.fermNDF;
- iNDF[count]:=Scalar*ptrFeedDescriptions^.GrazingFeed.unfermNDF;
- SStarch[count]:=Scalar*ptrFeedDescriptions^.GrazingFeed.SlowStarch;
- USStarch[count]:=Scalar*ptrFeedDescriptions^.GrazingFeed.UndegSStarch;
- end;
- QStarch[count]:=Scalar*ptrFeedDescriptions^.GrazingFeed.QuickStarch;
- UQStarch[count]:=Scalar*ptrFeedDescriptions^.GrazingFeed.UndegQStarch;
- DegCP[count]:=Scalar*ptrFeedDescriptions^.GrazingFeed.P2;
- iDegCP[count]:=Scalar*ptrFeedDescriptions^.GrazingFeed.P3;
- SolCHO:=SolCHO+Scalar*ptrFeedDescriptions^.GrazingFeed.C1;
- if ptrFeedDescriptions^.Pectins then
- begin
- SolsNDF:=0;
- PectinPS[count]:=Scalar*ptrFeedDescriptions^.GrazingFeed.C1sNDF;
- end
- else
- begin
- if ptrFeedDescriptions^.ACHOintoWSCsNDF then
- SolsNDF:=SolsNDF+Scalar*ptrFeedDescriptions^.GrazingFeed.C1sNDF
- else SolsNDF:=0;
- end;
- SolCP[count]:=Scalar*ptrFeedDescriptions^.GrazingFeed.P1;
- Ash:=Ash+Scalar*ptrFeedDescriptions^.GrazingFeed.Mins;
- Oil:=Oil+Scalar*ptrFeedDescriptions^.GrazingFeed.EE;
- BoundWater:=BoundWater+fNDF[count]+iNDF[count]+QStarch[count];
- //SI Pools
- SIfNDF[count]:=0;
- SIiNDF[count]:=0;
- SIStarch[count]:=0;
- SIDegCP[count]:=0;
- SIiDegCP[count]:=0;
- end;
- NH3Rum:=0.005*17*ptrFeedDescriptions^.RVol; //g - assume initial conc of 5mM
- //calculate rates per tslp
- HGPPass := (0.8/0.2)*ptrFeedDescriptions^.PPass;//foregut ppn/HGppn
- if not FSGrazingAll[ptrFeedDescriptions^.Diet] then
- for loopi:=0 to ptrFeedDescriptions^.iNoFeeds-1 do
- begin
- RSGlycerol[loopi]:=Power(1+ptrFeedDescriptions^.TMRFeed[loopi].SlowGlycerolRate,1/StepsPerHour)-1;
- RNDF[loopi]:=(Power(1+ptrFeedDescriptions^.TMRFeed[loopi].RC2,1/StepsPerHour)-1){*0.5};
- RQStarch[loopi]:=Power(1+ptrFeedDescriptions^.TMRFeed[loopi].RC3,1/StepsPerHour)-1;
- RSStarch[loopi]:=(Power(1+ptrFeedDescriptions^.TMRFeed[loopi].RSStarch,1/StepsPerHour)-1){*0.5};
- RDegCP[loopi]:=Power(1+ptrFeedDescriptions^.TMRFeed[loopi].RP2,1/StepsPerHour)-1;
- RaCP[loopi]:=Power(1+ptrFeedDescriptions^.TMRFeed[loopi].RP1,1/StepsPerHour)-1;
- PectinRate[loopi]:=Power(1+ptrFeedDescriptions^.TMRFeed[loopi].PectinRate,1/StepsPerHour)-1;
- SlowReleaseNH3Rate[loopi]:=Power(1+ptrFeedDescriptions^.TMRFeed[loopi].SRNH3Rate,1/StepsPerHour)-1;
- end;
- if ptrFeedDescriptions^.iGrazing>0 then
- //Grazing is NumFoods-1 - PreMixParlourNo when iParlour is on.
- begin
- count:=ptrFeedDescriptions^.iNoFeeds;
- RSGlycerol[count]:=Power(1+ptrFeedDescriptions^.GrazingFeed.SlowGlycerolRate,1/StepsPerHour)-1;
- RNDF[count]:=Power(1+ptrFeedDescriptions^.GrazingFeed.RC2,1/StepsPerHour)-1;
- RQStarch[count]:=Power(1+ptrFeedDescriptions^.GrazingFeed.RC3,1/StepsPerHour)-1;
- RSStarch[count]:=Power(1+ptrFeedDescriptions^.GrazingFeed.RSStarch,1/StepsPerHour)-1;
- RDegCP[count]:=Power(1+ptrFeedDescriptions^.GrazingFeed.RP2,1/StepsPerHour)-1;
- RaCP[count]:=Power(1+ptrFeedDescriptions^.GrazingFeed.RP1,1/StepsPerHour)-1;
- PectinRate[count]:=Power(1+ptrFeedDescriptions^.GrazingFeed.PectinRate,1/StepsPerHour)-1;
- end;
- if ptrFeedDescriptions^.iParlour>0 then
- begin
- n1:=0;
- for count:=ParlourCountLow to ParlourCountHigh do
- begin
- RSGlycerol[count]:=Power(1+ptrFeedDescriptions^.ParlourFeed[n1].SlowGlycerolRate,1/StepsPerHour)-1;
- RNDF[count]:=Power(1+ptrFeedDescriptions^.ParlourFeed[n1].RC2,1/StepsPerHour)-1;
- RQStarch[count]:=Power(1+ptrFeedDescriptions^.ParlourFeed[n1].RC3,1/StepsPerHour)-1;
- RSStarch[count]:=Power(1+ptrFeedDescriptions^.ParlourFeed[n1].RSStarch,1/StepsPerHour)-1;
- RDegCP[count]:=Power(1+ptrFeedDescriptions^.ParlourFeed[n1].RP2,1/StepsPerHour)-1;
- RaCP[count]:=Power(1+ptrFeedDescriptions^.ParlourFeed[n1].RP1,1/StepsPerHour)-1;
- PectinRate[count]:=Power(1+ptrFeedDescriptions^.ParlourFeed[n1].PectinRate,1/StepsPerHour)-1;
- SlowReleaseNH3Rate[count]:=Power(1+ptrFeedDescriptions^.ParlourFeed[n1].SRNH3Rate,1/StepsPerHour)-1;
- inc(n1);
- end;
- end;
- if ptrFeedDescriptions^.iRobotic>1 then
- begin
- n1:=0;
- for count:=RoboticCountLow to RoboticCountHigh do
- begin
- RSGlycerol[count]:=Power(1+ptrFeedDescriptions^.RoboticFeed[n1].SlowGlycerolRate,1/StepsPerHour)-1;
- RNDF[count]:=Power(1+ptrFeedDescriptions^.RoboticFeed[n1].RC2,1/StepsPerHour)-1;
- RQStarch[count]:=Power(1+ptrFeedDescriptions^.RoboticFeed[n1].RC3,1/StepsPerHour)-1;
- RSStarch[count]:=Power(1+ptrFeedDescriptions^.RoboticFeed[n1].RSStarch,1/StepsPerHour)-1;
- RDegCP[count]:=Power(1+ptrFeedDescriptions^.RoboticFeed[n1].RP2,1/StepsPerHour)-1;
- RaCP[count]:=Power(1+ptrFeedDescriptions^.RoboticFeed[n1].RP1,1/StepsPerHour)-1;
- PectinRate[count]:=Power(1+ptrFeedDescriptions^.RoboticFeed[n1].PectinRate,1/StepsPerHour)-1;
- SlowReleaseNH3Rate[count]:=Power(1+ptrFeedDescriptions^.RoboticFeed[n1].SRNH3Rate,1/StepsPerHour)-1;
- inc(n1);
- end;
- end;
- if ptrFeedDescriptions^.iLiquid>0 then
- begin
- count:=LiquidCount;
- begin
- RSGlycerol[count]:=Power(1+ptrFeedDescriptions^.LiquidFeed.SlowGlycerolRate,1/StepsPerHour)-1;
- RNDF[count]:=Power(1+ptrFeedDescriptions^.LiquidFeed.RC2,1/StepsPerHour)-1;
- RQStarch[count]:=Power(1+ptrFeedDescriptions^.LiquidFeed.RC3,1/StepsPerHour)-1;
- RSStarch[count]:=Power(1+ptrFeedDescriptions^.LiquidFeed.RSStarch,1/StepsPerHour)-1;
- RDegCP[count]:=Power(1+ptrFeedDescriptions^.LiquidFeed.RP2,1/StepsPerHour)-1;
- RaCP[count]:=Power(1+ptrFeedDescriptions^.LiquidFeed.RP1,1/StepsPerHour)-1;
- PectinRate[count]:=Power(1+ptrFeedDescriptions^.LiquidFeed.PectinRate,1/StepsPerHour)-1;
- SlowReleaseNH3Rate[count]:=Power(1+ptrFeedDescriptions^.LiquidFeed.SRNH3Rate,1/StepsPerHour)-1;
- end;
- end;
- RMicProt:=Power(1+MicrobialProteinRate,1/StepsPerHour)-1;
- RSolCHO:=Power(1+ptrFeedDescriptions^.RC1,1/StepsPerHour)-1;
- RLPass:=Power(1+ptrFeedDescriptions^.LPass,1/StepsPerHour)-1;
- RPPass:=Power(1+ptrFeedDescriptions^.PPass,1/StepsPerHour)-1;
- HGPPass:=Power(1+HGPPass,1/StepsPerHour)-1;
- ConcPPass:=(-0.424+1.45*ptrFeedDescriptions^.PPass*100)/100;
- RConcPPass:=Power(1+ConcPPass,1/StepsPerHour)-1;
- //if ptrFeedDescriptions^.Long then
- // if not ptrFeedDescriptions^.LPBRwithRumination then
- // LPBR:=Power(1+ptrFeedDescriptions^.LongParticleBR,1/StepsPerHour)-1
- // else
- LPBreakdownR:=Power(1+2*ptrFeedDescriptions^.LongParticleBR,1/StepsPerHour)-1;
- //Andy on Pickervance diet led to the following 0.1. That agrees with what they were eating
- //if Beef then
- // LPBreakdownR:=LPBreakdownR*0.8
- //else
- // if LeftStr(Instant.Edit66.Text,1)='-' then
- if ChopLength then
- if version1_01_16 then
- begin
- LPBreakdownR:=LPBreakdownR*0.45*LargeParticleBR;
- end
- else
- begin
- LPBreakdownR:=LPBreakdownR*0.45*LargeParticleBR
- end
- else
- LPBreakdownR:=LPBreakdownR*0.5*LargeParticleBR;
- //Rumen water
- FreeWater:=ptrFeedDescriptions^.RVol*0.75;
- //ptrFeedDescriptions^.RumFillUpper:=1;
- LiquidVolume:=FreeWater*1.2;
- OxygenLevel:=1*LiquidVolume; //umole/litre
- Neutralised:=0.155*LiquidVolume;
- RestSaliva:=RestSalivaPpn*21.25*ptrFeedDescriptions^.ActualWeight*0.375/Thousand/StepsPerHour;//kg/tstep
- ElapsedTime:=0;
- PassageFree:=RLPass*FreeWater/LiquidVolume;
- PassageBound:=RConcPPass*(1-FreeWater/LiquidVolume);
- //Start main loops
- for Days1toEnd:=1 to ptrFeedDescriptions^.iDaysToRun do //daily loop
- begin
- ptrNutAbsorbed^.RuminationTime:=1;
- EEsoFar:=0; DaysIntake:=0;
- dQAcR:=0; dQAcHG:=0; dQPrR:=0; dQPrHG:=0; dQBuR:=0; dQBuHG:=0;
- dSIDigCHO:=0; dSIMic:=0; dMP:=0; dAbsOil:=0; dQLaR:=0; dSIMicCHO:=0;dSIMicLip:=0;
- UrineWater:=0;WaterDrunk:=0; UrinaryN:=0;GrassDailyIntake:=0;TMRDailyIntake:=0;
- for loopi:=0 to NumFoods-1 do SupplementToEat[loopi]:=0;//initialise
- for Hours1to24:=1 to HoursInDay do //hourly loop
- begin
- HFSCiR:=0;
- HFNiR:=0;
- HFSiR:=0; HFSSiR:=0;
- HSCPiR:=0;
- HDCPiR:=0;
- // HSCiR:=0;
- // HPSCiR:=0;
- HFNH3QiR:=0;
- HFNH3SiR:=0;
- hEMNSh:=0;
- PAcR:=0; PPrR:=0; PBuR:=0; PLaR:=0; //dpH:=0;
- FreeProteinRatio:=0; SolidProteinRatio:=0;
- dAcid:=0; dNaHCO3:=0;
- //put eating grazing vs tmr here
- if FSGrazingpemNDF then
- begin
- if (Hours1to24 in GrazingHour[ptrFeedDescriptions^.Diet]) then
- begin
- // EatingTime:=[3,8,12,14,17,19,23];
- // EatingTime:=[3,8,10,12,14,16,18,20,23];
- EatingTime:=[2,6,9,12,15,18,20,23];
- // if ActiveFibreGrazing<27.5 then
- // RuminatingTime:=0.0054*ActiveFibreGrazing+0.4531
- // else
- // RuminatingTime:=0.6;
- // Available2Eat:=WakingTime*(1-RuminatingTime);
- // if Available2Eat<9.5 then EatingTime:=[4,7,9,12,15,18,21,24]
- // else if Available2Eat<10.5 then EatingTime:=[3,6,9,12,14,16,18,21,24]
- // else if Available2Eat<11.5 then EatingTime:=[2,4,6,9,12,14,16,18,21,23]
- // else EatingTime:=[2,4,6,8,10,12,14,16,18,21,23];
- end;
- end
- else
- begin
- // if ActiveFibreTMR<27.5 then
- // RuminatingTime:=0.0054*ActiveFibreTMR+0.4531
- // else
- // RuminatingTime:=0.6;
- // Available2Eat:=WakingTime*(1-RuminatingTime);
- if Virgilio then
- begin
- end
- else if TMRRobotic then
- begin
- end
- else if NoOfMeals=11 then
- begin
- //10 to 7 meals per day
- if StrToInt(Instant.Edit63.Text)<=39 then
- if version1_01_16 then
- begin
- if Beef then
- EatingTime:=[3,7,11,15,19,23]
- else
- EatingTime:=[3,7,9,12,15,18,20,23];
- end
- else
- begin
- EatingTime:=[2,6,9,12,16,19,22];
- end
- else if StrToInt(Instant.Edit63.Text)<=49 then
- EatingTime:=[3,7,9,12,15,18,20,23]
- else
- EatingTime:=[2,4,6,8,10,12,14,17,19,22];//[2,6,9,12,16,19,22];//[3,8,12,14,17,19,23];//[3,8,11,14,18,21,24]; //[3,8,12,14,16,19,23]
- // if Available2Eat<9.5 then EatingTime:=[4,7,9,12,15,18,21,24] [2,4,7,9,12,15,18,20,23];//
- // else if Available2Eat<10.5 then EatingTime:=[3,6,9,12,14,16,18,21,24]
- // else if Available2Eat<11.0 then EatingTime:=[2,4,6,9,12,14,16,18,20,23]
- // else EatingTime:=[2,4,6,8,10,12,14,16,18,21,23];
- end
- else if NoOfMeals=8 then
- begin
- {88} EatingTime:=[2,6,9,11,14,18,20,23];//[3,8,12,14,16,18,20,23];
- end
- else if NoOfMeals=6 then
- begin
- EatingTime:=[8,12,16,18,21,24];
- end
- else if NoOfMeals=4 then
- begin
- EatingTime:=[1,8,14,20];
- end;
- end;
- for StepHours1toEnd:=1 to StepsPerHour do //within hour loop
- begin
- if (LagTimeParlour) and (LagParlourFeed>0) then
- begin
- n1:=0;
- for count:=NumFoods-counter+1 to NumFoods-1-ptrFeedDescriptions^.iRobotic do
- begin
- ParlourPerMealPerFood:=LagParlourFeed/StepsPerHour
- *PMParlourAmount[n1]/100;
- QStarch[count]:=QStarch[count]+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].QuickStarch;
- UQStarch[count]:=UQStarch[count]+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].UndegQStarch;
- SolCHO:=SolCHO+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].C1;
- MonoPG_Glycerol:=MonoPG_Glycerol+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].MPG;
- Glycerol:=Glycerol+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].Glycerol;
- UnfermentedGlycerolSmall:=UnfermentedGlycerolSmall+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].UnfermentedGlycerol;
- SolCP[count]:=SolCP[count]+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].P1;
- if ptrFeedDescriptions^.Pectins then
- begin
- SolsNDF:=0;
- PectinPS[count]:=PectinPS[count]+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].C1sNDF;
- end
- else
- begin
- if ptrFeedDescriptions^.ACHOintoWSCsNDF then
- SolsNDF:=SolsNDF+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].C1sNDF
- else SolsNDF:=0;
- end;
- Ash:=Ash+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].Mins;
- Oil:=Oil+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].EE;
- ConsumedVFA:=ConsumedVFA+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].fVFA;
- Lactate:=Lactate+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].fLactic;
- ConsumedNH3:=ConsumedNH3+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].fNH3;
- AcidEaten:=AcidEaten+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].PpnAcid;
- BicarbonateEaten:=BicarbonateEaten+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].HCO3*Thousand/MWNaHCO3;
- FeedWater:=FeedWater+ParlourPerMealPerFood*10
- *(100-ptrFeedDescriptions^.ParlourFeed[n1].DM);
- inc(n1);
- end;
- end;
- if (Hours1to24 in AwakeTime) and (not (Hours1to24+1 in EatingTime)) then
- begin
- if (FSParlour[ptrFeedDescriptions^.Diet]) and
- (Hours1to24 in ParlourHour[ptrFeedDescriptions^.Diet]) then
- begin
- if ptrFeedDescriptions^.LPBRwithRumination then LPBR:=0;
- RuminationSaliva:=0;
- end
- else
- begin
- // ruminating saliva needs to be fixed to large part vs small part
- if ptrFeedDescriptions^.LPBRwithRumination then LPBR:=LPBreakdownR;
- LongParticles:=0; ShortParticles:=0;
- if ChopLength then
- begin
- for loopi:=0 to NumFoods-1 do
- begin
- LongParticles:=LongParticles+fNDFLong[loopi]+iNDFLong[loopi]
- +SStarchLong[loopi]+USStarchLong[loopi]
- +DegCPLong[loopi]+iDegCPLong[loopi];
- ShortParticles:=ShortParticles+fNDF[loopi]+iNDF[loopi]
- +SStarch[loopi]+USStarch[loopi]
- +DegCP[loopi]+iDegCP[loopi];
- end;
- if (Days1toEnd=4) and (Hours1to24=HoursinDay)
- and (StepHours1toEnd=StepsPerHour) then
- begin
- MaxLongParticles:=LongParticles/(ptrNutAbsorbed^.RuminationTime
- *60/StepsPerHour)*MaxRuminationTime;
- TotalLongParticles:=LongParticles;
- MaxLPBR:=True;
- end;
- if MaxLPBR then
- LPBR:=TotalLongParticles*LPBR/LongParticles
- else
- LPBR:=LPBR;
- end
- else
- begin
- for loopi:=0 to NumFoods-1 do
- begin
- LongParticles:=LongParticles+fNDFLong[loopi]+iNDFLong[loopi];
- ShortParticles:=ShortParticles+fNDF[loopi]+iNDF[loopi];
- end;
- end;
- //if (Days1toEnd=20) then
- // QMP:=QMP;
- if LongParticles/(LongParticles+ShortParticles)>ptrFeedDescriptions^.RatioLongtoTotal then
- begin
- if pH<7 then
- RuminationSaliva:=1.17*27.1*0.375/Thousand/StepsPerHour
- *ptrFeedDescriptions^.ActualWeight
- else
- RuminationSaliva:=0.5*27.1*0.375/Thousand/StepsPerHour*ptrFeedDescriptions^.ActualWeight;
- inc(ptrNutAbsorbed^.RuminationTime);
- end
- else
- begin
- if ptrFeedDescriptions^.LPBRwithRumination then
- if version1_01_16 then
- begin
- LPBR:=LPBreakdownR*0.15*ForageDMBelow30Ppn;
- end
- else
- begin
- LPBR:=0;
- end;
- RuminationSaliva:=0;
- end;
- end;
- end
- else
- begin
- if ptrFeedDescriptions^.LPBRwithRumination then
- if version1_01_16 then
- begin
- LPBR:=LPBreakdownR*0.15*ForageDMBelow30Ppn;
- end
- else
- begin
- LPBR:=0;
- end;
- RuminationSaliva:=0;
- end;
- //TimeSpentEating flows in here from way down below to put on or off the EatingSaliva
- //(line 2052)
- if StepHours1toEnd*60/StepsPerHour<TimeSpentEating then
- //Eating time increased to 10 per day. Have to decrease the amount of eating saliva produced each meal hence 0.54
- SalivaFlow:=EatingSaliva+RestSaliva+{1.5*}RuminationSaliva
- else SalivaFlow:=RestSaliva+RuminationSaliva ;
- //if (Days1toEnd=20){ and (Hours1to24>7)} and (StepHours1toEnd=1) then
- // QMP:=QMP;
- try
- if ptrFeedDescriptions^.LagTime then
- begin
- PassLagSGlyceroltoSI:=0;
- PassLagUreatoSI:=0;
- for loopi:=0 to NumFoods-1 do
- begin
- PassLagfNDFtoSI[loopi]:=0;
- PassLagiNDFtoSI[loopi]:=0;
- PassLagSStarchtoSI[loopi]:=0;
- PassLagUSStarchtoSI[loopi]:=0;
- PassLagDegCPtoSI[loopi]:=0;
- PassLagiDegCPtoSI[loopi]:=0;
- LagSGlycerol[loopi]:=0;
- LagNDF[loopi]:=0;
- LagSStarch[loopi]:=0;
- LagCP[loopi]:=0;
- LagUrea[loopi]:=0;
- end;
- ElapsedTime:=HoursInDay*(Days1toEnd-1)+Hours1to24-1+StepHours1toEnd/StepsPerHour;
- for loopi:=0 to NumFoods-1 do
- for loopm:=1 to HoursInDay do
- begin
- if (LagNDFEntryTime[loopi,loopm]>0) then
- begin
- if (LagNDFEntryTime[loopi,loopm]<ElapsedTime) then
- begin
- if not (FSGrazingAll[ptrFeedDescriptions^.Diet]) and
- (loopi<ptrFeedDescriptions^.iNoFeeds) then
- begin
- fNDF[loopi]:=fNDF[loopi]+LagfNDFToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.TMRFeed[loopi].LargePartLag*LPMultiplier[loopi]);
- iNDF[loopi]:=iNDF[loopi]+LagiNDFToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.TMRFeed[loopi].LargePartLag*LPMultiplier[loopi]);
- fNDFLong[loopi]:=fNDFLong[loopi]+LagfNDFToEnter[loopi,loopm]
- *ptrFeedDescriptions^.TMRFeed[loopi].LargePartLag*LPMultiplier[loopi];
- iNDFLong[loopi]:=iNDFLong[loopi]+LagiNDFToEnter[loopi,loopm]
- *ptrFeedDescriptions^.TMRFeed[loopi].LargePartLag*LPMultiplier[loopi];
- end
- else if loopi=ptrFeedDescriptions^.iNoFeeds-1+ptrFeedDescriptions^.iGrazing then
- begin
- fNDF[loopi]:=fNDF[loopi]+LagfNDFToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.GrazingFeed.LargePartLag);
- iNDF[loopi]:=iNDF[loopi]+LagiNDFToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.GrazingFeed.LargePartLag);
- fNDFLong[loopi]:=fNDFLong[loopi]+LagfNDFToEnter[loopi,loopm]
- *ptrFeedDescriptions^.GrazingFeed.LargePartLag;
- iNDFLong[loopi]:=iNDFLong[loopi]+LagiNDFToEnter[loopi,loopm]
- *ptrFeedDescriptions^.GrazingFeed.LargePartLag;
- end
- else if loopi>ptrFeedDescriptions^.iNoFeeds-1+ptrFeedDescriptions^.iGrazing
- then
- //if loopi >, there is a Parlour Feed and maybe a Robotic Feed. ParlourFeed[numbers]
- //and RoboticFeed[numbers] start from zero and go up
- //to the total number of ingredients in a parlour feed -1. So loopi needs to be corrected
- //to make it zero and upwards. It is corrected by -1 -(ptrFeedDescriptions^.iNoFeeds-1
- // +ptrFeedDescriptions^.iGrazing).
- //The LargePartLag is set in SingleForm and is a proportion (0-1). It says how much
- //is Long particles. If LargePartLag is zero, all of the LagfNDFToEnter goes to
- //fNDF and if it is 1, all goes to fNDFLong.
- begin
- if loopi<=ParlourCountHigh then
- begin
- fNDF[loopi]:=fNDF[loopi]+LagfNDFToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.ParlourFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing)].LargePartLag);
- iNDF[loopi]:=iNDF[loopi]+LagiNDFToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.ParlourFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing)].LargePartLag);
- fNDFLong[loopi]:=fNDFLong[loopi]+LagfNDFToEnter[loopi,loopm]
- *ptrFeedDescriptions^.ParlourFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing)].LargePartLag;
- iNDFLong[loopi]:=iNDFLong[loopi]+LagiNDFToEnter[loopi,loopm]
- *ptrFeedDescriptions^.ParlourFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing)].LargePartLag;
- end
- else if loopi<=RoboticCountHigh then
- begin
- fNDF[loopi]:=fNDF[loopi]+LagfNDFToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.RoboticFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing
- +ptrFeedDescriptions^.iParlour)].LargePartLag);
- iNDF[loopi]:=iNDF[loopi]+LagiNDFToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.RoboticFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing
- +ptrFeedDescriptions^.iParlour)].LargePartLag);
- fNDFLong[loopi]:=fNDFLong[loopi]+LagfNDFToEnter[loopi,loopm]
- *ptrFeedDescriptions^.RoboticFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing
- +ptrFeedDescriptions^.iParlour)].LargePartLag;
- iNDFLong[loopi]:=iNDFLong[loopi]+LagiNDFToEnter[loopi,loopm]
- *ptrFeedDescriptions^.RoboticFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing
- +ptrFeedDescriptions^.iParlour)].LargePartLag;
- end
- else
- begin
- fNDF[loopi]:=fNDF[loopi]+LagfNDFToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.LiquidFeed.LargePartLag);
- iNDF[loopi]:=iNDF[loopi]+LagiNDFToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.LiquidFeed.LargePartLag);
- fNDFLong[loopi]:=fNDFLong[loopi]+LagfNDFToEnter[loopi,loopm]
- *ptrFeedDescriptions^.LiquidFeed.LargePartLag;
- iNDFLong[loopi]:=iNDFLong[loopi]+LagiNDFToEnter[loopi,loopm]
- *ptrFeedDescriptions^.LiquidFeed.LargePartLag;
- end;
- end;
- LagNDFEntryTime[loopi,loopm]:=-1;
- LagfNDFToEnter[loopi,loopm]:=0;
- LagiNDFToEnter[loopi,loopm]:=0;
- end
- else
- begin
- if not (FSGrazingAll[ptrFeedDescriptions^.Diet]) and
- (loopi<ptrFeedDescriptions^.iNoFeeds) then
- begin
- if not ptrFeedDescriptions^.TMRFeed[loopi].ForOrConc then
- begin
- {**} PassLagfNDFtoSI[loopi]:=PassLagfNDFtoSI[loopi]
- +LagfNDFToEnter[loopi,loopm]*RConcPPass;//Days1toEnd
- PassLagiNDFtoSI[loopi]:=PassLagiNDFtoSI[loopi]
- +LagiNDFToEnter[loopi,loopm]*RConcPPass;//Days1toEnd
- LagfNDFToEnter[loopi,loopm]:=LagfNDFToEnter[loopi,loopm]*(1-RConcPPass);
- LagiNDFToEnter[loopi,loopm]:=LagiNDFToEnter[loopi,loopm]*(1-RConcPPass);
- end;
- end
- else if loopi>ptrFeedDescriptions^.iNoFeeds-1+ptrFeedDescriptions^.iGrazing
- {+ptrFeedDescriptions^.iParlour} then
- begin
- if loopi<=ParlourCountHigh then
- begin
- if ptrFeedDescriptions^.iParlour>0 then
- begin
- if not ptrFeedDescriptions^.ParlourFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing)].ForOrConc then
- begin
- PassLagfNDFtoSI[loopi]:=PassLagfNDFtoSI[loopi]
- +LagfNDFToEnter[loopi,loopm]*RConcPPass;//Days1toEnd
- PassLagiNDFtoSI[loopi]:=PassLagiNDFtoSI[loopi]
- +LagiNDFToEnter[loopi,loopm]*RConcPPass;//Days1toEnd
- LagfNDFToEnter[loopi,loopm]:=LagfNDFToEnter[loopi,loopm]*(1-RConcPPass);
- LagiNDFToEnter[loopi,loopm]:=LagiNDFToEnter[loopi,loopm]*(1-RConcPPass);
- end;
- end;
- end
- else if loopi<=RoboticCountHigh then
- begin
- if ptrFeedDescriptions^.iRobotic>0 then
- begin
- if not ptrFeedDescriptions^.RoboticFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing
- +ptrFeedDescriptions^.iParlour)].ForOrConc then
- begin
- PassLagfNDFtoSI[loopi]:=PassLagfNDFtoSI[loopi]
- +LagfNDFToEnter[loopi,loopm]*RConcPPass;//Days1toEnd
- PassLagiNDFtoSI[loopi]:=PassLagiNDFtoSI[loopi]
- +LagiNDFToEnter[loopi,loopm]*RConcPPass;//Days1toEnd
- LagfNDFToEnter[loopi,loopm]:=LagfNDFToEnter[loopi,loopm]*(1-RConcPPass);
- LagiNDFToEnter[loopi,loopm]:=LagiNDFToEnter[loopi,loopm]*(1-RConcPPass);
- end;
- end;
- end
- else
- begin
- if ptrFeedDescriptions^.iRobotic>0 then
- begin
- if not ptrFeedDescriptions^.LiquidFeed.ForOrConc then
- begin
- PassLagfNDFtoSI[loopi]:=PassLagfNDFtoSI[loopi]
- +LagfNDFToEnter[loopi,loopm]*RConcPPass;//Days1toEnd
- PassLagiNDFtoSI[loopi]:=PassLagiNDFtoSI[loopi]
- +LagiNDFToEnter[loopi,loopm]*RConcPPass;//Days1toEnd
- LagfNDFToEnter[loopi,loopm]:=LagfNDFToEnter[loopi,loopm]*(1-RConcPPass);
- LagiNDFToEnter[loopi,loopm]:=LagiNDFToEnter[loopi,loopm]*(1-RConcPPass);
- end;
- end;
- end;
- end;
- LagNDF[loopi]:=LagNDF[loopi]+LagfNDFToEnter[loopi,loopm]
- +LagiNDFToEnter[loopi,loopm];
- end; //EntryTime<ElapsedTime
- end; //EntryTime>0
- if (LagSGlycerolEntryTime[loopi,loopm]>0) then
- begin
- if (LagSGlycerolEntryTime[loopi,loopm]<ElapsedTime) then
- begin
- Glycerol:=Glycerol+LagSGlycerolToEnter[loopi,loopm];
- LagSGlycerolEntryTime[loopi,loopm]:=-1;
- LagSGlycerolToEnter[loopi,loopm]:=0;
- end
- else
- begin
- PassLagSGlycerolToSI:=PassLagSGlyceroltoSI+
- LagSGlycerolToEnter[loopi,loopm]*RConcPPass;
- LagSGlycerolToEnter[loopi,loopm]:=LagSGlycerolToEnter[loopi,loopm]*
- (1-RConcPPass);
- LagSGlycerol[loopi]:=LagSGlycerol[loopi]+LagSGlycerolToEnter[loopi,loopm];
- end; //EntryTime<ElapsedTime
- end; //EntryTime>0
- if (LagUreaEntryTime[loopi,loopm]>0) then
- begin
- if (LagUreaEntryTime[loopi,loopm]<ElapsedTime) then
- begin
- SlowReleaseNH3:=SlowReleaseNH3+LagUreaToEnter[loopi,loopm];
- LagUreaEntryTime[loopi,loopm]:=-1;
- LagUreaToEnter[loopi,loopm]:=0;
- end
- else
- begin
- PassLagUreaToSI:=PassLagUreatoSI+
- LagUreaToEnter[loopi,loopm]*RConcPPass;
- LagUreaToEnter[loopi,loopm]:=LagUreaToEnter[loopi,loopm]*
- (1-RConcPPass);
- LagUrea[loopi]:=LagUrea[loopi]+LagUreaToEnter[loopi,loopm];
- end; //EntryTime<ElapsedTime
- end; //EntryTime>0
- if (LagSStarchEntryTime[loopi,loopm]>0) then
- begin
- if (LagSStarchEntryTime[loopi,loopm]<ElapsedTime) then
- begin
- if not (FSGrazingAll[ptrFeedDescriptions^.Diet]) and (loopi<ptrFeedDescriptions^.iNoFeeds) then
- begin
- SStarch[loopi]:=SStarch[loopi]+LagSStarchToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.TMRFeed[loopi].LargePartLag*LPMultiplier[loopi]);
- USStarch[loopi]:=USStarch[loopi]+LagUSStarchToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.TMRFeed[loopi].LargePartLag*LPMultiplier[loopi]);
- SStarchLong[loopi]:=SStarchLong[loopi]+LagSStarchToEnter[loopi,loopm]
- *ptrFeedDescriptions^.TMRFeed[loopi].LargePartLag*LPMultiplier[loopi];
- USStarchLong[loopi]:=USStarchLong[loopi]+LagUSStarchToEnter[loopi,loopm]
- *ptrFeedDescriptions^.TMRFeed[loopi].LargePartLag*LPMultiplier[loopi];
- end
- else if loopi=ptrFeedDescriptions^.iNoFeeds-1+ptrFeedDescriptions^.iGrazing then
- begin
- SStarch[loopi]:=SStarch[loopi]+LagSStarchToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.GrazingFeed.LargePartLag);
- USStarch[loopi]:=USStarch[loopi]+LagUSStarchToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.GrazingFeed.LargePartLag);
- SStarchLong[loopi]:=SStarchLong[loopi]+LagSStarchToEnter[loopi,loopm]
- *ptrFeedDescriptions^.GrazingFeed.LargePartLag;
- USStarchLong[loopi]:=USStarchLong[loopi]+LagUSStarchToEnter[loopi,loopm]
- *ptrFeedDescriptions^.GrazingFeed.LargePartLag;
- end
- else if loopi>ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing then
- begin
- if loopi<=ParlourCountHigh then
- begin
- SStarch[loopi]:=SStarch[loopi]+LagSStarchToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.ParlourFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing)].LargePartLag);
- USStarch[loopi]:=USStarch[loopi]+LagUSStarchToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.ParlourFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing)].LargePartLag);
- SStarchLong[loopi]:=SStarchLong[loopi]+LagSStarchToEnter[loopi,loopm]
- *ptrFeedDescriptions^.ParlourFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing)].LargePartLag;
- USStarchLong[loopi]:=USStarchLong[loopi]+LagUSStarchToEnter[loopi,loopm]
- *ptrFeedDescriptions^.ParlourFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing)].LargePartLag;
- end
- else if loopi<=RoboticCountHigh then
- begin
- SStarch[loopi]:=SStarch[loopi]+LagSStarchToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.RoboticFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing
- +ptrFeedDescriptions^.iParlour)].LargePartLag);
- USStarch[loopi]:=USStarch[loopi]+LagUSStarchToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.RoboticFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing
- +ptrFeedDescriptions^.iParlour)].LargePartLag);
- SStarchLong[loopi]:=SStarchLong[loopi]+LagSStarchToEnter[loopi,loopm]
- *ptrFeedDescriptions^.RoboticFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing
- +ptrFeedDescriptions^.iParlour)].LargePartLag;
- USStarchLong[loopi]:=USStarchLong[loopi]+LagUSStarchToEnter[loopi,loopm]
- *ptrFeedDescriptions^.RoboticFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing
- +ptrFeedDescriptions^.iParlour)].LargePartLag;
- end
- else
- begin
- SStarch[loopi]:=SStarch[loopi]+LagSStarchToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.LiquidFeed.LargePartLag);
- USStarch[loopi]:=USStarch[loopi]+LagUSStarchToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.LiquidFeed.LargePartLag);
- SStarchLong[loopi]:=SStarchLong[loopi]+LagSStarchToEnter[loopi,loopm]
- *ptrFeedDescriptions^.LiquidFeed.LargePartLag;
- USStarchLong[loopi]:=USStarchLong[loopi]+LagUSStarchToEnter[loopi,loopm]
- *ptrFeedDescriptions^.LiquidFeed.LargePartLag;
- end;
- end;
- LagSStarchEntryTime[loopi,loopm]:=-1;
- LagSStarchToEnter[loopi,loopm]:=0;
- LagUSStarchToEnter[loopi,loopm]:=0;
- end
- else
- begin
- if not (FSGrazingAll[ptrFeedDescriptions^.Diet]) and (loopi<ptrFeedDescriptions^.iNoFeeds) then
- begin
- if not ptrFeedDescriptions^.TMRFeed[loopi].ForOrConc then
- begin
- {**} PassLagSStarchtoSI[loopi]:=PassLagSStarchtoSI[loopi]
- +LagSStarchToEnter[loopi,loopm]*RConcPPass;//Days1toEnd
- PassLagUSStarchtoSI[loopi]:=PassLagUSStarchtoSI[loopi]
- +LagUSStarchToEnter[loopi,loopm]*RConcPPass;//Days1toEnd
- LagSStarchToEnter[loopi,loopm]:=LagSStarchToEnter[loopi,loopm]*(1-RConcPPass);
- LagUSStarchToEnter[loopi,loopm]:=LagUSStarchToEnter[loopi,loopm]*(1-RConcPPass);
- end;
- end
- else if loopi>ptrFeedDescriptions^.iNoFeeds-1+ptrFeedDescriptions^.iGrazing
- {+ptrFeedDescriptions^.iParlour} then
- begin
- if loopi<=ParlourCountHigh then
- begin
- if ptrFeedDescriptions^.iParlour>0 then
- begin
- if not ptrFeedDescriptions^.ParlourFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing)].ForOrConc then
- begin
- PassLagSStarchtoSI[loopi]:=PassLagSStarchtoSI[loopi]
- +LagSStarchToEnter[loopi,loopm]*RConcPPass;//Days1toEnd
- PassLagUSStarchtoSI[loopi]:=PassLagUSStarchtoSI[loopi]
- +LagUSStarchToEnter[loopi,loopm]*RConcPPass;//Days1toEnd
- LagSStarchToEnter[loopi,loopm]:=LagSStarchToEnter[loopi,loopm]*(1-RConcPPass);
- LagUSStarchToEnter[loopi,loopm]:=LagUSStarchToEnter[loopi,loopm]*(1-RConcPPass);
- end;
- end
- else if loopi<=RoboticCountHigh then
- begin
- if ptrFeedDescriptions^.iRobotic>0 then
- begin
- if not ptrFeedDescriptions^.RoboticFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing
- +ptrFeedDescriptions^.iParlour)].ForOrConc then
- begin
- PassLagSStarchtoSI[loopi]:=PassLagSStarchtoSI[loopi]
- +LagSStarchToEnter[loopi,loopm]*RConcPPass;//Days1toEnd
- PassLagUSStarchtoSI[loopi]:=PassLagUSStarchtoSI[loopi]
- +LagUSStarchToEnter[loopi,loopm]*RConcPPass;//Days1toEnd
- LagSStarchToEnter[loopi,loopm]:=LagSStarchToEnter[loopi,loopm]*(1-RConcPPass);
- LagUSStarchToEnter[loopi,loopm]:=LagUSStarchToEnter[loopi,loopm]*(1-RConcPPass);
- end;
- end;
- end
- else
- begin
- if ptrFeedDescriptions^.iRobotic>0 then
- begin
- if not ptrFeedDescriptions^.LiquidFeed.ForOrConc then
- begin
- PassLagSStarchtoSI[loopi]:=PassLagSStarchtoSI[loopi]
- +LagSStarchToEnter[loopi,loopm]*RConcPPass;//Days1toEnd
- PassLagUSStarchtoSI[loopi]:=PassLagUSStarchtoSI[loopi]
- +LagUSStarchToEnter[loopi,loopm]*RConcPPass;//Days1toEnd
- LagSStarchToEnter[loopi,loopm]:=LagSStarchToEnter[loopi,loopm]*(1-RConcPPass);
- LagUSStarchToEnter[loopi,loopm]:=LagUSStarchToEnter[loopi,loopm]*(1-RConcPPass);
- end;
- end;
- end;
- end;
- end;
- LagSStarch[loopi]:=LagSStarch[loopi]+LagSStarchToEnter[loopi,loopm]
- +LagUSStarchToEnter[loopi,loopm];
- end; //EntryTime<ElapsedTime
- end; //EntryTime>0
- if (LagCPEntryTime[loopi,loopm]>0) then
- begin
- if (LagCPEntryTime[loopi,loopm]<ElapsedTime) then
- begin
- if not (FSGrazingAll[ptrFeedDescriptions^.Diet]) and (loopi<ptrFeedDescriptions^.iNoFeeds) then
- begin
- DegCP[loopi]:=DegCP[loopi]+LagDegCPToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.TMRFeed[loopi].LargePartLag*LPMultiplier[loopi]);
- iDegCP[loopi]:=iDegCP[loopi]+LagiDegCPToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.TMRFeed[loopi].LargePartLag*LPMultiplier[loopi]);
- DegCPLong[loopi]:=DegCPLong[loopi]+LagDegCPToEnter[loopi,loopm]
- *ptrFeedDescriptions^.TMRFeed[loopi].LargePartLag*LPMultiplier[loopi];
- iDegCPLong[loopi]:=iDegCPLong[loopi]+LagiDegCPToEnter[loopi,loopm]
- *ptrFeedDescriptions^.TMRFeed[loopi].LargePartLag*LPMultiplier[loopi];
- end
- else if loopi=ptrFeedDescriptions^.iNoFeeds-1+ptrFeedDescriptions^.iGrazing then
- begin
- DegCP[loopi]:=DegCP[loopi]+LagDegCPToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.GrazingFeed.LargePartLag);
- iDegCP[loopi]:=iDegCP[loopi]+LagiDegCPToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.GrazingFeed.LargePartLag);
- DegCPLong[loopi]:=DegCPLong[loopi]+LagDegCPToEnter[loopi,loopm]
- *ptrFeedDescriptions^.GrazingFeed.LargePartLag;
- iDegCPLong[loopi]:=iDegCPLong[loopi]+LagiDegCPToEnter[loopi,loopm]
- *ptrFeedDescriptions^.GrazingFeed.LargePartLag;
- end
- else if loopi>ptrFeedDescriptions^.iNoFeeds-1+ptrFeedDescriptions^.iGrazing
- {+ptrFeedDescriptions^.iParlour} then
- begin
- if loopi<=ParlourCountHigh then
- begin
- DegCP[loopi]:=DegCP[loopi]+LagDegCPToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.ParlourFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing)].LargePartLag);
- iDegCP[loopi]:=iDegCP[loopi]+LagiDegCPToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.ParlourFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing)].LargePartLag);
- DegCPLong[loopi]:=DegCPLong[loopi]+LagDegCPToEnter[loopi,loopm]
- *ptrFeedDescriptions^.ParlourFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing)].LargePartLag;
- iDegCPLong[loopi]:=iDegCPLong[loopi]+LagiDegCPToEnter[loopi,loopm]
- *ptrFeedDescriptions^.ParlourFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing)].LargePartLag;
- end
- else if loopi<=RoboticCountHigh then
- begin
- DegCP[loopi]:=DegCP[loopi]+LagDegCPToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.RoboticFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing
- +ptrFeedDescriptions^.iParlour)].LargePartLag);
- iDegCP[loopi]:=iDegCP[loopi]+LagiDegCPToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.RoboticFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing
- +ptrFeedDescriptions^.iParlour)].LargePartLag);
- DegCPLong[loopi]:=DegCPLong[loopi]+LagDegCPToEnter[loopi,loopm]
- *ptrFeedDescriptions^.RoboticFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing
- +ptrFeedDescriptions^.iParlour)].LargePartLag;
- iDegCPLong[loopi]:=iDegCPLong[loopi]+LagiDegCPToEnter[loopi,loopm]
- *ptrFeedDescriptions^.RoboticFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing
- +ptrFeedDescriptions^.iParlour)].LargePartLag;
- end
- else
- begin
- DegCP[loopi]:=DegCP[loopi]+LagDegCPToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.LiquidFeed.LargePartLag);
- iDegCP[loopi]:=iDegCP[loopi]+LagiDegCPToEnter[loopi,loopm]
- *(1-ptrFeedDescriptions^.LiquidFeed.LargePartLag);
- DegCPLong[loopi]:=DegCPLong[loopi]+LagDegCPToEnter[loopi,loopm]
- *ptrFeedDescriptions^.LiquidFeed.LargePartLag;
- iDegCPLong[loopi]:=iDegCPLong[loopi]+LagiDegCPToEnter[loopi,loopm]
- *ptrFeedDescriptions^.LiquidFeed.LargePartLag;
- end;
- end;
- LagCPEntryTime[loopi,loopm]:=-1;
- LagDegCPToEnter[loopi,loopm]:=0;
- LagiDegCPToEnter[loopi,loopm]:=0;
- end
- else //if CPEntryTime<Elapsedtime
- begin
- if not (FSGrazingAll[ptrFeedDescriptions^.Diet]) and (loopi<ptrFeedDescriptions^.iNoFeeds) then
- begin
- if not ptrFeedDescriptions^.TMRFeed[loopi].ForOrConc then
- begin
- PassLagDegCPtoSI[loopi]:=PassLagDegCPtoSI[loopi]
- +LagDegCPToEnter[loopi,loopm]*RConcPPass;
- PassLagiDegCPtoSI[loopi]:=PassLagiDegCPtoSI[loopi]
- +LagiDegCPToEnter[loopi,loopm]*RConcPPass;
- LagDegCPToEnter[loopi,loopm]:=LagDegCPToEnter[loopi,loopm]*(1-RConcPPass);
- LagiDegCPToEnter[loopi,loopm]:=LagiDegCPToEnter[loopi,loopm]*(1-RConcPPass);
- end;
- end
- else if loopi>ptrFeedDescriptions^.iNoFeeds-1+ptrFeedDescriptions^.iGrazing
- {+ptrFeedDescriptions^.iParlour} then
- begin
- if loopi<=ParlourCountHigh then
- begin
- if ptrFeedDescriptions^.iParlour>0 then
- begin
- if not ptrFeedDescriptions^.ParlourFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing)].ForOrConc then
- begin
- PassLagDegCPtoSI[loopi]:=PassLagDegCPtoSI[loopi]
- +LagDegCPToEnter[loopi,loopm]*RConcPPass;//Days1toEnd
- PassLagiDegCPtoSI[loopi]:=PassLagiDegCPtoSI[loopi]
- +LagiDegCPToEnter[loopi,loopm]*RConcPPass;//Days1toEnd
- LagDegCPToEnter[loopi,loopm]:=LagDegCPToEnter[loopi,loopm]*(1-RConcPPass);
- LagiDegCPToEnter[loopi,loopm]:=LagiDegCPToEnter[loopi,loopm]*(1-RConcPPass);
- end;
- end
- else if loopi<=RoboticCountHigh then
- begin
- if ptrFeedDescriptions^.iRobotic>0 then
- begin
- if not ptrFeedDescriptions^.RoboticFeed[loopi-1
- -(ptrFeedDescriptions^.iNoFeeds-1
- +ptrFeedDescriptions^.iGrazing
- +ptrFeedDescriptions^.iParlour)].ForOrConc then
- begin
- PassLagDegCPtoSI[loopi]:=PassLagDegCPtoSI[loopi]
- +LagDegCPToEnter[loopi,loopm]*RConcPPass;//Days1toEnd
- PassLagiDegCPtoSI[loopi]:=PassLagiDegCPtoSI[loopi]
- +LagiDegCPToEnter[loopi,loopm]*RConcPPass;//Days1toEnd
- LagDegCPToEnter[loopi,loopm]:=LagDegCPToEnter[loopi,loopm]*(1-RConcPPass);
- LagiDegCPToEnter[loopi,loopm]:=LagiDegCPToEnter[loopi,loopm]*(1-RConcPPass);
- end;
- end;
- end
- else
- begin
- if ptrFeedDescriptions^.iRobotic>0 then
- begin
- if not ptrFeedDescriptions^.LiquidFeed.ForOrConc then
- begin
- PassLagDegCPtoSI[loopi]:=PassLagDegCPtoSI[loopi]
- +LagDegCPToEnter[loopi,loopm]*RConcPPass;//Days1toEnd
- PassLagiDegCPtoSI[loopi]:=PassLagiDegCPtoSI[loopi]
- +LagiDegCPToEnter[loopi,loopm]*RConcPPass;//Days1toEnd
- LagDegCPToEnter[loopi,loopm]:=LagDegCPToEnter[loopi,loopm]*(1-RConcPPass);
- LagiDegCPToEnter[loopi,loopm]:=LagiDegCPToEnter[loopi,loopm]*(1-RConcPPass);
- end;
- end;
- end;
- end;
- end;
- LagCP[loopi]:=LagCP[loopi]+LagDegCPToEnter[loopi,loopm]
- +LagiDegCPToEnter[loopi,loopm];
- end;
- end;
- end;
- end;
- except
- on Exception do MessageBeep(0);
- end;
- RumDM:=0;TotalRumDM:=0;
- for loopi:=0 to NumFoods-1 do
- begin
- RumDM:=RumDM+fNDF[loopi]+iNDF[loopi]+fNDFLong[loopi]+iNDFLong[loopi]
- +LagNDF[loopi]+LagCP[loopi]+DegCP[loopi]+iDegCP[loopi]
- +DegCPLong[loopi]+iDegCPLong[loopi]{+QStarch[loopi]+UQStarch[loopi]}{+SolCP[loopi]}
- {+SStarch[loopi]+USStarch[loopi]+LagSStarch[loopi]
- +SStarchLong[loopi]+USStarchLong[loopi]};
- TotalRumDM:=TotalRumDM+fNDF[loopi]+iNDF[loopi]+fNDFLong[loopi]+iNDFLong[loopi]
- +LagNDF[loopi]+LagCP[loopi]+DegCP[loopi]+iDegCP[loopi]
- +DegCPLong[loopi]+iDegCPLong[loopi]+QStarch[loopi]+UQStarch[loopi]+SolCP[loopi]
- +SStarch[loopi]+USStarch[loopi]+LagSStarch[loopi]
- +SStarchLong[loopi]+USStarchLong[loopi]+PectinPS[loopi];
- end;
- TotalRumDM:=TotalRumDM+SolCHO;
- //if (Days1toEnd=20){ and (Hours1to24>7)} and (StepHours1toEnd=1) then
- // QMP:=QMP;
- FermQStarchRum:=0; FermSStarchRum:=0;
- FermNDFRum:=0;
- FermDegCPRum:=0;
- FermNDFHG:=0; FermPectinHG:=0;
- FermSolCPRum:=0; FermPectinRum:=0;
- SumPassDigCPtoSI:=0;
- BoundWater:=0;
- PassSIWater:=0;
- //Calculate Flows
- //Passage
- PassSolCHOtoSI:=SolCHO*(PassageFree+PassageBound);//RLPass
- PassLactictoSI:=Lactate*(PassageFree+PassageBound);//RLPass
- PassSolsNDFtoSI:=SolsNDF*(PassageFree+PassageBound);//RLPass
- SumPassSolCPtoSI:=0;
- PassMPGtoSI:=MonoPG_Glycerol*(PassageFree+PassageBound);
- PassGlyceroltoSI:=Glycerol*(PassageFree+PassageBound)+PassLagSGlyceroltoSI;
- PassUnfermentedGlyceroltoSI:=UnfermentedGlycerolSmall*(PassageFree+PassageBound);
- for loopi:=0 to NumFoods-1 do
- begin
- PassSolCPtoSI[loopi]:=SolCP[loopi]*(PassageFree+PassageBound);//RLPass
- SumPassSolCPtoSI:=SumPassSolCPtoSI+PassSolCPtoSI[loopi];
- end;
- PassAshtoSI:=Ash*(PassageFree+PassageBound);//RLPass
- PassOiltoSI:=Oil*(PassageFree+PassageBound);//RLPass
- PassNH3toSI:=NH3Rum*(PassageFree+PassageBound)+PassLagUreatoSI;//RLPass
- if Beef then
- begin
- PassQMicLiquidR:=QMicLiquidR*MicPassRate*0.075; //Liquid to Solid transfer rate
- PassQMicSolidsR:=QMicSolidsR*MicPassRate*0.05; //Solid to Liquid transfer rate
- end
- else
- begin
- PassQMicLiquidR:=QMicLiquidR*MicPassRate*0.5; //Liquid to Solid transfer rate
- PassQMicSolidsR:=QMicSolidsR*MicPassRate*0.4; //Solid to Liquid transfer rate
- end;
- //Check whether forage or concentrate and use appropriate passage rate
- //FororConc true if forage
- for loopi:=0 to ptrFeedDescriptions^.iNoFeeds-1 do
- begin
- if not ptrFeedDescriptions^.TMRFeed[loopi].FororConc then
- begin
- PassfNDFLongtoSI[loopi]:=fNDFLong[loopi]*RConcPPass*LPMult;
- PassiNDFLongtoSI[loopi]:=iNDFLong[loopi]*RConcPPass*LPMult*PassageRateFactor;
- PassSStarchLongtoSI[loopi]:=SStarchLong[loopi]*RConcPPass*LPMult;
- PassUSStarchLongtoSI[loopi]:=USStarchLong[loopi]*(RConcPPass*USPass)*LPMult;
- PassDegCPLongtoSI[loopi]:=DegCPLong[loopi]*RConcPPass*LPMult;
- PassiDegCPLongtoSI[loopi]:=iDegCPLong[loopi]*RConcPPass*LPMult;
- PassfNDFtoSI[loopi]:=fNDF[loopi]*RConcPPass;
- PassiNDFtoSI[loopi]:=iNDF[loopi]*RConcPPass*PassageRateFactor;
- PassSStarchtoSI[loopi]:=SStarch[loopi]*RConcPPass;
- PassUSStarchtoSI[loopi]:=USStarch[loopi]*(RConcPPass*USPass);
- PassDegCPtoSI[loopi]:=DegCP[loopi]*RConcPPass;
- PassiDegCPtoSI[loopi]:=iDegCP[loopi]*RConcPPass;
- end
- else
- begin
- PassfNDFLongtoSI[loopi]:=fNDFLong[loopi]*RPPass*LPMult;
- PassiNDFLongtoSI[loopi]:=iNDFLong[loopi]*RPPass*LPMult*PassageRateFactor;
- PassSStarchLongtoSI[loopi]:=SStarchLong[loopi]*RConcPPass*LPMult;
- PassUSStarchLongtoSI[loopi]:=USStarchLong[loopi]*(RConcPPass)*LPMult*USPass;
- PassDegCPLongtoSI[loopi]:=DegCPLong[loopi]*RPPass*LPMult;
- PassiDegCPLongtoSI[loopi]:=iDegCPLong[loopi]*RPPass*LPMult;
- PassfNDFtoSI[loopi]:=fNDF[loopi]*RPPass;
- PassiNDFtoSI[loopi]:=iNDF[loopi]*RPPass*PassageRateFactor;
- PassSStarchtoSI[loopi]:=SStarch[loopi]*RConcPPass;
- PassUSStarchtoSI[loopi]:=USStarch[loopi]*(RConcPPass*USPass);
- PassDegCPtoSI[loopi]:=DegCP[loopi]*RPPass;
- PassiDegCPtoSI[loopi]:=iDegCP[loopi]*RPPass;
- end;
- PassPectintoSI[loopi]:=PectinPS[loopi]*(PassageFree+PassageBound);
- PassQStarchtoSI[loopi]:=QStarch[loopi]*(PassageFree+PassageBound);//RLPass
- PassUQStarchtoSI[loopi]:=UQStarch[loopi]*(PassageFree+PassageBound);//RLPass
- SumPassDigCPtoSI:=SumPassDigCPtoSI+PassDegCPtoSI[loopi]+PassiDegCPtoSI[loopi]
- +PassDegCPLongtoSI[loopi]+PassiDegCPLongtoSI[loopi]
- end;
- if ptrFeedDescriptions^.iGrazing>0 then
- begin
- count:=ptrFeedDescriptions^.iNoFeeds;
- if not ptrFeedDescriptions^.GrazingFeed.FororConc then
- begin
- PassfNDFLongtoSI[count]:=fNDFLong[count]*RConcPPass*LPMult;
- PassiNDFLongtoSI[count]:=iNDFLong[count]*RConcPPass*LPMult;
- PassSStarchLongtoSI[count]:=SStarchLong[count]*RConcPPass*LPMult;
- PassUSStarchLongtoSI[count]:=USStarchLong[count]*(RConcPPass*USPass)*LPMult;
- PassDegCPLongtoSI[count]:=DegCPLong[count]*RConcPPass*LPMult;
- PassiDegCPLongtoSI[count]:=iDegCPLong[count]*RConcPPass*LPMult;
- PassfNDFtoSI[count]:=fNDF[count]*RConcPPass;
- PassiNDFtoSI[count]:=iNDF[count]*RConcPPass;
- PassSStarchtoSI[count]:=SStarch[count]*RConcPPass;
- PassUSStarchtoSI[count]:=USStarch[count]*(RConcPPass*USPass);
- PassDegCPtoSI[count]:=DegCP[count]*RConcPPass;
- PassiDegCPtoSI[count]:=iDegCP[count]*RConcPPass;
- end
- else
- begin
- PassfNDFLongtoSI[count]:=fNDFLong[count]*RPPass*LPMult;
- PassiNDFLongtoSI[count]:=iNDFLong[count]*RPPass*LPMult;
- PassSStarchLongtoSI[count]:=SStarchLong[count]*RConcPPass*LPMult;
- PassUSStarchLongtoSI[count]:=USStarchLong[count]*(RConcPPass*USPass)*LPMult;
- PassDegCPLongtoSI[count]:=DegCPLong[count]*RPPass*LPMult;
- PassiDegCPLongtoSI[count]:=iDegCPLong[count]*RPPass*LPMult;
- PassfNDFtoSI[count]:=fNDF[count]*RPPass;
- PassiNDFtoSI[count]:=iNDF[count]*RPPass;
- PassSStarchtoSI[count]:=SStarch[count]*RConcPPass;
- PassUSStarchtoSI[count]:=USStarch[count]*(RConcPPass*USPass);
- PassDegCPtoSI[count]:=DegCP[count]*RPPass;
- PassiDegCPtoSI[count]:=iDegCP[count]*RPPass;
- end;
- PassPectintoSI[count]:=PectinPS[count]*(PassageFree+PassageBound);
- PassQStarchtoSI[count]:=QStarch[count]*(PassageFree+PassageBound);//RLPass
- PassUQStarchtoSI[count]:=UQStarch[count]*(PassageFree+PassageBound);//RLPass
- SumPassDigCPtoSI:=SumPassDigCPtoSI+PassDegCPtoSI[count]+PassiDegCPtoSI[count]
- +PassDegCPLongtoSI[count]+PassiDegCPLongtoSI[count]
- end;
- if ptrFeedDescriptions^.iParlour>0 then
- begin
- n1:=0;
- for count:=NumFoods-counter+1 to NumFoods-1 do
- begin
- if not ptrFeedDescriptions^.ParlourFeed[n1].FororConc then
- begin
- PassfNDFLongtoSI[count]:=fNDFLong[count]*RConcPPass*LPMult;
- PassiNDFLongtoSI[count]:=iNDFLong[count]*RConcPPass*LPMult;
- PassSStarchLongtoSI[count]:=SStarchLong[count]*RConcPPass*LPMult;
- PassUSStarchLongtoSI[count]:=USStarchLong[count]*(RConcPPass*USPass)*LPMult;
- PassDegCPLongtoSI[count]:=DegCPLong[count]*RConcPPass*LPMult;
- PassiDegCPLongtoSI[count]:=iDegCPLong[count]*RConcPPass*LPMult;
- PassfNDFtoSI[count]:=fNDF[count]*RConcPPass;
- PassiNDFtoSI[count]:=iNDF[count]*RConcPPass;
- PassSStarchtoSI[count]:=SStarch[count]*RConcPPass;
- PassUSStarchtoSI[count]:=USStarch[count]*(RConcPPass*USPass);
- PassDegCPtoSI[count]:=DegCP[count]*RConcPPass;
- PassiDegCPtoSI[count]:=iDegCP[count]*RConcPPass;
- end
- else
- begin
- PassfNDFLongtoSI[count]:=fNDFLong[count]*RPPass*LPMult;
- PassiNDFLongtoSI[count]:=iNDFLong[count]*RPPass*LPMult;
- PassSStarchLongtoSI[count]:=SStarchLong[count]*RConcPPass*LPMult;
- PassUSStarchLongtoSI[count]:=USStarchLong[count]*(RConcPPass*USPass)*LPMult;
- PassDegCPLongtoSI[count]:=DegCPLong[count]*RPPass*LPMult;
- PassiDegCPLongtoSI[count]:=iDegCPLong[count]*RPPass*LPMult;
- PassfNDFtoSI[count]:=fNDF[count]*RPPass;
- PassiNDFtoSI[count]:=iNDF[count]*RPPass;
- PassSStarchtoSI[count]:=SStarch[count]*RConcPPass;
- PassUSStarchtoSI[count]:=USStarch[count]*(RConcPPass*USPass);
- PassDegCPtoSI[count]:=DegCP[count]*RPPass;
- PassiDegCPtoSI[count]:=iDegCP[count]*RPPass;
- end;
- PassPectintoSI[count]:=PectinPS[count]*(PassageFree+PassageBound);
- PassQStarchtoSI[count]:=QStarch[count]*(PassageFree+PassageBound);//RLPass
- PassUQStarchtoSI[count]:=UQStarch[count]*(PassageFree+PassageBound);//RLPass
- SumPassDigCPtoSI:=SumPassDigCPtoSI+PassDegCPtoSI[count]
- +PassiDegCPtoSI[count]+PassDegCPLongtoSI[count]
- +PassiDegCPLongtoSI[count];
- inc(n1);
- end;
- end;
- //Breakdown
- if ChopLength then
- begin
- for loopi:=0 to NumFoods-1 do
- begin
- fNDFLongBreakdown[loopi]:=fNDFLong[loopi]*LPBR;
- iNDFLongBreakdown[loopi]:=iNDFLong[loopi]*LPBR;
- SStarchLongBreakdown[loopi]:=SStarchLong[loopi]*LPBR;
- USStarchLongBreakdown[loopi]:=USStarchLong[loopi]*LPBR;
- DegCPLongBreakdown[loopi]:=DegCPLong[loopi]*LPBR;
- iDegCPLongBreakdown[loopi]:=iDegCPLong[loopi]*LPBR;
- SProteinToQProteinSolubilisation[loopi]:=DegCP[loopi]*SlowProteinToQuickProtein;
- SStarchToQStarchBreakdown[loopi]:=SStarch[loopi]*SStarchToQStarchBR;
- end;
- end
- else
- begin
- for loopi:=0 to NumFoods-1 do
- begin
- fNDFLongBreakdown[loopi]:=fNDFLong[loopi]*LPBR;
- iNDFLongBreakdown[loopi]:=iNDFLong[loopi]*LPBR;
- SStarchLongBreakdown[loopi]:=SStarchLong[loopi]*LPBR;
- USStarchLongBreakdown[loopi]:=USStarchLong[loopi]*LPBR;
- DegCPLongBreakdown[loopi]:=DegCPLong[loopi]*LPBR;
- iDegCPLongBreakdown[loopi]:=iDegCPLong[loopi]*LPBR;
- SProteinToQProteinSolubilisation[loopi]:=DegCP[loopi]*SlowProteinToQuickProtein;
- SStarchToQStarchBreakdown[loopi]:=SStarch[loopi]*SStarchToQStarchBR;
- // USStarchToUQStarchBreakdown[loopi]:=USStarch[loopi]*SStarchToQStarchBR;
- end;
- end;
- // if Days1toEnd=5 then
- // if StepHours1toEnd=1 then
- // QMP:=QMP;
- //Fermentation
- FermSolCHOinRum:=SolCHO*RSolCHO;
- FermMonoPG_GlycerolinRum:=MonoPG_Glycerol*RSolCHO;
- FermGlycerolinRumen:=Glycerol*RSolCHO;
- // if Days1toEnd=ptrFeedDescriptions.iDaysToRun then
- // dGlycerol:=dGlycerol+FermMonoPG_GlycerolinRum;
- FermSolsNDFinRum:=SolsNDF*RSolCHO;
- FermLacticinRum:=Lactate*RSolCHO*10; //2.5
- if NH3Rum>20 then
- FermNH3inRum:=15*RNH3
- else
- FermNH3inRum:=NH3Rum*RNH3;//RSolCHO*10;//only allow 75% NH3 to be fermented per iteration
- FermDLMCHO:=QDeadLiquidMicrobes*RSolCHO;
- FermDSMCHO:=QDeadSolidMicrobes*RSolCHO;
- FermDLMLip:=QDeadLiquidMicrobes*RSolCHO;
- FermDSMLip:=QDeadSolidMicrobes*RSolCHO;
- FermDLMProt:=QDeadLiquidMicrobes*RMicProt;
- FermDSMProt:=QDeadSolidMicrobes*RMicProt;
- FermDLaMCHO:=QDeadLiquidMicrobesLa*RSolCHO;
- FermDLaMLip:=QDeadLiquidMicrobesLa*RSolCHO;
- FermDLaMProt:=QDeadLiquidMicrobesLa*RMicProt;
- for loopi:=0 to NumFoods-1 do
- begin
- FermfNDFinRum[loopi]:=fNDF[loopi]*RNDF[loopi];
- FermfNDFLonginRum[loopi]:=fNDFLong[loopi]*RNDF[loopi];
- FermNDFRum:=FermNDFRum+FermfNDFinRum[loopi]+FermfNDFLonginRum[loopi];
- FermSStarchinRum[loopi]:=SStarch[loopi]*RSStarch[loopi];
- FermSStarchLonginRum[loopi]:=SStarchLong[loopi]*RSStarch[loopi];
- FermSStarchRum:=FermSStarchRum+FermSStarchinRum[loopi]+FermSStarchLonginRum[loopi];
- FermDegCPinRum[loopi]:=DegCP[loopi]*RDegCP[loopi];
- FermDegCPLonginRum[loopi]:=DegCPLong[loopi]*RDegCP[loopi];
- FermDegCPRum:=FermDegCPRum+FermDegCPinRum[loopi]+FermDegCPLonginRum[loopi];
- FermStarchinRum[loopi]:=QStarch[loopi]*RQStarch[loopi];
- FermQStarchRum:=FermQStarchRum+FermStarchinRum[loopi];
- FermSolCPinRum[loopi]:=SolCP[loopi]*RaCP[loopi];
- FermSolCPRum:=FermSolCPRum+FermSolCPinRum[loopi];
- FermPectininRum[loopi]:=PectinPS[loopi]*PectinRate[loopi];
- FermPectinRum:=FermPectinRum+FermPectininRum[loopi];
- end;
- // pH:=5;
- // MicLacRum:=MicMaint*0.45+1000000*Power(10,-pH)/1.4;
- // MicRumLiquid:=MicMaint*0.45+1000000*Power(10,-pH)/1.4;
- // MicLacUtRum:=MicMaint*0.45+1000000*Power(10,-pH)/1.2;
- // MicRumSolids:=MicMaint*0.8+1000000*Power(10,-pH)/1;
- // MicLacRum:=MicMaint*0.5+1000000*Power(10,-pH)/1.2;
- MicLacRum:=(MicMaint*0.45+1000000*Power(10,-pH)/1.4)/StepsPerHour*QMicLaR
- *FreeWater/LiquidVolume;
- MicRumLiquid:=(MicMaint*0.45+1000000*Power(10,-pH)/1.4)/StepsPerHour*QMicLiquidR; //0.65 1.25
- MicLacUtRum:=(MicMaint*0.45+1000000*Power(10,-pH)/1.2)/StepsPerHour*QMicLaUtR;
- if (FNH3RumFree*(1-PpnLaUttoRest)-FermNH3inRumFree)>(FNH3RumSolid-FermNH3inRumSolid) then
- ProportionNH3Free:=ProportionNH3Free+0.01
- else ProportionNH3Free:=ProportionNH3Free-0.01;
- if ProportionNH3Free>0.8 then ProportionNH3Free:=0.8;
- if ProportionNH3Free<0.2 then ProportionNH3Free:=0.2;
- // if Days1toEnd=3 then
- // if Hours1to24=24 then
- // if StepHours1toEnd=10 then
- // QMP:=QMP;
- // Quick:=(FermSolCHOinRum+FermSolsNDFinRum
- // +FermDLMCHO+FermDLaMCHO+FermPectinRum+
- // FermQStarchRum)/(FermSolCPRum+FermDLMProt+FermDLaMProt+FNH3RumFree*6.25);
- // Slow:=(FermDSMCHO+FermNDFRum+FermSStarchRum)/(FermDegCPRum+FermDSMProt+FNH3RumSolid*6.25);
- FNH3RumFree:=FermNH3inRum*ProportionNH3Free;//0.5;//(QMicLaR+QMicLiquidR+QMicLaUtR)/(QMicLaR+QMicLiquidR+QMicSolidsR+QMicLaUtR);
- FNH3RumSolid:=FermNH3inRum*(1-ProportionNH3Free);//0.5;//QMicSolidsR/(QMicLaR+QMicLiquidR+QMicSolidsR);
- if Yeast then
- begin
- YeastMaint:=(MicMaint*0.45+1000000*Power(10,-pH)/1.2)/StepsPerHour*QYeast;
- YeastOxFe(FermSolCHOinRum,FermLacticinRum,FermQStarchRum,FermSolCPRum,
- FNH3RumFree,OxygenLevel,Oil*RSolCHO,YeastMaint,QYeast,deltaYeast,AcY,
- PropY,ButY,CH4Y,DeathYeast,OxygenUsed);
- end;
- PpnLaUttoRest:=QMicLaUtR/(QMicLaR+QMicLiquidR+QMicLaUtR);
- fermentation(FermSolCHOinRum+FermSolsNDFinRum
- +FermDLMCHO+FermDLaMCHO,FermPectinRum,
- FermQStarchRum,(FermSolCPRum+FermDLMProt+FermDLaMProt)
- *(1-PpnLaUttoRest),(Oil*RSolCHO+FermDLMLip+FermDLaMLip)
- *(1-PpnLaUttoRest),0,FNH3RumFree*(1-PpnLaUttoRest),QMicLiquidR,
- QMicLaR,StepsPerHour,AcLRum,PropLRum,ButLRum,LacLRum,CH4LRum,
- FermNH3inRumFree,MicRumLiquid,MicLacRum,UnFermSolCHOL,
- UnfermNDFRL,x,StarchUsedFree,PpnHexUsedL,PpnHexFerm,
- DeathOfQMicLiquidR,1);
- if LacLRum<0 then LacLRum:=0;
- if FermNH3inRumFree>FNH3RumFree*(1-PpnLaUttoRest) then
- PpnNH3:=1
- else
- PpnNH3:=FNH3RumFree*PpnLaUttoRest;
- fermentation(0,0,0,(FermSolCPRum+FermDLMProt+FermDLaMProt)*PpnLaUttoRest,
- (Oil*RSolCHO+FermDLMLip+FermDLaMLip)*PpnLaUttoRest,
- FermLacticinRum+FermMonoPG_GlycerolinRum+FermGlycerolinRumen,
- FNH3RumFree*PpnNH3,QMicLaUtR,0,StepsPerHour,
- AcLaRum,PropLaRum,ButLaRum,x,CH4LaRum,FermNH3inRumFreeLa,
- MicLacUtRum,x,x,x,UnFermLacticAcidL,x,x,x,DeathOfQMicLiquidRLa,1);
- MicGrowthLacRum:=MicLacRum;
- MicRumSolids:=(MicMaint*0.8+1000000*Power(10,-pH)/1)/StepsPerHour*QMicSolidsR;
- MicLacRum:=(MicMaint*0.5+1000000*Power(10,-pH)/1.2)/StepsPerHour*QMicLaR
- *(1-FreeWater/LiquidVolume);
- fermentation(FermDSMCHO,FermNDFRum,FermSStarchRum,
- FermDegCPRum+FermDSMProt,Oil*RSolCHO+FermDSMLip,0,
- FNH3RumSolid,QMicSolidsR,QMicLaR,StepsPerHour,AcSRum,PropSRum,ButSRum,
- LacSRum,CH4SRum,FermNH3inRumSolid,MicRumSolids,MicLacRum,UnFermSolCHOS,
- UnfermNDFRS,UnFermLacticAcidS,StarchUsedSolids,PpnHexUsedS,PpnHexFerm,
- DeathOfQMicSolidsR,2);
- // if Days1toEnd={ptrFeedDescriptions.iDaysToRun}1 then
- // if StepHours1toEnd=1 then
- // QMP:=QMP;
- MicGrowthLacRum:=MicGrowthLacRum+MicLacRum;
- HFSCiR:=HFSCiR+FermSolCHOinRum+FermSolsNDFinRum+FermPectinRum;//+FermLacticinRum;
- HFNiR:=HFNiR+FermNDFRum;
- HFSiR:=HFSiR+FermQStarchRum*StarchUsedFree;
- HFSSiR:=HFSSiR+FermSStarchRum*StarchUsedSolids;
- HSCPiR:=HSCPiR+FermSolCPRum;
- HDCPiR:=HDCPiR+FermDegCPRum;
- // HSCiR:=HSCiR+SolCHO*UnFermSolCHOL;
- // HPSCiR:=HPSCiR+PassSolCHOtoSI;
- //Update Compartments
- //Rumen
- SolCHO:=SolCHO-PassSolCHOtoSI-FermSolCHOinRum*UnFermSolCHOL;
- SolsNDF:=SolsNDF-PassSolsNDFtoSI-FermSolsNDFinRum;
- Lactate:=Lactate-PassLactictoSI-FermLacticinRum*UnFermLacticAcidL
- +(LacLRum+LacSRum)*MWLacticAcid;//LacRum in moles
- Ash:=Ash-PassAshtoSI+SalivaFlow*7.5-(MicRumLiquid+MicRumSolids
- +MicGrowthLacRum)*Thousand*MicAsh;//g;
- // BicarbonateFromSaliva:=SalivaFlow*BicarbonateContentSaliva/1000*1.0; //eq or moles
- Oil:=Oil-PassOiltoSI-Oil*RSolCHO*2;//*(PpnHexUsedL+PpnHexUsedS);
- //In MonoPG_Glycerol, 2*ferm because fermentation + absorption put at equivalent rates
- // 489 Ruminal and physiological metabolism of glycerin. C. R.Krehbiel*,J. Anim. Sci. Vol. 86, E-Suppl. 2/J. Dairy Sci. Vol. 91, E-Suppl. 1 p392
- MonoPG_Glycerol:=MonoPG_Glycerol-PassMPGtoSI-2*FermMonoPG_GlycerolinRum;
- Glycerol:=Glycerol-PassGlyceroltoSI-2*FermGlycerolinRumen;
- UnfermentedGlycerolSmall:=UnfermentedGlycerolSmall-PassUnfermentedGlyceroltoSI;
- // divided by 4 as Bodeker et al used rumen sacks to estimate uptake. Sacks
- //would not have whole rumen volume!
- AbsNH3:=(NH3Rum/LiquidVolume/MWNH3*Thousand*0.5)*3/StepsPerHour/5
- *ptrFeedDescriptions^.RVol/100;//mmoles per time step Bodeker et al 1990
- //20*blood to rumen a guess. In 10 min could estimate blood flow by using
- //scaled blood flow
- //NH3Rum should be around 18 to give 10mM (/LiquidVolume/MWNH3)
- // if Days1toEnd=ptrFeedDescriptions.iDaysToRun then
- // if Hours1to24=4 then
- // if StepHours1toEnd=4 then
- // QMP:=QMP;
- NH3Rum:=NH3Rum+ConsumedNH3/StepsPerHour-(FNH3RumFree*(1-PpnLaUttoRest)-FermNH3inRumFree)
- -(FNH3RumFree*PpnNH3-FermNH3inRumFreeLa)-(FNH3RumSolid-FermNH3inRumSolid)
- -PassNH3toSI+(SalivaFlow+0.5*VolBlood/BodyWater)*BloodUreaConc*2*MWNH3;//FermNH3Rum is value passed back of NH3 from fermentation
- NH3Rum:=NH3Rum-AbsNH3*LiquidVolume*MWNH3/Thousand;
- for loopi:=0 to NumFoods-1 do
- begin
- NH3Rum:=NH3Rum+SlowReleaseNH3*SlowReleaseNH3Rate[loopi];
- SlowReleaseNH3:=(1-SlowReleaseNH3Rate[loopi])*SlowReleaseNH3;
- end;
- //milk from protein divided by no of hours and tstep then multiplied by BloodUreaConc
- //gives the no of moles of urea in milk
- if ptrFeedDescriptions^.Week>0 then
- ptrNutAbsorbed^.MilkUrea:=ptrNutAbsorbed^.MilkFromP[CowParity,
- ptrFeedDescriptions^.Week-1]/HoursInDay/StepsPerHour*BloodUreaConc
- else ptrNutAbsorbed^.MilkUrea:=LactationDay1/HoursInDay/StepsPerHour*BloodUreaConc;
- //dUrinaryN is gN/tstep and UrinaryN are gN/d
- dUrinaryN:=BloodUreaConc*2*MWN*Animal.Weight
- *ClearanceRatio/HoursInDay/StepsPerHour;
- UrinaryN:=UrinaryN+dUrinaryN;
- //1g of NH3 gives rise to 1/(2MWNH3) of urea moles
- //1g of N gives rise to 1/(2MWN) of urea moles
- //1 mmole of NH3 gives rise to 1/(2Thousand) of urea moles
- //20*blood flow a guess. Could use scaled blood flow as better estimate
- UreaPoolSize:=BloodUreaConc*BodyWater
- +PassNH3toSI/(2*MWNH3)*0.5+AbsNH3/2/Thousand
- +ptrNutAbsorbed^.NH3-dUrinaryN/MWN/2-ptrNutAbsorbed^.MilkUrea
- -SalivaFlow*BloodUreaConc-0.5*VolBlood/BodyWater*BloodUreaConc;
- BloodUreaConc:=UreaPoolSize/BodyWater;
- // if Days1toEnd=ptrFeedDescriptions.iDaysToRun then
- // if Hours1to24=4 then
- // if StepHours1toEnd=4 then
- // QMP:=QMP;
- if Days1toEnd>ptrFeedDescriptions.iDaysToRun-4 then//for last 4 days accumulate iterations where NH3 limiting
- begin
- if UnfermNDFRS>0 then
- inc(NH3Lim)
- else if (UnFermLacticAcidL>0) or (UnFermLacticAcidS>0) then
- inc(NH3Lim)
- else if (UnFermSolCHOL>0) or (UnFermSolCHOS>0) then
- inc(NH3Lim);
- end;
- for loopi:=0 to NumFoods-1 do
- begin
- fNDFLong[loopi]:=fNDFLong[loopi]-FermfNDFLonginRum[loopi]*UnfermNDFRS
- -PassfNDFLongtoSI[loopi]-fNDFLongBreakdown[loopi];
- iNDFLong[loopi]:=iNDFLong[loopi]-PassiNDFLongtoSI[loopi]-iNDFLongBreakdown[loopi];
- fNDF[loopi]:=fNDF[loopi]-FermfNDFinRum[loopi]*UnfermNDFRS-PassfNDFtoSI[loopi]
- +fNDFLongBreakdown[loopi];
- iNDF[loopi]:=iNDF[loopi]-PassiNDFtoSI[loopi]+iNDFLongBreakdown[loopi];
- SStarchLong[loopi]:=SStarchLong[loopi]-FermSStarchLonginRum[loopi]*StarchUsedSolids
- -PassSStarchLongtoSI[loopi]-SStarchLongBreakdown[loopi];
- USStarchLong[loopi]:=USStarchLong[loopi]-PassUSStarchLongtoSI[loopi]
- -USStarchLongBreakdown[loopi];
- SStarch[loopi]:=SStarch[loopi]-FermSStarchinRum[loopi]*StarchUsedSolids-PassSStarchtoSI[loopi]
- +SStarchLongBreakdown[loopi]-SStarchToQStarchBreakdown[loopi];
- USStarch[loopi]:=USStarch[loopi]-PassUSStarchtoSI[loopi]+USStarchLongBreakdown[loopi];
- DegCPLong[loopi]:=DegCPLong[loopi]-FermDegCPLonginRum[loopi]-PassDegCPLongtoSI[loopi]
- -DegCPLongBreakdown[loopi];
- iDegCPLong[loopi]:=iDegCPLong[loopi]-PassiDegCPLongtoSI[loopi]-iDegCPLongBreakdown[loopi];
- DegCP[loopi]:=DegCP[loopi]-FermDegCPinRum[loopi]-PassDegCPtoSI[loopi]
- +DegCPLongBreakdown[loopi]-SProteinToQProteinSolubilisation[loopi];
- iDegCP[loopi]:=iDegCP[loopi]-PassiDegCPtoSI[loopi]+iDegCPLongBreakdown[loopi];
- QStarch[loopi]:=QStarch[loopi]-FermStarchinRum[loopi]*StarchUsedFree-PassQStarchtoSI[loopi]
- +SStarchToQStarchBreakdown[loopi];
- UQStarch[loopi]:=UQStarch[loopi]-PassUQStarchtoSI[loopi];
- SolCP[loopi]:=SolCP[loopi]-FermSolCPinRum[loopi]-PassSolCPtoSI[loopi]
- +SProteinToQProteinSolubilisation[loopi];
- PectinPS[loopi]:=PectinPS[loopi]-FermPectininRum[loopi]*UnfermNDFRL
- -PassPectintoSI[loopi];
- DM:=fNDF[loopi]+iNDF[loopi]+fNDFLong[loopi]+iNDFLong[loopi]
- +LagNDF[loopi]+SolCP[loopi]+DegCP[loopi]+iDegCP[loopi]
- +DegCPLong[loopi]+iDegCPLong[loopi]+QStarch[loopi]+LagCP[loopi]
- +SStarch[loopi]+UQStarch[loopi]+USStarch[loopi]+LagSStarch[loopi]
- +SStarchLong[loopi]+USStarchLong[loopi];
- PassWater:=PassfNDFtoSI[loopi]+PassiNDFtoSI[loopi]
- +PassfNDFLongtoSI[loopi]+PassiNDFLongtoSI[loopi]
- +PassSolCPtoSI[loopi]+PassDegCPLongtoSI[loopi]
- +PassiDegCPLongtoSI[loopi]+PassDegCPtoSI[loopi]
- +PassiDegCPtoSI[loopi]+PassQStarchtoSI[loopi]
- +PassSStarchtoSI[loopi]+PassUQStarchtoSI[loopi]
- +PassUSStarchtoSI[loopi]+PassSStarchLongtoSI[loopi]
- +PassUSStarchLongtoSI[loopi];
- if DM>0 then PassSIWater:=PassSIWater+((PassfNDFtoSI[loopi]+PassiNDFtoSI[loopi])/(PassWater{*Thousand
- /(Thousand-ptrFeedDescriptions^.TMRFeed[loopi].C1
- -ptrFeedDescriptions^.TMRFeed[loopi].C1sNDF)})*7+1.08)
- *(PassWater-PassSolCPtoSI[loopi]-PassQStarchtoSI[loopi]-PassUQStarchtoSI[loopi]);
- if DM>0 then BoundWater:=BoundWater+((fNDF[loopi]+iNDF[loopi])/(DM{*Thousand
- /(Thousand-ptrFeedDescriptions^.TMRFeed[loopi].C1
- -ptrFeedDescriptions^.TMRFeed[loopi].C1sNDF)})*7+1.08)
- *(DM-SolCP[loopi]-QStarch[loopi]-UQStarch[loopi]);
- end;
- SolubleCP:=0; DegradableTrueP:=0;
- for loopi:=0 to NumFoods-1 do
- begin
- SolubleCP:=SolubleCP+SolCP[loopi];
- DegradableTrueP:=DegradableTrueP+DegCP[loopi];
- end;
- QAcR:=QAcR+AcLRum+AcSRum+AcLaRum+ConsumedVFA/MWAceticAcid/StepsPerHour;//Q and dQ for Ac, Pr, Bu are in moles!
- dQAcR:=dQAcR+AcLRum+AcSRum+AcLaRum+ConsumedVFA/MWAceticAcid/StepsPerHour;
- QPrR:=QPrR+PropLRum+PropSRum+PropLaRum;
- dQPrR:=dQPrR+PropLRum+PropSRum+PropLaRum;
- QBuR:=QBuR+ButLRum+ButSRum+ButLaRum;
- dQBuR:=dQBuR+ButLRum+ButSRum+ButLaRum;
- //Put in +ConsumedLactate/MWLacticAcid/StepsPerHour to QLaR and dQLaR
- QLaR:=QLaR+LacLRum+LacSRum+ConsumedLactate/MWLacticAcid/StepsPerHour
- -FermLacticinRum/MWLacticAcid*UnFermLacticAcidL;
- dQLaR:=dQLaR+LacLRum+LacSRum+ConsumedLactate/MWLacticAcid/StepsPerHour
- -FermLacticinRum/MWLacticAcid*UnFermLacticAcidL;
- if Days1toEnd=ptrFeedDescriptions.iDaysToRun then
- begin
- SIMicCHO:=SIMicCHO+((QMicLiquidR+QDeadLiquidMicrobes)*LiquidCHO+(QMicLaUtR
- +QDeadLiquidMicrobesLa)*LaUtCHO+QMicLaR*MicCHO)*PassageFree
- +((QMicLiquidR+QDeadLiquidMicrobes)*LiquidCHO+(QDeadSolidMicrobes
- +QMicSolidsR+QMicLaR)*MicCHO+(QMicLaUtR
- +QDeadLiquidMicrobesLa)*LaUtCHO)*PassageBound;
- SIMicLip:=SIMicLip+((QMicLiquidR+QDeadLiquidMicrobes)*LiquidLip+(QMicLaUtR
- +QDeadLiquidMicrobesLa)*LaUtLip+QMicLaR*MicLip)*PassageFree
- +((QMicLiquidR+QDeadLiquidMicrobes)*LiquidLip+(QDeadSolidMicrobes
- +QMicSolidsR+QMicLaR)*MicLip+(QMicLaUtR
- +QDeadLiquidMicrobesLa)*LaUtLip)*PassageBound;
- end;
- dSIMicCHO:=dSIMicCHO+((QMicLiquidR+QDeadLiquidMicrobes)*LiquidCHO+(QMicLaUtR
- +QDeadLiquidMicrobesLa)*LaUtCHO+QMicLaR*MicCHO)*PassageFree
- +((QMicLiquidR+QDeadLiquidMicrobes)*LiquidCHO+(QDeadSolidMicrobes
- +QMicSolidsR+QMicLaR)*MicCHO+(QMicLaUtR
- +QDeadLiquidMicrobesLa)*LaUtCHO)*PassageBound;
- dSIMicLip:=dSIMicLip+((QMicLiquidR+QDeadLiquidMicrobes)*LiquidLip+(QMicLaUtR
- +QDeadLiquidMicrobesLa)*LaUtLip+QMicLaR*MicLip)*PassageFree
- +((QMicLiquidR+QDeadLiquidMicrobes)*LiquidLip+(QDeadSolidMicrobes
- +QMicSolidsR+QMicLaR)*MicLip+(QMicLaUtR
- +QDeadLiquidMicrobesLa)*LaUtLip)*PassageBound;
- MPOutOfRumen:=((QMicLiquidR+QDeadLiquidMicrobes)*LiquidProt+(QMicLaUtR
- +QDeadLiquidMicrobesLa)*LaUtProt+QMicLaR*MicrobialCrudeProtein)*PassageFree
- +((QMicLiquidR+QDeadLiquidMicrobes)*LiquidProt+(QDeadSolidMicrobes
- +QMicSolidsR+QMicLaR)*MicrobialCrudeProtein+(QMicLaUtR
- +QDeadLiquidMicrobesLa)*LaUtProt)*PassageBound;
- QDeadLiquidMicrobes:=QDeadLiquidMicrobes+QMicLiquidR*DeathOfQMicLiquidR
- -QDeadLiquidMicrobes*(PassageFree+PassageBound)
- -FermDLMCHO-FermDLMProt-FermDLMLip;
- QDeadSolidMicrobes:=QDeadSolidMicrobes+QMicSolidsR*DeathOfQMicSolidsR
- -QDeadSolidMicrobes*RConcPPass-FermDSMCHO-FermDSMProt
- -FermDSMLip;
- QDeadLiquidMicrobesLa:=QDeadLiquidMicrobesLa+QMicLaUtR*DeathOfQMicLiquidRLa
- -QDeadLiquidMicrobesLa*(PassageFree+PassageBound)
- -FermDLaMCHO-FermDLaMProt-FermDLaMLip;
- QMicLiquidR:=QMicLiquidR-PassQMicLiquidR+PassQMicSolidsR
- -QMicLiquidR*(PassageFree+PassageBound)-QMicLiquidR*DeathOfQMicLiquidR;
- LiquidCHO:=(QMicLiquidR*LiquidCHO+MicRumLiquid*Thousand*MicCHO)/(QMicLiquidR
- +MicRumLiquid*Thousand);
- LiquidProt:=MicrobialCrudeProtein/MicNonCHO*(1-LiquidCHO);
- LiquidLip:=MicLip/MicNonCHO*(1-LiquidCHO);
- QMicLiquidR:=QMicLiquidR+MicRumLiquid*Thousand;
- QMicSolidsR:=QMicSolidsR+MicRumSolids*Thousand+PassQMicLiquidR-PassQMicSolidsR
- -QMicSolidsR*RConcPPass-QMicSolidsR*DeathOfQMicSolidsR;
- QMicLaUtR:=QMicLaUtR
- -QMicLaUtR*(PassageFree+PassageBound)-QMicLaUtR*DeathOfQMicLiquidRLa;
- LaUtCHO:=(QMicLaUtR*LaUtCHO+MicLacUtRum*Thousand*MicCHO)/(QMicLaUtR
- +MicLacUtRum*Thousand);
- LaUtProt:=MicrobialCrudeProtein/MicNonCHO*(1-LaUtCHO);
- LaUtLip:=MicLip/MicNonCHO*(1-LaUtCHO);
- QMicLaUtR:=QMicLaUtR+MicLacUtRum*Thousand;
- QMicLaR:=QMicLaR+MicGrowthLacRum*Thousand-QMicLaR*(PassageFree+PassageBound);
- Blood(CAcR,CPrR,CBuR,pH,ptrFeedDescriptions^.RVol,ptrFeedDescriptions^.RumSA{*RumFillUpper},
- StepsPerHour,AbsAc,AbsPr,AbsBu);
- //Production of H+ - total
- ProdLacAc:=0.05*(LacLRum+LacSRum)/(AcLRum+AcSRum); //*tslp/2;//
- Acid:=(CAcR+CPrR+CBuR+CLaR*(1.2+ProdLacAc))*LiquidVolume-ConsumedVFA/MWAceticAcid/StepsPerHour //moles
- -ConsumedLactate/MWLacticAcid/StepsPerHour+AcidEaten/StepsPerHour/Thousand
- +AcLRum+AcSRum+PropLRum+PropSRum+ButLRum+ButSRum+LacLRum+LacSRum
- +AcLaRum+PropLaRum+ButLaRum; //*1.2 to give lactic more umphh
- //CAcR, CPrR, CBuR, CLaR are moles/litre
- pnLaR:=CLaR/(CAcr+CPrR+CBuR+CLaR);
- CAcR:=CAcR+(AcLRum+AcSRum+AcLaRum+ConsumedVFA/MWAceticAcid/StepsPerHour)/LiquidVolume
- -AbsAc/LiquidVolume-CAcR*PassageFree-CAcR*PassageBound;
- CPrR:=CPrR+(PropLRum+PropSRum+PropLaRum)/LiquidVolume-AbsPr/LiquidVolume
- -CPrR*PassageFree-CPrR*PassageBound;
- CBuR:=CBuR+(ButLRum+ButSRum+ButLaRum)/LiquidVolume-AbsBu/LiquidVolume
- -CBuR*PassageFree-CBuR*PassageBound;
- CLaR:=Lactate/MWLacticAcid/LiquidVolume; //Lactate (g/kg) /90 (-> moles)
- BicarbonateFromSaliva:=SalivaFlow*BicarbonateContentSaliva/Thousand; //eq or moles
- if Days1toEnd=ptrFeedDescriptions.iDaysToRun then
- begin
- PAcR:=PAcR+AcLRum+AcSRum+AcLaRum;
- PPrR:=PPrR+PropLRum+PropSRum+PropLaRum;
- PBuR:=PBuR+ButLRum+ButSRum+ButLaRum;
- PLaR:=PLaR+LacLRum+LacSRum;
- if FNH3RumSolid-FermNH3inRumSolid<0 then
- NH3UsedSolid:=0
- else
- NH3UsedSolid:=FNH3RumSolid-FermNH3inRumSolid;
- if FNH3RumFree-FermNH3inRumFree<0 then
- NH3UsedFree:=0
- else
- NH3UsedFree:=FNH3RumFree-FermNH3inRumFree;
- HFNH3QiR:=HFNH3QiR+NH3UsedFree;
- HFNH3SiR:=HFNH3SiR+NH3UsedSolid;
- FreeProteinRatio:=FreeProteinRatio+FermNH3inRumFree-FNH3RumFree-FermSolCPRum*0.36/6.25*17/14;
- SolidProteinRatio:=SolidProteinRatio+FermNH3inRumSolid-FNH3RumSolid-FermDegCPRum*0.36/6.25*17/14;
- end;
- if Days1toEnd>4 then //3 to 4
- begin
- // if Bicarbonate7_74 then
- // begin
- //Paper in J Anim Sci 1998 Kohn and Dunlap on calculation of buffering capacity of
- //bicarbonate rumen 76, 1702-1709. Says pKa 7.74 and pCO2 0.7.
- //put in a pH factor which says how much acetate is dissociated at pH
- //So all VFA and lactic produced as acid but at pH how much is dissociated?
- DissociatedAcidRatioVFA:=exp(pH-pKVFA)/(exp(pH-pKVFA)+1);
- DissociatedAcidRatioLactic:=exp(pH-pKLA)/(exp(pH-pKLA)+1);
- deNaHCO3:=(BicarbonateFromSaliva+BicarbonateEaten/StepsPerHour
- +FermLacticinRum/MWLacticAcid*UnFermLacticAcidL*DissociatedAcidRatioLactic
- +(AbsAc+AbsPr+AbsBu)*DissociatedAcidRatioVFA)
- /(FreeWater+BoundWater/Thousand); //moles/l
- deHProduced:=((AcLRum+AcSRum+PropLRum+PropSRum+ButLRum+ButSRum
- +AcLaRum+PropLaRum+ButLaRum)*DissociatedAcidRatioVFA+(LacLRum
- +LacSRum)*DissociatedAcidRatioLactic+AcidEaten*AcidNeutralised/StepsPerHour)
- /(FreeWater+BoundWater/Thousand); //moles/l
- MolarNaHCO3:=MolarNaHCO3+deNaHCO3-deHProduced;
- if MolarNaHCO3<0.00127 then MolarNaHCO3:=0.00127;
- pHOverTime[StepHours1toEnd]:=pKCO2+log10(MolarNaHCO3/pCO2);
- MolarNaHCO3:=MolarNaHCO3*(1-PassageFree-PassageBound);
- dAcid:=dAcid+Acid;
- end;
- pH:=0;
- for loopi:=0 to AvpH-1 do
- begin
- if StepHours1toEnd-loopi=0 then
- pH:=pH+pHOverTime[10]
- else if StepHours1toEnd-loopi=-1 then
- pH:=pH+pHOverTime[9]
- else if StepHours1toEnd-loopi=-2 then
- pH:=pH+pHoverTime[8]
- else if StepHours1toEnd-loopi=-3 then
- pH:=pH+pHoverTime[7]
- else if StepHours1toEnd-loopi=-4 then
- pH:=pH+pHoverTime[6]
- else if StepHours1toEnd-loopi=-5 then
- pH:=pH+pHoverTime[5]
- else if StepHours1toEnd-loopi=-6 then
- pH:=pH+pHoverTime[4]
- else if StepHours1toEnd-loopi=-7 then
- pH:=pH+pHoverTime[3]
- else if StepHours1toEnd-loopi=-8 then
- pH:=pH+pHoverTime[2]
- else if StepHours1toEnd-loopi=-9 then
- pH:=pH+pHoverTime[1]
- else pH:=pH+pHOverTime[loopi+1];
- end;
- pH:=pH/AvpH;
- if (Days1toEnd=ptrFeedDescriptions.iDaysToRun-1) and (pH<6.25) then
- begin
- pHLim:=pHLim+(6.25-pH);
- end;
- if Days1toEnd=ptrFeedDescriptions^.iDaysToRun then
- DailyFlowSaliva:=DailyFlowSaliva+SalivaFlow;
- pHLast:=pHOverTime[StepHours1toEnd];
- if pH>6.75 then pH:=6.75;
- //Water dynamics
- RumenOsmol:=(CAcR+CPrR+CBuR+CLaR+(Ash/MWIons+SolCHO/MWGlucose
- +SolubleCP/MWProtein+MonoPG_Glycerol/MWMPG
- +NH3Rum/MWNH3)/LiquidVolume)*Thousand;
- OsFlux:=10*(0.0001*ptrFeedDescriptions^.RumSA*(RumenOsmol-BloodOsmol-55))
- /StepsPerHour/HoursInDay; //g/tstep Argylle and Baldwin 1988. .00003*RumSA my bit. 10* to give a tstep rate from a day rate!
- // if Days1toEnd=ptrFeedDescriptions.iDaysToRun then
- // if StepHours1toEnd=4 then
- // QMP:=QMP;
- if MicrobesAcidosis then
- begin
- BodyWater:=BodyWater-OsFlux-ptrFeedDescriptions^.MilkWater/StepsPerHour+OutFlow
- -MinimumUrineWater-SalivaFlow+PassSIWater/Thousand;
- if BodyWater>Animal.Water then
- begin
- dUrineWater:=BodyWater-Animal.Water;
- dWaterDrunk:=0;
- end
- else
- begin
- dUrineWater:=0;
- end;
- dUrineWater:=dUrineWater+MinimumUrineWater;
- UrineWater:=UrineWater+dUrineWater;
- BodyWater:=BodyWater-dUrineWater;
- end;
- FreeWater:=FreeWater+OsFlux+SalivaFlow+FeedWater/Thousand/StepsPerHour+dWaterDrunk;
- dWaterDrunk:=0;
- LiquidVolume:=FreeWater+BoundWater/Thousand;
- PassageFree:=RLPass*FreeWater/LiquidVolume;
- if PassageFree>0.5 then PassageFree:=0.5;
- PassageBound:=RConcPPass*(1-FreeWater/LiquidVolume);
- TotalRumenVol:=RumDM/Thousand+FreeWater+BoundWater/Thousand;
- if TotalRumenVol>ptrFeedDescriptions^.RVol then
- begin
- OutFlow:=TotalRumenVol-ptrFeedDescriptions^.RVol;
- TotalRumenVol:=ptrFeedDescriptions^.RVol;
- FreeWater:=FreeWater-Outflow;
- end
- else OutFlow:=0;
- RLPass:=OutFlow/LiquidVolume;
- if FreeWater<0.05 then FreeWater:=0.5;
- if Yeast then
- OxygenLevel:=OxygenLevel*(1-OxygenUsed)+(dWaterDrunk+SalivaFlow)*200
- -OutFlow;
- //SI
- dSIMic:=dSIMic+MPOutOfRumen/MicrobialCrudeProtein;
- MTP:=MTP+MPOutOfRumen*CPToTP*DigestibilityofTP;
- DUP:=DUP+(SumPassSolCPtoSI+SumPassDigCPtoSI)*DigestibilityOfDUP;
- MP:=MTP+DUP;//cumulative
- dMP:=dMP+MPOutOfRumen*CPToTP*DigestibilityofTP
- +(SumPassSolCPtoSI+SumPassDigCPtoSI)*DigestibilityOfDUP;
- SumUndigestedProtein:=0;
- for loopi:=0 to NumFoods-1 do
- begin
- SIfNDF[loopi]:=SIfNDF[loopi]+PassfNDFtoSI[loopi]+PassfNDFLongtoSI[loopi]
- +PassLagfNDFtoSI[loopi];
- SIiNDF[loopi]:=SIiNDF[loopi]+PassiNDFtoSI[loopi]+PassiNDFLongtoSI[loopi]
- +PassLagiNDFtoSI[loopi];
- SIDegCP[loopi]:=SIDegCP[loopi]+PassDegCPtoSI[loopi]+PassDegCPLongtoSI[loopi]
- +PassLagDegCPtoSI[loopi];
- SIiDegCP[loopi]:=SIiDegCP[loopi]+PassiDegCPtoSI[loopi]+PassiDegCPLongtoSI[loopi]
- +PassLagiDegCPtoSI[loopi];
- SIStarch[loopi]:=SIStarch[loopi]+(PassQStarchtoSI[loopi]+PassUQStarchtoSI[loopi]
- +PassSStarchToSI[loopi]+PassUSStarchToSI[loopi]
- +PassSStarchLongToSI[loopi]+PassUSStarchLongToSI[loopi])*LacticToGlucose;
- SIDigCHO:=SIDigCHO+(PassQStarchtoSI[loopi]+PassUQStarchtoSI[loopi]
- +PassSStarchToSI[loopi]+PassUSStarchToSI[loopi]
- +PassSStarchLongToSI[loopi]+PassUSStarchLongToSI[loopi])*LacticToGlucose;
- if Days1toEnd=(ptrFeedDescriptions^.iDaysToRun) then
- begin
- QCHO:=QCHO+(PassQStarchtoSI[loopi]+PassUQStarchtoSI[loopi]
- +PassSStarchToSI[loopi]+PassUSStarchToSI[loopi]
- +PassSStarchLongToSI[loopi]+PassUSStarchLongToSI[loopi])*LacticToGlucose;
- end;
- dSIDigCHO:=dSIDigCHO+(PassQStarchtoSI[loopi]+PassUQStarchtoSI[loopi]
- +PassSStarchToSI[loopi]+PassUSStarchToSI[loopi]
- +PassSStarchLongToSI[loopi]+PassUSStarchLongToSI[loopi])*LacticToGlucose;
- SumUndigestedProtein:=SumUndigestedProtein+PassDegCPtoSI[loopi]+PassiDegCPtoSI[loopi];
- end;
- // if Days1toEnd=(ptrFeedDescriptions^.iDaysToRun) then
- SIUndigestedCP:=(SumPassSolCPtoSI+SumUndigestedProtein)*(1-DigestibilityOfDUP)
- +MPOutOfRumen*CPToTP*(1-DigestibilityofTP);//FoodCP that is not absorbed
- SIDigCHO:=SIDigCHO+PassSolCHOtoSI+PassLactictoSI*LacticToGlucose
- +PassMPGtoSI/MWMPG/2*MWGlucose
- +(PassUnfermentedGlyceroltoSI+PassGlyceroltoSI)/MWGlycerol/2*MWGlucose;
- dSIDigCHO:=dSIDigCHO+PassSolCHOtoSI+PassLactictoSI*LacticToGlucose
- +PassMPGtoSI/MWMPG/2*MWGlucose
- +(PassUnfermentedGlyceroltoSI+PassGlyceroltoSI)/MWGlycerol/2*MWGlucose;
- AbsOil:=AbsOil+PassOiltoSI;
- dAbsOil:=dAbsOil+PassOiltoSI;
- //HG
- for loopi:=0 to NumFoods-1 do
- begin
- PassPectinOut[loopi]:=HGPectinPS[loopi]*HGPPass;
- PassfNDFOut[loopi]:=HGfNDF[loopi]*HGPPass;
- PassiNDFOut[loopi]:=HGiNDF[loopi]*HGPPass;
- FaecalPectin:=FaecalPectin+PassPectinOut[loopi];
- FaecaliNDF:=FaecaliNDF+PassiNDFOut[loopi];
- FaecalfNDF:=FaecalfNDF+PassfNDFOut[loopi];
- FDM:=FDM+PassfNDFOut[loopi]+PassiNDFOut[loopi]+PassPectinOut[loopi];//cumulative
- FermPectininHG[loopi]:=HGPectinPS[loopi]*PectinRate[loopi];
- FermPectinHG:=FermPectinHG+FermPectininHG[loopi];
- FermfNDFinHG[loopi]:=HGfNDF[loopi]*RNDF[loopi];
- FermNDFHG:=FermNDFHG+FermfNDFinHG[loopi];
- HGPectinPS[loopi]:=HGPectinPS[loopi]+PassPectintoSI[loopi]
- -PassPectinOut[loopi]-FermPectininHG[loopi];
- HGfNDF[loopi]:=HGfNDF[loopi]+PassfNDFtoSI[loopi]+PassfNDFLongtoSI[loopi]
- +PassLagfNDFtoSI[loopi]-PassfNDFOut[loopi]-FermfNDFinHG[loopi];
- HGiNDF[loopi]:=HGiNDF[loopi]+PassiNDFtoSI[loopi]+PassiNDFLongtoSI[loopi]
- +PassLagiNDFtoSI[loopi]-PassiNDFOut[loopi];
- end;
- FermNDFHG:=FermNDFHG;//+FermsNDFHG;
- FermProteinHG:=QProteinHG*0.1/StepsPerHour;
- MicHG:=MicMaint/StepsPerHour*QMicHG;
- if (Days1toEnd<3) and (Hours1to24<4) then //2 to 3
- else
- begin
- fermentation(FermsNDFHG,FermNDFHG+FermPectinHG,0,FermProteinHG,0,0,0,QMicHG,0,StepsPerHour,
- AcHG, PropHG, ButHG,LacHG, CH4HG, NH3HG, MicHG,MicLacHG,
- UnFermSolCHOHG, UnFermNDFHG,UnFermLacticAcidHG,StarchUsedHG,
- PpnHexUsed,PpnHexFerm,DeathOfQMicHG, 3);
- QMicHG:=QMicHG+MicHG*Thousand-QMicHG*HGPPass;
- end;
- QAcHG:=QAcHG+AcHG;
- dQAcHG:=dQAcHG+AcHG;
- QPrHG:=QPrHG+PropHG;
- dQPrHG:=dQPrHG+PropHG;
- QBuHG:=QBuHG+ButHG;
- dQBuHG:=dQBuHG+ButHG;
- QProteinHG:=QProteinHG-QProteinHG*HGPPass-FermProteinHG+SIUndigestedCP;
- FDM:=FDM+QMicHG*HGPPass+QProteinHG*HGPPass;
- if Days1toEnd=ptrFeedDescriptions^.iDaysToRun then
- begin
- QAc:=QAc+AcLRum+AcSRum+AcLaRum+ConsumedVFA/MWAceticAcid/StepsPerHour+AcHG;
- QPr:=QPr+PropLRum+PropSRum+PropLaRum+PropHG;
- QBu:=QBu+ButLRum+ButSRum+ButLaRum+ButHG;
- //Absorption of MonoPG_Glycerol equivalent to Fermentation
- QCHO:=QCHO+PassSolCHOtoSI+PassLactictoSI+(PassMPGtoSI
- +FermMonoPG_GlycerolinRum+PassUnfermentedGlyceroltoSI)/MWMPG/2*MWGlucose;
- QCH4R:=QCH4R+CH4LRum+CH4SRum+CH4LaRum;//moles
- QCH4HG:=QCH4HG+CH4HG;
- FaecalN:=FaecalN+QMicHG*HGPPass*0.5/6.25+QProteinHG*HGPPass/6.25;//assumes microbial CP is 50% of microbialDM
- QMTP:=QMTP+MPOutOfRumen*CPToTP*DigestibilityofTP;
- QDUP:=QDUP+(SumPassSolCPtoSI+SumPassDigCPtoSI)*DigestibilityOfDUP;
- QMP:=QMTP+QDUP;//cumulative
- SIMic:=SIMic+MPOutOfRumen/MicrobialCrudeProtein;
- //efficiency of microbial N synthesis (EMNS) 25gN/kgOM or 32gN/kgcarbohydrate
- dEMNS:=(MicRumLiquid+MicRumSolids+MicLacRum)*Thousand*Thousand*0.45/6.25
- /(FermSolCHOinRum+FermSolsNDFinRum+FermNDFRum+FermQStarchRum+FermSStarchRum
- {+FermSolCPRum+FermDegCPRum+Oil}-UnFermSolCHOL-UnFermSolCHOS
- -UnfermNDFRS-UnFermLacticAcidL-UnFermLacticAcidS);
- hEMNSh:=hEMNSh+dEMNS;
- EMNS:=EMNS+dEMNS;
- for loopi:=0 to NumFoods-1 do
- begin
- TLongNDFForage[Hours1To24]:=TLongNDFForage[Hours1To24]+(iNDFLong[loopi]
- +fNDFLong[loopi])/StepsPerHour/RumDM;
- ULongNDFForage[Hours1To24]:=ULongNDFForage[Hours1To24]+iNDFLong[loopi]
- /StepsPerHour/RumDM;
- if loopi<ptrFeedDescriptions^.iNoFeeds then
- begin
- if (ptrFeedDescriptions^.TMRFeed[loopi].ForOrConc) or (ptrFeedDescriptions^.TMRFeed[loopi].GroundOrLong=False) then
- begin
- UNDFForage[Hours1To24]:=UNDFForage[Hours1To24]+(iNDFLong[loopi]
- +iNDF[loopi])/StepsPerHour/TotalRumDM;
- TNDFForage[Hours1To24]:=TNDFForage[Hours1To24]+(iNDFLong[loopi]
- +iNDF[loopi]+fNDFLong[loopi]+fNDF[loopi])
- /StepsPerHour/TotalRumDM;
- end;
- end
- else if loopi=ptrFeedDescriptions^.iNoFeeds-1+ptrFeedDescriptions^.iGrazing then
- begin
- if ptrFeedDescriptions^.GrazingFeed.ForOrConc then
- begin
- UNDFForage[Hours1To24]:=UNDFForage[Hours1To24]+(iNDFLong[loopi]
- +iNDF[loopi])/StepsPerHour/TotalRumDM;
- TNDFForage[Hours1To24]:=TNDFForage[Hours1To24]+(iNDFLong[loopi]
- +iNDF[loopi]+fNDFLong[loopi]+fNDF[loopi])
- /StepsPerHour/TotalRumDM;
- end;
- end
- else if loopi>ptrFeedDescriptions^.iNoFeeds-1+ptrFeedDescriptions^.iGrazing then
- begin
- // if ptrFeedDescriptions^.ParlourFeed[loopi-1-(ptrFeedDescriptions^.iNoFeeds-1+ptrFeedDescriptions^.iGrazing)].ForOrConc then
- // begin
- // UNDFForage[Hours1To24]:=UNDFForage[Hours1To24]+(iNDFLong[loopi]
- // +iNDF[loopi])/StepsPerHour/TotalRumDM;
- // TNDFForage[Hours1To24]:=TNDFForage[Hours1To24]+(iNDFLong[loopi]
- // +iNDF[loopi]+fNDFLong[loopi]+fNDF[loopi])
- // /StepsPerHour/TotalRumDM;
- // end;
- end;
- end;
- end;
- end;//end of within hour loop
- LagParlourFeed:=0;
- //add in intake
- if (Hours1to24 in EatingTime) then
- begin
- // if Days1toEnd=ptrFeedDescriptions^.iDaysToRun then
- // QMP:=QMP;
- HourlyPotentialIntake:=(ptrFeedDescriptions^.RumFillUpper
- *ptrFeedDescriptions^.RVol*Thousand*0.15
- -RumDM)/Thousand;
- if (Hours1to24 in GrazingHour[ptrFeedDescriptions^.Diet]) then
- begin
- if HourlyPotentialIntake>ptrFeedDescriptions^.MaxIntakePerHourPGrazing then
- HourlyPotentialIntake:=ptrFeedDescriptions^.MaxIntakePerHourPGrazing;
- end
- else {if not Beef then}
- begin
- if HourlyPotentialIntake>ptrFeedDescriptions^.MaxIntakePerHour then
- begin
- HourlyPotentialIntake:=ptrFeedDescriptions^.MaxIntakePerHour;
- EatingStepsPerHour:=StepsPerHour;
- end
- else
- begin
- EatingStepsPerHour:=Round(StepsPerHour*HourlyPotentialIntake
- /ptrFeedDescriptions^.MaxIntakePerHour);
- end;
- end;
- end
- else
- HourlyPotentialIntake:=0;
- if HourlyPotentialIntake<0 then HourlyPotentialIntake:=0;
- ConsumedVFA:=0;
- ConsumedNH3:=0;
- ConsumedLactate:=0;
- FeedWater:=0;
- AcidEaten:=0; BicarbonateEaten:=0; AlkabupHaAcidConsumed:=0; AlkabupHaAcidConsumedPpn:=0;
- if (Hours1to24 in AwakeTime) then
- begin
- if (FSParlour[ptrFeedDescriptions^.Diet]) and
- (Hours1to24 in ParlourHour[ptrFeedDescriptions^.Diet])
- then
- begin
- n1:=0;
- ParlourRobot:=True;
- if LagTimeParlour then
- begin
- LagParlourFeed:=ptrFeedDescriptions^.ParlourPerMeal;
- end
- else
- begin
- LagParlourFeed:=0;
- end;
- for count:=ParlourCountLow to ParlourCountHigh do
- begin
- if TMRRobotic then
- begin
- if (HalfRobotic) and (Hours1to24=1) then
- begin
- HalfRoboticDMI:=0.5;
- end
- else
- begin
- HalfRoboticDMI:=1;
- end;
- ParlourPerMealPerFood:=ptrFeedDescriptions^.RoboticPerMeal1
- *PMParlourAmount[n1]/100*HalfRoboticDMI;
- end
- else
- ParlourPerMealPerFood:=ptrFeedDescriptions^.ParlourPerMeal
- *PMParlourAmount[n1]/100*HalfRoboticDMI;
- LagUrea[count]:=LagUrea[count]+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].UreaProtected;
- LagUreaToEnter[count,Hours1to24]:=ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].UreaProtected;
- LagUreaEntryTime[count,Hours1to24]:=ElapsedTime
- +ptrFeedDescriptions^.ParlourFeed[n1].UreaTimeLag;
- LagNDF[count]:=LagNDF[count]+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].fermNDF
- +ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].unfermNDF;
- LagfNDFToEnter[count,Hours1to24]:=ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].fermNDF;
- LagiNDFToEnter[count,Hours1to24]:=ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].unfermNDF;
- LagNDFEntryTime[count,Hours1to24]:=ElapsedTime
- +ptrFeedDescriptions^.ParlourFeed[n1].Lag;
- LagSStarch[count]:=LagSStarch[count]+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].SlowStarch
- +ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].UndegSStarch;
- LagSStarchToEnter[count,Hours1to24]:=ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].SlowStarch;
- LagUSStarchToEnter[count,Hours1to24]:=ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].UndegSStarch;
- LagSStarchEntryTime[count,Hours1to24]:=ElapsedTime
- +ptrFeedDescriptions^.ParlourFeed[n1].StarchLag;
- LagCP[count]:=LagCP[count]+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].P2
- +ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].P3;
- LagDegCPToEnter[count,Hours1to24]:=ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].P2;
- LagiDegCPToEnter[count,Hours1to24]:=ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].P3;
- LagCPEntryTime[count,Hours1to24]:=ElapsedTime
- +ptrFeedDescriptions^.ParlourFeed[n1].NLag;
- if LagTimeParlour then
- begin
- // LagParlourFeed:=ptrFeedDescriptions^.ParlourPerMeal;
- end
- else
- begin
- QStarch[count]:=QStarch[count]+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].QuickStarch;
- UQStarch[count]:=UQStarch[count]+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].UndegQStarch;
- SolCHO:=SolCHO+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].C1;
- MonoPG_Glycerol:=MonoPG_Glycerol+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].MPG;
- Glycerol:=Glycerol+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].Glycerol;
- UnfermentedGlycerolSmall:=UnfermentedGlycerolSmall+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].UnfermentedGlycerol;
- SolCP[count]:=SolCP[count]+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].P1;
- if ptrFeedDescriptions^.Pectins then
- begin
- SolsNDF:=0;
- PectinPS[count]:=PectinPS[count]+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].C1sNDF;
- end
- else
- begin
- if ptrFeedDescriptions^.ACHOintoWSCsNDF then
- SolsNDF:=SolsNDF+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].C1sNDF
- else SolsNDF:=0;
- end;
- Ash:=Ash+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].Mins;
- Oil:=Oil+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].EE;
- ConsumedVFA:=ConsumedVFA+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].fVFA;
- Lactate:=Lactate+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].fLactic;
- ConsumedNH3:=ConsumedNH3+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].fNH3;
- AcidEaten:=AcidEaten+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].PpnAcid;
- BicarbonateEaten:=BicarbonateEaten+ParlourPerMealPerFood
- *ptrFeedDescriptions^.ParlourFeed[n1].HCO3*Thousand/MWNaHCO3;
- FeedWater:=FeedWater+ParlourPerMealPerFood*10
- *(100-ptrFeedDescriptions^.ParlourFeed[n1].DM);
- end;
- HourlyActualIntake[count]:=ParlourPerMealPerFood;
- inc(n1);
- end;
- if ParlourTMR then
- begin
- for loopi:=0 to ptrFeedDescriptions^.iNoFeeds-1 do //
- begin
- //Rob reckoned that TMR eaten should be around 7 - 8 kg DM. 1.25 that I did have was lower than that at 2.5 so it was multiplied by 3.1!
- HI:=3.875*ptrAmount^[ptrFeedDescriptions^.iNoFeeds*(ptrFeedDescriptions^.Diet-1)+loopi]; //1.25
- LagUrea[loopi]:=LagUrea[loopi]+HI
- *ptrFeedDescriptions^.TMRFeed[loopi].UreaProtected;
- LagUreaToEnter[loopi,Hours1to24]:=HI*ptrFeedDescriptions^.TMRFeed[loopi].UreaProtected;
- if LagUreaToEnter[loopi,Hours1to24]>0 then
- LagUreaEntryTime[loopi,Hours1to24]:=ElapsedTime
- +ptrFeedDescriptions^.TMRFeed[loopi].UreaTimeLag;
- LagSGlycerol[loopi]:=LagSGlycerol[loopi]+HI
- *ptrFeedDescriptions^.TMRFeed[loopi].SlowGlycerol;
- LagSGlycerolToEnter[loopi,Hours1to24]:=HI*ptrFeedDescriptions^.TMRFeed[loopi].SlowGlycerol;
- if LagSGlycerolToEnter[loopi,Hours1to24]>0 then
- LagSGlycerolEntryTime[loopi,Hours1to24]:=ElapsedTime
- +ptrFeedDescriptions^.TMRFeed[loopi].SlowGlycerolLag;
- LagNDF[loopi]:=LagNDF[loopi]+HI*ptrFeedDescriptions^.TMRFeed[loopi].fermNDF
- +HI*ptrFeedDescriptions^.TMRFeed[loopi].unfermNDF;
- LagfNDFToEnter[loopi,Hours1to24]:=HI*ptrFeedDescriptions^.TMRFeed[loopi].fermNDF;
- LagiNDFToEnter[loopi,Hours1to24]:=HI*ptrFeedDescriptions^.TMRFeed[loopi].unfermNDF;
- if (LagfNDFToEnter[loopi,Hours1to24]>0) or (LagiNDFToEnter[loopi,Hours1to24]>0) then
- LagNDFEntryTime[loopi,Hours1to24]:=ElapsedTime+ptrFeedDescriptions^.TMRFeed[loopi].Lag{+4};
- LagSStarch[loopi]:=LagSStarch[loopi]+HI*ptrFeedDescriptions^.TMRFeed[loopi].SlowStarch
- +HI*ptrFeedDescriptions^.TMRFeed[loopi].UndegSStarch;
- LagSStarchToEnter[loopi,Hours1to24]:=HI*ptrFeedDescriptions^.TMRFeed[loopi].SlowStarch;
- LagUSStarchToEnter[loopi,Hours1to24]:=HI*ptrFeedDescriptions^.TMRFeed[loopi].UndegSStarch;
- if (LagSStarchToEnter[loopi,Hours1to24]>0) or (LagUSStarchToEnter[loopi,Hours1to24]>0) then
- LagSStarchEntryTime[loopi,Hours1to24]:=ElapsedTime+ptrFeedDescriptions^.TMRFeed[loopi].StarchLag{+4};
- QStarch[loopi]:=QStarch[loopi]+HI*ptrFeedDescriptions^.TMRFeed[loopi].QuickStarch;
- UQStarch[loopi]:=UQStarch[loopi]+HI*ptrFeedDescriptions^.TMRFeed[loopi].UndegQStarch;
- LagCP[loopi]:=LagCP[loopi]+HI*ptrFeedDescriptions^.TMRFeed[loopi].P2
- +HI*ptrFeedDescriptions^.TMRFeed[loopi].P3;
- LagDegCPToEnter[loopi,Hours1to24]:=HI*ptrFeedDescriptions^.TMRFeed[loopi].P2;
- LagiDegCPToEnter[loopi,Hours1to24]:=HI*ptrFeedDescriptions^.TMRFeed[loopi].P3;
- if (LagDegCPToEnter[loopi,Hours1to24]>0) or (LagiDegCPToEnter[loopi,Hours1to24]>0) then
- LagCPEntryTime[loopi,Hours1to24]:=ElapsedTime+ptrFeedDescriptions^.TMRFeed[loopi].NLag;
- SolCHO:=SolCHO+HI*ptrFeedDescriptions^.TMRFeed[loopi].C1;
- MonoPG_Glycerol:=MonoPG_Glycerol+HI*ptrFeedDescriptions^.TMRFeed[loopi].MPG;
- Glycerol:=Glycerol+HI*ptrFeedDescriptions^.TMRFeed[loopi].Glycerol;
- UnfermentedGlycerolSmall:=UnfermentedGlycerolSmall
- +HI*ptrFeedDescriptions^.TMRFeed[loopi].UnfermentedGlycerol;
- if ptrFeedDescriptions^.Pectins then
- begin
- SolsNDF:=0;
- PectinPS[loopi]:=PectinPS[loopi]+HI
- *ptrFeedDescriptions^.TMRFeed[loopi].C1sNDF
- end
- else
- begin
- if ptrFeedDescriptions^.ACHOintoWSCsNDF then
- SolsNDF:=SolsNDF+HI*ptrFeedDescriptions^.TMRFeed[loopi].C1sNDF
- else SolsNDF:=0;
- end;
- SolCP[loopi]:=SolCP[loopi]+HI*ptrFeedDescriptions^.TMRFeed[loopi].P1;
- Ash:=Ash+HI*ptrFeedDescriptions^.TMRFeed[loopi].Mins;
- Oil:=Oil+HI*ptrFeedDescriptions^.TMRFeed[loopi].EE;
- ConsumedVFA:=ConsumedVFA+HI*ptrFeedDescriptions^.TMRFeed[loopi].fVFA;
- Lactate:=Lactate+HI*ptrFeedDescriptions^.TMRFeed[loopi].fLactic;
- ConsumedLactate:=ConsumedLactate+HI*ptrFeedDescriptions^.TMRFeed[loopi].fLactic;
- ConsumedNH3:=ConsumedNH3+HI*ptrFeedDescriptions^.TMRFeed[loopi].fNH3;
- AcidEaten:=AcidEaten+HI*ptrFeedDescriptions^.TMRFeed[loopi].PpnAcid;
- if not NotAlkapHer then
- begin
- AlkabupHaAcidConsumed:=AlkabupHaAcidConsumed
- +HI*(ptrFeedDescriptions^.TMRFeed[loopi].fLactic
- +ptrFeedDescriptions^.TMRFeed[loopi].fVFA*1.25);
- end;
- BicarbonateEaten:=BicarbonateEaten+HI
- *ptrFeedDescriptions^.TMRFeed[loopi].HCO3*Thousand/MWNaHCO3;
- HourlyActualIntake[loopi]:=HI;
- FeedWater:=FeedWater+HI*10*(100-ptrFeedDescriptions^.TMRFeed[loopi].DM);
- // if Days1toEnd=ptrFeedDescriptions^.iDaysToRun then
- // if Hours1to24=3 then
- // QMP:=QMP;
- end;
- end;
- if (TMRRobotic) and (RoboticCountHigh>RoboticCountLow) then
- begin
- n1:=0;
- ParlourRobot:=True;
- for count:=RoboticCountLow to RoboticCountHigh do
- begin
- RoboticPerMealPerFood:=ptrFeedDescriptions^.RoboticPerMeal2
- *PMRoboticAmount[n1]/100*HalfRoboticDMI;
- if RoboticPerMealPerFood>0 then
- begin
- LagUrea[count]:=LagUrea[count]+RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].UreaProtected;
- LagUreaToEnter[count,Hours1to24]:=RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].UreaProtected;
- LagUreaEntryTime[count,Hours1to24]:=ElapsedTime
- +ptrFeedDescriptions^.RoboticFeed[n1].UreaTimeLag;
- LagNDF[count]:=LagNDF[count]+RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].fermNDF
- +RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].unfermNDF;
- LagfNDFToEnter[count,Hours1to24]:=RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].fermNDF;
- LagiNDFToEnter[count,Hours1to24]:=RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].unfermNDF;
- LagNDFEntryTime[count,Hours1to24]:=ElapsedTime
- +ptrFeedDescriptions^.RoboticFeed[n1].Lag;
- LagSStarch[count]:=LagSStarch[count]+RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].SlowStarch
- +RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].UndegSStarch;
- LagSStarchToEnter[count,Hours1to24]:=RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].SlowStarch;
- LagUSStarchToEnter[count,Hours1to24]:=RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].UndegSStarch;
- LagSStarchEntryTime[count,Hours1to24]:=ElapsedTime
- +ptrFeedDescriptions^.RoboticFeed[n1].StarchLag;
- LagCP[count]:=LagCP[count]+ParlourPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].P2
- +RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].P3;
- LagDegCPToEnter[count,Hours1to24]:=RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].P2;
- LagiDegCPToEnter[count,Hours1to24]:=RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].P3;
- LagCPEntryTime[count,Hours1to24]:=ElapsedTime
- +ptrFeedDescriptions^.RoboticFeed[n1].NLag;
- if LagTimeParlour then
- begin
- // LagParlourFeed:=ptrFeedDescriptions^.ParlourPerMeal;
- end
- else
- begin
- QStarch[count]:=QStarch[count]+RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].QuickStarch;
- UQStarch[count]:=UQStarch[count]+RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].UndegQStarch;
- SolCHO:=SolCHO+RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].C1;
- MonoPG_Glycerol:=MonoPG_Glycerol+RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].MPG;
- Glycerol:=Glycerol+RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].Glycerol;
- UnfermentedGlycerolSmall:=UnfermentedGlycerolSmall+RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].UnfermentedGlycerol;
- SolCP[count]:=SolCP[count]+RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].P1;
- if ptrFeedDescriptions^.Pectins then
- begin
- SolsNDF:=0;
- PectinPS[count]:=PectinPS[count]+RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].C1sNDF;
- end
- else
- begin
- if ptrFeedDescriptions^.ACHOintoWSCsNDF then
- SolsNDF:=SolsNDF+RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].C1sNDF
- else SolsNDF:=0;
- end;
- Ash:=Ash+RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].Mins;
- Oil:=Oil+RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].EE;
- ConsumedVFA:=ConsumedVFA+RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].fVFA;
- Lactate:=Lactate+RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].fLactic;
- ConsumedNH3:=ConsumedNH3+RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].fNH3;
- AcidEaten:=AcidEaten+RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].PpnAcid;
- BicarbonateEaten:=BicarbonateEaten+RoboticPerMealPerFood
- *ptrFeedDescriptions^.RoboticFeed[n1].HCO3*Thousand/MWNaHCO3;
- FeedWater:=FeedWater+RoboticPerMealPerFood*10
- *(100-ptrFeedDescriptions^.RoboticFeed[n1].DM);
- end;
- HourlyActualIntake[count]:=RoboticPerMealPerFood;
- inc(n1);
- end;
- end;
- if ptrFeedDescriptions^.iLiquid>0 then
- begin
- count:=LiquidCount;
- LiqPerMeal:=rFeedInfo.LiquidPerMeal*HalfRoboticDMI;
- begin
- LagUrea[count]:=LagUrea[count]+LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.UreaProtected;
- LagUreaToEnter[count,Hours1to24]:=LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.UreaProtected;
- LagUreaEntryTime[count,Hours1to24]:=ElapsedTime
- +ptrFeedDescriptions^.LiquidFeed.UreaTimeLag;
- LagNDF[count]:=LagNDF[count]+LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.fermNDF
- +LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.unfermNDF;
- LagfNDFToEnter[count,Hours1to24]:=LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.fermNDF;
- LagiNDFToEnter[count,Hours1to24]:=LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.unfermNDF;
- LagNDFEntryTime[count,Hours1to24]:=ElapsedTime
- +ptrFeedDescriptions^.LiquidFeed.Lag;
- LagSStarch[count]:=LagSStarch[count]+LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.SlowStarch
- +LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.UndegSStarch;
- LagSStarchToEnter[count,Hours1to24]:=LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.SlowStarch;
- LagUSStarchToEnter[count,Hours1to24]:=LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.UndegSStarch;
- LagSStarchEntryTime[count,Hours1to24]:=ElapsedTime
- +ptrFeedDescriptions^.LiquidFeed.StarchLag;
- LagCP[count]:=LagCP[count]+LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.P2
- +LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.P3;
- LagDegCPToEnter[count,Hours1to24]:=LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.P2;
- LagiDegCPToEnter[count,Hours1to24]:=LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.P3;
- LagCPEntryTime[count,Hours1to24]:=ElapsedTime
- +ptrFeedDescriptions^.LiquidFeed.NLag;
- if LagTimeParlour then
- begin
- // LagParlourFeed:=ptrFeedDescriptions^.ParlourPerMeal;
- end
- else
- begin
- QStarch[count]:=QStarch[count]+LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.QuickStarch;
- UQStarch[count]:=UQStarch[count]+LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.UndegQStarch;
- SolCHO:=SolCHO+LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.C1;
- MonoPG_Glycerol:=MonoPG_Glycerol+LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.MPG;
- Glycerol:=Glycerol+LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.Glycerol;
- UnfermentedGlycerolSmall:=UnfermentedGlycerolSmall+LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.UnfermentedGlycerol;
- SolCP[count]:=SolCP[count]+LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.P1;
- if ptrFeedDescriptions^.Pectins then
- begin
- SolsNDF:=0;
- PectinPS[count]:=PectinPS[count]+LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.C1sNDF;
- end
- else
- begin
- if ptrFeedDescriptions^.ACHOintoWSCsNDF then
- SolsNDF:=SolsNDF+LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.C1sNDF
- else SolsNDF:=0;
- end;
- Ash:=Ash+LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.Mins;
- Oil:=Oil+LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.EE;
- ConsumedVFA:=ConsumedVFA+LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.fVFA;
- Lactate:=Lactate+LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.fLactic;
- ConsumedNH3:=ConsumedNH3+LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.fNH3;
- AcidEaten:=AcidEaten+LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.PpnAcid;
- BicarbonateEaten:=BicarbonateEaten+LiqPerMeal
- *ptrFeedDescriptions^.LiquidFeed.HCO3*Thousand/MWNaHCO3;
- FeedWater:=FeedWater+LiqPerMeal*10
- *(100-ptrFeedDescriptions^.LiquidFeed.DM);
- end;
- HourlyActualIntake[count]:=LiqPerMeal;
- end;
- end;
- end;
- // if Days1toEnd=ptrFeedDescriptions^.iDaysToRun then
- // QMP:=QMP;
- CanEatForage:=False;
- end;
- if (Hours1to24 in EatingTime) then
- begin
- if (Hours1to24 in GrazingHour[ptrFeedDescriptions^.Diet]) then
- begin
- ParlourRobot:=False;
- if HourlyPotentialIntake>ptrFeedDescriptions^.SwardLength/4 then
- HourlyPotentialIntake:=ptrFeedDescriptions^.SwardLength/4;
- count:=ptrFeedDescriptions^.iNoFeeds;
- LagNDF[count]:=LagNDF[count]+HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.fermNDF
- +HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.unfermNDF;
- LagfNDFToEnter[count,Hours1to24]:=HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.fermNDF;
- LagiNDFToEnter[count,Hours1to24]:=HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.unfermNDF;
- LagNDFEntryTime[count,Hours1to24]:=ElapsedTime+ptrFeedDescriptions^.GrazingFeed.Lag;
- LagSStarch[count]:=LagSStarch[count]+HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.SlowStarch
- +HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.UndegSStarch;
- LagSStarchToEnter[count,Hours1to24]:=HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.SlowStarch;
- LagUSStarchToEnter[count,Hours1to24]:=HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.UndegSStarch;
- LagSStarchEntryTime[count,Hours1to24]:=ElapsedTime+ptrFeedDescriptions^.GrazingFeed.StarchLag;
- QStarch[count]:=QStarch[count]+HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.QuickStarch;
- UQStarch[count]:=UQStarch[count]+HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.UndegQStarch;
- LagCP[count]:=LagCP[count]+HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.P2
- +HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.P3;
- LagDegCPToEnter[count,Hours1to24]:=HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.P2;
- LagiDegCPToEnter[count,Hours1to24]:=HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.P3;
- LagCPEntryTime[count,Hours1to24]:=ElapsedTime+ptrFeedDescriptions^.GrazingFeed.NLag;
- SolCHO:=SolCHO+HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.C1;
- MonoPG_Glycerol:=MonoPG_Glycerol+HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.MPG;
- Glycerol:=Glycerol+HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.Glycerol;
- UnfermentedGlycerolSmall:=UnfermentedGlycerolSmall+HourlyPotentialIntake
- *ptrFeedDescriptions^.GrazingFeed.UnfermentedGlycerol;
- if ptrFeedDescriptions^.Pectins then
- begin
- SolsNDF:=0;
- PectinPS[count]:=PectinPS[count]+HourlyPotentialIntake
- *ptrFeedDescriptions^.GrazingFeed.C1sNDF
- end
- else
- begin
- if ptrFeedDescriptions^.ACHOintoWSCsNDF then
- SolsNDF:=SolsNDF+HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.C1sNDF
- else SolsNDF:=0;
- end;
- SolCP[count]:=SolCP[count]+HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.P1;
- Ash:=Ash+HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.Mins;
- Oil:=Oil+HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.EE;
- ConsumedVFA:=ConsumedVFA+HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.fVFA;
- Lactate:=Lactate+HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.fLactic;
- ConsumedLactate:=ConsumedLactate+HI*ptrFeedDescriptions^.GrazingFeed.fLactic;
- ConsumedNH3:=ConsumedNH3+HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.fNH3;
- AcidEaten:=AcidEaten+HourlyPotentialIntake*ptrFeedDescriptions^.GrazingFeed.PpnAcid;
- BicarbonateEaten:=BicarbonateEaten+HourlyPotentialIntake
- *ptrFeedDescriptions^.GrazingFeed.HCO3*Thousand/MWNaHCO3;
- HourlyActualIntake[count]:=HourlyPotentialIntake;
- GrassDailyIntake:=GrassDailyIntake+HourlyPotentialIntake;
- FeedWater:=FeedWater+HourlyPotentialIntake*10*(100-ptrFeedDescriptions^.GrazingFeed.DM);
- end
- else if not ParlourTMR then//if (ptrFeedDescriptions^.TMR) then
- begin
- if (ptrFeedDescriptions^.cFix) and (Days1toEnd>4) then
- begin
- DaysIntake:=DaysIntake+HourlyPotentialIntake;
- if DaysIntake>ptrFeedDescriptions^.Fixed then
- if DaysIntake-ptrFeedDescriptions^.Fixed<HourlyPotentialIntake then
- begin
- HourlyPotentialIntake:=ptrFeedDescriptions^.Fixed-(DaysIntake-HourlyPotentialIntake);
- end
- else
- begin
- HourlyPotentialIntake:=0;
- end;
- end;
- ParlourRobot:=False;
- for loopi:=0 to ptrFeedDescriptions^.iNoFeeds-1 do //
- begin
- HI:=HourlyPotentialIntake*ptrAmount^[ptrFeedDescriptions^.iNoFeeds*(ptrFeedDescriptions^.Diet-1)+loopi];
- LagUrea[loopi]:=LagUrea[loopi]+HI
- *ptrFeedDescriptions^.TMRFeed[loopi].UreaProtected;
- LagUreaToEnter[loopi,Hours1to24]:=HI*ptrFeedDescriptions^.TMRFeed[loopi].UreaProtected;
- if LagUreaToEnter[loopi,Hours1to24]>0 then
- LagUreaEntryTime[loopi,Hours1to24]:=ElapsedTime
- +ptrFeedDescriptions^.TMRFeed[loopi].UreaTimeLag;
- LagSGlycerol[loopi]:=LagSGlycerol[loopi]+HI
- *ptrFeedDescriptions^.TMRFeed[loopi].SlowGlycerol;
- LagSGlycerolToEnter[loopi,Hours1to24]:=HI*ptrFeedDescriptions^.TMRFeed[loopi].SlowGlycerol;
- if LagSGlycerolToEnter[loopi,Hours1to24]>0 then
- LagSGlycerolEntryTime[loopi,Hours1to24]:=ElapsedTime
- +ptrFeedDescriptions^.TMRFeed[loopi].SlowGlycerolLag;
- LagNDF[loopi]:=LagNDF[loopi]+HI*ptrFeedDescriptions^.TMRFeed[loopi].fermNDF
- +HI*ptrFeedDescriptions^.TMRFeed[loopi].unfermNDF;
- LagfNDFToEnter[loopi,Hours1to24]:=HI*ptrFeedDescriptions^.TMRFeed[loopi].fermNDF;
- LagiNDFToEnter[loopi,Hours1to24]:=HI*ptrFeedDescriptions^.TMRFeed[loopi].unfermNDF;
- if (LagfNDFToEnter[loopi,Hours1to24]>0) or (LagiNDFToEnter[loopi,Hours1to24]>0) then
- LagNDFEntryTime[loopi,Hours1to24]:=ElapsedTime+ptrFeedDescriptions^.TMRFeed[loopi].Lag{+4};
- LagSStarch[loopi]:=LagSStarch[loopi]+HI*ptrFeedDescriptions^.TMRFeed[loopi].SlowStarch
- +HI*ptrFeedDescriptions^.TMRFeed[loopi].UndegSStarch;
- LagSStarchToEnter[loopi,Hours1to24]:=HI*ptrFeedDescriptions^.TMRFeed[loopi].SlowStarch;
- LagUSStarchToEnter[loopi,Hours1to24]:=HI*ptrFeedDescriptions^.TMRFeed[loopi].UndegSStarch;
- if (LagSStarchToEnter[loopi,Hours1to24]>0) or (LagUSStarchToEnter[loopi,Hours1to24]>0) then
- LagSStarchEntryTime[loopi,Hours1to24]:=ElapsedTime+ptrFeedDescriptions^.TMRFeed[loopi].StarchLag{+4};
- QStarch[loopi]:=QStarch[loopi]+HI*ptrFeedDescriptions^.TMRFeed[loopi].QuickStarch;
- UQStarch[loopi]:=UQStarch[loopi]+HI*ptrFeedDescriptions^.TMRFeed[loopi].UndegQStarch;
- LagCP[loopi]:=LagCP[loopi]+HI*ptrFeedDescriptions^.TMRFeed[loopi].P2
- +HI*ptrFeedDescriptions^.TMRFeed[loopi].P3;
- LagDegCPToEnter[loopi,Hours1to24]:=HI*ptrFeedDescriptions^.TMRFeed[loopi].P2;
- LagiDegCPToEnter[loopi,Hours1to24]:=HI*ptrFeedDescriptions^.TMRFeed[loopi].P3;
- if (LagDegCPToEnter[loopi,Hours1to24]>0) or (LagiDegCPToEnter[loopi,Hours1to24]>0) then
- LagCPEntryTime[loopi,Hours1to24]:=ElapsedTime+ptrFeedDescriptions^.TMRFeed[loopi].NLag;
- SolCHO:=SolCHO+HI*ptrFeedDescriptions^.TMRFeed[loopi].C1;
- MonoPG_Glycerol:=MonoPG_Glycerol+HI*ptrFeedDescriptions^.TMRFeed[loopi].MPG;
- Glycerol:=Glycerol+HI*ptrFeedDescriptions^.TMRFeed[loopi].Glycerol;
- UnfermentedGlycerolSmall:=UnfermentedGlycerolSmall
- +HI*ptrFeedDescriptions^.TMRFeed[loopi].UnfermentedGlycerol;
- if ptrFeedDescriptions^.Pectins then
- begin
- SolsNDF:=0;
- PectinPS[loopi]:=PectinPS[loopi]+HI
- *ptrFeedDescriptions^.TMRFeed[loopi].C1sNDF
- end
- else
- begin
- if ptrFeedDescriptions^.ACHOintoWSCsNDF then
- SolsNDF:=SolsNDF+HI*ptrFeedDescriptions^.TMRFeed[loopi].C1sNDF
- else SolsNDF:=0;
- end;
- SolCP[loopi]:=SolCP[loopi]+HI*ptrFeedDescriptions^.TMRFeed[loopi].P1;
- Ash:=Ash+HI*ptrFeedDescriptions^.TMRFeed[loopi].Mins;
- Oil:=Oil+HI*ptrFeedDescriptions^.TMRFeed[loopi].EE;
- ConsumedVFA:=ConsumedVFA+HI*ptrFeedDescriptions^.TMRFeed[loopi].fVFA;
- Lactate:=Lactate+HI*ptrFeedDescriptions^.TMRFeed[loopi].fLactic;
- ConsumedLactate:=ConsumedLactate+HI*ptrFeedDescriptions^.TMRFeed[loopi].fLactic;
- ConsumedNH3:=ConsumedNH3+HI*ptrFeedDescriptions^.TMRFeed[loopi].fNH3;
- AcidEaten:=AcidEaten+HI*ptrFeedDescriptions^.TMRFeed[loopi].PpnAcid;
- if not NotAlkapHer then
- begin
- AlkabupHaAcidConsumed:=AlkabupHaAcidConsumed
- +HI*(ptrFeedDescriptions^.TMRFeed[loopi].fLactic
- +ptrFeedDescriptions^.TMRFeed[loopi].fVFA*1.25);
- end;
- BicarbonateEaten:=BicarbonateEaten+HI
- *ptrFeedDescriptions^.TMRFeed[loopi].HCO3*Thousand/MWNaHCO3;
- HourlyActualIntake[loopi]:=HI;
- FeedWater:=FeedWater+HI*10*(100-ptrFeedDescriptions^.TMRFeed[loopi].DM);
- // if Days1toEnd=ptrFeedDescriptions^.iDaysToRun then
- // if Hours1to24=3 then
- // QMP:=QMP;
- end;
- end;
- end;
- end
- else
- begin
- for loopi:=0 to NumFoods-1 do HourlyActualIntake[loopi]:=0;
- HourlyPotentialIntake:=0;
- end;
- //Drinking water here
- if BodyWater<Animal.Water then
- if Hours1to24 in DrinkingTime then
- begin
- dWaterDrunk:=Animal.Water-BodyWater;
- WaterDrunk:=WaterDrunk+dWaterDrunk;
- end;
- if not NotAlkapHer then
- begin
- if AlkabupHaAcidConsumed>0 then
- AlkabupHaAcidConsumedPpn:=(AlkabupHaAcidConsumed
- -HourlyPotentialIntake*ptrAmount^[ptrFeedDescriptions^.iNoFeeds
- *(ptrFeedDescriptions^.Diet-1)+AlkabupHaCounter]*1000)
- /AlkabupHaAcidConsumed;
- if AlkabupHaAcidConsumedPpn<0 then AlkabupHaAcidConsumedPpn:=0;
- AcidEaten:=AcidEaten*AlkabupHaAcidConsumedPpn;
- end;
- SumHourlyActualIntake:=0;
- for loopi:=0 to NumFoods-1 do
- SumHourlyActualIntake:=SumHourlyActualIntake+HourlyActualIntake[loopi];
- DMI:=DMI+SumHourlyActualIntake;
- WWIW:=DMI;
- TMRDailyIntake:=TMRDailyIntake+SumHourlyActualIntake;
- // if Days1toEnd>ptrFeedDescriptions^.iDaysToRun-4 then
- // QMP:=QMP;
- //Saliva is resting, eating and ruminating. If intake is zero, no eating!
- if SumHourlyActualIntake=0 then
- EatingSaliva:=0
- else
- begin
- if FSGrazingAll[ptrFeedDescriptions^.Diet] then
- DMRatio:=0.51 //ptrFeedDescriptions^.GrazingFeed.DM/100
- else
- DMRatio:=ptrFeedDescriptions^.TMRDM[ptrFeedDescriptions^.Diet]/
- ptrFeedDescriptions^.TMRFM[ptrFeedDescriptions^.Diet];
- if DMRatio<0.2 then
- EatingSaliva:=0
- else if DMRatio>0.5 then
- EatingSaliva:=RestSaliva
- else
- begin
- if TMROnlyGS then
- begin
- EatingSaliva:=RestSaliva*(DMRatio-0.2)/0.3;
- end
- else
- begin
- EatingSaliva:=RestSaliva;
- end;
- end;
- end;
- if ParlourRobot then
- EatingSaliva:=RestSaliva;
- ParlourRobot:=False;
- {//if eating, saliva is zero if active fibre is zero. Otherwise depends on active fibre
- if ActiveFibreTMR*SumHourlyActualIntake/ptrFeedDescriptions^.MaxIntakePerHour
- >RestSaliva*StepsPerHour then
- begin
- EatingSaliva:=ActiveFibreTMR*SumHourlyActualIntake
- /ptrFeedDescriptions^.MaxIntakePerHour/StepsPerHour
- *ptrFeedDescriptions^.RVol/100*ForageDMBelow30Ppn-RestSaliva ;
- if EatingSaliva<RestSaliva then EatingSaliva:=0; }
- //Anim Sci 2002, 74, 369-382 and Can J Anim Sci 2002, 82, 215-223 say eating time
- //is approx 35 min but I think is linked to AF. Below is a modification that puts the
- //eating time to 25 to 50 minutes depending on AF. This is used in determining
- //the EatingSaliva secretion way up above (line 636). So whereas it was set to 1 hour, it now
- //is set to a time above which it is zero.
- if SumHourlyActualIntake>0 then
- begin
- if LongForage then
- begin
- TimeSpentEating:=61;
- end
- else
- begin
- TimeSpentEating:=8+15+60*(1-SumHourlyActualIntake
- /ptrFeedDescriptions^.MaxIntakePerHourAF10);
- if TimeSpentEating<0 then TimeSpentEating:=60;
- if TimeSpentEating>60 then TimeSpentEating:=60;
- end;
- end
- else
- TimeSpentEating:=0;
- // if Days1toEnd=ptrFeedDescriptions^.iDaysToRun then
- // QMP:=QMP;
- { end
- else EatingSaliva:=0; }
- if (Days1toEnd>(ptrFeedDescriptions^.iDaysToRun-4)) then
- avDMI:=avDMI+SumHourlyActualIntake;
- if Days1toEnd>(ptrFeedDescriptions^.iDaysToRun-1) then
- begin
- if ptrFeedDescriptions^.iGrazing=1 then avDMIGrazing:=avDMIGrazing
- +HourlyActualIntake[ptrFeedDescriptions^.iNoFeeds];
- for loopi:=0 to NumFoods-1 do
- DailyIntake[loopi]:=DailyIntake[loopi]+HourlyActualIntake[loopi];
- end;
- if Days1toEnd=ptrFeedDescriptions^.iDaysToRun then
- begin
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].ThroughTheDaypH:=pH;
- if UNDFForage[Hours1To24]<0.2 then
- hourlypH[Hours1to24-1]:=pH-1.6
- else if UNDFForage[Hours1To24]<0.28 then
- hourlypH[Hours1to24-1]:=pH+(20*UNDFForage[Hours1To24]-5.6)
- else
- begin
- if Consultant=41 then
- hourlypH[Hours1to24-1]:=pH+0.1
- else
- hourlypH[Hours1to24-1]:=pH;
- end;
- hourlyNH3[Hours1to24-1]:=NH3Rum*RNH3*StepsPerHour; //g NH3/total liquid * rate of use for fermentation/h
- hourlyNH3Total[Hours1to24-1]:=NH3Rum/LiquidVolume/MWNH3*Thousand;
- hourlyQMicLiquidR[Hours1to24-1]:=QMicLiquidR/TotalRumenVol;
- hourlyQMicSolidsR[Hours1to24-1]:=QMicSolidsR/TotalRumenVol;
- hourlyQMicLaUtR[Hours1to24-1]:=QMicLaUtR/TotalRumenVol;
- hourlyQMicLaR[Hours1to24-1]:=QMicLaR/TotalRumenVol;
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].
- iHr:=Hours1to24;
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].
- TotIntake:=SumHourlyActualIntake;
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].
- CAcR:=CAcR*Thousand;
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].
- CPrR:=CPrR*Thousand;
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].
- CBuR:=CBuR*Thousand;
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].
- CLaR:=CLaR*Thousand;
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].
- QMicR:=QMicLiquidR+QMicSolidsR+QMicLaR+QMicLaUtR;
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].
- RumDM:=RumDM;
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].
- QCHOFerm:=HFSCiR;
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].
- NDFFerm:=HFNiR;
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].
- StarchFerm:=HFSiR;
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].
- SStarchFerm:=HFSSiR;
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].
- QPFerm:=HSCPiR;
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].
- SPFerm:=HDCPiR;
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].
- NH3QFerm:=HFNH3QiR/6.25*MWNH3/MWN;//FreeProteinRatio/tslp;//
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].
- NH3SFerm:=HFNH3SiR/6.25*MWNH3/MWN; //SolidProteinRatio/tslp;//
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].
- hEMNS:=hEMNSh/StepsPerHour;
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].
- PAcR:=PAcR;
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].
- PPrR:=PPrR;
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].
- PBuR:=PBuR;
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].
- PLaR:=PLaR;
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].
- ThroughTheDayAcid:=dAcid/StepsPerHour;
- ptrNutAbsorbed^.aNutAbsorbedElement[CowParity,ptrFeedDescriptions^.Week,Hours1to24-1].
- ThroughTheDayAlkali:=dNaHCO3/StepsPerHour;
- end;
- for loopi:=0 to NumFoods-1 do
- HourlyActualIntake[loopi]:=0;
- end;//end hourly loop
- //At end of each day calculate TMR intake and adjust long particle breakdown rate
- //accordingly.
- TMRDailyIntake:=TMRDailyIntake
- -rFeedInfo.ParlourPerMeal*ParlourFeeds[rFeedInfo.Parlour]
- -rFeedInfo.RoboticPerMeal1*RoboticFeeds[rFeedInfo.Parlour]
- -rFeedInfo.RoboticPerMeal2*RoboticFeeds[rFeedInfo.Parlour]
- -rFeedInfo.LiquidPerMeal*RoboticFeeds[rFeedInfo.Parlour]
- -GrassDailyIntake;
- if TMRDailyIntake<1 then TMRDailyIntake:=1;
- { ptrFeedDescriptions^.LongParticleBR:=0.1436*power(CalcLig(rFeedInfo.Diet,TMRDailyIntake),-0.4572)
- *power(rFeedInfo.ActualWeight,-0.27)*ForageDMBelow30Ppn;
- LPBreakdownR:=Power(1+2*ptrFeedDescriptions^.LongParticleBR,1/StepsPerHour)-1;
- if ChopLength then
- LPBreakdownR:=LPBreakdownR*0.45*LargeParticleBR //Langhill rumination time ~570 min=0.3
- else
- LPBreakdownR:=LPBreakdownR*0.5*LargeParticleBR;
- }
- EEsoFar:=(dQAcR+dQAcHG)*EnergyOfAcetate+(dQPrR+dQPrHG)*EnergyOfPropionate+
- (dQBuR+dQBuHG)*EnergyOfButyrate{+dQLaR*EnergyOfLacticAcid}+
- (dSIDigCHO+dSIMicCHO)*EnergyOfCHO+(dAbsOil+dSIMicLip)*EnergyOfOil;
- EnergyFromKetogenic:=(dQAcR+dQAcHG)*EnergyOfAcetate+(dQBuR+dQBuHG)*EnergyOfButyrate
- +(dAbsOil+dSIMicLip)*EnergyOfOil;
- EnergyFromGlucogenic:=(dQPrR+dQPrHG)*EnergyOfPropionate+
- (dSIDigCHO+dSIMicCHO)*EnergyOfCHO;
- RatioKetogenic:=EnergyFromKetogenic/(EnergyFromKetogenic+EnergyFromGlucogenic);
- //if Days1toEnd=20 then
- // QMP:=QMP;
- if Days1toEnd>4 then
- if MicrobesAcidosis then
- begin
- if ChopLength then
- begin
- if ptrNutAbsorbed^.RuminationTime*60/StepsPerHour>MaxRuminationTime*MaxRuminationFactor then
- MaxRum:=True
- else
- MaxRum:=False;
- end
- else MaxRum:=False;
- if (MaxRum) and (not DryCow) then
- begin
- IncreaseRumenFillUpper:=False;
- end
- else if ptrNutAbsorbed^.ProteinPerKG>0 then
- begin
- ProteinMilk:=(dMP-ptrNutAbsorbed^.MPReqNotMilk
- +ProtFromBody*Thousand)/ptrNutAbsorbed^.ProteinPerKG;
- if ProteinMilk>ptrNutAbsorbed^.PotentialMilk[CowParity,
- ptrFeedDescriptions^.Week] then
- begin
- XSProtein:=ProteinMilk-ptrNutAbsorbed^.PotentialMilk[CowParity,
- ptrFeedDescriptions^.Week];
- ProteinMilk:=ptrNutAbsorbed^.PotentialMilk[CowParity,
- ptrFeedDescriptions^.Week]*1.01;
- end
- else
- begin
- XSProtein:=0;
- end;
- XSProtein:=XSProtein*ptrNutAbsorbed^.ProteinPerKG;
- ProteinReqMilk:=ProteinMilk;
- //EEsoFar has to include all protein not used for milk * protein to energy
- EEsoFar:=EEsoFar+(ptrNutAbsorbed^.MPReqNotMilk+XSProtein)*(1/(EfficiencyMPtoAA
- *EfficiencyAAtoMilkP)-1)*(EnergyOfProtein-EnergyToMakeUrea);
- EnergyMilk:=(EEsoFar-ptrNutAbsorbed^.EReqNotMilk)/ptrNutAbsorbed^.EnergyPerKG;
- EnergyReqMilk:=EnergyMilk;
- if ptrFeedDescriptions^.Week<=Animal.TStar/DaysInWeek then
- begin
- Weeks1_12:=True;
- if ProteinMilk<EnergyMilk then
- begin
- ptrNutAbsorbed^.ProteinToEnergy[CowParity,ptrFeedDescriptions^.Week]:=0;
- if CowParity=2 then //only 3rd lactation
- begin
- if not SingleRun then
- begin
- ProtFromBody:=(EnergyMilk-ProteinMilk)*ptrNutAbsorbed^.ProteinPerKG/Thousand;
- end
- else
- begin
- if ProtFromBody<=0 then
- begin
- ProtFromBody:=MaxProtFromBody*0.2;
- end
- else
- begin
- ProtFromBody:=ProtFromBody*1.15;
- end;
- {**} ProtFromBody:=0;
- end;
- if ProtFromBody>MaxProtFromBody/2 then
- begin
- ProtFromBody:=MaxProtFromBody/2;
- end;
- ptrNutAbsorbed^.ProteinFromBody[ptrFeedDescriptions^.Week]:=
- ProtFromBody;
- IncreaseRumenFillUpper:=False;
- end
- else
- begin
- ptrNutAbsorbed^.ProteinFromBody[ptrFeedDescriptions^.Week]:=0;
- IncreaseRumenFillUpper:=False;
- end;
- end
- else //if ProteinMilk>=EnergyMilk
- begin
- ProtFromBody:=ProtFromBody*0.85;
- ptrNutAbsorbed^.ProteinFromBody[ptrFeedDescriptions^.Week]:=ProtFromBody;
- if ProteinMilk>=ptrNutAbsorbed^.PotentialMilk[CowParity,
- ptrFeedDescriptions^.Week] then
- begin
- if EnergyMilk<ptrNutAbsorbed^.PotentialMilk[CowParity,
- ptrFeedDescriptions^.Week] then
- begin
- IncreaseRumenFillUpper:=True;
- end
- else
- begin
- IncreaseRumenFillUpper:=False;
- end;
- end
- else
- begin
- IncreaseRumenFillUpper:=True;
- end;
- end;
- end
- else //if ptrFeedDescriptions^.Week>Animal.TStar/DaysInWeek then
- begin
- if ProteinMilk<EnergyMilk then
- begin
- ptrNutAbsorbed^.ProteinToEnergy[CowParity,ptrFeedDescriptions^.Week]:=0;
- //put on body fat here
- ptrNutAbsorbed^.ProteinFromBody[ptrFeedDescriptions^.Week]:=0;
- if ProteinMilk>=ptrNutAbsorbed^.PotentialMilk[CowParity,
- ptrFeedDescriptions^.Week] then
- IncreaseRumenFillUpper:=False
- else
- IncreaseRumenFillUpper:=True;
- end
- else //if ProteinMilk>=EnergyMilk
- begin
- //put here xsprotein to energy
- ptrNutAbsorbed^.ProteinFromBody[ptrFeedDescriptions^.Week]:=0;
- if ProteinMilk>ptrNutAbsorbed^.PotentialMilk[CowParity,
- ptrFeedDescriptions^.Week] then
- begin
- //calculate PotentialMilk-EnergyMilk and work out what protein to energy needed
- if EnergyMilk<ptrNutAbsorbed^.PotentialMilk[CowParity,
- ptrFeedDescriptions^.Week] then
- begin
- IncreaseRumenFillUpper:=True;
- end
- else
- begin
- IncreaseRumenFillUpper:=False;
- end;
- end
- else
- begin
- IncreaseRumenFillUpper:=True;
- end;
- end;
- end;
- end
- else//ptrNutAbsorbed^.ProteinPerKG<=0
- begin
- if (Beef) then
- begin
- // if Days1toEnd>ptrFeedDescriptions^.iDaysToRun-4 then
- // QMP:=QMP;
- ProteinGrowth:=(dMP-ptrNutAbsorbed^.MPReqNotMilk)*RV/Thousand*0.9;
- // EnergyForProtein:=ProteinGrowth*Thousand*Animal.EEP;
- if ((dQAcR+dQAcHG)*EnergyOfAcetate+(dQBuR+dQBuHG)*EnergyOfButyrate
- -MaintenanceEnergy*RatioKetogenic)>0 then
- LipidGrowth:=(((dQAcR+dQAcHG)*EnergyOfAcetate+
- (dQBuR+dQBuHG)*EnergyOfButyrate-MaintenanceEnergy
- *RatioKetogenic)/Animal.EELplus+(dAbsOil+dSIMicLip)/Thousand)
- +(EnergyFromGlucogenic-MaintenanceEnergy*(1-RatioKetogenic))
- /Animal.EELplus
- //*Animal.MatureLFEB/Animal.LipidFreeEmptyBody
- else
- LipidGrowth:=0;
- if (ProteinGrowth>Animal.MaxProtein) and (LipidGrowth>Animal.MaxLipid*1.0) then
- IncreaseRumenFillUpper:=False //True//
- else if LipidGrowth>Animal.MaxLipid*1.1 then
- IncreaseRumenFillUpper:=False
- else
- IncreaseRumenFillUpper:=True;
- end
- else
- begin
- if DryCow then
- begin
- if dMP>ptrNutAbsorbed^.MPReqNotMilk*1.5 then
- IncreaseRumenFillUpper:=False
- else
- IncreaseRumenFillUpper:=True;
- end
- else
- IncreaseRumenFillUpper:=True;
- end;
- end;
- if (not IncreaseRumenFillUpper) or (pH<5.5) then
- begin
- if (MaxRum) and (not DryCow) then
- ptrFeedDescriptions^.RumFillUpper:=ptrFeedDescriptions^.RumFillUpper*MaxRuminationTime/(ptrNutAbsorbed^.RuminationTime*60/StepsPerHour) //MaxLongParticles?LongParticles
- else if (SingleRun) and (ptrNutAbsorbed^.PotentialMilk[CowParity,
- ptrFeedDescriptions^.Week]>0) then
- begin
- if (EnergyMilk/ptrNutAbsorbed^.PotentialMilk[CowParity,
- ptrFeedDescriptions^.Week]>1.15) and (not Weeks1_12) then
- ptrFeedDescriptions^.RumFillUpper:=ptrFeedDescriptions^.RumFillUpper*0.9
- else if (SingleRun) and (Weeks1_12) then
- ptrFeedDescriptions^.RumFillUpper:=ptrFeedDescriptions^.RumFillUpper*0.97
- else
- ptrFeedDescriptions^.RumFillUpper:=ptrFeedDescriptions^.RumFillUpper*0.98;
- end
- else
- begin
- if Beef then
- begin
- if ProteinGrowth/Animal.MaxProtein>1.15 then
- begin
- ptrFeedDescriptions^.RumFillUpper:=ptrFeedDescriptions^.RumFillUpper*0.96;
- end
- else
- begin
- ptrFeedDescriptions^.RumFillUpper:=ptrFeedDescriptions^.RumFillUpper*0.99;
- end;
- end
- else
- begin
- if DryCow then
- ptrFeedDescriptions^.RumFillUpper:=ptrFeedDescriptions^.RumFillUpper*0.975
- else
- ptrFeedDescriptions^.RumFillUpper:=ptrFeedDescriptions^.RumFillUpper*0.99;//0.975
- end;
- end;
- ptrFeedDescriptions^.RumSA:=251360*power(ptrFeedDescriptions^.RumFillUpper*ptrFeedDescriptions^.RVol/4189.333,0.667);// 'cm2
- end
- else {if EEsoFar<ptrFeedDescriptions.EReq then}
- begin
- if (Beef) and (ptrFeedDescriptions^.RumFillUpper<1.15) then
- begin
- ptrFeedDescriptions^.RumFillUpper:=ptrFeedDescriptions^.RumFillUpper*1.02;
- ptrFeedDescriptions^.RumSA:=251360*power(ptrFeedDescriptions^.RumFillUpper*ptrFeedDescriptions^.RVol/4189.333,0.667);// 'cm2
- end
- else if (ptrFeedDescriptions^.RumFillUpper<1.15) and
- (not ptrFeedDescriptions^.FourOrFive) then
- begin
- if (EEsoFar/ptrFeedDescriptions.EReq<0.85) and (ptrFeedDescriptions^.RumFillUpper<0.92)
- and (not ChopLength) then
- ptrFeedDescriptions^.RumFillUpper:=ptrFeedDescriptions^.RumFillUpper*1.1
- else ptrFeedDescriptions^.RumFillUpper:=ptrFeedDescriptions^.RumFillUpper*1.01;
- ptrFeedDescriptions^.RumSA:=251360*power(ptrFeedDescriptions^.RumFillUpper*ptrFeedDescriptions^.RVol/4189.333,0.667);// 'cm2
- end
- else if (ptrFeedDescriptions^.RumFillUpper<1.15) then
- begin
- ptrFeedDescriptions^.RumFillUpper:=ptrFeedDescriptions^.RumFillUpper*1.02;
- end;
- end;
- end
- else
- begin
- end; //if MicrobesAcidosis
- inc(WhyWontItWork);
- end;//end daily loop
- ptrNutAbsorbed^.TotalLongNDF:=0;ptrNutAbsorbed^.TotalNDF:=0;
- ptrNutAbsorbed^.uLongNDF:=0;ptrNutAbsorbed^.TotaluNDF:=0;ptrNutAbsorbed^.iNDFForage:=0;
- ptrNutAbsorbed^.TotalNDFForage:=0;
- {for loopi:=0 to NumFoods-1 do
- begin
- ptrNutAbsorbed^.TotalLongNDF:=ptrNutAbsorbed^.TotalLongNDF+iNDFLong[loopi]+fNDFLong[loopi];
- ptrNutAbsorbed^.TotalNDF:=ptrNutAbsorbed^.TotalNDF+iNDFLong[loopi]+fNDFLong[loopi]+iNDF[loopi]+fNDF[loopi];
- ptrNutAbsorbed^.uLongNDF:=ptrNutAbsorbed^.uLongNDF+iNDFLong[loopi];
- ptrNutAbsorbed^.TotaluNDF:=ptrNutAbsorbed^.TotaluNDF+iNDFLong[loopi]+iNDF[loopi];
- if loopi<ptrFeedDescriptions^.iNoFeeds then
- begin
- if ptrFeedDescriptions^.TMRFeed[loopi].ForOrConc then
- begin
- ptrNutAbsorbed^.iNDFForage:=ptrNutAbsorbed^.iNDFForage+iNDFLong[loopi]+iNDF[loopi];
- ptrNutAbsorbed^.TotalNDFForage:=ptrNutAbsorbed^.TotalNDFForage+iNDFLong[loopi]
- +iNDF[loopi]+fNDFLong[loopi]+fNDF[loopi];
- end;
- end
- else if loopi=ptrFeedDescriptions^.iNoFeeds-1+ptrFeedDescriptions^.iGrazing then
- begin
- if ptrFeedDescriptions^.GrazingFeed.ForOrConc then
- begin
- ptrNutAbsorbed^.iNDFForage:=ptrNutAbsorbed^.iNDFForage+iNDFLong[loopi]+iNDF[loopi];
- ptrNutAbsorbed^.TotalNDFForage:=ptrNutAbsorbed^.TotalNDFForage+iNDFLong[loopi]
- +iNDF[loopi]+fNDFLong[loopi]+fNDF[loopi];
- end;
- end
- else if loopi>ptrFeedDescriptions^.iNoFeeds-1+ptrFeedDescriptions^.iGrazing then
- begin
- if ptrFeedDescriptions^.ParlourFeed[loopi-1-(ptrFeedDescriptions^.iNoFeeds-1+ptrFeedDescriptions^.iGrazing)].ForOrConc then
- begin
- ptrNutAbsorbed^.iNDFForage:=ptrNutAbsorbed^.iNDFForage+iNDFLong[loopi]+iNDF[loopi];
- ptrNutAbsorbed^.TotalNDFForage:=ptrNutAbsorbed^.TotalNDFForage+iNDFLong[loopi]
- +iNDF[loopi]+fNDFLong[loopi]+fNDF[loopi];
- end;
- end;
- end; }
- for loopi := 1 to 24 do
- begin
- ptrNutAbsorbed^.uLongNDF:=ptrNutAbsorbed^.uLongNDF+ULongNDFForage[loopi];
- ptrNutAbsorbed^.TotalLongNDF:=ptrNutAbsorbed^.TotalLongNDF+TLongNDFForage[loopi];
- ptrNutAbsorbed^.iNDFForage:=ptrNutAbsorbed^.iNDFForage+UNDFForage[loopi];
- ptrNutAbsorbed^.TotalNDFForage:=ptrNutAbsorbed^.TotalNDFForage+TNDFForage[loopi]
- end;
- ptrNutAbsorbed^.RuminationTime:=Round(60/StepsPerHour*ptrNutAbsorbed^.RuminationTime);
- ptrNutAbsorbed^.uLongNDF:=ptrNutAbsorbed^.uLongNDF/24;
- ptrNutAbsorbed^.iNDFForage:=ptrNutAbsorbed^.iNDFForage/24;
- ptrNutAbsorbed^.TotalLongNDF:=ptrNutAbsorbed^.TotalLongNDF/24;
- //ptrNutAbsorbed^.TotalNDF:=ptrNutAbsorbed^.TotalNDF/RumDM;
- ptrNutAbsorbed^.TotalNDFForage:=ptrNutAbsorbed^.TotalNDFForage/24;
- //ptrNutAbsorbed^.LongNDFtoTotalNDF:=ptrNutAbsorbed^.TotalLongNDF/ptrNutAbsorbed^.TotalNDF;
- //if ptrFeedDescriptions^.CFix then
- AvDMI:=AvDMI/4;
- ptrNutAbsorbed^.DMI[CowParity,ptrFeedDescriptions^.Week]:=AvDMI;
- TMRIntakeZaoying:=AvDMI;
- ptrNutAbsorbed^.GrazingDMI[CowParity,ptrFeedDescriptions^.Week]:=AvDMIGrazing;
- for loopi:=0 to NumFoods-1 do
- DailyIntake[loopi]:=DailyIntake[loopi];
- ptrNutAbsorbed^.MP[CowParity,ptrFeedDescriptions^.Week]:=QMP;
- ptrNutAbsorbed^.MTP[CowParity,ptrFeedDescriptions^.Week]:=QMTP;
- ptrNutAbsorbed^.DUP[CowParity,ptrFeedDescriptions^.Week]:=QDUP;
- ptrNutAbsorbed^.Ac[CowParity,ptrFeedDescriptions^.Week]:=QAc;
- ptrNutAbsorbed^.Pr[CowParity,ptrFeedDescriptions^.Week]:=QPr;
- ptrNutAbsorbed^.Bu[CowParity,ptrFeedDescriptions^.Week]:=QBu;
- ptrNutAbsorbed^.FDM[CowParity,ptrFeedDescriptions^.Week]:=FDM/ptrFeedDescriptions^.iDaysToRun/1000;
- ptrNutAbsorbed^.CHO[CowParity,ptrFeedDescriptions^.Week]:=QCHO;
- ptrNutAbsorbed^.AbsOil[CowParity,ptrFeedDescriptions^.Week]:=AbsOil/ptrFeedDescriptions^.iDaysToRun;
- ptrNutAbsorbed^.CH4[CowParity,ptrFeedDescriptions^.Week]:=QCH4R+QCH4HG;
- ptrNutAbsorbed^.FaecalN[CowParity,ptrFeedDescriptions^.Week]:=FaecalN;
- ptrNutAbsorbed^.FaecalfNDF[CowParity,ptrFeedDescriptions^.Week]:=FaecalfNDF/ptrFeedDescriptions^.iDaysToRun;
- ptrNutAbsorbed^.FaecaliNDF[CowParity,ptrFeedDescriptions^.Week]:=FaecaliNDF/ptrFeedDescriptions^.iDaysToRun;
- ptrNutAbsorbed^.UrinaryN[CowParity,ptrFeedDescriptions^.Week]:=UrinaryN;
- ptrNutAbsorbed^.TotMicLip[CowParity,ptrFeedDescriptions^.Week]:=SIMicCHO;
- ptrNutAbsorbed^.TotMicCHO[CowParity,ptrFeedDescriptions^.Week]:=SIMicLip;
- ptrNutAbsorbed^.pHLim[CowParity,ptrFeedDescriptions^.Week]:=Round(pHLim*100/(HoursInDay*StepsPerHour));
- ptrNutAbsorbed^.EMNS[CowParity,ptrFeedDescriptions^.Week]:=EMNS/(HoursInDay*StepsPerHour);
- ptrNutAbsorbed^.Saliva[CowParity,ptrFeedDescriptions^.Week]:=DailyFlowSaliva;
- Animal.PredictedGutFill:=TotalRumenVol/(rFeedInfo.ActualWeight*JerseyOpt);
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement