The software should roughly simulate the electrical system of an aircraft.
The system consists of:
Rechargeable battery featuring some discharge curve and some characteristic how the voltage drops under load.
DC generator, supplying power only if the aircraft engine is turned on
Battery recharging electronics allowing the battery recharging only if there is enough energy available in the system.
Multiple electrical instruments - consumers of electrical energy, each with specific level of consumption.
System bus inteconnecting all the participats, transfrerring the electrical energy from producers to consumers.
Instruments operate only if the voltage on the system bus exceeds some instrument-specific threshold. Each instrument consumes some amount of electrical energy if it is operable, causing some voltage drop on the system bus depending on instrument electrical characteristic and power supply electrical characteristic (battery or DC generator).
We would like to have a system that allows adding arbitrary number of instruments witch different electrical characteristics. The system should calculate the status in discrete time intervals (frames), every 50 milliseconds.
The status includes:
voltage level on the system bus
power sources load level (how much power is drawn from power supplies)
remaining battery capacity
instruments status (operability, current consumption level)
What we would like to see:
C++ classes implementing the modules. Can be very simple implementation but still following the way how the system should operate. Commented as you deem it necessary for the purpose of understanding the code.
Working software with some kind of UI (could be for example a simple console app) allowing to:
monitor the system status - for example print a line with status info every frame
adding or removing different type of consumers (with different consumption level and voltage threshold)
turning on/off the aircraft engine (makes the DC generator produce electrical energy)