can add two sin waves

This commit is contained in:
Scott Bell 2024-08-02 17:25:08 +02:00
parent 74c3a95ca3
commit ce5e435ae0
4 changed files with 8 additions and 5 deletions

View File

@ -59,7 +59,7 @@ export default class CompsManager extends EventEmitter {
return 'a + b'; return 'a + b';
} }
#addTelemetryObject = (telemetryObject) => { #addTelemetryObject = async (telemetryObject) => {
console.debug('📢 CompsManager: #addTelemetryObject', telemetryObject); console.debug('📢 CompsManager: #addTelemetryObject', telemetryObject);
const keyString = this.#openmct.objects.makeKeyString(telemetryObject.identifier); const keyString = this.#openmct.objects.makeKeyString(telemetryObject.identifier);
this.#telemetryObjects[keyString] = telemetryObject; this.#telemetryObjects[keyString] = telemetryObject;
@ -68,7 +68,7 @@ export default class CompsManager extends EventEmitter {
this.#telemetryCollections[keyString].on('add', this.#telemetryProcessor); this.#telemetryCollections[keyString].on('add', this.#telemetryProcessor);
this.#telemetryCollections[keyString].on('clear', this.#clearData); this.#telemetryCollections[keyString].on('clear', this.#clearData);
this.#telemetryCollections[keyString].load(); await this.#telemetryCollections[keyString].load();
}; };
static getCompsManager(domainObject, openmct, compsManagerPool) { static getCompsManager(domainObject, openmct, compsManagerPool) {

View File

@ -41,8 +41,8 @@ function calculate(telemetryForComps, expression) {
for (const [utc, sin1] of utcMap1.entries()) { for (const [utc, sin1] of utcMap1.entries()) {
if (utcMap2.has(utc)) { if (utcMap2.has(utc)) {
const sin2 = utcMap2.get(utc); const sin2 = utcMap2.get(utc);
const sumSin = evaluate(expression, { a: sin1, b: sin2 }); const output = evaluate(expression, { a: sin1, b: sin2 });
sumResults.push({ utc, sumSin }); sumResults.push({ utc, output });
} }
} }
return sumResults; return sumResults;

View File

@ -64,7 +64,8 @@ export default class CompsTelemetryProvider {
const telemetryForComps = specificCompsManager.requestUnderlyingTelemetry(); const telemetryForComps = specificCompsManager.requestUnderlyingTelemetry();
const expression = specificCompsManager.getExpression(); const expression = specificCompsManager.getExpression();
// need to create callbackID with a promise for future execution // need to create callbackID with a promise for future execution
console.debug('🏟️ Telemetry for comps:', telemetryForComps); console.debug('🏟️ 1 Telemetry for comps:', telemetryForComps);
console.debug('🏟️ 2 Telemetry for comps:', specificCompsManager.requestUnderlyingTelemetry());
this.#requestPromises[callbackID] = { resolve, reject }; this.#requestPromises[callbackID] = { resolve, reject };
this.#sharedWorker.port.postMessage({ this.#sharedWorker.port.postMessage({
type: 'calculateRequest', type: 'calculateRequest',

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
import CompsMetadataProvider from './CompsMetadataProvider.js';
import CompsTelemetryProvider from './CompsTelemetryProvider.js'; import CompsTelemetryProvider from './CompsTelemetryProvider.js';
import CompsViewProvider from './CompsViewProvider.js'; import CompsViewProvider from './CompsViewProvider.js';
@ -45,6 +46,7 @@ export default function CompsPlugin() {
} }
return true; return true;
}); });
openmct.telemetry.addProvider(new CompsMetadataProvider(openmct));
openmct.telemetry.addProvider(new CompsTelemetryProvider(openmct, compsManagerPool)); openmct.telemetry.addProvider(new CompsTelemetryProvider(openmct, compsManagerPool));
openmct.objectViews.addProvider(new CompsViewProvider(openmct, compsManagerPool)); openmct.objectViews.addProvider(new CompsViewProvider(openmct, compsManagerPool));
}; };