Skip to content

πŸš— A .NET 8.0 simulation system modeling Cars, Trucks, Buses, and Emergency Vehicles with safety validation, OOP design, and ISO 26262-inspired architecture.

Notifications You must be signed in to change notification settings

NickiMash17/AutonomousVehicleSimulation

Repository files navigation

πŸš— Autonomous Vehicle Simulation System

A console-based simulation demonstrating object-oriented design principles and safety-critical system architecture inspired by ISO 26262 standards.

.NET C# License


πŸ“‹ Table of Contents


🎯 Overview

This project simulates an autonomous vehicle system with multiple vehicle types, each implementing unique behaviors and safety constraints. Built as part of a Software Engineering assessment, it showcases practical application of design patterns, SOLID principles, and safety-critical system design.

Why This Project?

  • Academic Excellence: Demonstrates mastery of OOP concepts and architectural patterns
  • Industry Standards: Applies ISO 26262 safety principles to software design
  • Real-World Skills: Shows problem-solving abilities relevant to automotive software engineering

✨ Key Features

🚘 Vehicle Types

Vehicle Speed Range Special Features
πŸš— Car 0–180 km/h Standard acceleration and handling
🚚 Truck 0–120 km/h Cargo capacity management, reduced acceleration
🚌 Bus 0–100 km/h Passenger load affects performance metrics
πŸš“ Emergency Vehicle 0–200 km/h Emergency override mode, priority handling

πŸ›‘οΈ Safety-Critical Features

  • Input Validation: Comprehensive speed and fuel level checks
  • Error Handling: Graceful exception management for edge cases
  • Safety Constraints: Emergency vehicle operation monitoring (triggers error if <10 km/h without emergency mode)
  • State Management: Prevents invalid state transitions

πŸ—οΈ Architecture Highlights

  • Dependency Injection: Uses interfaces (ILogger, ITimeProvider) for testability
  • Design Patterns: Template Method and Strategy patterns
  • SOLID Principles: Clean separation of concerns and single responsibility
  • Extensibility: Easy to add new vehicle types or behaviors

πŸ”§ Technical Highlights

πŸ’‘ Object-Oriented Design
   β”œβ”€β”€ Inheritance hierarchy for vehicle types
   β”œβ”€β”€ Polymorphic behavior implementation
   └── Encapsulation of vehicle-specific logic

🎨 Design Patterns
   β”œβ”€β”€ Template Method: Shared vehicle behavior
   β”œβ”€β”€ Strategy Pattern: Flexible validation logic
   └── Dependency Injection: Testable architecture

πŸ§ͺ Quality Assurance
   β”œβ”€β”€ Automated test scenarios
   β”œβ”€β”€ Edge case validation
   └── Console-based verification

πŸš€ Getting Started

Prerequisites

  • .NET 8.0 SDK or higher
  • A code editor (VS Code, Visual Studio, or Rider)

Installation

  1. Clone the repository

    git clone https://github.com/NickiMash17/autonomous-vehicle-simulation.git
    cd autonomous-vehicle-simulation
  2. Restore dependencies

    dotnet restore
  3. Build the project

    dotnet build
  4. Run the simulation

    dotnet run

πŸ“ Project Structure

autonomous-vehicle-simulation/
β”‚
β”œβ”€β”€ Program.cs                      # Application entry point
β”‚
β”œβ”€β”€ Models/                         # Vehicle domain models
β”‚   β”œβ”€β”€ Vehicle.cs                  # Abstract base class
β”‚   β”œβ”€β”€ Car.cs                      # Standard car implementation
β”‚   β”œβ”€β”€ Truck.cs                    # Truck with cargo management
β”‚   β”œβ”€β”€ Bus.cs                      # Bus with passenger handling
β”‚   └── EmergencyVehicle.cs         # Emergency vehicle with override
β”‚
β”œβ”€β”€ Interfaces/                     # Abstraction layer
β”‚   β”œβ”€β”€ ILogger.cs                  # Logging contract
β”‚   └── ITimeProvider.cs            # Time simulation contract
β”‚
β”œβ”€β”€ Services/                       # Infrastructure services
β”‚   β”œβ”€β”€ ConsoleLogger.cs            # Console output implementation
β”‚   └── SimulationTimeProvider.cs   # Time control for testing
β”‚
└── README.md                       # Project documentation

πŸ’» Usage Examples

Sample Output

╔════════════════════════════════════════════════╗
β•‘   Autonomous Vehicle Simulation - Starting    β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

[βœ“] Car initialized
    └── Speed: 120 km/h | Fuel: 75% | Status: Active

[βœ“] Truck initialized
    └── Speed: 80 km/h | Fuel: 80% | Cargo: 5000 kg

[βœ“] Bus initialized
    └── Speed: 60 km/h | Fuel: 90% | Passengers: 30

[βœ“] Emergency Vehicle initialized
    └── Speed: 160 km/h | Mode: EMERGENCY | Priority: HIGH

════════════════════════════════════════════════
Simulation Complete - All Systems Operational
════════════════════════════════════════════════

Code Example

// Initialize vehicles with dependency injection
ILogger logger = new ConsoleLogger();
ITimeProvider timeProvider = new SimulationTimeProvider();

var emergencyVehicle = new EmergencyVehicle(logger, timeProvider);
emergencyVehicle.ActivateEmergencyMode();
emergencyVehicle.SetSpeed(160);

// Simulation handles safety constraints automatically

🎨 Design Patterns

Template Method Pattern

The abstract Vehicle class defines the skeleton of vehicle operations, allowing subclasses to override specific steps while maintaining consistent behavior.

Strategy Pattern

Validation and logging strategies can be swapped at runtime, enabling flexible testing scenarios and different operational modes.

Dependency Injection

Interfaces like ILogger and ITimeProvider allow for easy mocking and testing without tight coupling to concrete implementations.


πŸ—ΊοΈ Future Roadmap

  • GUI Dashboard: Build visual interface using WPF or .NET MAUI
  • Unit Testing: Implement comprehensive test suite with xUnit
  • AI Integration: Add autonomous decision-making algorithms
  • Telemetry System: Log simulation data to database
  • Multi-threading: Simulate concurrent vehicle operations
  • REST API: Expose simulation controls via web API
  • Docker Support: Containerize application for easy deployment

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.


πŸ‘©β€πŸ’» Author

Nicolette
Software Engineering Student | Full-Stack Developer | AI/ML Enthusiast

πŸ“ South Africa
πŸ”— GitHub | LinkedIn | Portfolio


πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


🏷️ Keywords

C# OOP .NET8 Autonomous-Vehicles Software-Engineering ISO-26262 Design-Patterns Safety-Critical-Systems Console-Application Academic-Project


⭐ If you found this project helpful, please consider giving it a star!

Made with ❀️ and β˜• by Nicolette

About

πŸš— A .NET 8.0 simulation system modeling Cars, Trucks, Buses, and Emergency Vehicles with safety validation, OOP design, and ISO 26262-inspired architecture.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages