|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Functions | |
| float | _demo_signal_sine (float t) |
| float | _demo_signal_ramp (float t) |
| float | _demo_signal_square (float t) |
| float | _demo_signal_noise (float t) |
| float | _demo_signal_step (float t) |
| float | _demo_signal_triangle (float t) |
| float | _demo_signal_double_sine (float t) |
| float | _demo_signal_decay (float t) |
| float | _demo_signal_pulse (float t) |
| float | _demo_signal_drift (float t) |
| float | _demo_signal_linear_cycle (float t) |
| float | _demo_signal_quadratic_cycle (float t) |
| float | _demo_signal_cubic_cycle (float t) |
| None | _precompute_demo_arrays () |
| int | _psi_to_code (float psi, float a, float b, float c, float d) |
| bytes | create_sensor_data_packet (List[Tuple[int, List[Tuple[int, int]]]] chunks, int packet_type, int version, int timestamp_ms, int max_packet_size) |
| bytes | build_demo_packet (Dict[int, Tuple[float, float, float, float]] pt_calibration, float demo_start_time, float stats_start_time, int packet_type, int version, int max_packet_size, int num_connectors=10, float psi_min=0.0, float psi_max=700.0) |
Variables | |
| int | MAX_PACKET_SIZE = 512 |
| str | PACKET_HEADER_FORMAT = "<BBI" |
| int | PACKET_HEADER_SIZE = 6 |
| str | SENSOR_DATA_PACKET_FORMAT = "<BB" |
| int | SENSOR_DATA_PACKET_SIZE = 2 |
| str | SENSOR_DATA_CHUNK_FORMAT = "<I" |
| int | SENSOR_DATA_CHUNK_SIZE = 4 |
| str | SENSOR_DATAPOINT_FORMAT = "<BI" |
| int | SENSOR_DATAPOINT_SIZE = 5 |
| int | DEMO_CODE_MIN = 0 |
| tuple | DEMO_CODE_MAX = (1 << 32) - 1 |
| int | PRECOMPUTED_LENGTH = 2000 |
| float | PRECOMPUTED_STEP = 0.05 |
| list | _DEMO_NORM_ARRAYS = [] |
| list | DEMO_SIGNAL_FUNCTIONS |
| dict | DEMO_PT_SPECIAL_SIGNALS |
Fake sensor data generator for demo mode.
Builds UDP packets in the same format as the real boards so the GUI receives and
decodes them exactly like real hardware.
Buffer layout matches Diablo::create_sensor_data_packet() in DAQv2-Comms:
- DiabloPackets.h: PacketHeader, SensorDataPacket, SensorDataChunk, SensorDatapoint
- DiabloPacketUtils.cpp: write order = header -> body_header -> for each chunk
(chunk timestamp -> num_sensors × datapoint)
No Qt or socket usage here.
|
protected |
Smooth cubic 0->1->0, period 4 s, normalized [0, 1].
Definition at line 116 of file demo_sensor_sender.py.
|
protected |
Repeating exponential decay, period 2 s.
Definition at line 84 of file demo_sensor_sender.py.
|
protected |
Beat pattern from two close frequencies.
Definition at line 78 of file demo_sensor_sender.py.
|
protected |
Slow linear drift + small deterministic variation, period 20 s.
Definition at line 97 of file demo_sensor_sender.py.
|
protected |
Triangle wave, period 4 s, normalized [0, 1] (linear 0->1->0).
Definition at line 104 of file demo_sensor_sender.py.
|
protected |
Smoothed deterministic noise in [0, 1].
Definition at line 61 of file demo_sensor_sender.py.
|
protected |
Short periodic spikes, period 2 s, duty 0.1 s.
Definition at line 92 of file demo_sensor_sender.py.
|
protected |
Parabola 0->1->0, period 4 s, normalized [0, 1].
Definition at line 110 of file demo_sensor_sender.py.
|
protected |
Sawtooth, repeating ramp up, period 4 s.
Definition at line 51 of file demo_sensor_sender.py.
|
protected |
Sine wave, period 4 s, scaled to [0, 1].
Definition at line 46 of file demo_sensor_sender.py.
|
protected |
Square wave, period 2 s.
Definition at line 56 of file demo_sensor_sender.py.
|
protected |
Two levels with slow transition, period 3 s per level.
Definition at line 67 of file demo_sensor_sender.py.
|
protected |
Triangle wave, period 4 s.
Definition at line 72 of file demo_sensor_sender.py.
|
protected |
Fill _DEMO_NORM_ARRAYS with fixed arrays of normalized [0,1] (run once at import).
Definition at line 147 of file demo_sensor_sender.py.
Referenced by build_demo_packet().
|
protected |
Inverse of cubic calibration: find ADC code that yields given psi (Newton-Raphson).
Definition at line 162 of file demo_sensor_sender.py.
Referenced by build_demo_packet().
| bytes demo_sensor_sender.build_demo_packet | ( | Dict[int, Tuple[float, float, float, float]] | pt_calibration, |
| float | demo_start_time, | ||
| float | stats_start_time, | ||
| int | packet_type, | ||
| int | version, | ||
| int | max_packet_size, | ||
| int | num_connectors = 10, | ||
| float | psi_min = 0.0, | ||
| float | psi_max = 700.0 ) |
Build one UDP packet with synthetic PT data for demo mode. Same structure as real boards: one chunk per connector (1..num_connectors), one datapoint per chunk. Normalized signals [0,1] are mapped to [psi_min, psi_max] and converted to ADC codes via inverse calibration so displayed psi ranges 0-700 for all.
Definition at line 229 of file demo_sensor_sender.py.
References _precompute_demo_arrays(), _psi_to_code(), create_sensor_data_packet(), and time.time().
| bytes demo_sensor_sender.create_sensor_data_packet | ( | List[Tuple[int, List[Tuple[int, int]]]] | chunks, |
| int | packet_type, | ||
| int | version, | ||
| int | timestamp_ms, | ||
| int | max_packet_size ) |
Build a sensor data UDP packet. Byte layout is identical to Diablo::create_sensor_data_packet() in DAQv2-Comms (DiabloPacketUtils.cpp): header (6) -> num_chunks, num_sensors (2) -> for each chunk: timestamp (4) then num_sensors × (sensor_id (1), data (4)). chunks: list of (chunk_timestamp_ms, [(sensor_id, adc_code_uint32), ...]) All chunks must have the same number of datapoints (num_sensors).
Definition at line 179 of file demo_sensor_sender.py.
Referenced by build_demo_packet().
|
protected |
Definition at line 43 of file demo_sensor_sender.py.
| tuple demo_sensor_sender.DEMO_CODE_MAX = (1 << 32) - 1 |
Definition at line 38 of file demo_sensor_sender.py.
| int demo_sensor_sender.DEMO_CODE_MIN = 0 |
Definition at line 37 of file demo_sensor_sender.py.
| dict demo_sensor_sender.DEMO_PT_SPECIAL_SIGNALS |
Definition at line 140 of file demo_sensor_sender.py.
| list demo_sensor_sender.DEMO_SIGNAL_FUNCTIONS |
Definition at line 122 of file demo_sensor_sender.py.
| int demo_sensor_sender.MAX_PACKET_SIZE = 512 |
Definition at line 20 of file demo_sensor_sender.py.
| str demo_sensor_sender.PACKET_HEADER_FORMAT = "<BBI" |
Definition at line 24 of file demo_sensor_sender.py.
| int demo_sensor_sender.PACKET_HEADER_SIZE = 6 |
Definition at line 25 of file demo_sensor_sender.py.
| int demo_sensor_sender.PRECOMPUTED_LENGTH = 2000 |
Definition at line 41 of file demo_sensor_sender.py.
| float demo_sensor_sender.PRECOMPUTED_STEP = 0.05 |
Definition at line 42 of file demo_sensor_sender.py.
| str demo_sensor_sender.SENSOR_DATA_CHUNK_FORMAT = "<I" |
Definition at line 30 of file demo_sensor_sender.py.
| int demo_sensor_sender.SENSOR_DATA_CHUNK_SIZE = 4 |
Definition at line 31 of file demo_sensor_sender.py.
| str demo_sensor_sender.SENSOR_DATA_PACKET_FORMAT = "<BB" |
Definition at line 27 of file demo_sensor_sender.py.
| int demo_sensor_sender.SENSOR_DATA_PACKET_SIZE = 2 |
Definition at line 28 of file demo_sensor_sender.py.
| str demo_sensor_sender.SENSOR_DATAPOINT_FORMAT = "<BI" |
Definition at line 33 of file demo_sensor_sender.py.
| int demo_sensor_sender.SENSOR_DATAPOINT_SIZE = 5 |
Definition at line 34 of file demo_sensor_sender.py.