Task Summary
DriverModel_RealSim.cpp and DriverModel_RealSim_v2021.cpp are nearly identical (~1887 and ~1922 lines respectively) with only minor API-level differences. Extract the shared logic into a common base to eliminate code duplication.
Why is this needed?
Currently any bug fix or feature must be applied to both files independently. The two files differ in only ~50 lines out of ~1900 (less than 3%), primarily:
long vs int type for VISSIM API parameters (v2021 API uses int)
- A few global flags added to v2021:
SUB_EGO_ONLY, ENABLE_WARMUP, isInitialTimeFinished
- Variable name
simTime vs simTime_g
- Default value of
NEED_SPEED_LIMIT (true vs false)
The remaining ~97% of code (message handling, socket communication, data processing, FIXS integration) is identical. Multiple // TODO: add code stubs appear in the same locations in both files.
Scope of Work
1. Analyze and document all differences
- Run a full diff and categorize every difference
- Document API-level differences (VISSIM 2022+ vs 2021 driver model API)
2. Extract shared logic
Option A: Single shared header DriverModel_FIXS_Common.h with inline implementation
Option B: Shared DriverModel_FIXS_Common.cpp compiled into both projects via shared source
3. Create thin version-specific wrappers
DriverModel_RealSim.cpp → thin wrapper using modern VISSIM API (long parameters)
DriverModel_RealSim_v2021.cpp → thin wrapper using legacy VISSIM API (int parameters)
- Both include/link to shared common implementation
4. Resolve TODO stubs
- The
// TODO: add code stubs (at least 8 locations in each file) represent unimplemented message field handlers
- Document what each TODO means and either implement or remove with a proper issue reference
5. Add Python auto-test
- Add
tests/Python/test_vissim_driver_parity.py that:
- Parses both
.cpp files
- Verifies that non-API-signature sections are identical (or differ only in known documented ways)
- Alerts if one file has a change that wasn't applied to the other
Files Involved
ProprietaryFiles/VISSIMserver/DriverModel_RealSim/DriverModel_RealSim.cpp
ProprietaryFiles/VISSIMserver/DriverModel_RealSim_v2021/DriverModel_RealSim_v2021.cpp
ProprietaryFiles/VISSIMserver/VISSIMserver.sln
- Build scripts in
scripts/dispatch/3_vissim_components.bat
Acceptance Criteria
Branch and PR Target
- All PRs for this issue should target the
dev branch (not main)
- First ensure
main is merged into dev before starting work
Task Summary
DriverModel_RealSim.cppandDriverModel_RealSim_v2021.cppare nearly identical (~1887 and ~1922 lines respectively) with only minor API-level differences. Extract the shared logic into a common base to eliminate code duplication.Why is this needed?
Currently any bug fix or feature must be applied to both files independently. The two files differ in only ~50 lines out of ~1900 (less than 3%), primarily:
longvsinttype for VISSIM API parameters (v2021 API usesint)SUB_EGO_ONLY,ENABLE_WARMUP,isInitialTimeFinishedsimTimevssimTime_gNEED_SPEED_LIMIT(true vs false)The remaining ~97% of code (message handling, socket communication, data processing, FIXS integration) is identical. Multiple
// TODO: add codestubs appear in the same locations in both files.Scope of Work
1. Analyze and document all differences
2. Extract shared logic
Option A: Single shared header
DriverModel_FIXS_Common.hwith inline implementationOption B: Shared
DriverModel_FIXS_Common.cppcompiled into both projects via shared source3. Create thin version-specific wrappers
DriverModel_RealSim.cpp→ thin wrapper using modern VISSIM API (longparameters)DriverModel_RealSim_v2021.cpp→ thin wrapper using legacy VISSIM API (intparameters)4. Resolve TODO stubs
// TODO: add codestubs (at least 8 locations in each file) represent unimplemented message field handlers5. Add Python auto-test
tests/Python/test_vissim_driver_parity.pythat:.cppfilesFiles Involved
ProprietaryFiles/VISSIMserver/DriverModel_RealSim/DriverModel_RealSim.cppProprietaryFiles/VISSIMserver/DriverModel_RealSim_v2021/DriverModel_RealSim_v2021.cppProprietaryFiles/VISSIMserver/VISSIMserver.slnscripts/dispatch/3_vissim_components.batAcceptance Criteria
tests/Python/test_vissim_driver_parity.pypassesBranch and PR Target
devbranch (notmain)mainis merged intodevbefore starting work