From 1db598ab451565d029e7b432271bd553643be1e9 Mon Sep 17 00:00:00 2001 From: Elena Date: Tue, 2 Jun 2020 02:44:40 +0200 Subject: [PATCH] Arreglos varios tiempos shp --- Olivia/olv_limp_thr.cpp | 173 ++++++++++++++++++++++++------------- Olivia/olv_reco_thr.cpp | 185 +++++++++++++++++++++------------------- 2 files changed, 212 insertions(+), 146 deletions(-) diff --git a/Olivia/olv_limp_thr.cpp b/Olivia/olv_limp_thr.cpp index 71864c3..b3ea942 100644 --- a/Olivia/olv_limp_thr.cpp +++ b/Olivia/olv_limp_thr.cpp @@ -6960,7 +6960,7 @@ void Colv_limp_thr::planifica_sub_1(int ithr, Matrix2d &cost_amb) s = &olv_limp->sec[is]; if(s->namb<=0) continue; - s->cost_despl_aux=0; + s->cost_despl_aux=0; sig=FALSE; //busca el ámbito inicial de la planificiación @@ -7101,7 +7101,7 @@ BOOL Colv_limp_thr::planifica_fin() /////////////////////////////////////// //Si es barrido mixto hay que copiar la info en las que no se ha sectorizado if(olv_limp->barr_mix) - copia_info_barr_mix(); + copia_info_barr_mix(); /////////////////////////////////// //prepara los datos para guardarlos @@ -7538,9 +7538,9 @@ BOOL Colv_limp_thr::genera_planif_instala(int is, int nvaciados, int ini, int fi return FALSE; if(tip_viaje==OLV_IDA_INST) - olv_limp->sec[is].t_despl[0]=(float)pp_insta[0].elem[pp_insta[0].nelem-1].coste; + olv_limp->sec[is].t_despl[0]=(float)pp_insta[i].elem[pp_insta[i].nelem-1].coste + olv_limp->t_sal; else if(tip_viaje==OLV_VUELTA_INST) //son impares, implica que la última ida adescargar es a la instalación también - olv_limp->sec[is].t_despl[1]=(float)pp_insta[pp->ninsta-1].elem[pp_insta[pp->ninsta-1].nelem-1].coste; + olv_limp->sec[is].t_despl[1]=(float)pp_insta[i].elem[pp_insta[i].nelem-1].coste + olv_limp->t_sal; return TRUE; } @@ -7964,7 +7964,7 @@ int Colv_limp_thr::rellena_insta_tramos() if(olv_limp->plan[is].planif_insta[nins-1].nelem==0) nins--; //es porque la descarga y planta son la misma pinsta = olv_limp->plan[is].planif_insta; - for(it=0;ittramos[is][it]; tramo->iins[0]=2*it; @@ -7975,14 +7975,20 @@ int Colv_limp_thr::rellena_insta_tramos() tramo->t_ini -= (float)pinsta[tramo->iins[0]].elem[pinsta[tramo->iins[0]].nelem-1].coste; tramo->t_fin += (float)pinsta[tramo->iins[1]].elem[pinsta[tramo->iins[1]].nelem-1].coste; tramo->t_total_tr=(float) (tramo->t_fin-tramo->t_ini); + + tramo->long_tr += pinsta[tramo->iins[0]].m[OLV_DESP] + pinsta[tramo->iins[1]].m[OLV_DESP]; + } + if (olv_limp->plan[is].ninsta % 2) //instala y descarga distintos si es impar + { + //para el último tramo + tramo = &olv_limp->tramos[is][nt-1]; + //tramo->iins[0] = 2 * it; + tramo->iins[1] = nins - 1; + //tramo->t_ini -= (float)pinsta[tramo->iins[0]].elem[pinsta[tramo->iins[0]].nelem - 1].coste; + tramo->t_fin += (float)pinsta[tramo->iins[1]].elem[pinsta[tramo->iins[1]].nelem - 1].coste; + tramo->t_total_tr = (float)(tramo->t_fin - tramo->t_ini); + tramo->long_tr += pinsta[tramo->iins[1]].m[OLV_DESP]; } - //para el último tramo - tramo = &olv_limp->tramos[is][it]; - tramo->iins[0]=2*it; - tramo->iins[1]=nins-1; - tramo->t_ini -= (float)pinsta[tramo->iins[0]].elem[pinsta[tramo->iins[0]].nelem-1].coste; - tramo->t_fin += (float)pinsta[tramo->iins[1]].elem[pinsta[tramo->iins[1]].nelem-1].coste; - tramo->t_total_tr=(float) (tramo->t_fin-tramo->t_ini); ii++; } return ii; @@ -7999,6 +8005,7 @@ BOOL Colv_limp_thr::guarda_cols_ruta_tram(char *path_shp) int h,m,s; int i, it,ntram,nt,nt_parc; ManagerDbfGdataTable dbfmgr; + GdataTable db; //cuenta el número de sectores no vacíos ntram=0; @@ -8019,7 +8026,12 @@ BOOL Colv_limp_thr::guarda_cols_ruta_tram(char *path_shp) return FALSE; } memset(info,0,ntram* OLV_SHP_SZ_CAMP_SZ); - AddColsDbf dataDbf(info); + AddColsDbf dataDbf(info); + if (!dbfmgr.LeeDbf(path_dbf, &db)) + { + free(info); + return FALSE; + } //SECTOR ya viene @@ -8036,7 +8048,7 @@ BOOL Colv_limp_thr::guarda_cols_ruta_tram(char *path_shp) } nt_parc+=nt; } - if(!dbfmgr.AddCol(path_dbf,"TTO",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) + if(!dbfmgr.AddCol(NULL,"TTO",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) { free(info); return FALSE; @@ -8057,7 +8069,7 @@ BOOL Colv_limp_thr::guarda_cols_ruta_tram(char *path_shp) } nt_parc+=nt; } - if(!dbfmgr.AddCol(path_dbf,"VIAJE",GdataTable::Tint,&dataDbf)) + if(!dbfmgr.AddCol(NULL,"VIAJE",GdataTable::Tint,&dataDbf)) { free(info); return FALSE; @@ -8079,7 +8091,7 @@ BOOL Colv_limp_thr::guarda_cols_ruta_tram(char *path_shp) } nt_parc+=nt; } - if(!dbfmgr.AddCol(path_dbf,"H_INI",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) + if(!dbfmgr.AddCol(NULL,"H_INI",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) { free(info); return FALSE; @@ -8101,7 +8113,7 @@ BOOL Colv_limp_thr::guarda_cols_ruta_tram(char *path_shp) } nt_parc+=nt; } - if(!dbfmgr.AddCol(path_dbf,"H_FIN",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) + if(!dbfmgr.AddCol(NULL,"H_FIN",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) { free(info); return FALSE; @@ -8123,7 +8135,7 @@ BOOL Colv_limp_thr::guarda_cols_ruta_tram(char *path_shp) } nt_parc+=nt; } - if(!dbfmgr.AddCol(path_dbf,"T_TOTAL",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) + if(!dbfmgr.AddCol(NULL,"T_TOTAL",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) { free(info); return FALSE; @@ -8145,7 +8157,7 @@ BOOL Colv_limp_thr::guarda_cols_ruta_tram(char *path_shp) } nt_parc += nt; } - if (!dbfmgr.AddCol(path_dbf, "M_TOTAL", GdataTable::Tdouble, &dataDbf)) + if (!dbfmgr.AddCol(NULL, "M_TOTAL", GdataTable::Tdouble, &dataDbf)) { free(info); return FALSE; @@ -8167,13 +8179,20 @@ BOOL Colv_limp_thr::guarda_cols_ruta_tram(char *path_shp) } nt_parc+=nt; } - if(!dbfmgr.AddCol(path_dbf,"T_TRAT",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) + if(!dbfmgr.AddCol(NULL,"T_TRAT",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) { free(info); return FALSE; } memset(info,0,ntram* OLV_SHP_SZ_CAMP_SZ); + free(info); + + if (!dbfmgr.grabaDbf(path_dbf, &db)) + { + return FALSE; + } + return TRUE; } //************************************************************************************* @@ -8246,20 +8265,19 @@ void Colv_limp_thr::rellena_tramos() } tramo->t_tto_tr = (float)(pp->t[OLV_TTO]); - if(pp->planif_insta) - { - if(it==0) - tramo->t_ini = (float)(olv_limp->t_ini+olv_limp->t_sal+pp->planif_insta[0].elem[pp->planif_insta[0].nelem-1].coste); - else - tramo->t_ini = (float)(pp->planif_insta[2*it].t[OLV_TTO]+pp->planif_insta[2*it].elem[pp->planif_insta[2*it].nelem-1].coste); - tramo->t_fin = (float)pp->planif_insta[2 * it + 1].t[OLV_TTO]; + + //actualiza tiempos de tramos + if (pp->planif_insta) + { + tramo->t_ini = (float)(pp->planif_insta[2 * it].t[OLV_TTO] + pp->planif_insta[2 * it].elem[pp->planif_insta[2 * it].nelem - 1].coste); + tramo->t_fin = (float)pp->planif_insta[2 * it + 1].t[OLV_TTO]; } else - { - tramo->t_ini = (float)(olv_limp->t_ini+olv_limp->t_sal); - tramo->t_fin = (float)(tramo->t_ini + olv_limp->sec[is].cost_ac+olv_limp->t_desc); - } - + { + tramo->t_ini = (float)olv_limp->t_ini; + tramo->t_fin = (float)(tramo->t_ini + olv_limp->sec[is].cost_ac + olv_limp->t_desc); + } + tramo->t_total_tr = (float) (tramo->t_fin-tramo->t_ini); } } @@ -8381,6 +8399,7 @@ BOOL Colv_limp_thr::guarda_cols_ruta(char *path_shp) char nombia[16]; int nsec, i, isec_novac; ManagerDbfGdataTable dbfmgr; + GdataTable db; //cuenta el número de sectores no vacíos nsec=0; @@ -8406,7 +8425,12 @@ BOOL Colv_limp_thr::guarda_cols_ruta(char *path_shp) return FALSE; } memset(info,0,nsec* OLV_SHP_SZ_CAMP_SZ); - AddColsDbf dataDbf(info); + AddColsDbf dataDbf(info); + if (!dbfmgr.LeeDbf(path_dbf, &db)) + { + free(info); + return FALSE; + } //SECTOR ya viene //TRATAMIENTO @@ -8420,7 +8444,7 @@ BOOL Colv_limp_thr::guarda_cols_ruta(char *path_shp) sprintf_s(&info[isec_novac*OLV_SHP_SZ_CAMP_CHAR],OLV_SHP_SZ_CAMP_CHAR,"%s",olv_limp->nomb_tto); isec_novac++; } - if(!dbfmgr.AddCol(path_dbf,"TTO",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) + if(!dbfmgr.AddCol(NULL,"TTO",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) { free(info); return FALSE; @@ -8440,7 +8464,7 @@ BOOL Colv_limp_thr::guarda_cols_ruta(char *path_shp) sprintf_s(&info[isec_novac*OLV_SHP_SZ_CAMP_CHAR],OLV_SHP_SZ_CAMP_CHAR,"%02d:%02d:%02d h",h,m,s); isec_novac++; } - if(!dbfmgr.AddCol(path_dbf,"H_INI",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) + if(!dbfmgr.AddCol(NULL,"H_INI",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) { free(info); return FALSE; @@ -8455,13 +8479,13 @@ BOOL Colv_limp_thr::guarda_cols_ruta(char *path_shp) { continue; } - tt=olv_limp->t_ini+ olv_limp->sec[i].cost_ac + olv_limp->t_desc + 2*olv_limp->t_sal; + tt=olv_limp->t_ini+ olv_limp->sec[i].cost_ac + olv_limp->t_desc; dame_h_m_s(tt, &h, &m, &s); sprintf_s(&info[isec_novac*OLV_SHP_SZ_CAMP_CHAR],OLV_SHP_SZ_CAMP_CHAR,"%02d:%02d:%02d h",h,m,s); isec_novac++; } - if(!dbfmgr.AddCol(path_dbf,"H_FIN",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) + if(!dbfmgr.AddCol(NULL,"H_FIN",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) { free(info); return FALSE; @@ -8474,12 +8498,12 @@ BOOL Colv_limp_thr::guarda_cols_ruta(char *path_shp) { if(olv_limp->sec[i].namb==0) continue; - tt=olv_limp->sec[i].cost_ac+olv_limp->t_desc + 2 * olv_limp->t_sal; + tt=olv_limp->sec[i].cost_ac+olv_limp->t_desc; dame_h_m_s(tt, &h, &m, &s); sprintf_s(&info[isec_novac*OLV_SHP_SZ_CAMP_CHAR],OLV_SHP_SZ_CAMP_CHAR,"%02d:%02d:%02d h",h,m,s); isec_novac++; } - if(!dbfmgr.AddCol(path_dbf,"T_TOTAL",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) + if(!dbfmgr.AddCol(NULL,"T_TOTAL",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) { free(info); return FALSE; @@ -8506,7 +8530,7 @@ BOOL Colv_limp_thr::guarda_cols_ruta(char *path_shp) isec_novac++; } - if (!dbfmgr.AddCol(path_dbf, "M_TOTAL", GdataTable::Tdouble, &dataDbf)) + if (!dbfmgr.AddCol(NULL, "M_TOTAL", GdataTable::Tdouble, &dataDbf)) { free(info); return FALSE; @@ -8524,7 +8548,7 @@ BOOL Colv_limp_thr::guarda_cols_ruta(char *path_shp) sprintf_s(&info[isec_novac*OLV_SHP_SZ_CAMP_CHAR],OLV_SHP_SZ_CAMP_CHAR,"%02d:%02d:%02d h",h,m,s); isec_novac++; } - if(!dbfmgr.AddCol(path_dbf,"T_INSTA",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) + if(!dbfmgr.AddCol(NULL,"T_INSTA",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) { free(info); return FALSE; @@ -8549,7 +8573,7 @@ BOOL Colv_limp_thr::guarda_cols_ruta(char *path_shp) isec_novac++; } - if (!dbfmgr.AddCol(path_dbf, "M_INSTA", GdataTable::Tdouble, &dataDbf)) + if (!dbfmgr.AddCol(NULL, "M_INSTA", GdataTable::Tdouble, &dataDbf)) { free(info); return FALSE; @@ -8567,7 +8591,7 @@ BOOL Colv_limp_thr::guarda_cols_ruta(char *path_shp) sprintf_s(&info[isec_novac*OLV_SHP_SZ_CAMP_CHAR],OLV_SHP_SZ_CAMP_CHAR,"%02d:%02d:%02d h",h,m,s); isec_novac++; } - if(!dbfmgr.AddCol(path_dbf,"T_DESCAN",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) + if(!dbfmgr.AddCol(NULL,"T_DESCAN",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) { free(info); return FALSE; @@ -8586,7 +8610,7 @@ BOOL Colv_limp_thr::guarda_cols_ruta(char *path_shp) isec_novac++; } - if(!dbfmgr.AddCol(path_dbf,"M_RUTA",GdataTable::Tdouble,&dataDbf)) + if(!dbfmgr.AddCol(NULL,"M_RUTA",GdataTable::Tdouble,&dataDbf)) { free(info); return FALSE; @@ -8719,16 +8743,21 @@ BOOL Colv_limp_thr::guarda_cols_ruta(char *path_shp) strcat_s(nombia,"DESP"); } - if(!dbfmgr.AddCol(path_dbf,nombia,tipodato,&dataDbf,sz)) + if(!dbfmgr.AddCol(NULL,nombia,tipodato,&dataDbf,sz)) { free(info); return FALSE; } memset(info,0,nsec* OLV_SHP_SZ_CAMP_SZ); } - } + } free(info); + + if (!dbfmgr.grabaDbf(path_dbf, &db)) + { + return FALSE; + } return TRUE; } //************************************************************************************* @@ -8743,6 +8772,7 @@ BOOL Colv_limp_thr::guarda_cols_ctrl(char *path_shp) char *info; int nsec, i, isec_novac; ManagerDbfGdataTable dbfmgr; + GdataTable db; //cuenta el número de sectores no vacíos nsec=0; @@ -8764,6 +8794,11 @@ BOOL Colv_limp_thr::guarda_cols_ctrl(char *path_shp) } memset(info,0,nsec*olv_limp->npts_ctrl* OLV_SHP_SZ_CAMP_SZ); AddColsDbf dataDbf(info); + if (!dbfmgr.LeeDbf(path_dbf, &db)) + { + free(info); + return FALSE; + } //rellena el nombre del tto k=0; @@ -8781,7 +8816,7 @@ BOOL Colv_limp_thr::guarda_cols_ctrl(char *path_shp) isec_novac++; k++; } - if(!dbfmgr.AddCol(path_dbf,"TTO",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) + if(!dbfmgr.AddCol(NULL,"TTO",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) { free(info); return FALSE; @@ -8803,7 +8838,7 @@ BOOL Colv_limp_thr::guarda_cols_ctrl(char *path_shp) isec_novac++; k++; } - if(!dbfmgr.AddCol(path_dbf,"SECUENCIA",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) + if(!dbfmgr.AddCol(NULL,"SECUENCIA",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) { free(info); return FALSE; @@ -8833,13 +8868,17 @@ BOOL Colv_limp_thr::guarda_cols_ctrl(char *path_shp) k++; isec_novac++; } - if(!dbfmgr.AddCol(path_dbf,"HORA",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) + if(!dbfmgr.AddCol(NULL,"HORA",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) { free(info); return FALSE; } free(info); + if (!dbfmgr.grabaDbf(path_dbf, &db)) + { + return FALSE; + } return TRUE; } //************************************************************************************* @@ -8854,6 +8893,7 @@ BOOL Colv_limp_thr::guarda_cols_insta(char *path_shp) int h,m,s,insta,i,ninsta,ninsta_parc,ninsta_novac; char tray[OLV_SHP_SZ_CAMP_CHAR]; ManagerDbfGdataTable dbfmgr; + GdataTable db; //añade una columna strcpy_s(path_dbf,MAX_PATH,path_shp); @@ -8878,6 +8918,11 @@ BOOL Colv_limp_thr::guarda_cols_insta(char *path_shp) } memset(info,0,ninsta* OLV_SHP_SZ_CAMP_SZ); AddColsDbf dataDbf(info); + if (!dbfmgr.LeeDbf(path_dbf, &db)) + { + free(info); + return FALSE; + } //rellena el nombre del tto ninsta_parc=0; @@ -8895,7 +8940,7 @@ BOOL Colv_limp_thr::guarda_cols_insta(char *path_shp) } ninsta_parc+=ninsta_novac; } - if(!dbfmgr.AddCol(path_dbf,"TTO",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) + if(!dbfmgr.AddCol(NULL,"TTO",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) { free(info); return FALSE; @@ -8935,7 +8980,7 @@ BOOL Colv_limp_thr::guarda_cols_insta(char *path_shp) } ninsta_parc+=ninsta_novac; } - if(!dbfmgr.AddCol(path_dbf,"TRAYECTO",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) + if(!dbfmgr.AddCol(NULL,"TRAYECTO",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) { free(info); return FALSE; @@ -8975,7 +9020,7 @@ BOOL Colv_limp_thr::guarda_cols_insta(char *path_shp) } ninsta_parc+=ninsta_novac; } - if(!dbfmgr.AddCol(path_dbf,"H_INI",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) + if(!dbfmgr.AddCol(NULL,"H_INI",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) { free(info); return FALSE; @@ -8994,6 +9039,8 @@ BOOL Colv_limp_thr::guarda_cols_insta(char *path_shp) continue; tt=olv_limp->plan[i].planif_insta[insta].elem[olv_limp->plan[i].planif_insta[insta].nelem-1].coste; + if((olv_limp->plan[i].planif_insta[insta].ninsta== OLV_IDA_INST) || (olv_limp->plan[i].planif_insta[insta].ninsta == OLV_VUELTA_INST)) + tt+= olv_limp->t_sal; ttt+=tt; dame_h_m_s(tt, &h, &m, &s); sprintf_s(&info[(insta+ninsta_parc)*OLV_SHP_SZ_CAMP_CHAR],OLV_SHP_SZ_CAMP_CHAR,"%02d:%02d:%02d h",h,m,s); @@ -9001,7 +9048,7 @@ BOOL Colv_limp_thr::guarda_cols_insta(char *path_shp) } ninsta_parc+=ninsta_novac; } - if(!dbfmgr.AddCol(path_dbf,"T_TOTAL",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) + if(!dbfmgr.AddCol(NULL,"T_TOTAL",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) { free(info); return FALSE; @@ -9024,7 +9071,7 @@ BOOL Colv_limp_thr::guarda_cols_insta(char *path_shp) } ninsta_parc+=ninsta_novac; } - if(!dbfmgr.AddCol(path_dbf,"M_TOTAL",GdataTable::Tdouble,&dataDbf)) + if(!dbfmgr.AddCol(NULL,"M_TOTAL",GdataTable::Tdouble,&dataDbf)) { free(info); return FALSE; @@ -9032,6 +9079,11 @@ BOOL Colv_limp_thr::guarda_cols_insta(char *path_shp) memset(info,0,ninsta* OLV_SHP_SZ_CAMP_SZ); free(info); + + if (!dbfmgr.grabaDbf(path_dbf, &db)) + { + return FALSE; + } return TRUE; } //************************************************************************************* @@ -9078,12 +9130,14 @@ BOOL Colv_limp_thr::genera_list_rut_ctrl() continue; ii=1; i=0; - t0=olv_limp->t_ini + olv_limp->sec[s].t_despl[0] + olv_limp->t_sal; + t0=olv_limp->t_ini + olv_limp->sec[s].t_despl[0]; if ((olv_limp->nod_instal != -1) && (pp->ninsta>0)) { linst[0] = pp->planif_insta[0].m[OLV_DESP]; linst[1] = pp->planif_insta[pp->ninsta-1].m[OLV_DESP]; + pp->planif_insta[0].t[OLV_TTO] = olv_limp->t_ini + olv_limp->t_sal; + pp->planif_insta[pp->ninsta - 1].t[OLV_TTO] = olv_limp->t_ini + olv_limp->sec[s].cost_ac + olv_limp->t_desc - olv_limp->sec[s].t_despl[1]; } ////////////////////////////////////////////// @@ -9228,8 +9282,6 @@ ctrl: //último punto de control e instalación if((i==(pp->nelem))&& !mal) { - //REVISAR - olv_limp->t_ini+ olv_limp->sec[s].cost_ac + olv_limp->t_desc + olv_limp->t_sal - olv_limp->sec[s].t_despl[1]; //quita_t_ult_desc(s,&tt); dame_h_m_s(tt, &h, &m, &seg); sprintf_s(fila0,256,"%02d;%04d;%s;%s;%s;%s;%02d:%02d:%02d;\r\n",s+1,ii,calle,"","Control - Fin","",h,m,seg); @@ -9252,9 +9304,9 @@ ctrl: } //final - tt = olv_limp->t_ini + olv_limp->sec[s].cost_ac + olv_limp->t_desc + 2 * olv_limp->t_sal; - ////////////////////////////////////////////// - dame_h_m_s(tt- olv_limp->t_sal - olv_limp->sec[s].t_despl[1], &h, &m, &seg); + ////////////////////////////////////////////// + tt = t0; + dame_h_m_s(tt, &h, &m, &seg); if (linst[1] == 0) sprintf_s(fila0, 256, "%02d;%04d;%s;%s;%s;%s;%02d:%02d:%02d;\r\n", s + 1, ii, "", "", "Vuelta a instalación", "", h, m, seg); else @@ -9266,6 +9318,7 @@ ctrl: continue; } + tt = olv_limp->t_ini + olv_limp->sec[s].cost_ac + olv_limp->t_desc; ////////////////////////////////////////////// dame_h_m_s(tt, &h, &m, &seg); sprintf_s(fila0, 256, "%02d;%04d;%s;%s;%s;%s;%02d:%02d:%02d;\r\n", s + 1, ii, "", "", "Fin", "", h, m, seg); diff --git a/Olivia/olv_reco_thr.cpp b/Olivia/olv_reco_thr.cpp index 1d87860..bab62e0 100644 --- a/Olivia/olv_reco_thr.cpp +++ b/Olivia/olv_reco_thr.cpp @@ -681,7 +681,7 @@ double Colv_reco_thr::dame_coste( Secu_amb * sec, int ini, int fin, Info_sec *s, if(ini==0)//si ini es 0 falta sumar el coste de la planta a el primer ambito { d+=olv_limp->arch_dj.dame_dis(olv_limp->arch_dj.id_instal, 0, s->iamb[sec[ini].iamb],0); - //d+=olv_reco->t_sal; + d+=olv_reco->t_sal; //suma el coste de la salida } cap_t+=olv_limp->iaso[olv_limp->carto.get(id_ambf).entity()->ref].inf_r.kg;//suma a la carga total la basura del primer ambito @@ -707,7 +707,7 @@ double Colv_reco_thr::dame_coste( Secu_amb * sec, int ini, int fin, Info_sec *s, d+=olv_reco->ord_sec_plan[OLV_PLANT].ctnod[0][olv_reco->iaso[olv_limp->carto.get(id_ambf).entity()->ref].inod[0]].dis;//suma el coste de ir del ultimo ambito a la planta d+=olv_reco->t_descarg;//suma el coste de descargar d+=olv_reco->ord_sec_plan[OLV_INSTAL].ctnod[0][olv_reco->nod_plant].dis;//suma el coste de ir de planta a instalacion - //d+=olv_reco->t_sal;//suma el coste de la llegada + d+=olv_reco->t_sal;//suma el coste de la llegada int iold=-1; BOOL errores=FALSE; @@ -876,7 +876,7 @@ double Colv_reco_thr::dame_coste_pon_viajes( Secu_amb * sec, int ini, int fin, I if(ini==0)//si ini es 0 falta sumar el coste de la planta a el primer ambito { d+=olv_limp->arch_dj.dame_dis(olv_limp->arch_dj.id_instal, 0, s->iamb[sec[ini].iamb],0); - //d+=olv_reco->t_sal;//suma el coste de la llegada + d+=olv_reco->t_sal;//suma el coste de la salida } cap_t+=olv_limp->iaso[olv_limp->carto.get(id_ambf).entity()->ref].inf_r.kg;//suma a la carga total la basura del primer ambito @@ -906,8 +906,8 @@ double Colv_reco_thr::dame_coste_pon_viajes( Secu_amb * sec, int ini, int fin, I nv_p--;//se descuenta uno porque se tiene que terminar en planta d+=olv_reco->ord_sec_plan[OLV_PLANT].ctnod[0][olv_reco->iaso[olv_limp->carto.get(id_ambf).entity()->ref].inod[0]].dis;//suma el coste de ir del ultimo ambito a la planta d+=olv_reco->ord_sec_plan[OLV_INSTAL].ctnod[0][olv_reco->nod_plant].dis;//suma el coste de ir de planta a instalacion + d+=olv_reco->t_sal;//suma el coste de la llegada d+=olv_reco->t_descarg;//suma el coste de descargar - //d+=olv_reco->t_sal;//suma el coste de la llegada /////////////////////////// coste=MAYUSCULO; @@ -1205,15 +1205,15 @@ void Colv_reco_thr::planifica_sub_1(int ithr, Matrix2d &cost_amb) /////////////////////////////////////////// //Añade la ruta de la instalación al primer punto - + double cc = 0, cc1 = 0; olv_limp->arch_dj.get_b(s->iamb[secu_ambi[0].iamb],secu_ambi[0].entrada, buf_aux); - Colv_geom::ruta_dj_inv_ok( + cc+=Colv_geom::ruta_dj_inv_ok( olv_reco->nod_instal,//id conjuncion inicial &secu2[0], //puntero a secuencia buf_aux, //nodos djktra conj final olv_limp->conjs.n, &nsecu2); - + cc += olv_limp->t_sal; if(!genera_planif_vaci(is,0, nsecu2, secu2,OLV_IDA_INST)) sal=TRUE; /////////////////////////////////////////// @@ -1222,7 +1222,6 @@ void Colv_reco_thr::planifica_sub_1(int ithr, Matrix2d &cost_amb) secu[0]=olv_limp->iaso[olv_limp->carto.get(s->iamb[secu_ambi[0].iamb]).entity()->ref].inod[secu_ambi[0].entrada]; aa[s->iamb[secu_ambi[0].iamb]].iseq=0; //olv_limp->t_conv - double cc=0, cc1=0; ss=1; int iam_ped; int iam_ent; @@ -1239,6 +1238,7 @@ void Colv_reco_thr::planifica_sub_1(int ithr, Matrix2d &cost_amb) olv_reco->ord_sec_plan[OLV_PLANT].ctnod[0], //nodos djktra conj final olv_limp->conjs.n, &nsecu2); + cc += olv_reco->t_descarg; if(!genera_planif_vaci(is,0, nsecu2, secu2,OLV_IDA_PLANT)) { sal=TRUE; @@ -1306,6 +1306,7 @@ void Colv_reco_thr::planifica_sub_1(int ithr, Matrix2d &cost_amb) olv_reco->ord_sec_plan[OLV_PLANT].ctnod[0], //nodos djktra conj final olv_limp->conjs.n, &nsecu2); + cc += olv_reco->t_descarg; if(!genera_planif_vaci(is,0, nsecu2, secu2,OLV_IDA_PLANT)) { sal=TRUE; @@ -1320,6 +1321,7 @@ void Colv_reco_thr::planifica_sub_1(int ithr, Matrix2d &cost_amb) olv_reco->ord_sec_plan[OLV_INSTAL].ctnod[0], //nodos djktra conj final olv_limp->conjs.n, &nsecu2); + cc += olv_limp->t_sal; if(!genera_planif_vaci(is,0, nsecu2, secu2,OLV_VUELTA_INST)) { sal=TRUE; @@ -1339,8 +1341,8 @@ void Colv_reco_thr::planifica_sub_1(int ithr, Matrix2d &cost_amb) //genera la ruta y los puntos de control if(!genera_planif(is,s->cost_despl_aux/*-cc*/, ss, secu,OLV_PLAN_RECO)) sal=TRUE; - olv_limp->sec[is].cost_ac=s->cost_despl_aux; - //olv_limp->sec[is].cost_ac=(float)(olv_limp->plan[is].elem[olv_limp->plan[is].nelem-1].coste+olv_limp->sec[is].t_despl[0]+olv_limp->sec[is].t_despl[1]); + //olv_limp->sec[is].cost_ac = s->cost_despl_aux; + olv_limp->sec[is].cost_ac=(float)(olv_limp->plan[is].elem[olv_limp->plan[is].nelem-1].coste+cc); } ////////////////////////////////// if( secu_ambi) @@ -1487,7 +1489,7 @@ BOOL Colv_reco_thr::genera_list_fila_vaci(Colv_csv *cc, char *fila0, int ielem, ltot=pp->m[OLV_DESP]; ////////////////// - //pone el tiempo acumulado, aprovecha y lo guarda aquí + //pone el tiempo acumulado anterior, en el que se inicia este vaciado, aprovecha y lo guarda aquí pp->t[OLV_TTO]=tt; ////////////////// @@ -1516,14 +1518,17 @@ BOOL Colv_reco_thr::genera_list_fila_vaci(Colv_csv *cc, char *fila0, int ielem, pp->m[OLV_TTO]=kgac; ////////////////// - *t0+=cost_despl+olv_reco->t_descarg; - tt+=cost_despl+olv_reco->t_descarg; dame_h_m_s(tt, &h, &m, &seg); sprintf_s(fila0,256,"%02d;%04d;%s;%.1f;%s;%.1f;%02d:%02d:%02d;\r\n",isec+1,secu,"",kgac,"Ida a descargar",ltot,h,m,seg); if(!cc->escribe(fila0)) { return FALSE; } + *t0 += cost_despl + olv_reco->t_descarg; + tt += cost_despl + olv_reco->t_descarg; + + if (is_fin) + *t0 = tt; if(olv_reco->ptos_vaci[iamb]!=(short)OLV_IDA_PLANT) return TRUE; @@ -1554,6 +1559,7 @@ BOOL Colv_reco_thr::genera_list_fila_vaci(Colv_csv *cc, char *fila0, int ielem, //reinicia, para que no vuelva a entrar olv_reco->ptos_vaci[iamb]=0; + return TRUE; } //************************************************************************************* @@ -1591,6 +1597,7 @@ BOOL Colv_reco_thr::guarda_cols_ruta(char *path_shp) int h,m,s,j; int nsec, i, isec_novac,p; ManagerDbfGdataTable dbfmgr; + GdataTable db; //cuenta el número de sectores no vacíos nsec=0; @@ -1605,7 +1612,6 @@ BOOL Colv_reco_thr::guarda_cols_ruta(char *path_shp) if(!Colv_limp_thr::guarda_cols_ruta(path_shp)) return FALSE; - //añade una columna a la ruta de tiempo de ruta strcpy_s(path_dbf,MAX_PATH,path_shp); //cambiaext(path_dbf,".shp",".dbf"); strcpy((Cdir_manager::extension_archivo(path_dbf)),"dbf"); @@ -1617,27 +1623,25 @@ BOOL Colv_reco_thr::guarda_cols_ruta(char *path_shp) } memset(info,0,nsec* OLV_SHP_SZ_CAMP_SZ); AddColsDbf dataDbf(info); - - /*//sustituye la info de hora final - isec_novac=0; - for(i=0;insec;i++) - { - if(olv_limp->sec[i].namb==0) - { - continue; - } - tt=olv_limp->t_ini+ olv_limp->sec[i].cost_ac + olv_limp->t_desc; - - dame_h_m_s(tt, &h, &m, &s); - sprintf_s(&info[isec_novac*OLV_SHP_SZ_CAMP_CHAR],OLV_SHP_SZ_CAMP_CHAR,"%02d:%02d:%02d h",h,m,s); - isec_novac++; - } - if(!dbfmgr.AddCol(path_dbf,"H_FIN",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) + if (!dbfmgr.LeeDbf(path_dbf, &db)) + { + free(info); + return FALSE; + } + + //elimina col M_DESP + if (!dbfmgr.DelCol(NULL, "M_DESP")) + { + free(info); + return FALSE; + } + + //renombra T_DESP por T_RUTA + if (!db.rename(db.getInd("T_DESP"),"T_RUTA")) { free(info); return FALSE; } - memset(info,0,nsec* OLV_SHP_SZ_CAMP_SZ);*/ //sustituye col m total isec_novac = 0; @@ -1658,7 +1662,7 @@ BOOL Colv_reco_thr::guarda_cols_ruta(char *path_shp) isec_novac++; } - if (!dbfmgr.AddCol(path_dbf, "M_TOTAL", GdataTable::Tdouble, &dataDbf)) + if (!dbfmgr.AddCol(NULL, "M_TOTAL", GdataTable::Tdouble, &dataDbf)) { free(info); return FALSE; @@ -1678,7 +1682,7 @@ BOOL Colv_reco_thr::guarda_cols_ruta(char *path_shp) ((int*)info)[isec_novac] = tt; isec_novac++; } - if(!dbfmgr.AddCol(path_dbf,"UDS_TRAT",GdataTable::Tint,&dataDbf)) + if(!dbfmgr.AddCol(NULL,"UDS_TRAT",GdataTable::Tint,&dataDbf)) { free(info); return FALSE; @@ -1696,7 +1700,7 @@ BOOL Colv_reco_thr::guarda_cols_ruta(char *path_shp) ((double*)info)[isec_novac] = tt; isec_novac++; } - if(!dbfmgr.AddCol(path_dbf,"KG_TOT_REC",GdataTable::Tdouble,&dataDbf)) + if(!dbfmgr.AddCol(NULL,"KG_TOT_REC",GdataTable::Tdouble,&dataDbf)) { free(info); return FALSE; @@ -1714,7 +1718,7 @@ BOOL Colv_reco_thr::guarda_cols_ruta(char *path_shp) ((int*)info)[isec_novac] = tt; isec_novac++; } - if(!dbfmgr.AddCol(path_dbf,"N_DESCARG",GdataTable::Tint,&dataDbf)) + if(!dbfmgr.AddCol(NULL,"N_DESCARG",GdataTable::Tint,&dataDbf)) { free(info); return FALSE; @@ -1739,7 +1743,7 @@ BOOL Colv_reco_thr::guarda_cols_ruta(char *path_shp) sprintf_s(&info[isec_novac*OLV_SHP_SZ_CAMP_CHAR],OLV_SHP_SZ_CAMP_CHAR,"%02d:%02d:%02d h",h,m,s); isec_novac++; } - if(!dbfmgr.AddCol(path_dbf,"T_DESCARG",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) + if(!dbfmgr.AddCol(NULL,"T_DESCARG",GdataTable::Tstring,&dataDbf,OLV_SHP_SZ_CAMP_CHAR)) { free(info); return FALSE; @@ -1763,7 +1767,7 @@ BOOL Colv_reco_thr::guarda_cols_ruta(char *path_shp) isec_novac++; } - if (!dbfmgr.AddCol(path_dbf, "M_DESCARG", GdataTable::Tdouble, &dataDbf)) + if (!dbfmgr.AddCol(NULL, "M_DESCARG", GdataTable::Tdouble, &dataDbf)) { free(info); return FALSE; @@ -1771,6 +1775,11 @@ BOOL Colv_reco_thr::guarda_cols_ruta(char *path_shp) memset(info, 0, nsec * OLV_SHP_SZ_CAMP_SZ); free(info); + + if (!dbfmgr.grabaDbf(path_dbf, &db)) + { + return FALSE; + } return TRUE; } //************************************************************************************* @@ -1785,6 +1794,7 @@ BOOL Colv_reco_thr::guarda_cols_insta(char *path_shp) //int h; int insta, ninsta_parc,ninsta,ninsta_novac; ManagerDbfGdataTable dbfmgr; + GdataTable db; ///////////////////////////////////// @@ -1814,6 +1824,11 @@ BOOL Colv_reco_thr::guarda_cols_insta(char *path_shp) } memset(info,0,ninsta* OLV_SHP_SZ_CAMP_SZ); AddColsDbf dataDbf(info); + if (!dbfmgr.LeeDbf(path_dbf, &db)) + { + free(info); + return FALSE; + } //kg descargados ninsta_parc=0; @@ -1835,7 +1850,7 @@ BOOL Colv_reco_thr::guarda_cols_insta(char *path_shp) } ninsta_parc+=ninsta_novac; } - if(!dbfmgr.AddCol(path_dbf,"KG_DESCARG",GdataTable::Tdouble,&dataDbf)) + if(!dbfmgr.AddCol(NULL,"KG_DESCARG",GdataTable::Tdouble,&dataDbf)) { free(info); return FALSE; @@ -1863,7 +1878,7 @@ BOOL Colv_reco_thr::guarda_cols_insta(char *path_shp) } ninsta_parc+=ninsta_novac; } - if(!dbfmgr.AddCol(path_dbf,"VIAJE",GdataTable::Tint,&dataDbf)) + if(!dbfmgr.AddCol(NULL,"VIAJE",GdataTable::Tint,&dataDbf)) { free(info); return FALSE; @@ -1871,6 +1886,11 @@ BOOL Colv_reco_thr::guarda_cols_insta(char *path_shp) memset(info,0,ninsta* OLV_SHP_SZ_CAMP_SZ); free(info); + + if (!dbfmgr.grabaDbf(path_dbf, &db)) + { + return FALSE; + } return TRUE; } //************************************************************************************* @@ -1891,7 +1911,9 @@ BOOL Colv_reco_thr::guarda_cols_ruta_tram(char *path_shp) char path_dbf[MAX_PATH]; double tt; int i, it,ntram,nt,nt_parc; + Info_planif *pinsta; ManagerDbfGdataTable dbfmgr; + GdataTable db; if(!Colv_limp_thr::guarda_cols_ruta_tram(path_shp)) return FALSE; @@ -1919,22 +1941,34 @@ BOOL Colv_reco_thr::guarda_cols_ruta_tram(char *path_shp) } memset(info,0,ntram* OLV_SHP_SZ_CAMP_SZ); AddColsDbf dataDbf(info); + if (!dbfmgr.LeeDbf(path_dbf, &db)) + { + free(info); + return FALSE; + } - //M_DESP + //M_RUTA nt_parc=0; for(i=0;insec;i++) { if(olv_limp->sec[i].namb==0) continue; nt=(int)olv_limp->tramos[i].size(); + for(it=0;itplan[i].planif_insta; tt=olv_limp->tramos[i][it].long_tr; + //como es solo ruta le quita las instalaciones + tt -= (pinsta[olv_limp->tramos[i][it].iins[0]].m[OLV_DESP] + pinsta[olv_limp->tramos[i][it].iins[1]].m[OLV_DESP]); + if (olv_limp->tramos[i][it].iins[1] > (olv_limp->tramos[i][it].iins[0] + 1)) //si la planta y la instala no son las mismas + tt -= pinsta[olv_limp->tramos[i][it].iins[1] - 1].m[OLV_DESP]; + ((double*)info)[nt_parc + it] = tt; } nt_parc+=nt; } - if(!dbfmgr.AddCol(path_dbf,"M_RUTA",GdataTable::Tdouble,&dataDbf)) + if(!dbfmgr.AddCol(NULL,"M_RUTA",GdataTable::Tdouble,&dataDbf)) { free(info); return FALSE; @@ -1955,7 +1989,7 @@ BOOL Colv_reco_thr::guarda_cols_ruta_tram(char *path_shp) } nt_parc+=nt; } - if(!dbfmgr.AddCol(path_dbf,"N_AMB",GdataTable::Tint,&dataDbf)) + if(!dbfmgr.AddCol(NULL,"N_AMB",GdataTable::Tint,&dataDbf)) { free(info); return FALSE; @@ -1976,7 +2010,7 @@ BOOL Colv_reco_thr::guarda_cols_ruta_tram(char *path_shp) } nt_parc+=nt; } - if(!dbfmgr.AddCol(path_dbf,"UDS_TRAT",GdataTable::Tint,&dataDbf)) + if(!dbfmgr.AddCol(NULL,"UDS_TRAT",GdataTable::Tint,&dataDbf)) { free(info); return FALSE; @@ -1997,12 +2031,18 @@ BOOL Colv_reco_thr::guarda_cols_ruta_tram(char *path_shp) } nt_parc+=nt; } - if(!dbfmgr.AddCol(path_dbf,"KG_TOT_REC",GdataTable::Tdouble,&dataDbf)) + if(!dbfmgr.AddCol(NULL,"KG_TOT_REC",GdataTable::Tdouble,&dataDbf)) { free(info); return FALSE; } memset(info,0,ntram* OLV_SHP_SZ_CAMP_SZ); + free(info); + + if (!dbfmgr.grabaDbf(path_dbf, &db)) + { + return FALSE; + } return TRUE; } //************************************************************************************* @@ -2015,6 +2055,8 @@ void Colv_reco_thr::rellena_tramos() Info_tramos *tramo; int ie,it,nt; + Colv_limp_thr::rellena_tramos(); + for(int is=0;isnsec;is++) { pp=&olv_limp->plan[is]; @@ -2022,27 +2064,13 @@ void Colv_reco_thr::rellena_tramos() for(it=0;ittramos[is][it]; - tramo->namb=0; tramo->ncont=0; for(ie=tramo->ie[0]; ie<=tramo->ie[1];ie++) { - tramo->long_tr+=(float) pp->elem[ie].ltot; - if(pp->elem[ie].tp!=OLV_PLAN_TIP_AMB) + if (pp->elem[ie].tp != OLV_PLAN_TIP_AMB) continue; - - tramo->namb++; tramo->ncont+=olv_limp->iaso[olv_limp->iaso[pp->elem[ie].refe].refe2].inf_r.uds; - } - - tramo->t_tto_tr = (float)(tramo->ncont*olv_reco->t_tto); - if(it==0) - tramo->t_ini = (float)(olv_limp->t_ini+pp->planif_insta[0].elem[pp->planif_insta[0].nelem-1].coste); - else - tramo->t_ini = (float)(pp->planif_insta[2*it].t[OLV_TTO]+pp->planif_insta[2*it].elem[pp->planif_insta[2*it].nelem-1].coste); - - tramo->t_fin = (float)pp->planif_insta[2*it+1].t[OLV_TTO]; - - tramo->t_total_tr = (float) (tramo->t_fin-tramo->t_ini); + } } } } @@ -2059,6 +2087,8 @@ int Colv_reco_thr::rellena_insta_tramos() Info_planif *pinsta; Info_tramos *tramo; + Colv_limp_thr::rellena_insta_tramos(); + ii=0; //para saber si hace algún tramo o no for(int is=0;isnsec;is++) { @@ -2069,36 +2099,19 @@ int Colv_reco_thr::rellena_insta_tramos() if(olv_limp->plan[is].planif_insta[nins-1].nelem==0) nins--; //es porque la descarga y planta son la misma pinsta = olv_limp->plan[is].planif_insta; - for(it=0;ittramos[is][it]; - tramo->iins[0]=2*it; - tramo->iins[1]=2*it+1; - /////////////////////////////////////// - //Actualiza los tiempos del tramo sumando los tiempos del viaje a inst - tramo->t_ini -= (float)pinsta[tramo->iins[0]].elem[pinsta[tramo->iins[0]].nelem-1].coste; - tramo->t_fin += (float)pinsta[tramo->iins[1]].elem[pinsta[tramo->iins[1]].nelem-1].coste; - tramo->t_total_tr=(float) (tramo->t_fin-tramo->t_ini); + if (it == 0)//primer tramo, le suma el tiempo de llegar + tramo->t_ini -= olv_limp->t_sal; + tramo->t_fin += olv_reco->t_descarg; + if(it == (nt-1)) + tramo->t_fin += olv_limp->t_sal; + + tramo->t_total_tr = (float)(tramo->t_fin - tramo->t_ini); } - //para el último tramo - tramo = &olv_limp->tramos[is][it]; - tramo->iins[0]=2*it; - tramo->iins[1]=nins-1; - tramo->t_ini -= (float)pinsta[tramo->iins[0]].elem[pinsta[tramo->iins[0]].nelem-1].coste; - //si la instalación no es la misma que la descarga, le suma el tiempo de ir a descargar y el de ir a la instalación - BOOL notdesc=TRUE; - for(int i=tramo->iins[0]+1;i<=tramo->iins[1];i++) - { - if(notdesc) - { - tramo->t_fin += olv_reco->t_descarg; - notdesc=FALSE; - } - tramo->t_fin += (float)pinsta[i].elem[pinsta[i].nelem-1].coste; - } - tramo->t_total_tr=(float) (tramo->t_fin-tramo->t_ini); - ii++; + ii++; } return ii; }