1. Dilute Solution yet again

Forked from Re: A Little House Cleaning

Ok, I promise I will not post anymore dilution code. Honest!

-- 
-- DiluteSolution.ex 
-- 
include std/console.e 
include std/math.e 
include std/convert.e 
 
constant Usage = sprintf("%s", { 
""" 

Dilute a Chlorine Solution: Dilution Law: V1*C1=V2*C2: V1=V2*C2/C1 
 
Usage: 
 
eui DiluteSolution.ex <C1> <V2> <C2> 
eui DiluteSolution.ex <C1> <V2> <C2> <d> 
 
C1 = % Sodium Hypochlorite of stock Bleach at time of purchase 
V2 = target volume of solution to create with  
C2% Sodium Hypochlorite 
 
option: <d> is the number of days since  purchase of C1 
        + perhaps an estimate of shelf days prior to purchase. 
        If d is added to the command line, the program will 
        calculate a degraded  C1 value based on a 20%  
        annual rate of degradation. Otherwise, the calculations  
        will be made based on the nominal value for C1% at  
        the time of purchase. 
 
EXAMPLES:  
 
    To make 32 oz "Cleaner Bleach" with 2% Sodium Hypochlorite: 
    from stock Bleach with 6% nominal Sodium Hypochlorite: 
    eui DiluteSolution.ex 6 32 2  
    use 10.67 oz of C1 + 21.33 oz of distilled water to make solution V2 C2 
 
    To degrade C1 by 190 days: eui DiluteSolution.ex 6 32 2 190 
    use 11.91 oz of C1 + 20.09 oz of distilled water to make solution V2 C2 
 
    To make 15 oz "Skin/Wound Wash" with 0.057% Sodium Hypochlorite: 
    from stock Bleach with 6% nominal Sodium Hypochlorite: 
    eui DiluteSolution.ex 6 15 0.057 190  -- $22 Anasept Wound Wash 
    use 0.16 oz of C1 + 14.84 oz of distilled water to make solution V2 C2 
""" 

}) 
 
procedure DiluteSolution(sequence cmd) 
atom V1, C1, V2, C2, adp = (20/100)/365.25 
integer d = 0 
    if length(cmd) <5 then display(Usage) abort(0) end if 
    C1 = to_number(cmd[3]) 
    V2 = to_number(cmd[4]) 
    C2 = to_number(cmd[5]) 
    if length(cmd) = 6 then    -- degrade C1 
        d = to_number(cmd[6])  
        C1 *= 1-(adp*d) 
    end if 
V1= round((V2*C2)/C1,100)   
display(sprintf("\n\nUse %.4g oz of C1 + %.4g oz of (distilled) water to make %.4g oz of %.4g%s"& 
    " Sodium Hypochlorite\n%.4g oz = %.4g tsp\n\t\t\t%.4g tblsp\n\t\t\t%.4g cup\n\t\t\t%.4g ml",     
    {V1,V2-V1, V2, C2, '%', V1, V1*6, V1*2, V1*0.12, V1*29.57} )) 
end procedure 
 
DiluteSolution(command_line()) 
 
new topic     » topic index » view message » categorize

2. Re: Dilute Solution yet again

I called the Public Health Department and got the official answer.

They have a disclaimer about "check the expiry date" before mixing.

I found a 3M report that the loss can be 50% at the end of a year. Public Health tells people to only buy what they need in the short run.

The reality is that they use test strips to measure the actual concentration. So health inspectors will check how the mixture is made, they measure, and advise.

_tom

new topic     » goto parent     » topic index » view message » categorize

3. Re: Dilute Solution yet again

_tom said...

I called the Public Health Department and got the official answer.

They have a disclaimer about "check the expiry date" before mixing.

I found a 3M report that the loss can be 50% at the end of a year. Public Health tells people to only buy what they need in the short run.

The reality is that they use test strips to measure the actual concentration. So health inspectors will check how the mixture is made, they measure, and advise.

_tom

Thanks _Tom

I am going to have to mull over this for a while to figure out how I can improve my little program to take into consideration the information you have brought to our attention:

  • The dilution factor could range from 20%-50% annually.
  • Best to buy in quantities that will be "consumed" quickly.
  • Testing degradation/reporting concentration: 1 g/m3 = 1 mg/L = 1 ppm = 0.0001% 1% = 10000ppm
  • Home Testing strips report 1 - 10 ppm? Not much help, except for testing drinking water.
  • Some Bleach bottles do not have an expiration date - best not to buy them I suppose.

I guess I could add another option to the command line allowing the user to input an annual degradation percentage in excess of 20% up to 50% - and adjust the daily degradation rate accordingly.

I'm not sure how to treat expiration dates. The Anasept 0.057% solution had an expiration date which led me to believe it was about 24 months from the "inception" date. But does that mean the solution would hold a minimum concentration of 0.057% until the expiration date?

All comments are appreciated...

Regards,
Ken Rhodes

new topic     » goto parent     » topic index » view message » categorize

4. Re: Dilute Solution yet again

Time to contact your local Health department. I sent out an email to Public Health about the time you started this thread--you get to talk to people who refer you to other people. Here, in Raccoon City, they seem to be well organized.

I saw a reference that dilute solutions degrade slower than concentrated solutions. Another reference implied the degradation is non-linear; the first half year is slow; the second half year is faster. Chlorox had an advert that they increase the concentration before delivery to endure you get what is on the label in the store.

Public Health, said they have test strips for the purpose that are obtained from health suppliers. Swimming pool maintainers may also have test strips.

_tom

new topic     » goto parent     » topic index » view message » categorize

5. Re: Dilute Solution yet again

_tom said...

Time to contact your local Health department. I sent out an email to Public Health about the time you started this thread--you get to talk to people who refer you to other people. Here, in Raccoon City, they seem to be well organized.

I saw a reference that dilute solutions degrade slower than concentrated solutions. Another reference implied the degradation is non-linear; the first half year is slow; the second half year is faster. Chlorox had an advert that they increase the concentration before delivery to endure you get what is on the label in the store.

Public Health, said they have test strips for the purpose that are obtained from health suppliers. Swimming pool maintainers may also have test strips.

_tom

I'd feel a lot more comfortable if there were some definitive document published on the web to which I could refer.

I have a very crude function which attempts to degrade the CL solution at an annual rate up to %20 during the first half of the year and then on up to 50% for the second half of the year. Any suggestions for a more accurate/elegant "non-linear" solution will be appreciated:

I also added a command line option allowing the user to specify an annual % of annual degradation:

-- 
-- DiluteSolution.ex 1.1 
-- 
include std/console.e 
include std/math.e 
include std/convert.e 
 
constant Usage = sprintf("%s", { 
""" 

Dilute a Chlorine Solution: Dilution Law: V1*C1=V2*C2: V1=V2*C2/C1 
 
Usage: 
            eui DiluteSolution.ex <C1> <V2> <C2> 
            eui DiluteSolution.ex <C1> <V2> <C2> <d> 
            eui DiluteSolution.ex <C1> <V2> <C2> <d> <adp> 
 
        C1 = % Sodium Hypochlorite of stock Bleach at time of purchase 
        V2 = target volume of solution to create with  
        C2% Sodium Hypochlorite 
 
option: <d> is the number of days since  purchase of C1 + perhaps an estimate of shelf  
            days prior to purchase.  If d is added to the command line, the program will calculate  
            a degraded  C1 value based on a graduated rate of annual degradation up to 50%.  
            Otherwise, the  calculations  will be made based on the nominal value for C1% at the  
            time of purchase. Or the user can specify an annual degradation % with option <adp> 
         
option: <adp> allows the user to specify an annual degradation %   
            enter as a number without the % symbol 
 
EXAMPLES:  
 
    To make 32 oz "Cleaner Bleach" with 2% Sodium Hypochlorite: 
    from stock Bleach with 6% nominal Sodium Hypochlorite: 
    eui DiluteSolution.ex 6 32 2  
    use 10.67 oz of C1 + 21.33 oz of distilled water to make solution V2 C2 
 
    To degrade C1 by 190 days: eui DiluteSolution.ex 6 32 2 190 
    use 11.91 oz of C1 + 20.09 oz of distilled water to make solution V2 C2 
 
    To make 15 oz "Skin/Wound Wash" with 0.057% Sodium Hypochlorite: 
    from stock Bleach with 6% nominal Sodium Hypochlorite: 
    eui DiluteSolution.ex 6 15 0.057 190  -- $22 Anasept Wound Wash 
    use 0.16 oz of C1 + 14.84 oz of distilled water to make solution V2 C2 
""" 

}) 
 
function calc_adp(integer days) 
-- returns % annual degradation 
 atom y=365.25  
 integer z = 50, x = 20 
 if days > floor(.98*y) then return z end if 
 if days > floor(.95*y) then return .95*z end if 
 if days > floor(.90*y) then return .90*z end if 
 if days > floor(.85*y) then return .85*z end if 
 if days > floor(.80*y) then return .80*z end if 
 if days > floor(.75*y) then return .75*z end if 
 if days > floor(.70*y) then return .70*z end if 
 if days > floor(.65*y) then return .65*z end if 
 if days > floor(.60*y) then return .60*z end if 
 if days > floor(.55*y) then return .55*z  end if 
 if days > floor(.50*y) then return .50*z end if 
 -- 
 if days > floor(.98*(y/2)) then return x end if 
 if days > floor(.95*(y/2)) then return .95*x end if 
 if days > floor(.85*(y/2)) then return .85*x end if  
 if days > floor(.70*(y/2)) then return .70*x end if 
 if days > floor(.60*(y/2)) then return .60*x end if 
 if days > floor(.50*(y/2)) then return .50*x end if 
 if days > floor(.40*(y/2)) then return .40*x end if 
 if days > floor(.30*(y/2)) then return .30*x end if 
 if days > floor(.20*(y/2)) then return .20*x end if 
 if days > floor(.10*(y/2)) then return .10*x end if 
 if days > floor(.05*(y/2)) then return .05*x  
 else return .025*x 
 end if 
end function 
 
procedure DiluteSolution(sequence cmd) 
integer d = 0  -- # of degradation days  
atom adp,       -- annual % degradation of C1  
V1, C1, V2, C2 
    if length(cmd)<5 then display(Usage) abort(0) end if 
    C1 = to_number(cmd[3])  -- % Sodium Hypochlorite of stock Bleach at time of purchase 
    V2 = to_number(cmd[4])  --  target volume of solution to create with 
    C2 = to_number(cmd[5])  --  C2 % Sodium Hypoclorite 
    if length(cmd) > 5 then  d = to_number(cmd[6]) end if      -- option: <d> 
    if length(cmd) = 7 then  adp = to_number(cmd[7])            -- option: <adp>  
        C1 *= (1-((adp/100)/365.25)*d) -- user specifies % adp  
    else 
        C1 *= (1-((calc_adp(d)/100)/365.25)*d) -- % adp is calculated on a graduated scale  
    end if 
V1 = round((V2*C2)/C1,100)   
display(sprintf("\n\nUse %.4g oz of C1 + %.4g oz of (distilled) water\nto make %.4g oz of %.4g%s"& 
    " Sodium Hypochlorite\n%.4g oz =   %.4g tsp\n\t\t\t\t%.4g tblsp\n\t\t\t\t\t%.4g cup\n\t\t\t\t\t\t%.4g ml",     
    {V1,V2-V1, V2, C2, '%', V1, V1*6, V1*2, V1*0.12, V1*29.57})) 
end procedure 
 
DiluteSolution(command_line()) 
 
new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu