57 lines
1.5 KiB
JavaScript
57 lines
1.5 KiB
JavaScript
// Lightweight protocol scaffold for Open-EnergyMesh 0.2 core ontology
|
|
// This file provides tiny, versioned data contracts used by adapters.
|
|
|
|
// Privacy budget and audit trail primitives to support privacy-preserving
|
|
// aggregation and governance provenance in the MVP.
|
|
class PrivacyBudget {
|
|
constructor(limit = 0, allocated = 0) {
|
|
this.limit = limit; // maximum allowed budget (abstract unit)
|
|
this.allocated = allocated; // amount currently allocated/used
|
|
}
|
|
}
|
|
|
|
class AuditLog {
|
|
constructor(entries = []) {
|
|
this.entries = entries; // array of audit entries
|
|
}
|
|
addEntry(entry) {
|
|
this.entries.push(entry);
|
|
}
|
|
}
|
|
|
|
// Lightweight protocol scaffold for Open-EnergyMesh 0.2 core ontology
|
|
// This file provides tiny, versioned data contracts used by adapters.
|
|
|
|
class LocalProblem {
|
|
constructor(version = '0.2') {
|
|
this.version = version;
|
|
this.variables = {}; // local optimization variables
|
|
this.constraints = []; // local constraints
|
|
this.objective = null; // objective description or function reference
|
|
this.privacyBudget = new PrivacyBudget();
|
|
this.auditLog = new AuditLog();
|
|
}
|
|
}
|
|
|
|
class SharedVariables {
|
|
constructor() {
|
|
this.variables = {}; // dual/shared variables (e.g., Lagrange multipliers)
|
|
this.metadata = {};
|
|
}
|
|
}
|
|
|
|
class PlanDelta {
|
|
constructor(timestamp = Date.now()) {
|
|
this.timestamp = timestamp;
|
|
this.changes = {}; // delta payload describing what changed
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
LocalProblem,
|
|
SharedVariables,
|
|
PlanDelta,
|
|
PrivacyBudget,
|
|
AuditLog
|
|
};
|