procedure(case,cur); /*add_funct.rpl*/
/*
this precedure adds a function curve to the selected plot based on the case and curve number
this procedure developed july 1998 CGE moment calculations for the functions added March 1999
*/
cur_n=1;
num_l=1;
curve_n="Model 1";
color_n="red";
line="double";
if cur = 2 then
begin;
line="single";
color_n="blue";
curve_n="Model 2";
num_l=500;
end;
if cur = 3 then
begin;
line="dash";
color_n="green";
LAB=ROW 7 COL 1 OF TABLE('PARAMETER');
curve_n=cat("t1 = ",LAB);
num_l=500;
end;
graph_name = cat('conserv_gr',case);
tname=cat('conserv_gr',case,'@curves');
if case > 1 then
begin;
graph_name = cat('retd_gr','1');
tname=cat('retd_gr','1','@curves');
end;
funct = cat('b6_l_sf(',getcell("parameter",1,1),',',getcell("parameter",2,1),',',
getcell("parameter",3,1),',',getcell("parameter",4,1),',',
getcell("parameter",5,1),',',getcell("parameter",6,1),',',
getcell("parameter",7,1),',',getcell("parameter",8,1),',',
getcell("parameter",9,1),',x,',num_l,',',
getcell("parameter",11,1),')');
type funct;
N=$_gr_addfuncrv(graph_name,funct,curve_n,100);
call setcell(tname,n,9,color_n);
call setcell(tname,n,6,line);
display table(tname);
/*
evaluate funct such that moment analysis can be performed on the function
the function is evaluateed untill it declined to 0.001
*/
if tableexists('funct_data') then delete funct_data;
result = 1;
x=0.05;
ii=1;
do while true;
if (result < 0.001 and ii > 5) then
doexit;
result = b6_l_sf("parameter"[1,1],"parameter"[2,1],"parameter"[3,1],"parameter"[4,1],
"parameter"[5,1],"parameter"[6,1],"parameter"[7,1],"parameter"[8,1],
"parameter"[9,1],x,num_l,"parameter"[11,1]);
set 'funct_data'[ii,0]=x;
set 'funct_data'[ii,1]=result;
x=x+0.05;
ii=ii+1;
end;
/*
calculate and store moment analysis of the calculated function
*/
caseval=1;
if (case >1) then caseval=2;
tab_name=cat('funct_',cur,'_moment',caseval);
type tab_name;
if tableexists(tab_name) then delete table(tab_name);
call moment('funct_data',tab_name,1,0,0);
end;