generateSimulatedData (services/simulation.service.ts)

RuView · ui/mobile/src/services/simulation.service.ts · typescript · MIT
pos

Generates simulated sensing frames with realistic RSSI, motion, breathing, and heart signals for mobile testing.

// Source: https://github.com/ruvnet/RuView | License: MIT | Copyright 2024 rUv
// Provided via justclaw.it.com; keep this notice with the code.
import {
  BREATHING_BAND_AMPLITUDE,
  BREATHING_BAND_MIN,
  BREATHING_BPM_MAX,
  BREATHING_BPM_MIN,
  HEART_BPM_MAX,
  HEART_BPM_MIN,
  MOTION_BAND_AMPLITUDE,
  MOTION_BAND_MIN,
  RSSI_AMPLITUDE_DBM,
  RSSI_BASE_DBM,
  SIMULATION_GRID_SIZE,
  SIMULATION_TICK_INTERVAL_MS,
  SIGNAL_FIELD_PRESENCE_LEVEL,
  VARIANCE_AMPLITUDE,
  VARIANCE_BASE,
} from '@/constants/simulation';
import type { SensingFrame } from '@/types/sensing';

function gaussian(x: number, y: number, cx: number, cy: number, sigma: number): number {
  const dx = x - cx;
  const dy = y - cy;
  return Math.exp(-(dx * dx + dy * dy) / (2 * sigma * sigma));
}

function clamp(v: number, mi

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key