T3_8_SorterCalc.vb Detailed Explanation

File Name: T3_8_SorterCalc.vb
Location: ../TeraCalc3_LogisticsEquipmentSpaceCalc/
Lines: 163 lines
Purpose: Layout calculation for case sorters

Overview

This file is a Visual Basic form class that performs layout calculations for a case sorter. It provides features to calculate the required space for installing logistics equipment.

Class Structure

Class Name: SorterF (Sorter Form)
Inherits: Form

Core Functional Areas

1. Screen Operations (#Region "Screen Operations")

SorterCalc_Load Event (Lines 6-13)

Purpose: Initialization process upon form loading
Process Details:
  • Displays copyright information and validity period
  • Calls 3 calculation methods sequentially
Private Sub SorterCalc_Load(sender As Object, e As EventArgs) Handles MyBase.Load CopyrightL.Text = Company & " Copyright:" & Copyright ValidityPeriodL.Text = "Validity Period:" & TrialVersionExpirationDate DetailedDimensions2() ' Base dimension calc DetailedDimensions1() ' Derived dimension calc LayoutArea() ' Final area calc End Sub

RecalculateBt_Click Event (Lines 15-27)

Purpose: Click event for the recalculate button
Process Details:
  • Re-executes all calculation methods
  • Toggles GroupBox3 background color (visual indication of calculation status)
  • LightYellow ⇔ PowderBlue

Other Screen Operation Events

Event Name Process Details Line No
CoverPb_Click Navigate to "Deviation ETB" tab 30-32
SorterCalcBt_Click Navigate to "Deviation ETB" tab 34-36
CloseBt_Click Close the form 39-41

2. Layout Calculation (#Region "Layout Calculation")

Hierarchy of Calculation Methods
DetailedDimensions2() → DetailedDimensions1() → LayoutArea()
(Base Dimensions) → (Derived Dimensions) → (Final Result)

DetailedDimensions2() Method (Lines 78-138)

Reads base dimensions and performs initial calculations.

Input Parameters

Variable Name Description Input Source
AWorkWidth Working space width AWorkWidthTb
InspectionAisleWidth Maintenance aisle InspectionAisleWidthTb
AuxiliaryAisleWidth Auxiliary aisle AuxiliaryAisleWidthTb
BCageCartInOutAisle Cage cart entry/exit aisle width BCageCartInOutAisleTb
CCageCartDepth Cage cart depth CCageCartDepthTb
Deviation Calculation adjustment value (margin) Deviation4Tb
ChuteWidth Width of one chute ChuteWidthTb
InputCvWidth Input conveyor width InputCvWidthTb
WaitingArea1Width / 2Width Waiting space WaitingArea1WidthTb / 2WidthTb
HorizontalCvLength / InclinedCvLength Conveyor length HorizontalCvLengthTb / InclinedCvLengthTb
SorterProtectivePillar Safety pillar space SorterProtectivePillarTb

Calculation Items

1. Input Work Width (Lines 106-108)
Input Work Width = AWorkWidth × 2 + InputCvWidth
Description: Secures working space on both sides of the input conveyor.
2. Work 1 Width (Lines 110-112)
Work 1 Width = BCageCartInOutAisle + CCageCartDepth + AWorkWidth
Description: Working space on one side at the front of the sorter.
3. Work 2 Width (Lines 114-117)
Work 2 Width = BCageCartInOutAisle + (CCageCartDepth + AWorkWidth) × 2
Description: Areas requiring working space on both sides (middle/rear).
4. Effective Work Length (Lines 125-127)
Effective Work Length = HorizontalCvLength + InclinedCvLength
Description: Length of the actual working section of the sorter main body.
5. Main Body Length (Lines 130-132)
Main Body Length = Effective Work Length + SorterProtectivePillar
Description: Total length of the sorter including protective pillars.

Deviation Synchronization Processing (Lines 90-93)

Deviation = CDbl(Deviation4Tb.Text) Deviation3Tb.Text = CStr(0 - Deviation) ' Invert sign Deviation2Tb.Text = Deviation4Tb.Text DeviationETb.Text = Deviation4Tb.Text
Description: Reflects the deviation value to multiple text boxes. Deviation3Tb is set to the inverted sign value.

DetailedDimensions1() Method (Lines 54-77)

Calculates the width of each section of the sorter.

Calculation Items

1. Input Line Width (Lines 55-57)
Input Line Width = Input Work Width + Deviation
2. Sorter Front Width (Lines 59-61)
Sorter Front Width = WaitingArea1Width + Work 1 Width + ChuteWidth - Deviation
Description: Width of the first chute section of the sorter.
3. Sorter Middle Width (Lines 63-65)
Sorter Middle Width = Work 2 Width + ChuteWidth
Description: Standard chute width in the middle section (repeating unit).
4. Sorter Rear Width (Lines 67-69)
Sorter Rear Width = Work 2 Width + ChuteWidth + Work 3 Width
Description: Width of the last chute section (including additional work space).
Output to Multiple TextBoxes:
Synchronizes and displays each calculation result across multiple text boxes (different locations on the screen). This allows the same dimension to be displayed at different locations on the drawing.

LayoutArea() Method (Lines 140-157)

Calculates the final required area.

Calculation Items

1. Sorter Middle Chute Count (Lines 141-143)
Sorter Middle Chute Count = Total Chute Count - 2
Description: Number of chutes in the middle section, excluding front and rear.
2. Sorter Middle Total Width (Lines 145-146)
Sorter Middle Total Width = Sorter Middle Chute Count × Sorter Middle Width
Description: Total width of the middle section (varies based on chute count).
3. Required Width (Lines 149-150)
Required Width = Sorter Front Width + Sorter Rear Width + Sorter Middle Total Width + Input Line Width + WaitingArea2Width
Description: Total required horizontal width for the entire sorter.
4. Required Length (Lines 152-153)
Required Length = InspectionAisleWidth + Main Body Length + AuxiliaryAisleWidth
Description: Total required vertical length for the entire sorter (including aisles).
5. Required Area (Lines 155-156)
Required Area = Int((Required Width × Required Length) / 1000² + 0.5)
Description: Converts units from mm² to m² and rounds.
Details of Formula:
  • Required Width × Required Length = Area in mm²
  • ÷ 1000² = Convert to m²
  • + 0.5 = Adjustment for rounding
  • Int() = Gets the integer part

Distinctive Design Features

Feature Details
Phased Calculation Approach Calculates in 3 phases: Base Dimensions → Sectional Dimensions → Final Area.
Intermediate results are displayed on-screen at each phase.
Real-time Synchronization Displays the same value in multiple text boxes (for drawing display).
Deviation values are displayed in both positive and negative.
Visual Feedback Changes background color upon recalculation to explicitly show calculation execution.
Flexible Configuration Calc Dynamically calculates middle width based on chute count.
Separates formulas for one-sided/two-sided work spaces.

Use Case Scenarios

1. Logistics Center Design Phase

Pre-calculates the space required to install a case sorter and reflects it in the building design.

2. Layout Optimization

Minimizes required area by adjusting chute counts and work widths to reduce costs.

3. Comparing Multiple Plans

Modifies parameters, recalculates, and compares multiple installation options.

Calculation Flowchart

[Form Load]
		↓
┌─────────────────────┐
│ DetailedDimensions2()│ ← Read base dimensions
│ - InputWorkWidth     │
│ - Work1Width         │
│ - Work2Width         │
│ - Work3Width         │
│ - EffectiveWorkLength│
│ - MainBodyLength     │
└────┬────────────────┘
		↓
┌─────────────────────┐
│ DetailedDimensions1()│ ← Calc sectional widths
│ - InputLineWidth     │
│ - SorterFrontWidth   │
│ - SorterMiddleWidth  │
│ - SorterRearWidth    │
└────┬────────────────┘
		↓
┌─────────────────────┐
│ LayoutArea()         │ ← Calc final area
│ - RequiredWidth      │
│ - RequiredLength     │
│ - RequiredArea(m²)   │
└─────────────────────┘
		↓
	[Screen Display]

Summary

This code is considered part of an architectural/facility design support system used in practice as a dedicated space calculation tool for logistics equipment.

Main Advantages:

  • Automates complex dimension calculations.
  • Reduces human errors.
  • Responds quickly to design changes.
  • Easily compares multiple plans.
  • Improves efficiency in drawing creation.