From 80f48cd36ea4acdf9a160fb441a388fc4553f1cd Mon Sep 17 00:00:00 2001 From: Yogesh Dhanapal Date: Sun, 4 Oct 2020 12:32:39 -0400 Subject: [PATCH] working on partial left turn north south --- ...n-north-south-configuration.component.html | 131 +++++++++++++++++- ...n-north-south-configuration.component.scss | 9 ++ ...ion-north-south-configuration.component.ts | 45 +++++- ...ersection-north-south-design.component.svg | 24 ++-- ...tersection-north-south-design.component.ts | 6 +- .../app/capx/services/capx-state.service.ts | 55 +++++++- .../models/junction-capacity-analyser.ts | 16 +++ 7 files changed, 267 insertions(+), 19 deletions(-) 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.html 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.html index 45c8f9b..3157a57 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.html +++ 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.html @@ -1 +1,130 @@ -

partial-displaced-left-turn-intersection-north-south-configuration works!

+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
PEPCH
{{(capxStateService.masterParameters$ | async)!.south_bound_u}}
PEPCH
{{(capxStateService.masterParameters$ | async)!.south_bound_left}}
PEPCH
{{(capxStateService.masterParameters$ | async)!.south_bound_thru}}
PEPCH
{{(capxStateService.masterParameters$ | async)!.south_bound_right}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + +
{{(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.PartialDisplacedLeftTurnIntersectionNorthSouth).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-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 e69de29..43d518d 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 @@ -0,0 +1,9 @@ +:host +{ + display: block; + margin: auto; + + table tr td input { + max-width: 30px; + } +} 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.ts 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.ts index c6cbe87..810ca4d 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.ts +++ 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.ts @@ -1,4 +1,9 @@ -import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; +import { CapxStateService } from './../../../../../services/capx-state.service'; +import { CapxIntersectionAnalysisResultParameters, Junction } from './../../../../../services/models/junction-capacity-analyser'; +import { ChangeDetectionStrategy, Component, OnDestroy, OnInit } from '@angular/core'; +import { BehaviorSubject } from 'rxjs'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { Junctions } from './../../../../../services/models/junctions'; @Component({ selector: 'capx-partial-displaced-left-turn-intersection-north-south-configuration', @@ -6,11 +11,45 @@ import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; styleUrls: ['./partial-displaced-left-turn-intersection-north-south-configuration.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush }) -export class PartialDisplacedLeftTurnIntersectionNorthSouthConfigurationComponent implements OnInit { +export class PartialDisplacedLeftTurnIntersectionNorthSouthConfigurationComponent 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.updatePartialDisplacedLeftTurnIntersectionNorthSouthParameters(value); + }); + + // tslint:disable-next-line: max-line-length + this.form.setValue(this.capxStateService.partialDisplacedLeftTurnIntersectionNorthSouthJunctionParameters$.value, {onlySelf: true, emitEvent: false}); + + const junction = this.capxStateService.state.get(Junctions.PartialDisplacedLeftTurnIntersectionNorthSouth) 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/design/partial-displaced-left-turn-intersection-north-south-design.component.svg b/projects/capx/src/app/capx/components/junctions/intersections/partial-displaced-left-turn-intersection-north-south-junction/design/partial-displaced-left-turn-intersection-north-south-design.component.svg index ca15253..48c0a3d 100644 --- a/projects/capx/src/app/capx/components/junctions/intersections/partial-displaced-left-turn-intersection-north-south-junction/design/partial-displaced-left-turn-intersection-north-south-design.component.svg +++ b/projects/capx/src/app/capx/components/junctions/intersections/partial-displaced-left-turn-intersection-north-south-junction/design/partial-displaced-left-turn-intersection-north-south-design.component.svg @@ -19,29 +19,29 @@ - - 662 + + {{(capxStateService.state.get(junctions.PartialDisplacedLeftTurnIntersectionNorthSouth).intersectionResult | async).zone2_south_clv}} - - 0.41 + + {{(capxStateService.state.get(junctions.PartialDisplacedLeftTurnIntersectionNorthSouth).intersectionResult | async).zone2_south_vc}} V / C Zone 2 - - 662 + + {{(capxStateService.state.get(junctions.PartialDisplacedLeftTurnIntersectionNorthSouth).intersectionResult | async).zone1_north_clv}} - - 0.41 + + {{(capxStateService.state.get(junctions.PartialDisplacedLeftTurnIntersectionNorthSouth).intersectionResult | async).zone1_north_vc}} V / C Zone 1 - - 662 + + {{(capxStateService.state.get(junctions.PartialDisplacedLeftTurnIntersectionNorthSouth).intersectionResult | async).zone5_center_clv}} - - 0.41 + + {{(capxStateService.state.get(junctions.PartialDisplacedLeftTurnIntersectionNorthSouth).intersectionResult | async).zone5_center_vc}} V / C Zone 5 diff --git a/projects/capx/src/app/capx/components/junctions/intersections/partial-displaced-left-turn-intersection-north-south-junction/design/partial-displaced-left-turn-intersection-north-south-design.component.ts b/projects/capx/src/app/capx/components/junctions/intersections/partial-displaced-left-turn-intersection-north-south-junction/design/partial-displaced-left-turn-intersection-north-south-design.component.ts index 07c3a7a..5baa248 100644 --- a/projects/capx/src/app/capx/components/junctions/intersections/partial-displaced-left-turn-intersection-north-south-junction/design/partial-displaced-left-turn-intersection-north-south-design.component.ts +++ b/projects/capx/src/app/capx/components/junctions/intersections/partial-displaced-left-turn-intersection-north-south-junction/design/partial-displaced-left-turn-intersection-north-south-design.component.ts @@ -1,4 +1,6 @@ +import { CapxStateService } from './../../../../../services/capx-state.service'; import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; +import { Junctions } from './../../../../../services/models/junctions'; @Component({ selector: 'capx-partial-displaced-left-turn-intersection-north-south-design', @@ -8,7 +10,9 @@ import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; }) export class PartialDisplacedLeftTurnIntersectionNorthSouthDesignComponent implements OnInit { - constructor() { } + junctions = Junctions; + constructor(public capxStateService: CapxStateService) { } + ngOnInit(): void { } 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 92159a9..469d6b4 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 } from './models/junction-capacity-analyser'; +import { Junction, JunctionTypes, CapxPartialDisplacedLeftTurnIntersectionNorthSouth } from './models/junction-capacity-analyser'; import { Junctions } from './models/junctions'; // tslint:disable: variable-name @@ -152,6 +152,21 @@ export class CapxStateService { north_bound_right: 1 }); + partialDisplacedLeftTurnIntersectionNorthSouthJunctionParameters$ = new BehaviorSubject({ + east_bound_left: 1, + east_bound_thru: 1, + east_bound_right: 1, + west_bound_left: 1, + west_bound_thru: 1, + west_bound_right: 1, + south_bound_left: 1, + south_bound_thru: 1, + south_bound_right: 1, + north_bound_left: 1, + north_bound_thru: 1, + north_bound_right: 1 + }); + rank$ = new BehaviorSubject>(new Map()); @@ -460,6 +475,7 @@ export class CapxStateService { this.solve(); this.solveConventionalJunction(); + this.solvePartialDisplacedLeftTurnIntersectionNorthSouthJunction(); } public updateInputParameters(params: CapxInputParameters): void { @@ -671,7 +687,42 @@ export class CapxStateService { (masterParameters.south_bound_left / inputParameters.adjustment_factor_left_turn + masterParameters.south_bound_u / inputParameters.adjustment_factor_u) / inputParameters.adjustment_factor_left_turn / junctionParameters.south_bound_left + max(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.west_bound_left / inputParameters.adjustment_factor_left_turn / junctionParameters.west_bound_left), 0)) ); const zone5_center_vc = round(zone5_center_clv / inputParameters.critical_lane_volume, 2); - (this.state.get('conventional')?.intersectionResult as BehaviorSubject).next({ + (this.state.get(Junctions.ConventionalIntersection)?.intersectionResult as BehaviorSubject).next({ + zone1_north_clv: null, + zone1_north_vc: null, + zone2_south_clv: null, + zone2_south_vc: null, + 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_vc: zone5_center_vc + }); + + this.updateRank(); + } + + public updatePartialDisplacedLeftTurnIntersectionNorthSouthParameters(params: CapxPartialDisplacedLeftTurnIntersectionNorthSouth): void { + this.partialDisplacedLeftTurnIntersectionNorthSouthJunctionParameters$.next(params); + this.solvePartialDisplacedLeftTurnIntersectionNorthSouthJunction(); + } + + private solvePartialDisplacedLeftTurnIntersectionNorthSouthJunction(): void { + const inputParameters = this.inputParameters$.value; + const masterParameters = this.masterParameters$.value; + const junctionParameters = this.partialDisplacedLeftTurnIntersectionNorthSouthJunctionParameters$.value; + const zone5_center_clv = max( + (masterParameters.east_bound_left / inputParameters.adjustment_factor_left_turn + masterParameters.east_bound_u / inputParameters.adjustment_factor_u) / 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 + masterParameters.west_bound_u / inputParameters.adjustment_factor_u) / 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)) + ) + + max( + (masterParameters.north_bound_left / inputParameters.adjustment_factor_left_turn + masterParameters.north_bound_u / inputParameters.adjustment_factor_u) / inputParameters.adjustment_factor_left_turn / junctionParameters.north_bound_left + max(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)), + (masterParameters.south_bound_left / inputParameters.adjustment_factor_left_turn + masterParameters.south_bound_u / inputParameters.adjustment_factor_u) / inputParameters.adjustment_factor_left_turn / junctionParameters.south_bound_left + max(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.west_bound_left / inputParameters.adjustment_factor_left_turn / junctionParameters.west_bound_left), 0)) + ); + const zone5_center_vc = round(zone5_center_clv / inputParameters.critical_lane_volume, 2); + (this.state.get(Junctions.PartialDisplacedLeftTurnIntersectionNorthSouth)?.intersectionResult as BehaviorSubject).next({ zone1_north_clv: null, zone1_north_vc: null, zone2_south_clv: null, 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 5efa981..e8853be 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 @@ -127,6 +127,22 @@ export interface CapxConventionalJunctionParameters { north_bound_right: number; } + +export interface CapxPartialDisplacedLeftTurnIntersectionNorthSouth { + 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;