🚛 T3_Uty1TruckTrajectoryCalc.vb - Detailed Explanation

📋 Overview

This file is a utility software that performs turning trajectory calculations for trucks (heavy vehicles and semi-trailers). It accurately calculates the minimum aisle width, clearance, and coordinates of various parts of the vehicle body when turning, and visually draws the trajectory diagram.

Main Uses:
  • Aisle width design in logistics facilities
  • Calculation of turning space for on-site roads
  • Verification of parking lot and yard design
  • Optimization of cargo handling space
  • Ensuring safe vehicle traffic lines

🔧 Dependencies

Imports OfficeOpenXml

Uses the EPPlus library to read truck specification data from Excel files.

🎯 Key Features

1. Truck Trajectory Calculation Feature

2. Precise Calculation using Trigonometry

3. Visualization Features

📊 Supported Vehicle Types

Vehicle Type Description Use Case
2T Standard Cab Standard Body Light Truck Urban delivery, small-scale logistics
2T Wide Cab Long Body Light Truck (Long) Long item / multi-load delivery
2T Wide Cab Super Long Body Light Truck (Super Long) High-capacity delivery
4T Cargo Wide Full Cab Medium Truck (Wide) Mid-distance transport
4T Cargo Standard Width Full Cab Medium Truck (Standard) General medium delivery
16T Cargo 6x2 Heavy Truck (3-axle) Mass transport
15T Cargo 8x4 Heavy Truck (4-axle) Heavy goods transport
11T Cargo Front Dual Axle Heavy Truck (Front dual) Special heavy goods
20ft Container Truck Dedicated for 20ft containers International logistics, port transport
40ft Container Truck Dedicated for 40ft containers Large-scale international logistics

🔍 Main Methods Details

1. Form Load Processing

Private Sub TruckTrajectoryDiagram_Load(sender As Object, e As EventArgs)

Initialization Process:

  1. Display expiration date and copyright
  2. Check existence of required files
  3. Load truck dimension data
  4. Load semi-trailer dimension data
  5. Set up vehicle type selection combobox
  6. Set default screen values
  7. Initial settings for trigonometric calculations

2. Start Calculation Processing

Private Sub CalcStartBt_Click_1(sender As Object, e As EventArgs)

Calculation Flow:

  1. Apply setting values (if necessary)
  2. Load screen data
  3. Calculate truck body coordinates
  4. Calculate clearance
  5. Adjust truck scale dimensions
  6. Calculate stop position before turning
  7. Draw straight and turning trajectory
  8. Visual feedback (change background color)

3. Truck Body Coordinate Calculation

Private Sub TruckBodyCoordinateCalc()

Calculation Items:

Calculation Basis: Calculates the relative position of each part using trigonometric functions based on the vehicle pitch (wheelbase).

4. Clearance Calculation

Private Sub ClearanceCalc()

Calculation Details:

Total Aisle Width = Outer Turning Radius - Inner Turning Radius + Safety Margin

5. Trajectory Diagram Drawing

Private Sub TruckTrajectoryDiagram_StraightTurn()

Drawing Elements:

Drawing Techniques: Uses Graphics.DrawLine, DrawRectangle, DrawEllipse, DrawArc, etc., to draw trajectories.

📐 Trigonometric Calculations

Basic Theory of Calculation

The truck trajectory calculation heavily uses the following trigonometric functions:

Basic Trigonometric Functions

sin(θ) = Opposite / Hypotenuse
cos(θ) = Adjacent / Hypotenuse
tan(θ) = Opposite / Adjacent

Inverse Trigonometric Functions

θ = arcsin(y / r) ← Find angle from y and r
θ = arccos(x / r) ← Find angle from x and r
θ = arctan(y / x) ← Find angle from y and x

Pythagorean Theorem

r² = x² + y²
x = √(r² - y²)
y = √(r² - x²)

Implemented Calculation Functions

Function Name Calculation Details Return Value
X_CoordinateCalc1(Angle, r) Calculate x coord from angle and r x = cos(Radians) × r
X_CoordinateCalc3(r, y) Calculate x coord from r and y x = √(r² - y²)
Y_CoordinateCalc1(Angle, r) Calculate y coord from angle and r y = sin(Radians) × r
R_CoordinateCalc3(y, x) Calculate radius r from x and y r = √(x² + y²)
RadianCalc1(r, y) Calculate radian from r and y θ = arcsin(y / r)
RadianCalc4(Angle) Calculate radian from angle Radian = (π / 180) × Angle
AngleCalc(Radian) Calculate angle from radian Angle = (180 / π) × Radian

Execution of Trigonometric Calculations

Private Sub TrigonometricCalc()

Calculation Steps:

  1. Calculation of Point P1 (1st Quadrant)
    • Calculate x from r and y
    • Calculate radian and angle
  2. Calculation of P1 at Landing (2nd Quadrant)
    • Calculate landing angle with 180° - Angle
    • The x-coordinate is negative in the 2nd quadrant
  3. Calculation of Point P2 (Landing -15°)
    • Subtract 15° from landing angle
    • Calculate new coordinates
  4. Calculation of Point P3 (Position after moving)
    • Add offset (xs, ys) from P1
    • Calculate new radius and angle
  5. Calculation of Point P4 (P3 -15°)
    • Subtract 15° from P3 angle
    • Calculate final coordinates
Quadrant Consideration: Care must be taken during calculations as coordinate signs differ between the 1st and 2nd quadrants.

📥 Data Loading

1. Truck Dimension Data

Private Sub TruckDimensionRead()

Loaded Data:

File Path: DatSavePath & "\TruckTrajectoryCalc\TruckDimensions.xlsx"
Sheet Name: TruckTrajectoryData
DataGridView: TruckDimensionDgv

2. Semi-Trailer Dimension Data

Private Sub SemiTrailerDimensionRead()

Loaded Data:

File Path: DatSavePath & "\TruckTrajectoryCalc\TruckDimensions.xlsx"
Sheet Name: SemiTrailerTrajectoryData
DataGridView: SemiTrailerDimensionDgv

🎨 UI Components

Input Parameters

Control Description Use Case
VehicleTypeSelectCb Vehicle type selection combobox Select truck for calculation
CenterCoordXTb, YTb Coordinates of the turning center Adjust drawing position
VehiclePitchTb Wheelbase Base value for turning calc
ScaleTb Scale of the drawing Adjust drawing size
StraightTb Straight distance Straight length before turning

Inputs for Trigonometric Calc

Control Description
Radius_rTb Radius (Hypotenuse)
yTb y-coordinate (Opposite)
xsTb, ysTb Moving distance (Offset)
HypotenuseTb Length of hypotenuse
OppositeTb Length of opposite side
AdjacentTb Length of adjacent side

RadioButtons (Display Switching)

PictureBox (Image Display)

DataGridView

Buttons

🖼️ Image Resources

The following JPG images are used as explanatory diagrams:

File Name Description
BodyDimensionDiagram2.jpg Dimension diagram of truck body parts
TruckTurningAisleWidth1.jpg Basic diagram of turning aisle width
TruckTurningAisleWidth2.jpg Detailed diagram of turning aisle width
TruckTurningAisleWidth2-1.jpg Overall clearance diagram
TruckTurningAisleWidth2-2.jpg Magnified clearance diagram
Image Folder: MyPath & "\TruckTrajectoryDiagramJpg"
Display Method: Images are displayed using PictureBox.BackgroundImageLayout = ImageLayout.Zoom.

📐 Calculation Example: Turning Aisle Width

Step 1: Front Wheel Turning Radius

Front Wheel Turning Radius = Minimum Turning Radius

Step 2: Rear Wheel Turning Radius

Rear Wheel Turning Radius = √(Front Wheel Turning Radius² - Vehicle Pitch²)

Step 3: Turning Radius of Body Outer Point

Outer Turning Radius = √((Front Wheel Turning Radius + Vehicle Width/2)² + Front Overhang²)

Step 4: Turning Radius of Body Inner Point

Inner Turning Radius = Rear Wheel Turning Radius - Vehicle Width/2

Step 5: Required Aisle Width

Required Aisle Width = Outer Turning Radius - Inner Turning Radius
Safety Margin: In actual design, it is recommended to add a safety margin of 10-20% to the calculated value.

🔍 Special Processing

1. Scale Adjustment

Private Sub TruckScaleDimension()

Scales the truck dimensions to fit the drawing canvas size. Adjustable via the scale parameter.

2. Default Value Setting by Vehicle Type

Private Sub ScreenDefaultSetting()

Automatically sets optimal drawing parameters (center coordinates, scale, straight distance) depending on the selected vehicle type.

Vehicle Type Scale Straight Distance Vehicle Pitch
2T Standard 0.02 1600mm 3000mm
2T Long 0.02 2900mm 3000mm
4T Cargo 0.02 4250~4500mm 3000mm
Heavy Truck 0.02 5450~5600mm 4000mm

3. Calculation of Stop Position Before Turning

Private Sub TruckTrajectoryDiagram_StopPositionBeforeTurn()

Calculates the truck's stop position before starting the turn and draws the vehicle in a straight state.

🎯 Visual Feedback

Changing GroupBox Background Color

When executing a calculation, the background color of GroupBox4 alternates:

If CalcStart_Chk2 = 0 Then
GroupBox4.BackColor = Color.LightYellow
CalcStart_Chk2 = 1
Else
GroupBox4.BackColor = Color.PowderBlue
CalcStart_Chk2 = 0
End If

🔧 DataGridView Settings

Common Settings

Cell Styles

Style Settings
cstyle1 Alignment = MiddleCenter
cstyle2 Alignment = MiddleRight, Format = "N0"
cstyle3 Alignment = MiddleRight, Format = "N1"

Column Width Settings

TruckDimensionDgv:
- Column 1 (Vehicle Name): Width 110px
- Other Columns: Width 50px

📊 Generation of Trigonometric Table

Private Sub TrigonometricTable()

Displays the results of trigonometric calculations as a list:

Display Items

Can be utilized for verification of engineering calculations or educational purposes.

📐 Implemented Trigonometric Methods

Coordinate Calculation Functions

Method Description Formula
X_CoordinateCalc1(Angle, r) X coord from angle and radius x = r × cos(Angle in radians)
X_CoordinateCalc3(r, y) X coord from radius and Y coord x = √(r² - y²)
Y_CoordinateCalc1(Angle, r) Y coord from angle and radius y = r × sin(Angle in radians)
R_CoordinateCalc3(y, x) Radius from X and Y coords r = √(x² + y²)

Angle / Radian Conversion Functions

Method Description Formula
RadianCalc1(r, y) Radian from radius and Y coord θ = arcsin(y / r)
RadianCalc4(Angle) Radian from angle Radian = Angle × π / 180
AngleCalc(Radian) Angle from radian Angle = Radian × 180 / π

🎨 Graphics Drawing

Drawing Methods Used

Pen Settings

Dim BPen As New Pen(Color.Black, 1) ' Black, line width 1
Dim RPen As New Pen(Color.Red, 2) ' Red, line width 2
Dim BPen_Dash As New Pen(Color.Blue, 1)
BPen_Dash.DashStyle = DashStyle.Dash ' Dashed line

Drawing Canvas

Dim g As Graphics = RotationPb.CreateGraphics()
g.Clear(RotationPb.BackColor) ' Clear canvas
' Drawing process
g.Dispose() ' Release resources

🔄 Overall Processing Flowchart

┌─────────────────────────────────────┐ │ Form Load │ └──────────┬──────────────────────────┘ │ ├→ Expiration / Copyright Display ├→ File Verification ├→ Load Truck Dimensions ├→ Load Semi-Trailer Dimensions ├→ Set VehicleTypeSelectCb ├→ Default Screen Settings └→ Initial Settings for Trig Calc │ ▼ ┌─────────────────────────────────────┐ │ Calculate Start Button Click │ └──────────┬──────────────────────────┘ │ ├→ Apply Settings (if needed) ├→ Load Screen Data │ ▼ ┌─────────────────────────────────────┐ │ Truck Body Coordinate Calc │ └──────────┬──────────────────────────┘ │ ├─ Front Wheel Center Coord ├─ Rear Wheel Center Coord ├─ Vehicle Front End Coord ├─ Vehicle Rear End Coord ├─ Four Corners Coord └─ Min Turning Radius │ ▼ ┌─────────────────────────────────────┐ │ Clearance Calculation │ └──────────┬──────────────────────────┘ │ ├─ Inner Clearance ├─ Outer Clearance ├─ Total Aisle Width ├─ Front Overhang └─ Rear Overhang │ ▼ ┌─────────────────────────────────────┐ │ Scale Adjustment │ └──────────┬──────────────────────────┘ │ ▼ ┌─────────────────────────────────────┐ │ Stop Position Before Turn Calc │ └──────────┬──────────────────────────┘ │ ▼ ┌─────────────────────────────────────┐ │ Straight & Turn Trajectory Draw │ └──────────┬──────────────────────────┘ │ ├─ Draw Body Outline ├─ Draw Front Wheel Trajectory ├─ Draw Rear Wheel Trajectory ├─ Draw Four Corners Trajectory └─ Display Aisle Width 

💡 Use Cases

1. Logistics Facility Design

2. Factory Site Design

3. Parking Lot Design

4. Education and Training

⚠️ Important Notes

Regarding Calculation Accuracy

  • The calculation results are theoretical values. They may differ slightly from actual vehicle behavior.
  • Tire deformation and suspension dive are not considered.
  • The effects of road slope and unevenness are not included.

Safety Margin

  • When designing, please add a safety margin (10-20%) to the calculated values.
  • In actual operation, the driver's skill level must also be considered.
  • Differences due to rainy weather or load conditions should be taken into account.

Data Updates

Truck dimension data requires periodic updates to match the latest vehicle specifications.

🔗 Related Modules

This utility can be linked with the following Tera Calculation Systems:

📚 Summary

T3_Uty1TruckTrajectoryCalc.vb is a specialized tool that precisely calculates and visualizes the turning trajectory of trucks.

Key Features

Application Areas

Important: When applying the calculation results to actual designs, always add a safety margin and have it verified by a professional.

📞 Support Information

Document Date: Auto-generated

Target File: T3_Uty1TruckTrajectoryCalc.vb

Language: Visual Basic .NET (VB.NET)

Total Lines: 1398 lines

Core Technologies: Windows Forms, Graphics Drawing, Trigonometric Calculations, EPPlus