@ekamjotsingh.ek/energy-management-system
Version:
A smart campus energy management system
37 lines (32 loc) • 1.03 kB
text/typescript
/**
* Class representing a renewable energy source.
*/
class RenewableEnergySource {
sourceID: string;
type: string;
output: number;
/**
* Create a RenewableEnergySource instance.
* @param sourceID - Unique identifier for the energy source.
* @param type - Type of the energy source (e.g., solar, wind).
* @param output - Current output of the energy source.
*/
constructor(sourceID: string, type: string, output: number) {
this.sourceID = sourceID;
this.type = type;
this.output = output;
}
/**
* Simulate monitoring the output of the energy source.
*/
monitorOutput(): void {
console.log(`Monitoring ${this.type} energy source ${this.sourceID} with output ${this.output}W.`);
}
/**
* Simulate storing excess energy.
*/
storeExcessEnergy(): void {
console.log(`Storing excess energy from source ${this.sourceID}.`);
}
}
export default RenewableEnergySource;