@ekamjotsingh.ek/energy-management-system
Version:
A smart campus energy management system
18 lines (15 loc) • 564 B
text/typescript
// Class to represent a data point in the system
export default class DataPoint {
dataPointID: string;
timestamp: Date;
energyUsage: number;
constructor(dataPointID: string, timestamp: Date, energyUsage: number) {
this.dataPointID = dataPointID;
this.timestamp = timestamp;
this.energyUsage = energyUsage;
}
// Simulate viewing data point information
viewData(): void {
console.log(`DataPoint ${this.dataPointID} at ${this.timestamp.toISOString()}: ${this.energyUsage} kWh.`);
}
}