Correcciones al dar sentido de circulacion a los ambitos

master
Gerardo 2024-04-26 08:20:31 +02:00
parent 4d3eff1dce
commit d4cc0745f6
6 changed files with 163 additions and 24 deletions

View File

@ -449,6 +449,13 @@ int Colv_limp::pon_config(char *config_)
break; break;
} }
else if (strstr(token, OliviaDef::GeneralDef::GG_senAmb))
{
if (!olv->dame_param(token, &sentido_ambitos))
break;
//sentido_ambitos = 0;
}
else if (strstr(token, OliviaDef::GeneralDef::GG_conj)) else if (strstr(token, OliviaDef::GeneralDef::GG_conj))
{ {
if (!olv->dame_param(token, (int*)&revisa_conju)) if (!olv->dame_param(token, (int*)&revisa_conju))
@ -929,6 +936,19 @@ void Colv_limp::dame_cost(double ltot, int ia, float *cost, float *cost2)
ancho=ancho_via; ancho=ancho_via;
*cost2=*cost=(float)(ltot*ancho*3600/t_tto); //en segundos *cost2=*cost=(float)(ltot*ancho*3600/t_tto); //en segundos
if (*cost2 > 10000)
{
*cost2 = *cost2;
}
if (sentido_ambitos == 1)
{
//revisa si el segmento es solo de entrada o solo de salida
if (iaso[ia].flgs & OLV_LIMP_FLG_CIRC_FT)
*cost2 = (float)MAYUSCULO;
else if (iaso[ia].flgs & OLV_LIMP_FLG_CIRC_TF)
*cost = (float)MAYUSCULO;
}
} }
else if(tipo_ambit==OLV_AMB_PUN) else if(tipo_ambit==OLV_AMB_PUN)
{ {
@ -944,6 +964,14 @@ void Colv_limp::dame_cost(double ltot, int ia, float *cost, float *cost2)
{ {
//coste fijo para los segmentos //coste fijo para los segmentos
*cost2 = *cost = 0;// (float)(ltot / (3 * OLV_KMH2MS));//OLV_LIMP_COST_SEGM *cost2 = *cost = 0;// (float)(ltot / (3 * OLV_KMH2MS));//OLV_LIMP_COST_SEGM
if (sentido_ambitos == 1)
{
//revisa si el segmento es solo de entrada o solo de salida
if (iaso[ia].flgs & OLV_LIMP_FLG_CIRC_FT)
*cost2 = (float)MAYUSCULO;
else if (iaso[ia].flgs & OLV_LIMP_FLG_CIRC_TF)
*cost = (float)MAYUSCULO;
}
} }
else if(iaso[ia].flgs & OLV_LIMP_FLG_PEAT_REP) else if(iaso[ia].flgs & OLV_LIMP_FLG_PEAT_REP)
{ {

View File

@ -44,6 +44,8 @@ public:
int nsec_orig; ///<Número de sectores original, se usa por si se corrige el num de sectores porque haya alguno vacío int nsec_orig; ///<Número de sectores original, se usa por si se corrige el num de sectores porque haya alguno vacío
int res_circ; ///<Restricción de circulación int res_circ; ///<Restricción de circulación
int res_angulos; ///<Restricción de angulos int res_angulos; ///<Restricción de angulos
int sentido_ambitos; ///asigna sentido a los abmbitos si =1 si =0 no
int lateral; ///<Lateralidad, 0 o -1 ambos, 1 derecha, 2 izda int lateral; ///<Lateralidad, 0 o -1 ambos, 1 derecha, 2 izda
int tipo_shp_viaj; ///<Indica la forma en que se guardan los viajes según la enum TipoViajes int tipo_shp_viaj; ///<Indica la forma en que se guardan los viajes según la enum TipoViajes
int t_sal; ///<Tiempo de salida/llegada a la instalación, en segundos int t_sal; ///<Tiempo de salida/llegada a la instalación, en segundos

View File

@ -278,6 +278,8 @@ typedef struct Info_aso2
int inod[2]; //índice a los nodos ini y final de la entidad int inod[2]; //índice a los nodos ini y final de la entidad
int oid; //objetct id de la carto int oid; //objetct id de la carto
int refe2; //en los segmentos o replicadas, el ámbito original int refe2; //en los segmentos o replicadas, el ámbito original
int refe3; //en los ámbitos lineales, su segmento inicial, el que está en su punto 0.
//En los segmentos, la nw a la que está enganchado
int refe; //referencia en la carto a ese elemento int refe; //referencia en la carto a ese elemento
int iamb; //índice al ámbito que es int iamb; //índice al ámbito que es
union union
@ -296,7 +298,7 @@ typedef struct Info_aso2
{ {
flgs=0; flgs=0;
iamb=-1; iamb=-1;
inod[0]=inod[1]=oid=refe2=refe=-1; inod[0]=inod[1]=oid=refe2=refe=refe3=-1;
inf_r.id=inf_n.nomb=0; inf_r.id=inf_n.nomb=0;
inf_n.velo=inf_l.ancho=inf_r.kg=-1; inf_n.velo=inf_l.ancho=inf_r.kg=-1;
inf_r.uds=0; inf_r.uds=0;

View File

@ -1748,6 +1748,8 @@ BOOL Colv_limp_thr::replica_doble_sent(Info_inw_dmin *inww_ord)
info_aux.refe=ientcp.entity()->ref; info_aux.refe=ientcp.entity()->ref;
//copia la velo y el nombre //copia la velo y el nombre
info_aux.inf_n.velo=olv_limp->iaso[refnw].inf_n.velo; info_aux.inf_n.velo=olv_limp->iaso[refnw].inf_n.velo;
info_aux.velReal = olv_limp->iaso[refnw].velReal;
info_aux.inf_n.nomb = (char*)malloc(strlen(olv_limp->iaso[refnw].inf_n.nomb)+1); info_aux.inf_n.nomb = (char*)malloc(strlen(olv_limp->iaso[refnw].inf_n.nomb)+1);
if(!info_aux.inf_n.nomb) if(!info_aux.inf_n.nomb)
break; break;
@ -1845,17 +1847,11 @@ BOOL Colv_limp_thr::une_amb_nw(int soloi)
int KK,i,refamb,k; int KK,i,refamb,k;
CartoBaseInfoEntity iamb; CartoBaseInfoEntity iamb;
BOOL comp_lejos,modo_ejes=FALSE; BOOL comp_lejos,modo_ejes=FALSE;
comp_lejos=(olv_limp->res_circ<OLV_RES_RECOGER_SOLO_LADO_Y_GIROS) && ((olv_limp->uds_tto!=OliviaDef::GeneralDef::OlvTipTtoMh_eje) &&
(olv_limp->uds_tto!=OliviaDef::GeneralDef::OlvTipTtoM2h_eje));
//si es tipo ejes, lo hace de otra forma //si es tipo ejes, lo hace de otra forma
if((olv_limp->uds_tto==OliviaDef::GeneralDef::OlvTipTtoMh_eje) || modo_ejes = (olv_limp->uds_tto == OliviaDef::GeneralDef::OlvTipTtoMh_eje) ||
(olv_limp->uds_tto==OliviaDef::GeneralDef::OlvTipTtoM2h_eje)) (olv_limp->uds_tto == OliviaDef::GeneralDef::OlvTipTtoM2h_eje);
{ comp_lejos=(olv_limp->res_circ<OLV_RES_RECOGER_SOLO_LADO_Y_GIROS) && modo_ejes;
modo_ejes=TRUE;
}
////////////////// //////////////////
//coge el factor del tipo de ámbito, 1 si es puntual, 2 si es lineal //coge el factor del tipo de ámbito, 1 si es puntual, 2 si es lineal
KK=olv_limp->tipo_ambit; KK=olv_limp->tipo_ambit;
@ -1978,6 +1974,86 @@ BOOL Colv_limp_thr::une_amb_nw(int soloi)
} }
} }
//*************************************************//
/*Revisa si tiene que ponerle sentido de entrada o salida a los segmentos de unión, para respetar que
trabaje los ámbitos en el mismo sentido que la calle
Solo aplicable a ámbitos lineales*/
if (!(olv_limp->sentido_ambitos == 1 && KK == OLV_AMB_LIN))
return TRUE;
//Revisa sentidos
int refsegini=-1, refsegfin=-1;
int nent = olv_limp->carto.getNumberEntities();
int refnw=-1;
CartoBaseInfoEntity ientseg;
CartoBaseInfoEntity ientnw;
double *pto0nw, *ptoNamb;
bool nwder = false, ambder = false;
//Bucle por cada ámbito
for (i = 0; i < olv_limp->n_amb && !pirate; i++)
{
iamb = olv_limp->carto.getEntity(i);
refamb = iamb.entity()->ref;
//busca su segmento inicial
refsegini = olv_limp->iaso[refamb].refe3;
if (refsegini<0 || refsegini>nent)
continue;
ientseg= olv_limp->carto.getRef(refsegini);
refsegfin = olv_limp->iaso[refsegini].refe3;
//busca la inw donde está apuntado
refnw = olv_limp->inww_amb[i].refnw;
ientnw= olv_limp->carto.getRef(refnw);
//coge el punto anterior de la nw
pto0nw = ientnw.getPto(olv_limp->inww_amb[i].ip);
// coge el punto siguiente del ámbito
ptoNamb = iamb.getPto(1);
nwder = false;
ambder = false;
nwder = GeometryFunction::IsDer(&ientseg, pto0nw, 0, 1);
ambder = GeometryFunction::IsDer(&ientseg, ptoNamb, 0, 1);
if((nwder && ambder) || (!nwder && !ambder))
{
//están al mismo lado el punto from de la nw y el final del ámbito
if ((olv_limp->iaso[refnw].flgs & OLV_LIMP_FLG_CIRC_FT) ||
(!(olv_limp->iaso[refnw].flgs & (OLV_LIMP_FLG_CIRC_FT | OLV_LIMP_FLG_CIRC_TF)) && olv_limp->iaso[refamb].flgs & OLV_LIMP_FLG_DER))
{
//el segmento es solo salida, sentido TF, porque el T es el 1 y el F es el 0, que es el que coincide con la carto
olv_limp->iaso[refsegini].flgs |= OLV_LIMP_FLG_CIRC_TF;
olv_limp->iaso[refsegfin].flgs |= OLV_LIMP_FLG_CIRC_FT;
olv_limp->iaso[refamb].flgs |= OLV_LIMP_FLG_CIRC_TF;
}
else
{
//el segmento es solo entrada, sentido FT
olv_limp->iaso[refsegini].flgs |= OLV_LIMP_FLG_CIRC_FT;
olv_limp->iaso[refsegfin].flgs |= OLV_LIMP_FLG_CIRC_TF;
olv_limp->iaso[refamb].flgs |= OLV_LIMP_FLG_CIRC_FT;
}
}
else
{
//están a distinto lado
//están a distinto lado el punto from de la nw y el final del ámbito
if ((olv_limp->iaso[refnw].flgs & OLV_LIMP_FLG_CIRC_FT) ||
(!(olv_limp->iaso[refnw].flgs & (OLV_LIMP_FLG_CIRC_FT | OLV_LIMP_FLG_CIRC_TF)) && olv_limp->iaso[refamb].flgs & OLV_LIMP_FLG_DER))
{
//el segmento es solo entrada, sentido FT, porque el T es el 1 y el F es el 0, que es el que coincide con la carto
olv_limp->iaso[refsegini].flgs |= OLV_LIMP_FLG_CIRC_FT;
olv_limp->iaso[refsegfin].flgs |= OLV_LIMP_FLG_CIRC_TF;
olv_limp->iaso[refamb].flgs |= OLV_LIMP_FLG_CIRC_FT;
}
else
{
//el segmento es solo salida, sentido TF
olv_limp->iaso[refsegini].flgs |= OLV_LIMP_FLG_CIRC_TF;
olv_limp->iaso[refsegfin].flgs |= OLV_LIMP_FLG_CIRC_FT;
olv_limp->iaso[refamb].flgs |= OLV_LIMP_FLG_CIRC_TF;
}
}
}
//*************************************************//
return TRUE; return TRUE;
} }
//************************************************************************************* //*************************************************************************************
@ -2380,7 +2456,7 @@ fin:
void Colv_limp_thr::add_uniones_obj(int i_amb) void Colv_limp_thr::add_uniones_obj(int i_amb)
{ {
double ptos[2][3]; double ptos[2][3];
int refamb,nptos,KK, refnw,npt_amb; int refamb,nptos,KK, refnw,npt_amb, refsegini;
CartoBaseInfoEntity ientamb,ientnw,ientseg; CartoBaseInfoEntity ientamb,ientnw,ientseg;
CartoLine ptos_aux; CartoLine ptos_aux;
INT64 ff; INT64 ff;
@ -2465,7 +2541,21 @@ void Colv_limp_thr::add_uniones_obj(int i_amb)
info_aux.flgs=ff; info_aux.flgs=ff;
info_aux.refe=ientseg.entity()->ref; info_aux.refe=ientseg.entity()->ref;
info_aux.refe2=ientamb.entity()->ref; info_aux.refe2=ientamb.entity()->ref;
info_aux.refe3 = refnw;
olv_limp->iaso[info_aux.refe]=info_aux; olv_limp->iaso[info_aux.refe]=info_aux;
if (k == 0)
{
//apunta la refe3 del ámbito al primer segmento,el que está unido a su punto 0
//solo aplicable a ámbitos lineales
olv_limp->iaso[refamb].refe3 = info_aux.refe;
refsegini = info_aux.refe;
}
else
{
//apunta la refe3 del segmento inicial al segmento final
if(refsegini>0 && refsegini< olv_limp->iaso.size())
olv_limp->iaso[refsegini].refe3 = info_aux.refe;
}
if(inww->inw_old)//ojo if(inww->inw_old)//ojo
{ {
@ -4840,15 +4930,20 @@ void Colv_limp_thr::calcula_cost_amb_sub(int ithr)
if(na==i) if(na==i)
{ {
//el coste de un ámbito a sí mismo es el de trabajar ese ámbito //el coste de un ámbito a sí mismo es el de trabajar ese ámbito
float faux = olv_limp->cost_conj[olv_limp->iaso[ref_na].inod[1]][olv_limp->iaso[ref_na].inod[0]];
olv_limp->cost_amb[amb_na][amb_na]=olv_limp->cost_conj[olv_limp->iaso[ref_na].inod[0]][olv_limp->iaso[ref_na].inod[1]]; olv_limp->cost_amb[amb_na][amb_na]=olv_limp->cost_conj[olv_limp->iaso[ref_na].inod[0]][olv_limp->iaso[ref_na].inod[1]];
if (olv_limp->cost_amb[amb_na][amb_na] > faux)
{
olv_limp->cost_amb[amb_na][amb_na] = faux;
}
continue; continue;
} }
//todo costes
if(olv_limp->cost_amb[amb_i][amb_na]>costes_nodos[olv_limp->iaso[ref_i].inod[0]].dis) if(olv_limp->cost_amb[amb_i][amb_na]>costes_nodos[olv_limp->iaso[ref_i].inod[0]].dis)
olv_limp->cost_amb[amb_i][amb_na]=costes_nodos[olv_limp->iaso[ref_i].inod[1]].dis; olv_limp->cost_amb[amb_i][amb_na]=costes_nodos[olv_limp->iaso[ref_i].inod[0]].dis;
if(KK==OLV_AMB_LIN) if(KK==OLV_AMB_LIN)
{ {
if(olv_limp->cost_amb[amb_i][amb_na]>costes_nodos[olv_limp->iaso[ref_i].inod[0]].dis) if(olv_limp->cost_amb[amb_i][amb_na]>costes_nodos[olv_limp->iaso[ref_i].inod[1]].dis)
olv_limp->cost_amb[amb_i][amb_na]=costes_nodos[olv_limp->iaso[ref_i].inod[1]].dis; olv_limp->cost_amb[amb_i][amb_na]=costes_nodos[olv_limp->iaso[ref_i].inod[1]].dis;
} }
} }
@ -8337,7 +8432,11 @@ BOOL Colv_limp_thr::genera_planif_aux(int is, Info_sec *ss, Info_planif *pp, int
if(!ambs_sec) if(!ambs_sec)
return FALSE; return FALSE;
memset(ambs_sec,0,ss->namb); memset(ambs_sec,0,ss->namb);
double velo;
if (olv_limp->v_despl == 0)
velo = OLV_LIMP_VELO_CIRC_NW * OLV_KMH2MS;
else
velo = olv_limp->v_despl;
//bucle para cada conjunción de la secuencia //bucle para cada conjunción de la secuencia
for(i=0;i<nsecu-1 && !sal;i++) for(i=0;i<nsecu-1 && !sal;i++)
{ {
@ -8403,10 +8502,16 @@ BOOL Colv_limp_thr::genera_planif_aux(int is, Info_sec *ss, Info_planif *pp, int
{ {
tp=OLV_PLAN_TIP_NW; //es la segunda vez que pasa por ahí tp=OLV_PLAN_TIP_NW; //es la segunda vez que pasa por ahí
dt=OLV_DESP; dt=OLV_DESP;
cost=ltot/olv_limp->v_despl;
cost=ltot/ velo;
} }
else else
{ {
float faux= olv_limp->cost_conj[secu[i+1]][secu[i]];
if (cost > faux)
cost = faux;
//cost = olv_limp->cost_conj[secu[i]][secu[i + 1]];
/////////////////////////////////// ///////////////////////////////////
if(olv_limp->iaso[ref_j].flgs & OLV_LIMP_FLG_AMB_PEAT) if(olv_limp->iaso[ref_j].flgs & OLV_LIMP_FLG_AMB_PEAT)
tp=OLV_PLAN_TIP_AMB_PEAT; tp=OLV_PLAN_TIP_AMB_PEAT;
@ -8449,7 +8554,7 @@ BOOL Colv_limp_thr::genera_planif_aux(int is, Info_sec *ss, Info_planif *pp, int
//en info0 se ha guardado la peatonal original //en info0 se ha guardado la peatonal original
ref_nw=olv_limp->inww_amb[amb_j+!sdire*olv_limp->n_amb].refnw; ref_nw=olv_limp->inww_amb[amb_j+!sdire*olv_limp->n_amb].refnw;
dt=OLV_DESP; dt=OLV_DESP;
cost=ltot/olv_limp->v_despl; cost=ltot/ velo;
} }
else//es carretera else//es carretera
{ {

View File

@ -82,8 +82,8 @@ MAINICON ICON "favicon.ico"
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,0,1,0 FILEVERSION 4,2,2,0
PRODUCTVERSION 4,0,1,0 PRODUCTVERSION 4,2,2,0
FILEFLAGSMASK 0x17L FILEFLAGSMASK 0x17L
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -100,12 +100,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "VSM" VALUE "CompanyName", "VSM"
VALUE "FileDescription", "Launcher de la aplicación Olivia" VALUE "FileDescription", "Launcher de la aplicación Olivia"
VALUE "FileVersion", "4.0.1.0" VALUE "FileVersion", "4.2.2.0"
VALUE "InternalName", "OliviaTasks" VALUE "InternalName", "OliviaTasks"
VALUE "LegalCopyright", "OLIVIA (c) VSM 2020. All rights reserved." VALUE "LegalCopyright", "OLIVIA (c) VSM 2020. All rights reserved."
VALUE "OriginalFilename", "OliviaTasks.exe" VALUE "OriginalFilename", "OliviaTasks.exe"
VALUE "ProductName", "OliviaTasks" VALUE "ProductName", "OliviaTasks"
VALUE "ProductVersion", "4.0.1.0" VALUE "ProductVersion", "4.2.2.0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -51,7 +51,7 @@ namespace OliviaDef
public const int ProgrMax = 100; public const int ProgrMax = 100;
public const int ProgrStep = 5; public const int ProgrStep = 5;
public const int ParamN = 5; public const int ParamN = 5;
public const int ParamLimpN = 49; public const int ParamLimpN = 50;
public const int ParamRecoN = 47; public const int ParamRecoN = 47;
/* /*
* Define el separador entre parámetros de la llamada al proceso oliviatasks * Define el separador entre parámetros de la llamada al proceso oliviatasks
@ -165,6 +165,8 @@ namespace OliviaDef
public const string GG_topo = "reviTopo"; public const string GG_topo = "reviTopo";
public const string GG_conj = "reviConj"; public const string GG_conj = "reviConj";
public const string GG_angu = "reviAng"; public const string GG_angu = "reviAng";
public const string GG_senAmb = "sentAmb";
/** /**
* Define las propiedades de limpieza a enviar a oliviatasks * Define las propiedades de limpieza a enviar a oliviatasks
*/ */