From 167bd0a6dd47f9ed5dbe36580c3c702ee9b959a1 Mon Sep 17 00:00:00 2001 From: Yogesh Dhanapal Date: Mon, 5 Oct 2020 21:17:15 -0400 Subject: [PATCH] working on Partial Displaced Left Turn Intersection (E-W) --- ...ion-east-west-configuration.component.html | 131 +++++++++++++++++- ...ion-east-west-configuration.component.scss | 9 ++ ...ction-east-west-configuration.component.ts | 46 +++++- ...n-north-south-configuration.component.scss | 2 +- .../app/capx/services/capx-state.service.ts | 67 ++++++++- .../models/junction-capacity-analyser.ts | 15 ++ 6 files changed, 263 insertions(+), 7 deletions(-) diff --git a/projects/capx/src/app/capx/components/junctions/intersections/partial-displaced-left-turn-intersection-east-west-junction/configuration/partial-displaced-left-turn-intersection-east-west-configuration.component.html b/projects/capx/src/app/capx/components/junctions/intersections/partial-displaced-left-turn-intersection-east-west-junction/configuration/partial-displaced-left-turn-intersection-east-west-configuration.component.html index 823142e..72bb32a 100644 --- a/projects/capx/src/app/capx/components/junctions/intersections/partial-displaced-left-turn-intersection-east-west-junction/configuration/partial-displaced-left-turn-intersection-east-west-configuration.component.html +++ b/projects/capx/src/app/capx/components/junctions/intersections/partial-displaced-left-turn-intersection-east-west-junction/configuration/partial-displaced-left-turn-intersection-east-west-configuration.component.html @@ -1 +1,130 @@ -

partial-displaced-left-turn-intersection-east-west-configuration works!

+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
PEPCH
{{(capxStateService.masterParameters$ | async)!.south_bound_right}}
PEPCH
{{(capxStateService.masterParameters$ | async)!.south_bound_thru}}
PEPCH
{{(capxStateService.masterParameters$ | async)!.south_bound_left}}
PEPCH
{{(capxStateService.masterParameters$ | async)!.south_bound_u}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + +
{{(capxStateService.masterParameters$ | async)!.east_bound_u}}
PEPCH
{{(capxStateService.masterParameters$ | async)!.east_bound_left}}
PEPCH
{{(capxStateService.masterParameters$ | async)!.east_bound_thru}}
PEPCH
{{(capxStateService.masterParameters$ | async)!.east_bound_right}}
PEPCH
+
+ + +
+ +
+ + + + + + + +
Zone 5
{{(capxStateService.state.get(junctions.PartialDisplacedLeftTurnIntersectionEastWest).intersectionResult | async).zone5_center_clv}}
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
PEPCH
{{(capxStateService.masterParameters$ | async)!.west_bound_right}}
PEPCH
{{(capxStateService.masterParameters$ | async)!.west_bound_thru}}
PEPCH
{{(capxStateService.masterParameters$ | async)!.west_bound_left}}
PEPCH
{{(capxStateService.masterParameters$ | async)!.west_bound_u}}
+
+ + +
+ + + + + + + + + + + + + + + + + + + +
{{(capxStateService.masterParameters$ | async)!.north_bound_u}}
PEPCH
{{(capxStateService.masterParameters$ | async)!.north_bound_left}}
PEPCH
{{(capxStateService.masterParameters$ | async)!.north_bound_thru}}
PEPCH
{{(capxStateService.masterParameters$ | async)!.north_bound_right}}
PEPCH
+ + +
diff --git a/projects/capx/src/app/capx/components/junctions/intersections/partial-displaced-left-turn-intersection-east-west-junction/configuration/partial-displaced-left-turn-intersection-east-west-configuration.component.scss b/projects/capx/src/app/capx/components/junctions/intersections/partial-displaced-left-turn-intersection-east-west-junction/configuration/partial-displaced-left-turn-intersection-east-west-configuration.component.scss index e69de29..08ad10b 100644 --- a/projects/capx/src/app/capx/components/junctions/intersections/partial-displaced-left-turn-intersection-east-west-junction/configuration/partial-displaced-left-turn-intersection-east-west-configuration.component.scss +++ b/projects/capx/src/app/capx/components/junctions/intersections/partial-displaced-left-turn-intersection-east-west-junction/configuration/partial-displaced-left-turn-intersection-east-west-configuration.component.scss @@ -0,0 +1,9 @@ +:host +{ + display: block; + overflow-y: auto; + + table tr td input { + max-width: 30px; + } +} diff --git a/projects/capx/src/app/capx/components/junctions/intersections/partial-displaced-left-turn-intersection-east-west-junction/configuration/partial-displaced-left-turn-intersection-east-west-configuration.component.ts b/projects/capx/src/app/capx/components/junctions/intersections/partial-displaced-left-turn-intersection-east-west-junction/configuration/partial-displaced-left-turn-intersection-east-west-configuration.component.ts index d2ae6f0..77b6092 100644 --- a/projects/capx/src/app/capx/components/junctions/intersections/partial-displaced-left-turn-intersection-east-west-junction/configuration/partial-displaced-left-turn-intersection-east-west-configuration.component.ts +++ b/projects/capx/src/app/capx/components/junctions/intersections/partial-displaced-left-turn-intersection-east-west-junction/configuration/partial-displaced-left-turn-intersection-east-west-configuration.component.ts @@ -1,4 +1,9 @@ -import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; +import { CapxStateService } from './../../../../../services/capx-state.service'; +import { ChangeDetectionStrategy, Component, OnDestroy, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { CapxIntersectionAnalysisResultParameters, Junction } from './../../../../../services/models/junction-capacity-analyser'; +import { Junctions } from './../../../../../services/models/junctions'; +import { BehaviorSubject } from 'rxjs'; @Component({ selector: 'capx-partial-displaced-left-turn-intersection-east-west-configuration', @@ -6,11 +11,46 @@ import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; styleUrls: ['./partial-displaced-left-turn-intersection-east-west-configuration.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush }) -export class PartialDisplacedLeftTurnIntersectionEastWestConfigurationComponent implements OnInit { +export class PartialDisplacedLeftTurnIntersectionEastWestConfigurationComponent implements OnInit, OnDestroy { - constructor() { } + result$: BehaviorSubject = new BehaviorSubject(null); + + junctions = Junctions; + constructor(private fb: FormBuilder, public capxStateService: CapxStateService) { } + + + form: FormGroup = this.fb.group({ + east_bound_left: [null , Validators.required], + east_bound_thru: [null, Validators.required], + east_bound_right: [null, Validators.required], + west_bound_left: [null, Validators.required], + west_bound_thru: [null, Validators.required], + west_bound_right: [null, Validators.required], + south_bound_left: [null, Validators.required], + south_bound_thru: [null, Validators.required], + south_bound_right: [null, Validators.required], + north_bound_left: [null, Validators.required], + north_bound_thru: [null, Validators.required], + north_bound_right: [null, Validators.required] + }); ngOnInit(): void { + this.form.valueChanges.subscribe(value => { + this.capxStateService.updatePartialDisplacedLeftTurnIntersectionEastWestParameters(value); + }); + + // tslint:disable-next-line: max-line-length + this.form.setValue(this.capxStateService.partialDisplacedLeftTurnIntersectionEastWestJunctionParameters$.value, {onlySelf: true, emitEvent: false}); + + const junction = this.capxStateService.state.get(Junctions.PartialDisplacedLeftTurnIntersectionEastWest) as Junction; + (junction.intersectionResult as BehaviorSubject).subscribe(result => { + this.result$.next(result); + }); + } + + ngOnDestroy(): void { + this.result$.complete(); } } + diff --git a/projects/capx/src/app/capx/components/junctions/intersections/partial-displaced-left-turn-intersection-north-south-junction/configuration/partial-displaced-left-turn-intersection-north-south-configuration.component.scss b/projects/capx/src/app/capx/components/junctions/intersections/partial-displaced-left-turn-intersection-north-south-junction/configuration/partial-displaced-left-turn-intersection-north-south-configuration.component.scss index 210ad47..08ad10b 100644 --- a/projects/capx/src/app/capx/components/junctions/intersections/partial-displaced-left-turn-intersection-north-south-junction/configuration/partial-displaced-left-turn-intersection-north-south-configuration.component.scss +++ b/projects/capx/src/app/capx/components/junctions/intersections/partial-displaced-left-turn-intersection-north-south-junction/configuration/partial-displaced-left-turn-intersection-north-south-configuration.component.scss @@ -1,7 +1,7 @@ :host { display: block; - overflow-y: scroll; + overflow-y: auto; table tr td input { max-width: 30px; diff --git a/projects/capx/src/app/capx/services/capx-state.service.ts b/projects/capx/src/app/capx/services/capx-state.service.ts index c112842..fdc5cdd 100644 --- a/projects/capx/src/app/capx/services/capx-state.service.ts +++ b/projects/capx/src/app/capx/services/capx-state.service.ts @@ -1,4 +1,4 @@ -import { Junction, JunctionTypes, CapxPartialDisplacedLeftTurnIntersectionNorthSouth } from './models/junction-capacity-analyser'; +import { Junction, JunctionTypes, CapxPartialDisplacedLeftTurnIntersectionNorthSouth, CapxPartialDisplacedLeftTurnIntersectionEastWest } from './models/junction-capacity-analyser'; import { Junctions } from './models/junctions'; // tslint:disable: variable-name @@ -168,6 +168,21 @@ export class CapxStateService { north_bound_right: 1 }); + partialDisplacedLeftTurnIntersectionEastWestJunctionParameters$ = new BehaviorSubject({ + east_bound_left: 2, + east_bound_thru: 3, + east_bound_right: 1, + west_bound_left: 2, + west_bound_thru: 3, + west_bound_right: 1, + south_bound_left: 1, + south_bound_thru: 2, + south_bound_right: 1, + north_bound_left: 1, + north_bound_thru: 2, + north_bound_right: 1 + }); + rank$ = new BehaviorSubject>(new Map()); @@ -477,6 +492,7 @@ export class CapxStateService { this.solve(); this.solveConventionalJunction(); this.solvePartialDisplacedLeftTurnIntersectionNorthSouthJunction(); + this.solvePartialDisplacedLeftTurnIntersectionEastWestJunction(); } public updateInputParameters(params: CapxInputParameters): void { @@ -669,7 +685,7 @@ export class CapxStateService { this.rank$.next(inter_ranks); } - + //#region Conventional public updateConventionalJunctionParameters(params: CapxConventionalJunctionParameters): void { this.conventionalJunctionParameters$.next(params); this.solveConventionalJunction(); @@ -705,7 +721,11 @@ export class CapxStateService { this.updateRank(); } + //#endregion + + + //#region Partial Displaced LeftTurn Intersection North South public updatePartialDisplacedLeftTurnIntersectionNorthSouthParameters(params: CapxPartialDisplacedLeftTurnIntersectionNorthSouth): void { this.partialDisplacedLeftTurnIntersectionNorthSouthJunctionParameters$.next(params); this.solvePartialDisplacedLeftTurnIntersectionNorthSouthJunction(); @@ -743,6 +763,49 @@ export class CapxStateService { this.updateRank(); } + //#endregion + + + //#region Partial Displaced LeftTurn Intersection East West + public updatePartialDisplacedLeftTurnIntersectionEastWestParameters(params: CapxPartialDisplacedLeftTurnIntersectionEastWest): void { + this.partialDisplacedLeftTurnIntersectionEastWestJunctionParameters$.next(params); + this.solvePartialDisplacedLeftTurnIntersectionEastWestJunction(); + } + + private solvePartialDisplacedLeftTurnIntersectionEastWestJunction(): void { + const inputParameters = this.inputParameters$.value; + const masterParameters = this.masterParameters$.value; + const junctionParameters = this.partialDisplacedLeftTurnIntersectionEastWestJunctionParameters$.value; + + const zone1_north_clv = masterParameters.south_bound_left / inputParameters.adjustment_factor_left_turn / junctionParameters.south_bound_left + (masterParameters.north_bound_thru + masterParameters.east_bound_left) / junctionParameters.north_bound_thru + + const zone5_center_clv = max(masterParameters.north_bound_left / inputParameters.adjustment_factor_left_turn / junctionParameters.north_bound_left, masterParameters.north_bound_thru / junctionParameters.north_bound_thru, round(max(0, masterParameters.north_bound_right / inputParameters.adjustment_factor_right_turn / junctionParameters.north_bound_right - masterParameters.east_bound_left / inputParameters.adjustment_factor_left_turn / junctionParameters.east_bound_left), 0), masterParameters.south_bound_left / inputParameters.adjustment_factor_left_turn / junctionParameters.south_bound_left, masterParameters.south_bound_thru / junctionParameters.south_bound_thru, round(max(0, masterParameters.south_bound_right / inputParameters.adjustment_factor_right_turn / junctionParameters.south_bound_right - masterParameters.east_bound_left / inputParameters.adjustment_factor_left_turn / junctionParameters.east_bound_left), 0)) + max(masterParameters.east_bound_left / inputParameters.adjustment_factor_left_turn / junctionParameters.east_bound_left + max(masterParameters.west_bound_thru / junctionParameters.west_bound_thru, round(max(0, masterParameters.west_bound_right / inputParameters.adjustment_factor_right_turn / junctionParameters.west_bound_right - masterParameters.south_bound_left / inputParameters.adjustment_factor_left_turn / junctionParameters.south_bound_left), 0)), masterParameters.west_bound_left / inputParameters.adjustment_factor_left_turn / junctionParameters.west_bound_left + max( masterParameters.east_bound_thru / junctionParameters.east_bound_thru, round(max(0, masterParameters.east_bound_right / inputParameters.adjustment_factor_right_turn / junctionParameters.east_bound_right - masterParameters.north_bound_left / inputParameters.adjustment_factor_left_turn / junctionParameters.north_bound_left), 0))) + + const zone2_south_clv = masterParameters.north_bound_left / inputParameters.adjustment_factor_left_turn / junctionParameters.north_bound_left + (masterParameters.south_bound_thru + masterParameters.west_bound_left) / junctionParameters.south_bound_thru + + + const zone1_north_vc = round(zone1_north_clv / inputParameters.critical_lane_volume, 2); + const zone5_center_vc = round(zone5_center_clv / inputParameters.critical_lane_volume, 2); + const zone2_south_vc = round(zone2_south_clv / inputParameters.critical_lane_volume, 2); + (this.state.get(Junctions.PartialDisplacedLeftTurnIntersectionNorthSouth)?.intersectionResult as BehaviorSubject).next({ + zone1_north_clv: round(zone1_north_clv), + zone1_north_vc, + zone2_south_clv: round(zone2_south_clv), + zone2_south_vc, + zone3_east_clv: null, + zone3_east_vc: null, + zone4_west_clv: null, + zone4_west_vc: null, + zone5_center_clv: round(zone5_center_clv), + zone5_center_vc, + all_clv: round(max(zone1_north_clv, zone5_center_clv, zone2_south_clv)), + all_vc: max(zone1_north_vc, zone5_center_vc, zone2_south_vc) + }); + + this.updateRank(); + } + //#endregion + public getClvRangeColor(zone_all_clv: number | null): string { // update range text diff --git a/projects/capx/src/app/capx/services/models/junction-capacity-analyser.ts b/projects/capx/src/app/capx/services/models/junction-capacity-analyser.ts index cb5ad54..a4418a5 100644 --- a/projects/capx/src/app/capx/services/models/junction-capacity-analyser.ts +++ b/projects/capx/src/app/capx/services/models/junction-capacity-analyser.ts @@ -143,6 +143,21 @@ export interface CapxPartialDisplacedLeftTurnIntersectionNorthSouth { north_bound_right: number; } +export interface CapxPartialDisplacedLeftTurnIntersectionEastWest { + east_bound_left: number; + east_bound_thru: number; + east_bound_right: number; + west_bound_left: number; + west_bound_thru: number; + west_bound_right: number; + south_bound_left: number; + south_bound_thru: number; + south_bound_right: number; + north_bound_left: number; + north_bound_thru: number; + north_bound_right: number; +} + export interface CapxIntersectionAnalysisResultParameters { zone1_north_clv: number | null; zone1_north_vc: number | null;