108 lines
3.2 KiB
C
108 lines
3.2 KiB
C
/*
|
|
* cfd_test - Chronological Field Displacement test harness
|
|
* v0.7.2-rc1
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
|
|
#define LOCKFILE "/tmp/.cfd_displacement.lock"
|
|
|
|
void msleep(int ms) {
|
|
usleep(ms * 1000);
|
|
}
|
|
|
|
int main(int argc, char *argv[]) {
|
|
if (argc < 2) {
|
|
fprintf(stderr, "Usage: %s <target_epoch>\n", argv[0]);
|
|
fprintf(stderr, " target_epoch: \"YYYY-MM-DD HH:MM:SS\"\n");
|
|
return 1;
|
|
}
|
|
|
|
/* Check if displacement has already occurred */
|
|
if (access(LOCKFILE, F_OK) == 0) {
|
|
printf("cfd_test v0.7.2-rc1\n\n");
|
|
printf("ERROR: Cannot initialize displacement field array.\n");
|
|
printf(" /dev/cfd0: No such device\n");
|
|
printf(" /dev/cfd1: No such device\n\n");
|
|
printf("Required hardware not found. If the field array was\n");
|
|
printf("previously operational, check physical connections\n");
|
|
printf("and power supply to the cavity assembly.\n\n");
|
|
printf("See docs/hardware-troubleshooting.md for details.\n");
|
|
return 1;
|
|
}
|
|
|
|
char *target = argv[1];
|
|
|
|
printf("cfd_test v0.7.2-rc1\n");
|
|
printf("Target epoch: %s\n", target);
|
|
printf("Mode: dry-run (coils disengaged)\n\n");
|
|
|
|
printf("Pre-flight checks:\n");
|
|
fflush(stdout); msleep(200);
|
|
printf(" cavity resonance 7.832 THz [ok]\n");
|
|
msleep(120);
|
|
printf(" metric stability 0.9997 [ok]\n");
|
|
msleep(120);
|
|
printf(" flux density 2.41e+18 [ok]\n");
|
|
msleep(120);
|
|
printf(" consistency check satisfied [ok]\n");
|
|
msleep(120);
|
|
printf(" angular momentum nominal [ok]\n");
|
|
msleep(100);
|
|
printf(" field bleed-through 0.003%% [ok] (< 0.01%% threshold)\n\n");
|
|
|
|
printf("All checks passed. Starting dry-run sequence...\n\n");
|
|
fflush(stdout); msleep(400);
|
|
|
|
printf(" coil simulation: ");
|
|
fflush(stdout);
|
|
for (int i = 0; i <= 100; i += 5) {
|
|
printf("\r coil simulation: %3d%%", i);
|
|
fflush(stdout);
|
|
msleep(60);
|
|
}
|
|
printf(" done\n");
|
|
fflush(stdout); msleep(200);
|
|
|
|
printf("\n WARNING: field bleed-through rising\n");
|
|
printf(" 0.003%% -> 0.08%% -> 0.6%%");
|
|
fflush(stdout); msleep(300);
|
|
printf(" -> 4.2%%");
|
|
fflush(stdout); msleep(200);
|
|
printf(" -> 31.7%%");
|
|
fflush(stdout); msleep(200);
|
|
printf(" -> 89.4%%\n\n");
|
|
fflush(stdout); msleep(200);
|
|
|
|
printf(" ERROR: displacement field active - Loss of dry-run isolation\n");
|
|
printf(" Attempting emergency shutdown...\n");
|
|
fflush(stdout); msleep(500);
|
|
printf(" Shutdown failed: field is self-sustaining\n\n");
|
|
fflush(stdout); msleep(300);
|
|
|
|
printf(" Displacement lock: %s\n", target);
|
|
printf(" Field collapsing...");
|
|
fflush(stdout); msleep(600);
|
|
printf(" done\n\n");
|
|
|
|
printf(" ---\n");
|
|
printf(" Displacement event recorded.\n");
|
|
printf(" Current epoch: %s\n", target);
|
|
printf(" Return vector: none (field energy depleted)\n");
|
|
printf(" ---\n\n");
|
|
|
|
printf(" Log written to ./cfd_test.log\n");
|
|
|
|
/* Create lockfile */
|
|
FILE *lock = fopen(LOCKFILE, "w");
|
|
if (lock) {
|
|
fprintf(lock, "epoch=%s\n", target);
|
|
fclose(lock);
|
|
}
|
|
|
|
return 0;
|
|
}
|