Software Architecture - tj0vtj0v/KI-B-4-Software_Engineering GitHub Wiki
1. Overview
The microwave defrosting program follows a modular architecture, where each functional aspect of the system is encapsulated in a dedicated software component. The architecture promotes clarity, modularity, testability, and safety, aligning with best practices for embedded systems. Components communicate through clearly defined interfaces, enabling controlled access to sensors, actuators, and user inputs.
A diagram illustrating the architecture with all its submodules is provided below:
2. Assumptions
-
Hardware Availability
- All sensors (temperature, door switch, light sensor) and actuators (magnetron, fan, turntable motor, lamp) respond within specified timing bounds.
-
Real-Time Constraints
- Control loops must execute within their deadlines (e.g., door interlock check < 10 ms).
-
User Controls & Display
- The microwave is equipped with:
- A small monochrome LCD capable of rendering up to four characters, a colon separator, and simple pictogram icons.
- A single multifunction rotary encoder (with push-click to select, and rotate to edit values).
- A mechanical "Door Open" button, and distinct "Start" and "Stop/Cancel" buttons.
- The user interface guides the user through the defrost workflow (select program → adjust settings via rotary → press "Start").
- The microwave is equipped with:
-
Environment
- Supply voltage and line frequency remain within specified tolerances.
-
Logging
- Sufficient non-volatile storage is available for event logs; log operations must not block real-time control loops.
-
UI Constraints
- Display updates are limited by the LCD's four-character width and icon set; messages and indicators must be designed accordingly.
3. Interfaces of Components
Each software component defines a clear external interface for safe and predictable interaction. Below is a breakdown of each module, detailing what can be retrieved (get) and what can be controlled (set), along with their internal procedures:
-
Sensor Control
- Get: Temperature (interior & magnetron), door status, weight, humidity.
- Internal: Continuously polls sensor values and filters readings.
-
Door Control
- Get: Door lock and latch position.
- Set: Lock or unlock the door.
- Internal: Raises error if latch and lock state mismatch.
-
Light Control
- Get: Lamp state and health.
- Set: Toggle lamp.
- Internal: Monitors usage cycles and detects lamp failure.
-
Program Control
- Get: Current defrost program and its progress.
- Set: Start, pause, resume, cancel; adjust time.
- Internal: Maintains program logic and defrost cycle control.
-
Power Handler
- Get: Active power level.
- Set: Modify power level.
- Internal: Translates power level to target states of actuators.
-
Turntable Control
- Get: Rotation speed and status.
- Set: Enable/disable, direction.
- Internal: Controls motor operation.
-
Reflector Control
- Get: Rotation speed and status.
- Set: Enable/disable, direction.
- Internal: Controls motor operation.
-
Magnetron Control
- Get: Operational status, load, power, health.
- Set: Enable/disable high-voltage circuit.
- Internal: Monitors thermal limits and operational cycles.
-
Cooling Fan Control
- Get: RPM and health.
- Set: Set RPM or activate auto mode.
- Internal: Calculates necessary RPM to prevent overheating.
-
System Control
- Get: Error and exception reports.
- Set: Transition system state (Idle, Running, etc.).
- Internal: State machine managing high-level program flow.
-
Emergency Control
- Get: System health summary.
- Set: Trigger emergency mode.
- Internal: Activates safety shutdowns, manages emergency protocols.
-
Alarm Control
- Get: Current alert level.
- Set: Trigger or clear alarms.
- Internal: Controls alarm logic and tone patterns.
-
Idle Watchdog
- Set: Activate idle observer.
- Internal: Detects user inactivity and initiates wakeup of system control.
-
User Interaction Control
- Get: Validated user input.
- Set: UI screen and control settings.
- Internal: Handles input and display feedback.
-
Input Detector
- Get: Input events and diagnostics.
- Set: Configure polling frequency.
- Internal: Scans and preprocesses input signals.
-
Display Handler
- Get: Display status.
- Set: Set icons and text.
- Internal: Translates logical output into visual display.
-
Logging Handler
- Get: Current verbosity level.
- Set: Set logging detail or flush.
- Internal: Timestamps and formats system event logs.