LogResult database connectionHP_Omistaja9. maata 2008 10:42jtue1. elota 2008 17:01 48,241,0,0,1,1,1,0,0,0,01,305,142,830,519,17Arial, 150,Model Result_database_conn,2,2,-32766,1,Result database connection.ANA100,1,1,1,2,9,2970,2100,15,0Inp dim0144,344,1128,161,0,0,1,0,0,0,72,0,152425,39321,65535Inp_dimLocs0144,448,1128,161,0,0,1,0,0,0,72,0,152425,39321,65535LocationsInp run0144,272,1128,161,0,0,1,0,0,0,72,0,152425,39321,65535Inp_runInp var0144,168,1128,161,0,0,1,0,0,0,72,0,152425,39321,65535Inp_varVar for rdb0144,240,1128,161,0,0,1,0,0,0,72,0,152425,39321,65535Var_for_rdbDetailsjtue18. heita 2008 10:14 48,24744,288,148,241,634,1,593,686,17Concatenation UDFsThis library contains functions to make various instances of concatenation more convenient. Concat3 thru Concat10 are generalizations of the built-in Concat function which concatenate from 3 to 10 arrays in a single call (while the built-in Concat concatenates two arrays). ConcatRows concatenates all the rows of a single array.David Kendall & Lonnie ChrismanMon, Jan 26, 2004 8:49 AMLonnieWed, Sep 05, 2007 3:23 PM48,2472,512,168,241,0,0,1,1,1,0,0,0,01,39,36,798,452,23(A1, A2, A3: ArrayType; I1, I2, I3, J: IndexType )Concat3Concatenates three arrays, A1, A2, and A3. I1, I2, and I3 are the indexes that are joined; J is the index of the new array; J usually is the concatenation of I1, I2, and I3Index I12 := Concat(I1,I2);
Concat( Concat( A1,A2,I1,I2,I12 ), A3, I12, I3, J )88,64,148,262,56,56,986,596A1,A2,A3,I1,I2,I3,J(A1, A2, A3, A4: ArrayType; I1, I2, I3, I4, J: IndexType )Concat4Concatenates four arrays, A1, A2, A3, and A4. I1, I2, I3, and I4 are the indexes that are joined; J is the index of the new array; J usually is the concatenation of I1, I2, I3, and I4.Index I12 := Concat(I1,I2);
Index I123:= Concat(I12, I3);
Concat(
Concat(
Concat( A1,A2,I1,I2,I12 ),
A3, I12, I3, I123),
A4, I123, I4, J);
192,64,148,242,30,30,986,596A1,A2,A3,A4,I1,I2,I3,I4,J0(A1, A2, A3, A4, A5, A6, A7, A8, A9: ArrayType; I1, I2, I3, I4, I5, I6, I7, I8, I9, J: IndexType)Concat9Concatenates nine arrays, A1, ..., A9. I1, ..., I9 are the indexes joined; J is the index of the new array; J usually is the concatenation of I1, ..., I9.Index I12 := Concat(I1,I2);
Index I123 := Concat(I12, I3);
Index I1234 := Concat(I123, I4);
Index I12345 := Concat(I1234, I5);
Index I123456 := Concat(I12345, I6);
Index I1234567 := Concat(I123456, I7);
Index I12345678 := Concat(I1234567, I8);
Concat(
Concat(
Concat(
Concat(
Concat(
Concat(
Concat(
Concat( A1,A2,I1,I2,I12 ),
A3, I12, I3, I123),
A4, I123, I4, I1234),
A5, I1234, I5, I12345),
A6, I12345, I6, I123456),
A7, I123456, I7, I1234567),
A8, I1234567, I8, I12345678),
A9, I12345678, I9, J);88,232,148,242,27,120,469,638A1,A2,A3,A4,A5,A6,A7,A8,A9,I1,I2,I3,I4,I5,I6,I7,I8,I9,J0(A1, A2, A3, A4, A5: ArrayType; I1, I2, I3, I4, I5, J: IndexType )Concat5Concatenates five arrays, A1, ..., A5. I1, ..., I5 are the indexes joined; J is the index of the new array; J usually is the concatenation of I1, ..., I5.Index I12 := Concat(I1,I2);
Index I123:= Concat(I12, I3);
Index I1234 := Concat(I123, I4);
Concat(
Concat(
Concat(
Concat( A1,A2,I1,I2,I12 ),
A3, I12, I3, I123),
A4, I123, I4, I1234),
A5, I1234, I5, J);88,120,148,242,160,160,986,596A1,A2,A3,A4,A5,I1,I2,I3,I4,I5,J(A1, A2, A3, A4, A5, A6: ArrayType; I1, I2, I3, I4, I5, I6, J: IndexType )Concat6Concatenates six arrays, A1, ..., A6. I1, ..., I6 are the indexes joined; J is the index of the new array; J usually is the concatenation of I1, ..., I6.Index I12 := Concat(I1,I2);
Index I123:= Concat(I12, I3);
Index I1234 := Concat(I123, I4);
Index I12345 := Concat(I1234, I5);
Concat(
Concat(
Concat(
Concat(
Concat( A1,A2,I1,I2,I12 ),
A3, I12, I3, I123),
A4, I123, I4, I1234),
A5, I1234, I5, I12345),
A6, I12345, I6, J);192,120,148,242,644,94,602,712A1,A2,A3,A4,A5,A6,I1,I2,I3,I4,I5,I6,J0(A1, A2, A3, A4, A5, A6, A7: ArrayType; I1, I2, I3, I4, I5, I6, I7, J: IndexType )Concat7Concatenates seven arrays, A1, ..., A7. I1, ..., I7 are the indexes joined; J is the index of the new array; J usually is the concatenation of I1, ..., I7.Index I12 := Concat(I1,I2);
Index I123:= Concat(I12, I3);
Index I1234 := Concat(I123, I4);
Index I12345 := Concat(I1234, I5);
Index I123456 := Concat(I12345, I6);
Concat(
Concat(
Concat(
Concat(
Concat(
Concat( A1,A2,I1,I2,I12 ),
A3, I12, I3, I123),
A4, I123, I4, I1234),
A5, I1234, I5, I12345),
A6, I12345, I6, I123456),
A7, I123456, I7, J);88,176,148,242,580,98,551,565A1,A2,A3,A4,A5,A6,A7,I1,I2,I3,I4,I5,I6,I7,J(A1, A2, A3, A4, A5, A6, A7, A8: ArrayType; I1, I2, I3, I4, I5, I6, I7, I8, J: IndexType )Concat8Concatenates eight arrays, A1, ..., A8. I1, ..., I8 are the indexes joined; J is the index of the new array; J usually is the concatenation of I1, ..., I8.Index I12 := Concat(I1,I2);
Index I123:= Concat(I12, I3);
Index I1234 := Concat(I123, I4);
Index I12345 := Concat(I1234, I5);
Index I123456 := Concat(I12345, I6);
Index I1234567 := Concat(I123456, I7);
Concat(
Concat(
Concat(
Concat(
Concat(
Concat(
Concat( A1,A2,I1,I2,I12 ),
A3, I12, I3, I123),
A4, I123, I4, I1234),
A5, I1234, I5, I12345),
A6, I12345, I6, I123456),
A7, I123456, I7, I1234567),
A8, I1234567, I8, J);192,176,148,242,12,98,561,737A1,A2,A3,A4,A5,A6,A7,A8,I1,I2,I3,I4,I5,I6,I7,I8,J0(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10: ArrayType; I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, J: IndexType)Concat10Concatenates ten arrays, A1, ..., A10. I1, ..., I10 are the indexes joined; J is the index of the new array; J usually is the concatenation of I1, ..., I10.Index I12 := Concat(I1,I2);
Index I123 := Concat(I12, I3);
Index I1234 := Concat(I123, I4);
Index I12345 := Concat(I1234, I5);
Index I123456 := Concat(I12345, I6);
Index I1234567 := Concat(I123456, I7);
Index I12345678 := Concat(I1234567, I8);
Index I123456789 := Concat(I12345678, I9);
Concat(
Concat(
Concat(
Concat(
Concat(
Concat(
Concat(
Concat(
Concat( A1,A2,I1,I2,I12 ),
A3, I12, I3, I123),
A4, I123, I4, I1234),
A5, I1234, I5, I12345),
A6, I12345, I6, I123456),
A7, I123456, I7, I1234567),
A8, I1234567, I8, I12345678),
A9, I12345678, I9, I123456789),
A10, I123456789, I10, J);192,232,148,242,542,93,632,744A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,J0(A : ArrayType ; RowIndex,ColIndex,ResultIndex : IndexType)ConcatRows (A,I,J,K)Takes an array, A indexed by RowIndex & ColIndex, and concatenates each row, henceforth flattening the array by one dimension. The result is indexed by ResultIndex, which must be an index with size(RowIndex) * size(ColIndex) elements.index L := [ identifier of RowIndex, identifier of ColIndex, "val"];
slice(Mdarraytotable(A,ResultIndex,L),L,3)320,64,164,242,30,320,478,348A,RowIndex,ColIndex,ResultIndex[]Var for rdbTable(Self,Vari)(
'Fig_3_cost_by_source',9,1,
'Fig_5a_societal_costs',10,1,
'Fig_5b_subsidies',11,0,
'Fig_5c_expanding',12,1
)['item 1','item 2','item 3','item 4']216,96,148,161,1,1,1,1,1,0,0,0,02,102,90,476,4812,18,518,416,303,0,MIDM2,355,348,653,303,0,MIDM[Formnode Var_for_rdb1]52425,39321,65535[Vari,Self][Self,Vari][][1,1,1,0][Sys_localindex('I'),1,Sys_localindex('F'),1,Sys_localindex('G'),1]Inp resultvar output:= 0;
var e:= card_res;
var x:= 1;
while x<= size(var_for_rdb)/size(vari) do (
var c:= slice(Var_for_rdb,var_for_rdb,x);
index runn:= if c[Vari='Probabilistic?']=1 then copyindex(run) else [0];
var b:= getfract(mid(evaluate(c[vari='Name'])),0.5);
var a:= if c[Vari='Probabilistic?']=1 then (
var d:= sample(evaluate(c[vari='Name']));
d[run=runn])
else (
var d:= b;
if runn=0 then d);
index endscen:= 1+e..size(b)+e;
index row2:= 1..size(endscen)*size(runn);
index l:= concat(indexnames(b),['Value']);
a:= mdarraytotable(a,endscen,l);
a:= a[.l='Value'];
a:= array(iresult,[endscen,c[vari='Var_id'],a,runn]);
a:= concatrows(a,endscen,runn,row2);
output:= if x= 1 then a else for y:= iresult do (
concat(output[iresult=y],a[iresult=y]) );
e:= e+size(b);
x:= x+1);
index row:= 1..size(output)/size(iresult);
for y:= iresult do (slice(output[iresult=y],row))360,96,148,162,52,8,528,6462,634,4,529,601,0,MIDM[Iresult,Sys_localindex('ROW')][0,0,0,0][1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24][Sys_localindex('RUNN'),1,Iresult,3,Sys_localindex('ENDSCEN'),1]Variable cardinalityReset;
index a:= DBquery('DSN=resultdatabase','SELECT Var_id
FROM `Variable` ');
index b:= ['Var_id'];
max(max(DBTable(a, b ),a),b)216,24,148,161,1,1,1,1,1,0,0,0,02,376,386,416,303,0,MIDM65535,52427,65534[]DBindicesDBTable(Dbindex, Dbindexlabel )56,272,148,152,54,74,1024,686,0,MIDM65535,52427,65534[Dbindexlabel,Dbindex]['Loc_id','Result_id','Dim_id','Location']DBindexLabelDBlabels(Dbindex)64,328,156,122,102,90,476,353['Var_id','Var_name','Var_scope','Var_unit','Validity_date','Run_id','Run_time']DBindexReset;
DBquery('DSN=resultdatabase','SELECT Rows.Ind_id, Ind_name, row_number, Location.Loc_id, Location
FROM `Location`, `Rows`, `Index`
WHERE Location.Loc_id = Rows.Loc_id and
`Index`.Ind_id = Rows.Ind_id')56,304,148,132,102,90,476,4102,280,290,416,303,0,MIDM[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]Write indexdbwrite('DSN=resultdatabase', appendtablesql(inp_ind,inp_ind,Iind,'`Index` '));
'Done'480,456,148,1665535,45873,39321[Sys_localindex('A'),Iind][]ODBC LibraryLonnieThu, Sep 11, 1997 2:15 PMLonnieTue, Feb 05, 2008 10:03 AM48,2456,456,152,241,1,1,1,1,1,0,0,0,01,-151,272,499,497,17Arial, 13(A:ArrayType;I:IndexType;L:IndexType;row;dbTableName)InsertRecSqlGenerates the SQL "INSERT INTO" statement for one line of table A. A is a 2-D table indexed by rows I and columns L. L's domain serves as the column names in the database table. dbTableName is the name of the table in the database. The result begins with two semi-colons, since it will be used with an SQL statement preceeding it.(';;INSERT INTO ' & dbTableName & '(' & JoinText(L,L,',') & ') VALUES (' & Vallist(A[I=row],L)) & ')'184,32,152,242,235,352,487,423A,I,L,row,dbTableName(V:ArrayType;I:IndexType)ValListTakes a list of values, and returns a string which the concatenation of each value, separated by commas, and with each value quoted.JoinText( '''' & V & '''', I, ',')72,32,052,24V,I1,F,4,14,0,0(Tabl:ArrayType;RowIndex:IndexType;LabelIndex:IndexType;dbTableName)WriteTableSql(Table,Rows,Labels,dbTableName)Returns the SQL that will write the table to the database table.
This can be used as the second argument to DBWrite.
This SQL statement replaces the entire contents of an existing table with the new data.'DELETE FROM '& Dbtablename & JoinText(Insertrecsql(Tabl, Rowindex, Labelindex, Rowindex, Dbtablename),RowIndex)328,32,188,242,728,341,510,476Tabl,RowIndex,LabelIndex,dbTableName(Tabl:ArrayType;RowIndex:IndexType;LabelIndex:IndexType;dbTableName)WriteTableSql(Table,Rows,Labels,dbTableName)Returns the SQL that will write the table to the database table.
This can be used as the second argument to DBWrite.
This SQL statement replaces the entire contents of an existing table with the new data.JoinText(Insertrecsql(Tabl, Rowindex, Labelindex, Rowindex, Dbtablename),RowIndex)328,88,188,242,86,246,510,476Tabl,RowIndex,LabelIndex,dbTableNameDBresultReset;
DBquery('DSN=resultdatabase','SELECT var_name, Restat.*, var_unit, Indices.*, Run.*
FROM Variable, Run_list, Run, Loc_of_result,
(SELECT var_id, result_id, avg(result) as result, min(result) as minimum, max(result) as maximum, count(sample) as n
FROM Result
GROUP BY result_id) as Restat,
(SELECT Dimension.Dim_id, Dimension.Dim_name, Rows.Ind_id, Ind_name, row_number, Location.Loc_id, Location
FROM `Dimension`, `Location`, `Rows`, `Index`
WHERE Dimension.Dim_id = Location.Dim_id and
Location.Loc_id = Rows.Loc_id and
`Index`.Ind_id = Rows.Ind_id) as Indices
WHERE Variable.var_id = Restat.var_id and
Restat.result_id = Run_list.result_id and
Run_list.run_id = Run.run_id and
Restat.result_id = Loc_of_result.result_id and
Loc_of_result.loc_id = Indices.loc_id
ORDER BY run_id DESC, var_id, result_id')56,200,148,132,280,290,416,303,0,MIDM[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]DBresultsDBTable(Dbresult, Dbreslabel)56,168,148,162,17,34,1187,497,0,MIDM65535,52427,65534[Dbreslabel,Dbresult]['Loc_id','Result_id','Dim_id','Location']DBresLabeldblabels(Dbresult)64,224,160,132,280,290,416,469,0,MIDM[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]Inp_indTable(Self,Iind)(
card_ind+1,ind_name,dime
)['item 1']360,456,148,162,197,430,416,303,0,MIDM1,49155,65535[Iind,Self][Self,Iind]['item 1']iind['Ind_id','Ind_name','Dim_id']360,488,148,13['Ind_id','Ind_name','Dim_id']Inp dimTable(Self,Idim)(
card_dim+1,'Composite fraction','The fraction of trips that are performed using composite traffic, from the total number of trips','fraction',0,0
)['item 1']360,384,148,162,222,370,767,303,0,MIDM2,330,482,558,303,0,MIDM[Formnode Inp_dim1]52425,39321,65535[Idim,Self][Self,Idim]idim['Dim_id','Dim_name','Dim_scope','Dim_unit','Dim_definition','Dim_result']360,416,148,13['Dim_id','Dim_name','Dim_scope','Dim_unit','Dim_definition','Dim_result']Inp rowindex row:= 1..size(Locations);
var a:= slice(Locations, row);
array(Irow,[card_ind+1,row,card_loc+row])['item 1']360,600,148,162,250,441,416,303,0,MIDM2,52,121,404,577,0,MIDM19661,48336,65535[Irow,Self][Irow,Sys_localindex('ROW')]['item 1']irow['Ind_id','Row_number','Loc_id']360,632,148,13Inp locindex row:= 1..size(Locations);
var a:= slice(Locations, row);
array(Iloc,[card_loc+row,Dime,a])['item 1','item 2','item 3','item 4','item 5','item 6','item 7','item 8','item 9','item 10','item 11','item 12','item 13','item 14','item 15','item 16','item 17','item 18','item 19','item 20','item 21']360,528,148,162,319,169,421,433,0,MIDM2,31,353,405,433,0,MIDM19661,48336,65535[Iloc,Self][Iloc,Sys_localindex('ROW')]['item 1','item 2','item 3','item 4','item 5','item 6','item 7','item 8','item 9','item 10','item 11','item 12','item 13','item 14','item 15','item 16','item 17','item 18','item 19','item 20','item 21'][Inp_dim,1,In2,1,Locs,9,Sys_localindex('IND'),1,In4,1]iloc['Loc_id','Dim_id','Location']360,560,148,13Card indReset;
index a:= DBquery('DSN=resultdatabase','SELECT Ind_id
FROM `Index` ');
index b:= ['Ind_id'];
max(max(DBTable(a, b ),a),b)216,440,148,1665535,52427,65534Card dimReset;
index a:= DBquery('DSN=resultdatabase','SELECT Dim_id
FROM `Dimension` ');
index b:= ['Dim_id'];
max(max(DBTable(a, b ),a),b)216,384,148,1665535,52427,65534Card locReset;
index a:= DBquery('DSN=resultdatabase','SELECT Loc_id
FROM `Location` ');
index b:= ['Loc_id'];
max(max(DBTable(a, b ),a),b)216,512,148,1665535,52427,65534Locations['0','0.02','0.05','0.1','0.25','0.4','0.45','0.5','0.55','0.65','0.75','0.9','1']216,600,148,16[Formnode Locs1]52425,39321,65535Write dimensiondbwrite('DSN=resultdatabase', appendtablesql(inp_dim,inp_dim,Idim,'Dimension '));
'Done'480,384,148,162,312,322,698,303,0,MIDM65535,45873,39321[]Card resReset;
index a:= DBquery('DSN=resultdatabase','SELECT Result_id
FROM `Result` ');
index b:= ['Result_id'];
max(max(DBTable(a, b ),a),b)216,168,148,1665535,52427,65534[]Inp loc of resultvar output=0;
var e:= card_res;
var x:= 1;
while x<= size(var_for_rdb)/size(vari) do (
var c:= slice(Var_for_rdb,var_for_rdb,x);
var a:= getfract(mid(evaluate(c[vari='Name'])),0.5); {getfract forces the effect of sample() away, while mid doesn't}
index h:= indexnames(a);
index l:= concat(h,['Value']);
index roww:= 1..size(a)*size(h);
index endscen:= 1+e..size(a)+e;
e:= e+size(a);
a:= mdarraytotable(a,endscen,l);
a:= a[l=h];
var b:= if Dbindices[Dbindexlabel='Ind_name']=h then Dbindices[Dbindexlabel='row_number'] else '';
index d:= 1..max(max(b,Dbindex),h);
b:= Positioninindex(b , d, Dbindex );
b:= Dbindices[Dbindex=b, Dbindexlabel='Loc_id'];
var w:=1;
while w<= size(h) do (
index m:= evaluate(slice(h,w));
var z:= 1;
while z<=size(m) do (
var g:= slice(m,z);
var f:= slice(slice(b,h,w),d,z);
a:= if a=g then f else a;
z:= z+1);
w:= w+1);
a:= array(Ilocres,[endscen,a]);
a:= concatrows(a,a.h,endscen,roww);
output:= if x= 1 then a else for y:= ilocres do (
concat(output[ilocres=y],a[ilocres=y]) );
x:= x+1);
index row:= 1..size(output)/size(ilocres);
for y:= ilocres do (slice(output[ilocres=y],row))360,168,148,162,115,34,423,7552,40,27,546,681,0,MIDM[Ilocres,Sys_localindex('ROW')]['','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',''][Sys_localindex('H'),1,Sys_localindex('ENDSCEN'),1,Sys_localindex('D'),1]Year_11..272,72,148,13(1..3)*1072,96,148,12(1..4)*10072,120,148,12Test variableYear_1+Cause_of_death_1+Cause_of_death_272,40,148,162,328,338,416,303,0,MIDM[Cause_of_death_2,Cause_of_death_1][In5,2,In6,1,In7,1]Write locresdbwrite('DSN=resultdatabase', appendtablesql(inp_loc_of_result,inp_loc_of_result.row,Ilocres,'Loc_of_result '));
'Done'480,168,148,1665535,45873,39321[]iresult['Result_id','Var_id','Result','Sample']360,128,148,13[]['Result_id','Var_id','Result','Sample']ilocres['Result_id','Loc_id']360,200,148,13Inp run listvar output:= 0;
var e:= card_res;
var x:= 1;
while x<= size(var_for_rdb)/size(vari) do (
var c:= slice(Var_for_rdb,var_for_rdb,x);
var b:= getfract(mid(evaluate(c[vari='Name'])),0.5);
index endscen:= 1+e..size(b)+e;
var a:= array(irunlist,[endscen,card_run+1]);
output:= if x= 1 then a else for y:= irunlist do (
concat(output[irunlist=y],a[irunlist=y]) );
e:= e+size(b);
x:= x+1);
index row:= 1..size(output)/size(irunlist);
for y:= irunlist do (slice(output[irunlist=y],row))360,240,148,162,102,90,476,5782,773,40,372,741,0,MIDM[Irunlist,Sys_localindex('ROW')]Card runReset;
index a:= DBquery('DSN=resultdatabase','SELECT Run_id
FROM `Run` ');
index b:= ['Run_id'];
max(max(DBTable(a, b ),a),b)216,312,148,161,1,1,1,1,1,0,0,0,065535,52427,65534irunlist['Result_id','Run_id']360,272,148,131,1,1,1,1,1,0,0,0,0Inp runTable(Self,Irun)(
card_run+1,'18.1.2007','Jouni','Analytica 4.1.0.9, CompositeTraffic_1_0_6.ana v. 11:47, 1000 iterations'
)['item 1']360,312,148,162,380,294,629,303,0,MIDM2,456,466,416,303,0,MIDM[Formnode Inp_run1]52425,39321,65535[Irun,Self][Self,Irun]2,D,4,2,0,0,4,0,$,0,"yyyy-mm-dd",0irun['Run_id','Run_date','Run_who','Run_method']360,344,148,13['Run_id','Run_date','Run_who','Run_method']Inp varTable(Self,Ivar)(
variable_cardinality+1,'Fig_3_cost_by_source','Trip costs per source','Trip costs per source','e/trip',
variable_cardinality+2,'Fig_5a_societal_costs','Societal costs as a function of composite fraction','Societal costs as a function of composite fraction','e/day',
variable_cardinality+3,'Fig_5b_subsidies','Subsidies needed to obtain the composite fraction objective','Subsidies needed to obtain the composite fraction objective','e/day',
variable_cardinality+4,'Fig_5c_expanding','Societal costs at different levels of guarantee (here, for guarantee level 7)','Societal costs at different levels of guarantee (here, for guarantee level 7)','e/day'
)['item 1','item 2','item 3','item 4']360,24,148,162,0,-23,1272,6812,29,211,1110,301,0,MIDM2,152,434,886,303,0,MIDM[Formnode Inp_var1]52425,39321,65535[Ivar,Self][Ivar,Self]2,D,4,2,0,0,4,0,$,0,"yyyy-mm-dd",0ivar['Var_id','Var_name','Var_title','Var_scope','Var_unit']360,56,148,13['Var_id','Var_name','Var_title','Var_scope','Var_unit']Write vardbwrite('DSN=resultdatabase', appendtablesql(inp_var,inp_var,Ivar,'Variable '));
'Done'480,24,148,1665535,45873,39321[]Write rundbwrite('DSN=resultdatabase', appendtablesql(inp_run,inp_run,Irun,'Run '));
'Done'480,312,148,1665535,45873,39321[]Write runlistdbwrite('DSN=resultdatabase', appendtablesql(inp_run_list,inp_run_list.row,Irunlist,'Run_list '));
'Done'480,240,148,1665535,45873,39321[]Write resultdbwrite('DSN=resultdatabase', appendtablesql(inp_result,inp_result.row,Iresult,'Result '));
'Done'480,96,148,1665535,45873,39321[]Write locationdbwrite('DSN=resultdatabase', appendtablesql(inp_loc,inp_loc.row,Iloc,'Location '));
'Done'480,528,148,1665535,45873,39321[]Write rowdbwrite('DSN=resultdatabase', appendtablesql(inp_row,inp_row.row,Irow,'Rows '));
'Done'480,600,148,1665535,45873,39321[]vari['Name','Var_id','Probabilistic?']216,128,148,12['Name','Var_id','Probabilistic?']Reset6564,384,148,161,1,1,1,1,1,0,0,0,015216,552,148,161,1,1,1,1,1,0,0,0,0[Formnode Dime1]52425,39321,65535Ind name'Comp_fr_1'['item 1']216,472,148,162,457,448,416,303,0,MIDM[Formnode Ind_name1]52425,39321,65535[Iind,Self][Self,Iind]['item 1']DBindicesDBTable(Dbindex1, Dbindexlabel1 )72,568,148,152,54,74,1024,686,0,MIDM65535,52427,65534[Dbindexlabel1,Dbindex1]['Loc_id','Result_id','Dim_id','Location']DBindexLabelDBlabels(Dbindex1)80,624,156,122,102,90,476,353['Var_id','Var_name','Var_scope','Var_unit','Validity_date','Run_id','Run_time']DBindexReset;
DBquery('DSN=resultdatabase','SELECT Rows.Ind_id, Ind_name, row_number, Dimension.Dim_id, Dimension.Dim_name, Location.Loc_id, Location
FROM `Dimension`, `Location`, `Rows`, `Index`
WHERE Dimension.Dim_id = Location.Dim_id and Location.Loc_id = Rows.Loc_id and `Index`.Ind_id = Rows.Ind_id')72,600,148,132,102,90,476,4102,280,290,416,303,0,MIDM[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]This module saves model results into the Result Database. You need a password for that. Note that the variables and indexes must exist in the database before you save variables using them. Also, the variable must exist before you can save its results.256,40,-1256,40Variables that must be up-to-date before running the write procedure:656,112,-1124,201,0,0,1,0,1,0,,0,65535,65532,19661Inp var592,168,-156,161,0,0,1,0,1,0,,0,65535,65532,19661Var for rdb,
Inp run592,244,-156,201,0,0,1,0,1,0,,0,65535,65532,19661Inp dim592,344,-156,161,0,0,1,0,1,0,,0,65535,65532,19661Dime, Ind_name, Locations592,429,-156,291,0,0,1,0,1,0,,0,65535,65532,19661Note! Currently, you must insert one variable and its results at one time. Variables with no results will cause errors in numbering.664,40,-1144,32Insert a variable340,160,-6324,321,0,0,1,0,1,0,,0,Te11Insert a dimension340,336,-5324,321,0,0,1,0,1,0,,0,Te11Insert a variable result340,248,-4324,481,0,0,1,0,1,0,,0,Te11Insert an index340,424,-3324,481,0,0,1,0,1,0,,0,Dime0356,421,184,131,0,0,1,0,0,0,72,0,152425,39321,65535DimeInd name0144,421,1128,131,0,0,1,0,0,0,72,0,152425,39321,65535Ind_nameLog31.7.2008 Jouni Tuomisto
Identified problems:
* Inp_loc_of_result can calculate at least 800000 rows, but Write_locres is unable to write that data into the database.
* Inp_run_list does not work with composite traffic model cost variables. I attempted to write the following variables (from Var_fo_rdb node):
Fig_3_cost_by_source' 9 1
Fig_5a_societal_costs' 10 1
Fig_5b_subsidies' 11 0
Fig_5c_expanding' 12 1
but this resulted in an error message from Cap_variab_2: "first parameter in sortindex must be a table". This error does not occur when the node is calculated, only when I attempt to write it into the database. See an email to Dale Rice 31.7.2008.
0736,168,148,242,83,23,511,358