A console-based simulation demonstrating object-oriented design principles and safety-critical system architecture inspired by ISO 26262 standards.
- Overview
- Key Features
- Technical Highlights
- Getting Started
- Project Structure
- Usage Examples
- Design Patterns
- Future Roadmap
- Contributing
- Author
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.
- 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
| 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 |
- 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
- 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
π‘ 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
- .NET 8.0 SDK or higher
- A code editor (VS Code, Visual Studio, or Rider)
-
Clone the repository
git clone https://github.com/NickiMash17/autonomous-vehicle-simulation.git cd autonomous-vehicle-simulation -
Restore dependencies
dotnet restore
-
Build the project
dotnet build
-
Run the simulation
dotnet run
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
ββββββββββββββββββββββββββββββββββββββββββββββββββ
β 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
ββββββββββββββββββββββββββββββββββββββββββββββββ
// 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 automaticallyThe abstract Vehicle class defines the skeleton of vehicle operations, allowing subclasses to override specific steps while maintaining consistent behavior.
Validation and logging strategies can be swapped at runtime, enabling flexible testing scenarios and different operational modes.
Interfaces like ILogger and ITimeProvider allow for easy mocking and testing without tight coupling to concrete implementations.
- 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
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.
Nicolette
Software Engineering Student | Full-Stack Developer | AI/ML Enthusiast
π South Africa
π GitHub | LinkedIn | Portfolio
This project is licensed under the MIT License - see the LICENSE file for details.
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