pacemaker 1.0.1
COM automation for people with deadlines and a hatred of GUIs
 
Loading...
Searching...
No Matches
Experiment Class Reference

High-level manager for a single INCA measurement experiment run. More...

#include <Experiment.hpp>

Public Member Functions

 Experiment (pacemaker::inca::com::IncaOnlineExperimentProxy exp, pacemaker::inca::com::IncaExperimentViewProxy expview, pacemaker::inca::com::ExperimentDeviceProxy device)
 Constructs an Experiment from its constituent COM proxies.
 
 Experiment (Experiment &&)=default
 Move constructor transfers ownership of all COM proxies.
 
Experimentoperator= (Experiment &&)=default
 Move assignment transfers ownership of all COM proxies.
 
 ~Experiment ()=default
 Default Destructor; COM proxies are released via their own destructors.
 
auto start_recording () -> void
 Starts a new measurement recording in INCA.
 
auto stop_recording (const std::string &filename) -> void
 Stops the recording, saves the data, and resets all parameters.
 
auto add_param (const std::string &name) -> void
 Registers a calibration parameter for use during the experiment.
 
auto set_param (const std::string &name, double value) -> void
 Sets a registered calibration parameter to the given value.
 
auto reset () -> void
 Resets all registered parameters to their reference-page values and clears the internal parameter table.
 

Detailed Description

High-level manager for a single INCA measurement experiment run.

Experiment composes the lower-level COM proxy objects into a coherent workflow for controlling a measurement session:

  1. Register parameters - call add_param() for each calibration scalar that the automated run needs to manipulate.
  2. Start recording - call start_recording() to begin data capture.
  3. Modify parameters - call set_param() as many times as required during the run.
  4. Stop recording - call stop_recording() to flush buffered data, save the recording, stop the measurement, and reset all parameters to their reference-page values.

Experiment objects are not constructed directly; they are created and returned by Session::connect().

The class is move-constrcutible but not copyable, reflecting the unique ownership of the underlying COM resources.

See also
pacemaker::inca::Session::connect()
pacemaker::inca::com::IncaOnlineExperimentProxy
pacemaker::inca::com::CalibrationScalarDataProxy

Definition at line 41 of file Experiment.hpp.

Constructor & Destructor Documentation

◆ Experiment() [1/2]

Constructs an Experiment from its constituent COM proxies.

All three proxies are moved into the Experiment, transferring ownership. This constructor is intended to be called exclusively by Session::connect().

Parameters
expProxy for the INCA online experiment COM object.
expviewProxy for the INCA experiment-view COM object.
deviceProxy for the primary ECU device to use during the run.

◆ Experiment() [2/2]

Experiment ( Experiment && )
default

Move constructor transfers ownership of all COM proxies.

◆ ~Experiment()

~Experiment ( )
default

Default Destructor; COM proxies are released via their own destructors.

Member Function Documentation

◆ operator=()

Experiment & operator= ( Experiment && )
default

Move assignment transfers ownership of all COM proxies.

◆ start_recording()

auto start_recording ( ) -> void

Starts a new measurement recording in INCA.

Delegates to IncaOnlineExperimentProxy::StartRecording(). The recording captures all online measurement signals configured in the open INCA experiment from this point forward.

Call add_param() for any calibration parameters the run needs to control before calling start_recording().

◆ stop_recording()

auto stop_recording ( const std::string & filename) -> void

Stops the recording, saves the data, and resets all parameters.

The method performs the following steps in order:

  1. Sleeps for k_flush_delay (40 ms) to allow INCA to flush any buffered measurement samples.
  2. Calls IncaOnlineExperimentProxy::StopRecordingAndSave().
  3. Calls IncaOnlineExperimentProxy::StopMeasurement().
  4. Calls reset() to restore all registered calibration parameters to their reference-page values and clear the internal parameter table.
Parameters
filenameOutput recording filename/filepath.

◆ add_param()

auto add_param ( const std::string & name) -> void

Registers a calibration parameter for use during the experiment.

Looks up the named calibration scalar on the primary device and stores the resulting CalibrationScalarDataProxy internally. The parameter can then be updated during the run via set_param().

Calling add_param() a second time with the same name is a no-op; the parameter is not re-fetched from INCA.

Parameters
nameName fo the calibration parameter as it appears in INCA (e.g. "Engine_TorqueRequest").
Exceptions
std::runtime_errorif the parameter cannot be found on the device (propagated from IncaOnlineExperimentProxy::GetCalibrationValueInDevice()).

◆ set_param()

auto set_param ( const std::string & name,
double value ) -> void

Sets a registered calibration parameter to the given value.

The parameter must have been previously registered via add_param(). Delegates to CalibrationScalarDataProxy::SetImplValue().

Parameters
nameName of the calibration parameter previously registered with add_param().
valueNew value to write to the parameter's implementation page.
Exceptions
std::out_of_rangeif name was not registered via add_param(). The exception message includes the parameter name.

◆ reset()

auto reset ( ) -> void

Resets all registered parameters to their reference-page values and clears the internal parameter table.

Iterates over all stored CalibrationScalarDataProxy objects and calls ResetValueToRP() on each, then clears both the name-to-index map and the proxy vector. After this call the experiment is in the same state as immediately after construction.

This method is called automatically by stop_recording() at the end of each run, but may also be called explicitly if an early reset is required.


The documentation for this class was generated from the following file: