No such thing as an If loop.
There's a For loop (which is in the example I gave above) or you can use Repeat ..Until or While Do...
For handles incrementing for you. With Repeat or While, you have to handle the incrementing...
For all three loops, you CAN use an IF to force an early break, but I think all you need is a For loop...
Original For Loop
for dtime := 0 to 3600 do // ie, one hour's worth of data
begin
BioCon := Biomass + (7*10^-5 * (Substrat/(10+Substrat)) * Biomass - 7*10^-6) * dtime;
SubCon := Substrat + ((-1/0.60)* 7*10^-5 * (Substrat/(10 + Substrat) * Biomass ) * dtime;
// Add (dtime, BioCon) to graph as series 1
// Add (dtime, SubCon) to graph as series 2
end;
As a while loop
dtime := 0;
while (dtime <= 3600) do
begin
BioCon := Biomass + (7*10^-5 * (Substrat/(10+Substrat)) * Biomass - 7*10^-6) * dtime;
SubCon := Substrat + ((-1/0.60)* 7*10^-5 * (Substrat/(10 + Substrat) * Biomass ) * dtime;
// Add (dtime, BioCon) to graph as series 1
// Add (dtime, SubCon) to graph as series 2
dtime := dtime + 1;
end;
As a Repeat loop
dtime := 0;
Repeat
BioCon := Biomass + (7*10^-5 * (Substrat/(10+Substrat)) * Biomass - 7*10^-6) * dtime;
SubCon := Substrat + ((-1/0.60)* 7*10^-5 * (Substrat/(10 + Substrat) * Biomass ) * dtime;
// Add (dtime, BioCon) to graph as series 1
// Add (dtime, SubCon) to graph as series 2
dTime := dTime + 1;
Until dTime>3600; // <--- NOTE, the condition for break is different to the while loop, it's opposite
UPDATE:
Doh! None of these three will compile - my fault for copy/pasting the original code :-)
BioCon := Biomass + (7*10^-5 * (Substrat/(10+Substrat)) * Biomass - 7*10^-6) * dtime;
^ doesn't do what you think it does... You need, errr, power()?
Working on the For Loop only....
Uses
Math;
...
for dtime := 0 to 3600 do // ie, one hour's worth of data
begin
BioCon := Biomass + (7*power(10, -5) * (Substrat/(10+Substrat)) * Biomass - 7*power(10, -6)) * dtime;
SubCon := Substrat + ((-1/0.60)* 7*power(10, -5) * (Substrat/(10 + Substrat) * Biomass ) * dtime;
// Add (dtime, BioCon) to graph as series 1
// Add (dtime, SubCon) to graph as series 2
end;