Class TACResults
Aggregates trial-level and summary metrics for a TAC test session, and provides CSV export of the full trial history.
Inherited Members
Namespace: MOSAIC.Components.Tests.TAC
Assembly: MOSAIC.dll
Syntax
public sealed class TACResults : ObservableObject, INotifyPropertyChanged, INotifyPropertyChanging
Remarks
This class is owned by a TAC block (via Results) and should not be instantiated independently. It is observable so that ViewModels can bind directly to the aggregate properties.
Thread safety: Property updates are expected to occur on the pipeline thread. Bind from the UI thread via the standard dispatcher mechanism.
Constructors
TACResults(string, double, double)
Initializes a new TACResults instance.
Declaration
public TACResults(string blockName, double dwellTime, double successThreshold)
Parameters
| Type | Name | Description |
|---|---|---|
| string | blockName | Name of the owning TAC block. |
| double | dwellTime | Configured dwell time (for export headers). |
| double | successThreshold | Configured success threshold (for export headers). |
Fields
_averageCompletionTime
Average completion time across successful trials (seconds).
Declaration
[ObservableProperty]
private double _averageCompletionTime
Field Value
| Type | Description |
|---|---|
| double |
_averageOvershoot
Average overshoot count across all trials.
Declaration
[ObservableProperty]
private double _averageOvershoot
Field Value
| Type | Description |
|---|---|
| double |
_averagePathEfficiency
Average path efficiency across successful trials [0, 1].
Declaration
[ObservableProperty]
private double _averagePathEfficiency
Field Value
| Type | Description |
|---|---|
| double |
_blockName
Name of the owning TAC block (used in export headers).
Declaration
private readonly string _blockName
Field Value
| Type | Description |
|---|---|
| string |
_completionRate
Completion rate as a percentage [0, 100].
Declaration
[ObservableProperty]
private double _completionRate
Field Value
| Type | Description |
|---|---|
| double |
_completionTimes
Declaration
private readonly List<double> _completionTimes
Field Value
| Type | Description |
|---|---|
| List<double> |
_dwellTime
Dwell time configuration (used in export headers).
Declaration
private readonly double _dwellTime
Field Value
| Type | Description |
|---|---|
| double |
_overshootCounts
Declaration
private readonly List<int> _overshootCounts
Field Value
| Type | Description |
|---|---|
| List<int> |
_pathEfficiencies
Declaration
private readonly List<double> _pathEfficiencies
Field Value
| Type | Description |
|---|---|
| List<double> |
_successThreshold
Success threshold configuration (used in export headers).
Declaration
private readonly double _successThreshold
Field Value
| Type | Description |
|---|---|
| double |
_trialHistory
Declaration
private readonly List<TrialRecord> _trialHistory
Field Value
| Type | Description |
|---|---|
| List<TrialRecord> |
_trialsAttempted
Total number of attempted trials.
Declaration
[ObservableProperty]
private int _trialsAttempted
Field Value
| Type | Description |
|---|---|
| int |
_trialsCompleted
Number of successfully completed trials.
Declaration
[ObservableProperty]
private int _trialsCompleted
Field Value
| Type | Description |
|---|---|
| int |
Properties
AverageCompletionTime
Average completion time across successful trials (seconds).
Declaration
[ExcludeFromCodeCoverage]
public double AverageCompletionTime { get; set; }
Property Value
| Type | Description |
|---|---|
| double |
AverageOvershoot
Average overshoot count across all trials.
Declaration
[ExcludeFromCodeCoverage]
public double AverageOvershoot { get; set; }
Property Value
| Type | Description |
|---|---|
| double |
AveragePathEfficiency
Average path efficiency across successful trials [0, 1].
Declaration
[ExcludeFromCodeCoverage]
public double AveragePathEfficiency { get; set; }
Property Value
| Type | Description |
|---|---|
| double |
CompletionRate
Completion rate as a percentage [0, 100].
Declaration
[ExcludeFromCodeCoverage]
public double CompletionRate { get; set; }
Property Value
| Type | Description |
|---|---|
| double |
TrialCount
Number of trials recorded so far.
Declaration
public int TrialCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
TrialHistory
Read-only access to the full trial history for export or analysis.
Declaration
public IReadOnlyList<TrialRecord> TrialHistory { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<TrialRecord> |
TrialsAttempted
Total number of attempted trials.
Declaration
[ExcludeFromCodeCoverage]
public int TrialsAttempted { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
TrialsCompleted
Number of successfully completed trials.
Declaration
[ExcludeFromCodeCoverage]
public int TrialsCompleted { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
Avg(List<double>)
Computes the arithmetic mean of a list.
Declaration
private static double Avg(List<double> v)
Parameters
| Type | Name | Description |
|---|---|---|
| List<double> | v |
Returns
| Type | Description |
|---|---|
| double |
ExportCsv()
Exports the full trial history as a CSV string, including configuration headers and a summary footer.
Declaration
public string ExportCsv()
Returns
| Type | Description |
|---|---|
| string | A CSV-formatted string ready to be written to a file. |
Examples
var csv = tacBlock.Results.ExportCsv();
File.WriteAllText("tac_results.csv", csv);
OnAverageCompletionTimeChanged(double)
Executes the logic for when AverageCompletionTime just changed.
Declaration
private void OnAverageCompletionTimeChanged(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The new property value that was set. |
Remarks
This method is invoked right after the value of AverageCompletionTime is changed.
OnAverageCompletionTimeChanged(double, double)
Executes the logic for when AverageCompletionTime just changed.
Declaration
private void OnAverageCompletionTimeChanged(double oldValue, double newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| double | oldValue | The previous property value that was replaced. |
| double | newValue | The new property value that was set. |
Remarks
This method is invoked right after the value of AverageCompletionTime is changed.
OnAverageCompletionTimeChanging(double)
Executes the logic for when AverageCompletionTime is changing.
Declaration
private void OnAverageCompletionTimeChanging(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The new property value being set. |
Remarks
This method is invoked right before the value of AverageCompletionTime is changed.
OnAverageCompletionTimeChanging(double, double)
Executes the logic for when AverageCompletionTime is changing.
Declaration
private void OnAverageCompletionTimeChanging(double oldValue, double newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| double | oldValue | The previous property value that is being replaced. |
| double | newValue | The new property value being set. |
Remarks
This method is invoked right before the value of AverageCompletionTime is changed.
OnAverageOvershootChanged(double)
Executes the logic for when AverageOvershoot just changed.
Declaration
private void OnAverageOvershootChanged(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The new property value that was set. |
Remarks
This method is invoked right after the value of AverageOvershoot is changed.
OnAverageOvershootChanged(double, double)
Executes the logic for when AverageOvershoot just changed.
Declaration
private void OnAverageOvershootChanged(double oldValue, double newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| double | oldValue | The previous property value that was replaced. |
| double | newValue | The new property value that was set. |
Remarks
This method is invoked right after the value of AverageOvershoot is changed.
OnAverageOvershootChanging(double)
Executes the logic for when AverageOvershoot is changing.
Declaration
private void OnAverageOvershootChanging(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The new property value being set. |
Remarks
This method is invoked right before the value of AverageOvershoot is changed.
OnAverageOvershootChanging(double, double)
Executes the logic for when AverageOvershoot is changing.
Declaration
private void OnAverageOvershootChanging(double oldValue, double newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| double | oldValue | The previous property value that is being replaced. |
| double | newValue | The new property value being set. |
Remarks
This method is invoked right before the value of AverageOvershoot is changed.
OnAveragePathEfficiencyChanged(double)
Executes the logic for when AveragePathEfficiency just changed.
Declaration
private void OnAveragePathEfficiencyChanged(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The new property value that was set. |
Remarks
This method is invoked right after the value of AveragePathEfficiency is changed.
OnAveragePathEfficiencyChanged(double, double)
Executes the logic for when AveragePathEfficiency just changed.
Declaration
private void OnAveragePathEfficiencyChanged(double oldValue, double newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| double | oldValue | The previous property value that was replaced. |
| double | newValue | The new property value that was set. |
Remarks
This method is invoked right after the value of AveragePathEfficiency is changed.
OnAveragePathEfficiencyChanging(double)
Executes the logic for when AveragePathEfficiency is changing.
Declaration
private void OnAveragePathEfficiencyChanging(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The new property value being set. |
Remarks
This method is invoked right before the value of AveragePathEfficiency is changed.
OnAveragePathEfficiencyChanging(double, double)
Executes the logic for when AveragePathEfficiency is changing.
Declaration
private void OnAveragePathEfficiencyChanging(double oldValue, double newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| double | oldValue | The previous property value that is being replaced. |
| double | newValue | The new property value being set. |
Remarks
This method is invoked right before the value of AveragePathEfficiency is changed.
OnCompletionRateChanged(double)
Executes the logic for when CompletionRate just changed.
Declaration
private void OnCompletionRateChanged(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The new property value that was set. |
Remarks
This method is invoked right after the value of CompletionRate is changed.
OnCompletionRateChanged(double, double)
Executes the logic for when CompletionRate just changed.
Declaration
private void OnCompletionRateChanged(double oldValue, double newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| double | oldValue | The previous property value that was replaced. |
| double | newValue | The new property value that was set. |
Remarks
This method is invoked right after the value of CompletionRate is changed.
OnCompletionRateChanging(double)
Executes the logic for when CompletionRate is changing.
Declaration
private void OnCompletionRateChanging(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | The new property value being set. |
Remarks
This method is invoked right before the value of CompletionRate is changed.
OnCompletionRateChanging(double, double)
Executes the logic for when CompletionRate is changing.
Declaration
private void OnCompletionRateChanging(double oldValue, double newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| double | oldValue | The previous property value that is being replaced. |
| double | newValue | The new property value being set. |
Remarks
This method is invoked right before the value of CompletionRate is changed.
OnTrialsAttemptedChanged(int)
Executes the logic for when TrialsAttempted just changed.
Declaration
private void OnTrialsAttemptedChanged(int value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | value | The new property value that was set. |
Remarks
This method is invoked right after the value of TrialsAttempted is changed.
OnTrialsAttemptedChanged(int, int)
Executes the logic for when TrialsAttempted just changed.
Declaration
private void OnTrialsAttemptedChanged(int oldValue, int newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| int | oldValue | The previous property value that was replaced. |
| int | newValue | The new property value that was set. |
Remarks
This method is invoked right after the value of TrialsAttempted is changed.
OnTrialsAttemptedChanging(int)
Executes the logic for when TrialsAttempted is changing.
Declaration
private void OnTrialsAttemptedChanging(int value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | value | The new property value being set. |
Remarks
This method is invoked right before the value of TrialsAttempted is changed.
OnTrialsAttemptedChanging(int, int)
Executes the logic for when TrialsAttempted is changing.
Declaration
private void OnTrialsAttemptedChanging(int oldValue, int newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| int | oldValue | The previous property value that is being replaced. |
| int | newValue | The new property value being set. |
Remarks
This method is invoked right before the value of TrialsAttempted is changed.
OnTrialsCompletedChanged(int)
Executes the logic for when TrialsCompleted just changed.
Declaration
private void OnTrialsCompletedChanged(int value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | value | The new property value that was set. |
Remarks
This method is invoked right after the value of TrialsCompleted is changed.
OnTrialsCompletedChanged(int, int)
Executes the logic for when TrialsCompleted just changed.
Declaration
private void OnTrialsCompletedChanged(int oldValue, int newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| int | oldValue | The previous property value that was replaced. |
| int | newValue | The new property value that was set. |
Remarks
This method is invoked right after the value of TrialsCompleted is changed.
OnTrialsCompletedChanging(int)
Executes the logic for when TrialsCompleted is changing.
Declaration
private void OnTrialsCompletedChanging(int value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | value | The new property value being set. |
Remarks
This method is invoked right before the value of TrialsCompleted is changed.
OnTrialsCompletedChanging(int, int)
Executes the logic for when TrialsCompleted is changing.
Declaration
private void OnTrialsCompletedChanging(int oldValue, int newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| int | oldValue | The previous property value that is being replaced. |
| int | newValue | The new property value being set. |
Remarks
This method is invoked right before the value of TrialsCompleted is changed.
RecordTrial(TrialRecord)
Records a completed trial (success or failure) and updates aggregate metrics.
Declaration
public void RecordTrial(TrialRecord trial)
Parameters
| Type | Name | Description |
|---|---|---|
| TrialRecord | trial | The trial record to add. |
Reset()
Resets all metrics, trial history, and aggregate accumulators to their initial state.
Declaration
public void Reset()
UpdateAggregateMetrics()
Recomputes all aggregate metrics from the accumulated lists.
Declaration
private void UpdateAggregateMetrics()