<< 
      Graphics`Colors`
Off[
        General::"spell1"];
Off[
        General::"spell"];
MakeDataBarsOnly[dataTable_]:=Module[
{n, x = dataTable[[All, 1]], 
              y = dataTable[[All, 2]], maxY, minY, bars, edges, 
              prettyBars, points = dataTable}, 
n = 
              Length[x]; 
If[Max[y] > 0, maxY = Max[y], 
              maxY = 0]; 
If[Min[y] < 0, minY = Min[y], 
              minY = 0]; 
bars = 
              List[]; 
Do[
              bars = Append[bars, 
                  Graphics[{GrayLevel[0.9], 
                      Rectangle[{x[[j - 1]], 0}, {x[[j]], 
                          y[[j - 1]]}]}]], {j, 2, 
                n}]; 
edges = List[]; 
Do[
              edges = Append[edges, 
                  Graphics[{GrayLevel[0.7], 
                      Line[{{x[[j]], 0}, {x[[j]], 
                            y[[j]]}, {x[[j + 1]], 
                            y[[j]]}, {x[[j + 1]], 0}}]}]], {j, 1, 
                n - 1}]; 
prettyBars = 
              Join[bars, edges]; 
dots = 
              ListPlot[points, PlotStyle -> {PointSize[0.02]}, 
                DisplayFunction -> Identity]; 
Return[
              Show[{prettyBars, dots}, Axes -> True, 
                AxesOrigin -> {x[[1]], 0}, 
                DisplayFunction -> $DisplayFunction, 
                PlotRange -> {minY, maxY}]];
];
MakeDataBars[dataTable_, yhat_] := 
          Module[
{n, x = dataTable[[All, 1]], 
              y = dataTable[[All, 2]], bars, edges, prettyBars, 
              points = dataTable}, 
n = 
              Length[x]; 
bars = 
              List[]; 
Do[
              bars = Append[bars, 
                  Graphics[{GrayLevel[0.9], 
                      Rectangle[{x[[j - 1]], 0}, {x[[j]], 
                          y[[j - 1]]}]}]], {j, 2, 
                n}]; 
edges = List[]; 
Do[
              edges = Append[edges, 
                  Graphics[{GrayLevel[0.7], 
                      Line[{{x[[j]], 0}, {x[[j]], 
                            y[[j]]}, {x[[j + 1]], 
                            y[[j]]}, {x[[j + 1]], 0}}]}]], {j, 1, 
                n - 1}]; 
prettyBars = 
              Join[bars, edges]; 
dots = 
              ListPlot[points, PlotStyle -> {AbsolutePointSize[10]}, 
                DisplayFunction -> Identity]; 
curve = 
              Plot[yhat[t], {t, Min[x], Max[x]}, 
                DisplayFunction -> Identity]; 
Return[
              Show[{prettyBars, dots, curve}, Axes -> True, 
                AxesOrigin -> {x[[1]], 0}, 
                DisplayFunction -> $DisplayFunction]];
];
MakeRiemannBars[f_, xPartition_] := 
          Module[
{n, x = xPartition, y, minY, maxY, bars, 
              edges, prettyBars, points = dataTable}, 
y = 
              f[x]; 
If[Max[y] > 0, maxY = Max[y], 
              maxY = 0]; 
If[Min[y] < 0, minY = Min[y], 
              minY = 0]; 
n = 
              Length[x]; 
bars = 
              List[]; 
Do[
              bars = Append[bars, 
                  Graphics[{GrayLevel[0.9], 
                      Rectangle[{x[[j - 1]], 0}, {x[[j]], 
                          y[[j - 1]]}]}]], {j, 2, 
                n}]; 
edges = List[]; 
Do[
              edges = Append[edges, 
                  Graphics[{GrayLevel[0.7], 
                      Line[{{x[[j]], 0}, {x[[j]], 
                            y[[j]]}, {x[[j + 1]], 
                            y[[j]]}, {x[[j + 1]], 0}}]}]], {j, 1, 
                n - 1}]; 
prettyBars = 
              Join[bars, edges]; 
curve = 
              Plot[f[t], {t, Min[x], Max[x]}, 
                DisplayFunction -> Identity]; 
Return[
              Show[{prettyBars, curve}, Axes -> True, 
                AxesOrigin -> {x[[1]], 0}, 
                DisplayFunction -> $DisplayFunction, 
                PlotRange -> {minY, maxY}]];
];

Enter the data

data = {{0, 0}, {2.0, 0.0}, {4.0, 0.28}, {6.0, 3.33}, {8.0, 
            100.0}, {9.0, 481.0}, {10.0, 1618.0}, {10.5, 2368.0}, {11.0, 
            2415.0}, {11.5, 1946.0}, {12. , 0.00}};

Plot the data

\(\(p1 = 
        ListPlot[
          data, 
PlotStyle -> {Blue, 
              AbsolutePointSize[4]}, 
ImageSize -> {800, 
              500}, 
AxesLabel -> {"Time (s)", "Con (mg/L)"}, 
PlotLabel -> "Concentration of Chemical", 
TextStyle -> {FontSize -> 18}];\)\)

In the first 4 hours zero mg of the chemical flows into the tank:

0*4*500

Amount after 2 hours of concentation being at 0.28 , and a flow rate of 500 L/hr:

0 + 0.28*2*500

Amount after another 2 hours of concentation being at 3.33 , and a flow rate of 500 L/hr:

280.  + 3.33*2*500

Amount after another  hour  of concentation being at 100.0 , and a flow rate of 500 L/hr:

3610 + 100.0*1*500

and so on, the final answer will be:

0*2*500 + 0*2*500 + 0.28*2*500 + 
3.33*2*500 + 
      100.0*1*500 + 481.0*1*500 + 
1618.0*0.5*500 + 
      2368.0*0.5*500 + 2415.0*0.5*500 + 1946.0*0.5*500

This answer is the same as the sum of the area of the bars pictured below times by 500:

MakeDataBarsOnly[data]

This is only an approximation because the the concentration does not remain constant for the whole of the time intervals
Using the methods in Module 3 to fit a model of the form y = ((a(12 - x))^2) (e^(-b(12 - x))) we get:

bestA = 18302.00224090394`;
bestB = 1.9290836612579962`;
con[t_] = 
      bestA*(12 - t)^2*E^(-bestB*(12 - t))

So if we assume that the concentration remained constant for every 0.5 hours the total amount would be:

con[0.00]*0.5*500 + con[0.5]*0.5*500 + con[1.0]*0.5*500 + 
      con[1.5]*0.5*500 + 
con[2.0]*0.5*500 + 
      con[2.5]*0.5*500 + con[3.0]*0.5*500 + 
      con[3.5]*0.5*500 + 
con[4.0]*0.5*500 + 
      con[4.5]*0.5*500 + con[5.0]*0.5*500 + 
      con[5.5]*0.5*500 + 
con[6.0]*0.5*500 + 
      con[6.5]*0.5*500 + con[7.0]*0.5*500 + 
      con[7.5]*0.5*500 + 
con[8.0]*0.5*500 + 
      con[8.5]*0.5*500 + con[9.0]*0.5*500 + 
      con[9.5]*0.5*500 + 
con[10.0]*0.5*500 + 
      con[10.5]*0.5*500 + con[11.0]*0.5*500 + con[11.5]*0.5*500

This can illustrated as:

MakeRiemannBars[con, Range[0, 12, 0.5]]

More accurrate still would be to assume that the concentration was constant for only 0.1 hours:

con[0.00]*0.1*500+con[0.01]*0.1*500+con[0.2]*0.1*500+

Use Sum to save typing:

Sum[con[0.1*i]*0.1*500, {i, 0, 12/0.1 - 1}]

Graphically:

MakeRiemannBars[con, Range[0, 12, 0.1]]

Better Still, use 0.01:

Sum[
      con[0.01*i]*0.01*500, {i, 0, 12/0.01 - 1}]
MakeRiemannBars[con, Range[0, 12, 0.01]]

Best of all:

Limit[Sum[con[dt*i]*dt*500, {i, 0, 12/dt - 1}], dt -> 0]

When Mathematica refuses to calculate limits we use a very small dt and hope:

Sum[con[0.0001*i]*0.0001*500, {i, 0, 12/0.0001 - 1}]

So the total mass of the chemical flowing through the outlet pipe in a 12 hour shift is 2.5 kg, and this is the area under the concentration curve.

Additional information that can be gleened from these calculations

Notice that we could have calculated the total amount of chemical deposited into the tank at any time during the shift:
For example if we wanted the amount that flowed into the tank in the first 4 hours:

MakeRiemannBars[con, Range[0, 4, 0.1]];

Sum[con[0.1*i]*0.1*500, {i, 0, 4/0.1  - 1}]

This is an approximation. The exact answer is

Limit[Sum[con[dt*i]*dt*500, {i, 0, 4/dt  -  1}], dt -> 0]

But Mathematica refuses to compute this, so we must settle for:

Sum[con[0.00001*i]*0.00001*500, {i, 0, 4/0.00001  -  1}]

Another example: Calculate the amount of chemical that flowed into the tank between the 9th and 11th hours of the shift

A picture of this:

MakeRiemannBars[con, Range[9, 11, 0.1]];

All of the examples so far have started at 0, but this is not a problem because we can calculated the total amount in the first 11 hours and subtract off the amount that flowed in the first 9 hours

amountFirst11 = 
      Sum[con[i*0.00001]*0.00001*500, {i, 0, 11/0.00001 - 1}]

amountFirst9 = 
      Sum[con[i*0.00001]*0.00001*500, {i, 0, 9/0.00001 - 1}]

amountFirst11 - amountFirst9

So approximately 1.59 kg flowed into the tank from hour 9 upto hour 11 of the shift.

Alternative Method (Differential Model)

Concentration is rate of change of the amount per volume, i.e., ((dA(t))/dt) = c(t)*500

DSolve[A'[t] == con[t]*500, A[t], t]

Define the amount function:

A[t_] = (E^(1.9290836612579962` t)) (0.06583748987344133` - 
              0.010500525421595833` t + 0.00041940429675416064` (t^2)) + 
        C[1]

So the increase in the amount from time 0 to time 12 is A[12]-A[0]

A[12] - A[0]

Additional information that can be gleened from these calculations

We use A[x] to calculate the exact values of the amount that flows into the tank in the first 4 hours of a shift:

A[4] - A[0]

And for the amount to flow inbetween the 9th and 11th hour of the shift:

A[11] - A[9]

So we see that the approximate answers about were good approximations

Total amount in a FULL tank

To calculate the total amount of chemical that flowed into the tank, we must know how many 12 hours shifts it takes to fill a tank. Volume of the tank is 
length*width*depth=18*5*2

Vol = 18*5*2

This is in (m^3) there are 1000 Letres in 1 (m^3), so the tank has a capacity of 180000 litres. Liquid flows in at a rate of 500 L/hr so it takes

180000/500

hours to fill the tank this is 360/12=30 shifts (or 15 days). Therefore the total mass of chemical that flows into the tank is

30*2.549443578390586`*^6