This commit is contained in:
Martino Ferrari
2026-05-15 17:42:14 +02:00
commit e3389f932b
40 changed files with 7622 additions and 0 deletions
+289
View File
@@ -0,0 +1,289 @@
/**
* Test MARTe2 application for UDPStreamer DataSource.
*
* Generates scalar and high-frequency packed signals and streams them via UDPStreamer.
* Connect with the WebUI client (Client/WebUI) to visualise the signals.
*
* Signals produced (scalar, 10 kHz):
* Counter uint32 cycle counter from LinuxTimer
* Time uint32 time in microseconds from LinuxTimer
* Sine1 float32, 1 Hz sine, amplitude 10, quantised to uint16 on wire
* Sine2 float32, 0.3 Hz sine, amplitude 5, raw float32 on wire
*
* Signals produced (packed temporal arrays, 10 kHz × 1000 samples = 10 MSps):
* Ch1 float32[1000], 1 kHz sine, amplitude 1.0
* Ch2 float32[1000], 1 kHz sine, amplitude 0.5, phase π/2
* Both channels use TimeMode=FirstSample with Time as the anchor and
* SamplingRate=10000000 so the WebUI reconstructs the per-sample timestamps.
*/
$TestApp = {
Class = RealTimeApplication
+Functions = {
Class = ReferenceContainer
// ── Copy Counter + Time from LinuxTimer into the inter-GAM DDB ──────
+TimerGAM = {
Class = IOGAM
InputSignals = {
Counter = {
DataSource = Timer
Type = uint32
}
Time = {
Frequency = 1000
DataSource = Timer
Type = uint32
}
}
OutputSignals = {
Counter = {
DataSource = DDB
Type = uint32
}
Time = {
DataSource = DDB
Type = uint32
}
}
}
// ── 1 Hz sinusoidal signal ───────────────────────────────────────────
+SineGAM1 = {
Class = WaveformSin
Amplitude = 10.0
Frequency = 1.0
Phase = 0.0
Offset = 0.0
InputSignals = {
Time = {
DataSource = DDB
Type = uint32
}
}
OutputSignals = {
Sine1 = {
DataSource = DDB
Type = float32
}
}
}
// ── 0.3 Hz sinusoidal signal (phase-shifted) ─────────────────────────
+SineGAM2 = {
Class = WaveformSin
Amplitude = 5.0
Frequency = 0.3
Phase = 1.0472
Offset = 0.0
InputSignals = {
Time = {
DataSource = DDB
Type = uint32
}
}
OutputSignals = {
Sine2 = {
DataSource = DDB
Type = float32
}
}
}
// ── 1 kHz sine burst channel 1 (1000 samples/packet at 10 MSps) ──────
+SineGAM3 = {
Class = SineArrayGAM
Frequency = 1000.0
Amplitude = 1.0
Phase = 0.0
Offset = 0.0
SamplingRate = 1000000.0
OutputSignals = {
Ch1 = {
DataSource = DDB
Type = float32
NumberOfDimensions = 1
NumberOfElements = 1000
}
}
}
// ── 1 kHz sine burst channel 2 (phase-shifted by π/2) ──────────────
+SineGAM4 = {
Class = SineArrayGAM
Frequency = 1000.0
Amplitude = 0.5
Phase = 1.5708
Offset = 0.0
SamplingRate = 1000000.0
OutputSignals = {
Ch2 = {
DataSource = DDB
Type = float32
NumberOfDimensions = 1
NumberOfElements = 1000
}
}
}
// ── Route signals into UDPStreamer ────────────────────────────────────
+StreamerGAM = {
Class = IOGAM
InputSignals = {
Counter = {
DataSource = DDB
Type = uint32
}
Time = {
DataSource = DDB
Type = uint32
}
Sine1 = {
DataSource = DDB
Type = float32
}
Sine2 = {
DataSource = DDB
Type = float32
}
Ch1 = {
DataSource = DDB
Type = float32
NumberOfDimensions = 1
NumberOfElements = 1000
}
Ch2 = {
DataSource = DDB
Type = float32
NumberOfDimensions = 1
NumberOfElements = 1000
}
}
OutputSignals = {
Counter = {
DataSource = Streamer
Type = uint32
}
Time = {
DataSource = Streamer
Type = uint32
}
Sine1 = {
DataSource = Streamer
Type = float32
}
Sine2 = {
DataSource = Streamer
Type = float32
}
Ch1 = {
DataSource = Streamer
Type = float32
NumberOfDimensions = 1
NumberOfElements = 1000
}
Ch2 = {
DataSource = Streamer
Type = float32
NumberOfDimensions = 1
NumberOfElements = 1000
}
}
}
}
+Data = {
Class = ReferenceContainer
DefaultDataSource = DDB
// ── Inter-GAM data buffer ────────────────────────────────────────────
+DDB = {
Class = GAMDataSource
}
// ── Real-time clock / trigger source ─────────────────────────────────
+Timer = {
Class = LinuxTimer
SleepNature = "Default"
Signals = {
Counter = {
Type = uint32
}
Time = {
Type = uint32
}
}
}
// ── UDP Streamer DataSource ──────────────────────────────────────────
+Streamer = {
Class = UDPStreamer
Port = 44500
MaxPayloadSize = 1400
Signals = {
Counter = {
Type = uint32
}
Time = {
Type = uint32
Unit = "us"
}
Sine1 = {
Type = float32
Unit = "V"
RangeMin = -10.0
RangeMax = 10.0
QuantizedType = "uint16"
}
Sine2 = {
Type = float32
Unit = "V"
RangeMin = -5.0
RangeMax = 5.0
}
Ch1 = {
Type = float32
Unit = "V"
NumberOfDimensions = 1
NumberOfElements = 1000
TimeMode = FirstSample
TimeSignal = Time
SamplingRate = 1000000.0
}
Ch2 = {
Type = float32
Unit = "V"
NumberOfDimensions = 1
NumberOfElements = 1000
TimeMode = FirstSample
TimeSignal = Time
SamplingRate = 1000000.0
}
}
}
// ── Timing statistics ────────────────────────────────────────────────
+Timings = {
Class = TimingDataSource
}
}
+States = {
Class = ReferenceContainer
+Running = {
Class = RealTimeState
+Threads = {
Class = ReferenceContainer
+Thread1 = {
Class = RealTimeThread
CPUs = 0x1
Functions = {TimerGAM SineGAM1 SineGAM2 SineGAM3 SineGAM4 StreamerGAM}
}
}
}
}
+Scheduler = {
Class = GAMScheduler
TimingDataSource = Timings
}
}