Skip to content

Commit 9c1d691

Browse files
committed
Fixed OD_link weg optimalisatie
1 parent eeea37f commit 9c1d691

File tree

6 files changed

+56
-31
lines changed

6 files changed

+56
-31
lines changed

cfg/main/Analyses.dms

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,11 @@ container Analyses: Using = "Units;Classifications;geometries;sourcedata"
184184

185185
#include<ComputeProxy.dms>
186186

187-
container RunPerMS:=
188-
for_each_ne(
189-
RegionalUnits/Continental_EU/name
190-
, 'PerMemberState_T('+quote(RegionalUnits/Continental_EU/name)+')'
191-
);
187+
// container RunPerMS:=
188+
// for_each_ne(
189+
// RegionalUnits/Continental_EU/name
190+
// , 'PerMemberState_T('+quote(RegionalUnits/Continental_EU/name)+')'
191+
// );
192192

193193
Template PerMemberState_T
194194
{

cfg/main/Geometries.dms

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ container Geometries
2727
parameter<float64> y_min := 4700000d;
2828
parameter<float64> y_max := 5230000d;
2929
}
30+
container Extent_Amsterdam
31+
{
32+
//Extent Amsterdam
33+
parameter<float64> x_min := 3960000d;
34+
parameter<float64> x_max := 3987000d;
35+
parameter<float64> y_min := 3250000d;
36+
parameter<float64> y_max := 3270000d;
37+
}
3038

3139
container Extent := ='Extent_'+ModelParameters/CountryFolder;
3240

@@ -42,7 +50,9 @@ container Geometries
4250
attribute<.> ordinal := id(.);
4351
}
4452

45-
attribute<BaseProjection> polygon (poly) := points2sequence(point_set/point, point_set/sequence_rel, point_set/ordinal);
53+
attribute<BaseProjection> geometry (poly) := points2sequence(point_set/point, point_set/sequence_rel, point_set/ordinal);
54+
55+
unit<uint32> result := selection_polygon;
4656
}
4757

4858
unit<ipoint> Base_grid_1km := SourceData/Locations/Population, DialogData = "BaseProjection"

cfg/main/ModelParameters.dms

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
container ModelParameters : using = "units"
22
{
3-
parameter<uint32> Org_Gridsize := 50; // 1 5 10 50
4-
parameter<uint32> Dest_Gridsize := 50; // 1 5 10 50
3+
parameter<uint32> Org_Gridsize := 1; // 1 5 10 50
4+
parameter<uint32> Dest_Gridsize := 1; // 1 5 10 50
55
parameter<string> OrgGridsize := string(Org_Gridsize)+'km'; // '1km' 5km 10km 50km
66
parameter<string> DestGridsize := string(Dest_Gridsize)+'km'; // '1km'5km 10km 50km
77
parameter<min_f> MaxTravelTime := 240[min_f];
@@ -10,10 +10,11 @@
1010
parameter<string> StreetTypeSubsetSelectie := 'FuncRoadClass/V/Local_Road_of_Minor_Importance'; //7 FuncRoadClass/V/Local_Road 8 FuncRoadClass/V/Secondary_Road Local_Road_of_Minor_Importance Local_Road_of_High_Importance
1111
parameter<uint8> NumberOfItersForNetworkCleanUp := 10b;
1212

13-
parameter<bool> Use_Country_OD_selection := FALSE; // TRUE FALSE //Country is currently defined as Finland
13+
parameter<bool> Use_Country_OD_selection := TRUE; // TRUE FALSE //Country is currently defined as Finland
1414
parameter<string> PopVersie := '2021_v1_0'; //2021_v1_0 2018
1515
parameter<string> Roads_path := '%NetworkModelDataDir%/Infrastructure/TomTom/'+CountryFolder+'/NW2021_SP_streets_subset.fss';
16-
parameter<string> CountryFolder := Use_Country_OD_selection ? 'Finland' : 'EU';
16+
parameter<string> CountryFolder := Use_Country_OD_selection ? 'Amsterdam' : 'EU'; // Amsterdam Finland EU
17+
parameter<string> OD_SelectionCountry := CountryFolder == 'Amsterdam' ? 'Netherlands' : CountryFolder == 'Finland' ? 'Finland' : 'EU';
1718

1819
container Advanced
1920
{
@@ -72,3 +73,11 @@
7273
}
7374
}
7475
}
76+
77+
// FORward
78+
// F 602 T 924
79+
// F 924 T 603
80+
81+
// backward
82+
// F275 T912
83+
// F912 T 450

cfg/main/SourceData/Infrastructure/TomTom.dms

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Container TomTom : Using = "Units;geometries;classifications/tomtom"
5050
attribute<BaseProjection> Geometry;
5151
attribute<uint64> JNCTID;
5252

53-
attribute<bool> IsWithinStudyArea := IsDefined(point_in_polygon(geometry, Geometries/selection_polygon/polygon));
53+
attribute<bool> IsWithinStudyArea := IsDefined(point_in_polygon(geometry, Geometries/selection_polygon/result/geometry));
5454
}
5555

5656
container Make_Streets
@@ -94,17 +94,17 @@ Container TomTom : Using = "Units;geometries;classifications/tomtom"
9494

9595
unit<uint32> Streets_Selectie := select_with_attr_by_cond(Read_Streets_container, Read_Streets_container/Streets_Selection_Condition)
9696
{
97-
attribute<BaseProjection> geometry_clean (arc) := Impl/geometry_clean;
98-
attribute<uint64> F_JNCTID_directed := Direction == Directions/v/backwards ? T_JNCTID : F_JNCTID; // relevant voor latere routen (bij direction = 3 moet je f_ en t_ swappen, bij 3 & 4 geldt eenrichtingsverkeer) --> Comment van Chris
99-
attribute<uint64> T_JNCTID_directed := Direction == Directions/v/backwards ? F_JNCTID : T_JNCTID; // relevant voor latere routen (bij direction = 3 moet je f_ en t_ swappen, bij 3 & 4 geldt eenrichtingsverkeer) --> Comment van Chris
97+
attribute<BaseProjection> geometry_clean (arc) := Impl/geometry_clean;
98+
attribute<uint64> F_JNCTID_directed := Direction == Directions/v/backwards ? T_JNCTID : F_JNCTID; // relevant voor latere routen (bij direction = 3 moet je f_ en t_ swappen, bij 3 & 4 geldt eenrichtingsverkeer) --> Comment van Chris
99+
attribute<uint64> T_JNCTID_directed := Direction == Directions/v/backwards ? F_JNCTID : T_JNCTID; // relevant voor latere routen (bij direction = 3 moet je f_ en t_ swappen, bij 3 & 4 geldt eenrichtingsverkeer) --> Comment van Chris
100100

101101
container Impl
102102
{
103103
unit<uint32> src := ..;
104104
attribute<BaseProjection> geometry_clean (src, arc) := points2sequence(CleanUp_BeginEndPointLink/seq2points/CleanUpPoints/Point, CleanUp_BeginEndPointLink/seq2points/CleanUpPoints/sequence_rel, CleanUp_BeginEndPointLink/seq2points/CleanUpPoints/NewOrdinal);
105105

106106
container CleanUp_BeginEndPointLink
107-
{
107+
{
108108
//// checks
109109
// #punten per sequence in org moet oneven zijn.
110110
parameter<bool> Check_ModuloIsEen := all(LastOrdinalNr % 2 == 0);
@@ -134,25 +134,19 @@ Container TomTom : Using = "Units;geometries;classifications/tomtom"
134134

135135
container Selection
136136
{
137-
// attribute<bool> Streets_IsJunctionWithinStudyArea (FSS/Streets_src) := FSS/Junctions/IsWithinStudyArea[FSS/Streets_src/F_JNCT_rel];
138-
// attribute<bool> Streets_IsStreetTypeSubsetSelectie (FSS/Streets_src) := ='FSS/Streets_src/FRC_rel <= '+ModelParameters/StreetTypeSubsetSelectie;
139-
// attribute<bool> Streets_Selection_Condition (FSS/Streets_src) := =ModelParameters/UseStreetTypeSubset ? 'Streets_IsStreetTypeSubsetSelectie && Streets_IsJunctionWithinStudyArea' : 'Streets_IsJunctionWithinStudyArea';
140-
141-
// unit<uint32> Streets_selection_unit := select_with_attr_by_cond(FSS/Streets_src, Streets_Selection_Condition);
142-
143137
container Make_Streets_selection := FSS/Streets_Selectie
144138
, StorageName = "=ModelParameters/Roads_path"
145139
{
146140
attribute<BaseProjection> geometry (FSS/Streets_Selectie, arc) := FSS/Streets_Selectie/geometry_clean;
147141
attribute<FuncRoadClass> FRC_rel (FSS/Streets_Selectie) := FSS/Streets_Selectie/FRC_rel;
148-
attribute<uint64> F_JNCTID (FSS/Streets_Selectie) := FSS/Streets_Selectie/F_JNCTID[uint64];
149-
attribute<uint64> T_JNCTID (FSS/Streets_Selectie) := FSS/Streets_Selectie/T_JNCTID[uint64];
142+
attribute<uint64> F_JNCTID (FSS/Streets_Selectie) := FSS/Streets_Selectie/F_JNCTID_directed[uint64];
143+
attribute<uint64> T_JNCTID (FSS/Streets_Selectie) := FSS/Streets_Selectie/T_JNCTID_directed[uint64];
150144
attribute<m> METERS (FSS/Streets_Selectie) := FSS/Streets_Selectie/METERS[m];
151145
attribute<min_f> MINUTES (FSS/Streets_Selectie) := FSS/Streets_Selectie/MINUTES[min_f];
152146
attribute<km_hr> KPH (FSS/Streets_Selectie) := FSS/Streets_Selectie/KPH[km_hr];
153147
attribute<Directions> Direction (FSS/Streets_Selectie) := FSS/Streets_Selectie/Direction;
154148

155-
parameter<uint32> n := #FSS/Streets_Selectie;
149+
parameter<uint32> n := #FSS/Streets_Selectie;
156150
}
157151

158152
container Read_Streets_selection
@@ -172,7 +166,7 @@ Container TomTom : Using = "Units;geometries;classifications/tomtom"
172166
attribute<km_hr> KPH (domain);
173167
attribute<Directions> Direction (domain);
174168

175-
parameter<uint32> n;
169+
parameter<uint32> n;
176170
}
177171
}
178172

@@ -184,7 +178,6 @@ Container TomTom : Using = "Units;geometries;classifications/tomtom"
184178
attribute<uint64> F_JNCTID := Selection/Read_Streets_selection/F_JNCTID;
185179
attribute<uint64> T_JNCTID := Selection/Read_Streets_selection/T_JNCTID;
186180

187-
188181
attribute<km_hr> KPH := Selection/Read_Streets_selection/KPH;
189182
attribute<m> METERS := Selection/Read_Streets_selection/METERS;
190183
attribute<min_f> MINUTES := Selection/Read_Streets_selection/MINUTES;

cfg/main/SourceData/RegionalUnits.dms

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ container RegionalUnits : using = "geometries"
6363
attribute<bool> IsEFTA := EFTA_STAT == 'T';
6464
attribute<bool> IsCC := CC_STAT == 'T';
6565
attribute<bool> IsTerritory := strcount(SVRG_UN, 'Territory') > 0;
66-
unit<uint32> Subset := select_with_attr_by_cond(.,name_engl == 'Finland');
66+
unit<uint32> Subset := select_with_attr_by_cond(.,name_engl == /ModelParameters/OD_SelectionCountry);
6767

6868

6969
}

cfg/main/Templates.dms

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ container Templates: Using = "Units;Classifications;geometries;Classifications/T
109109
attribute<bool> IsOneDirection := arc_rel->IsOneDirection;
110110
attribute<BaseProjection> first_point := first_point(geometry); //OD point --> vanwege directions hoeft deze niet te klopppen...
111111
attribute<BaseProjection> last_point := last_point(geometry); //May or may not be an existing network node, otherwise it is a new node
112-
attribute<bool> IsOD_connection_road := !IsDefined(arc_rel);
112+
attribute<bool> IsOD_connection_road := !IsDefined(arc_rel); // connect gives arc_rel which gives the rel to the original link, in case of existing link. Is new link, this is undefined.
113113
}
114114

115115
unit<uint32> LinkSet_Read: StorageName = "= '%LocalDataProjDir%/'+ProjName+'/'+ModelParameters/CountryFolder+'/Linkset_O-'+ModelParameters/OrgGridsize+'_D-'+/ModelParameters/DestGridsize+'_Pop-'+string(ModelParameters/PopVersie)+'.fss'", StorageReadOnly = "True"
@@ -119,6 +119,15 @@ container Templates: Using = "Units;Classifications;geometries;Classifications/T
119119
attribute<BaseProjection> first_point;
120120
attribute<BaseProjection> last_point;
121121
attribute<bool> IsOD_connection_road;
122+
123+
// For visualisation
124+
attribute<BaseProjection> geometry (arc) := points2sequence(PointSet/Point, PointSet/SeqNr, PointSet/Ordinal);
125+
unit<uint32> PointSet := union_unit(.,.)
126+
{
127+
attribute<BaseProjection> Point := Union_Data(., ../first_point, ../last_point);
128+
attribute<..> SeqNr := value(id(.) % nrofrows(..), ..);
129+
attribute<uint32> Ordinal := id(.) / nrofrows(..);
130+
}
122131
}
123132

124133
unit<uint32> LinkSet := LinkSet_Read
@@ -279,7 +288,11 @@ container Templates: Using = "Units;Classifications;geometries;Classifications/T
279288

280289
unit<uint32> UniqueLocations := NetwerkSpec/UniqueLocations
281290
{
282-
attribute<NodeSet> Node_rel := rlookup(geometry, NodeSet/Values);
291+
attribute<NodeSet> Node_rel := rlookup(geometry, NodeSet/Values);
292+
attribute<LinkSet> Link_rel := rlookup(Node_rel, LinkSet/F1);
293+
attribute<NodeSet> Node_rel_if_new_ODlink := Link_rel -> F2;
294+
attribute<NodeSet> Node_rel_of_link_to_network := !(link_rel -> IsOD_connection_road) ? Node_rel : Node_rel_if_new_ODlink;
295+
283296
}
284297

285298
unit<uint32> LinkSet := PrevIntermediateLinkSet
@@ -306,8 +319,8 @@ container Templates: Using = "Units;Classifications;geometries;Classifications/T
306319
{
307320
attribute<uint32> NrConnectedLinks := pcount(LinkSet/F1) + pcount(LinkSet/F2);
308321
attribute<bool> BordersWithOneDirectionalRoad := LinkSet/IsOneDirection[invert(LinkSet/F1)] || LinkSet/IsOneDirection[invert(LinkSet/F2)];
309-
attribute<bool> WillBeDeleted := NrConnectedLinks == 2 && pcount(UniqueLocations/Node_rel) == 0; // 2 connectinglinks means intermediary without junction, and if there are no node_rel's then it is not an OD-point.,
310-
attribute<bool> IsOD_connection_road := NodeSet_src/IsOD_connection_road;
322+
attribute<bool> WillBeDeleted := NrConnectedLinks == 2 && pcount(UniqueLocations/Node_rel) == 0 && pcount(UniqueLocations/Node_rel_of_link_to_network) == 0; // 2 connectinglinks means intermediary without junction, and if there are no node_rel's then it is not an OD-point.,
323+
// attribute<bool> IsOD_connection_road := NodeSet_src/IsOD_connection_road;
311324

312325
//Forward relations
313326
attribute<JunctionFreeSection> JunctionFreeSection_rel := ConnectedParts/JunctionFreeSection_rel[ConnectedParts_rel];

0 commit comments

Comments
 (0)