esercitazione a livello didattico-liceale
con turbo pascal , su argomenti di chimica vari

equilibrio dinamico e costante

 

program dinami1;
(* soluzione problemi equilibrio chimico *)
(* si calcola Ke con concentrazioni note da inserire *)
uses crt;
var r1,r2,p1,p2,ke:real;
    cr1,cr2,cp1,cp2:integer;
    s:integer;  


procedure fine;
begin
writeln('premi enter');
readln;
end;

procedure pausa;
begin
writeln('premi enter');readln;
end;

function f(x:real;n:integer):real;
var a:integer;
    y:real;
begin
y:=n*ln(x);
f:=exp(y);
end;

procedure esamina(x:real);
begin
if x>1 then writeln('equilibrio spostato verso destra,prodotti')
else if x=1 then writeln('equilibrio indifferente')
else writeln('equilibrio spostato verso sinistra,reagenti');
end;

procedure pro1;
begin
writeln('inserire concentrazioni molari ');
write('concentrazione reattivo1  r1  ');readln(r1);
write('concentrazione reattivo2  r2  ');readln(r2);
write('concentrazione prodotto1  p1  ');readln(p1);
write('concentrazione prodotto2  p2  ');readln(p2);
writeln('inserire coefficienti:anche se =1 ');
write('coefficiente reattivo1    cr1 ');readln(cr1);
write('coefficiente reattivo2    cr2 ');readln(cr2);
write('coefficiente prodotto1    cp1 ');readln(cp1);
write('coefficiente prodotto2    cp2 ');readln(cp2);
if cp1>1 then p1:=f(p1,cp1) else p1:=p1;
if cp2>1 then p2:=f(p2,cp2) else p2:=p2;
if cr1>1 then r1:=f(r1,cr1) else r1:=r1;
if cr2>1 then r2:=f(r2,cr2) else r2:=r2;
writeln('calcolo concentrazioni elevate a proprio esponente ');
writeln('p1=',p1:0:2,'..p2=',p2:0:2,'..r1=',r1:0:2,'..r2=',r2:0:2);
writeln;
writeln(' Ke=(p1*p2)/(r1*r2) ');
ke:=(p1*p2)/(r1*r2);esamina(ke);
writeln(ke:8:6,'...',ke);
pausa;
end;

procedure pro2;
begin
writeln('inserire concentrazioni molari ');
write('concentrazione reattivo1  r1  ');readln(r1);
write('concentrazione reattivo2  r2  ');readln(r2);
write('concentrazione prodotto1  p1  ');readln(p1);
writeln('inserire coefficienti:anche se =1 ');
write('coefficiente reattivo1    cr1 ');readln(cr1);
write('coefficiente reattivo2    cr2 ');readln(cr2);
write('coefficiente prodotto1    cp1 ');readln(cp1);
if cp1>1 then p1:=f(p1,cp1) else p1:=p1;
if cr1>1 then r1:=f(r1,cr1) else r1:=r1;
if cr2>1 then r2:=f(r2,cr2) else r2:=r2;
writeln('calcolo concentrazioni elevate a proprio esponente ');
writeln('p1=',p1:0:2,'..r1=',r1:0:2,'..r2=',r2:0:2);
writeln;
writeln(' Ke=(p1)/(r1*r2) ');
ke:=(p1)/(r1*r2);esamina(ke);
writeln(ke:8:6,'...',ke);
pausa;
end;

procedure pro3;
begin
writeln('inserire concentrazioni molari ');
write('concentrazione reattivo1  r1  ');readln(r1);
write('concentrazione prodotto1  p1  ');readln(p1);
write('concentrazione prodotto2  p2  ');readln(p2);
writeln('inserire coefficienti:anche se =1 ');
write('coefficiente reattivo1    cr1 ');readln(cr1);
write('coefficiente prodotto1    cp1 ');readln(cp1);
write('coefficiente prodotto2    cp2 ');readln(cp2);
if cp1>1 then p1:=f(p1,cp1) else p1:=p1;
if cp2>1 then p2:=f(p2,cp2) else p2:=p2;
if cr1>1 then r1:=f(r1,cr1) else r1:=r1;
writeln('calcolo concentrazioni elevate a proprio esponente ');
writeln('p1=',p1:0:2,'..p2=',p2:0:2,'..r1=',r1:0:2);
writeln;
writeln(' Ke=(p1*p2)/(r1) ');
ke:=(p1*p2)/(r1);esamina(ke);
writeln(ke:8:6,'...',ke);
pausa;
end;

procedure pro4;
begin
writeln('inserire concentrazioni molari ');
write('concentrazione reattivo1  r1  ');readln(r1);
write('concentrazione prodotto1  p1  ');readln(p1);
writeln('inserire coefficienti:anche se =1 ');
write('coefficiente reattivo1    cr1 ');readln(cr1);
write('coefficiente prodotto1    cp1 ');readln(cp1);
if cp1>1 then p1:=f(p1,cp1) else p1:=p1;
if cr1>1 then r1:=f(r1,cr1) else r1:=r1;
writeln('calcolo concentrazioni elevate a proprio esponente ');
writeln('p1=',p1:0:2,'..r1=',r1:0:2);
writeln;
writeln(' Ke=(p1)/(r1) ');
ke:=(p1)/(r1);esamina(ke);
writeln(ke:8:6,'...',ke);
pausa;
end;

procedure scelta;
var ancora:integer;
begin
clrscr;
writeln('seleziona tipo problema ');
writeln('1...calcolare Ke con 2 reattivi e 2 prodotti');
writeln('2...calcolare Ke con 2 reattivi e 1 prodotti');
writeln('3...calcolare Ke con 1 reattivo e 2 prodotti');
writeln('4...calcolare Ke con 1 reattivi e 1 prodotti');
writeln('9...fine ');
write('opzione=');readln(s);
clrscr;
case s of
1:pro1;
2:pro2;
3:pro3;
4:pro4;
9:fine;
end;
writeln('----------------------------');
writeln('altro problema:scrivi 1...fine:scrivi 2 ');readln(ancora);
if ancora =1 then scelta else fine;
end;


begin
clrscr;
writeln('funzione programma:calcolo costante equilibrio Ke');
writeln('---------------------------------------------------');
writeln('premi enter');readln;
scelta;
end.

 

 

 

 

ritorna