Parameter Set Generator API Reference¶
An overview of commands for Parameter generator for projects.
Info
This API is included in the
ecu.test Interface Python Library ecutest-interface.
ParamGenerator¶
- class ParamGenerator¶
Base class for iterator-based user-defined parameter set generators.
Derive from this class when the required package runs can be prepared and yielded in sequence. Implement
GenerationIterator()and yield oneCycleDataobject for each package run. UsePreGeneration()to read input files or prepare data, and usePostGeneration()for cleanup. The simple text-file implementation inexamples/ParametersetGeneratorExample.pyfollows this workflow.Use
CallbackParamGeneratorinstead when the next parameter set depends on package return values from a previous run.Some fields and methods must be overridden (mandatory), others may be overridden (optional). There are also methods that are only to be called by the user implementation and should not be overridden (those without a note).
-
DESCRIPTION : str =
''¶ A short description of the parameter generator.
Info
Setting this field is optional
-
ID : str =
''¶ A universally unique identifier to make the parameter generator unique. The ID should be generated using a UUID generator to be unique.
Info
Setting this field is mandatory
-
NAME : str =
''¶ The display name of the parameter generator.
Info
Setting this field is mandatory
-
SERIALIZE : dict[str, tuple[str, str] | tuple[str, str, object]] =
{}¶ Declaration of parameter-set generator instance variables that are exported to and imported from XML when a project is saved or loaded. Add one dictionary item for each persisted instance variable. Example:
SERIALIZE = { 'foo': ('FOO-VAR', 'integer', 23), 'bar': ('BAR', 'string'), 'params': ('PARAMETERS', 'list'), }The declaration key must match the corresponding instance-variable name. For example, an attribute named
self.foorequires the key'foo'. Each value is a tuple with at least two elements:<variable name>: (<variable alias>, <type alias>, [default value])Syntax and meaning of the tuple’s elements are:
<variable alias> declares the XML element name used to represent the variable.
<type alias> specifies the Python variable type. The following aliases are supported:
boolean: boolinteger: intlong: intfloat: floatstring: strunicode: strlist: listdict: dict
Important: Keys of serialized dictionaries must be strings. Values in lists and dictionaries, including nested lists and dictionaries, must be
bool,int,float,str,list, ordict.longandunicoderemain available only for compatibility and should not be used in new code.<default value> is an optional element. It specifies the variable’s default value. If the variable’s value equals its default value during export the variable is not exported at all. Conversely, the variable receives its default value during import if the XML data does not provide a value for the variable.
Info
Setting this field is optional
-
api =
None¶ Access to the internal ecu.test API. The API will be assigned at runtime, in order to be independent from ecu.test for testing purposes.
See also
-
projectPath : str | None =
None¶ Absolute path to the project file containing the generator. In case of direct execution, this is the source project. In case of static generation it is the destination project.
- classmethod GetDescription()¶
Returns the description of the parameter generator. The description can be specified by setting the class variable
DESCRIPTION.- Returns:
Description text of the parameter generator.
- Return type:
str
- classmethod GetId()¶
Returns the universally unique identifier of the parameter generator. The identifier should be specified by setting the class variable
ID.- Returns:
Unique identifier of the parameter generator.
- Return type:
str
- classmethod GetName()¶
Returns the name of the parameter generator. The name should be specified by setting the class variable
NAME.- Returns:
Display name of the parameter generator.
- Return type:
str
- Check()¶
Validate the generator configuration before generation.
Return user-visible error messages, or an empty list when the configuration is valid.
- Returns:
List of validation error messages.
- Return type:
list[str]
Info
Overriding this method is optional.
-
CreateCycleData(paramSet=
None, constSet=None, name=None)¶ Create a
CycleDataobject for one generated package run.The resulting object bundles input-variable values, optional constants, a report display name, recordings, mapping items, and additional report attributes. Prefer this helper to directly creating
CycleData, because ecu.test can replace it with a runtime-specific implementation.- Parameters:
- Returns:
Cycle object containing one generated package-run configuration.
- Return type:
- DryGenerationEnabled()¶
Return whether the generator runs in dry generation mode.
In this mode, ecu.test creates static parameter records instead of executing package runs. Runtime constants and package return values are unavailable.
- Returns:
Trueif dry generation mode is active, otherwiseFalse.- Return type:
bool
- abstractmethod GenerationIterator()¶
Implement this method to generate parameter sets. Each generated package run must be represented by one
CycleDataobject, which can be created withCreateCycleData().This method must be a Python generator function and must use
yieldto provide eachCycleDataobject. Do not yield a list or another container: ecu.test validates every yielded value and accepts only oneCycleDatainstance at a time.During normal execution, the iterator is resumed after ecu.test has executed the yielded cycle. Code after
yieldcan therefore callGetLastReturnSet()when the next cycle depends on return variables from the preceding package run. In dry generation mode, ecu.test creates static parameter records instead and this helper returnsNone.Example:
def GenerationIterator(self): for line in file: yield self.CreateCycleData({'lineData': line})Info
Overriding this method is mandatory
- GetDialog()¶
Return a configuration dialog for this parameter-set generator.
The dialog should update this instance’s settings, normally the attributes declared in
SERIALIZE. ReturnNonewhen no configuration UI is required.- Returns:
Configuration dialog instance, or
Noneif no dialog is required.- Return type:
wx.Dialog | None
Info
Overriding this method is optional.
- GetLastReturnSet()¶
Return the return-variable dictionary from the most recently executed package run.
Call this method only from
GenerationIterator(), after the iterator has yielded at least one cycle and has been resumed. The dictionary uses package return-variable names as keys. It is unavailable before the first completed package run and during dry generation; in both cases, this method returnsNone.- Returns:
Return-variable dictionary of the latest executed cycle, or
Noneif unavailable.- Return type:
dict | None
- GetParameterText()¶
Return a short summary of the current settings for the properties column.
- Returns:
One-line summary text of the current generator settings.
- Return type:
str
Info
Overriding this method is optional.
- GetReportData()¶
Return custom information for the generator test step in the report.
Return
ReportDatato populate its value and comment columns. ReturnNoneto use the default report content.- Returns:
Custom report data, or
Noneto keep the default report output.- Return type:
ReportData | None
Info
Overriding this method is optional.
- GetTargetItemCount()¶
Return the expected number of generated package cycles for progress reporting.
ecu.test can call this method repeatedly while generation is running, so the value is an estimate and may be calculated dynamically.
- Returns:
Expected number of generated package cycles.
- Return type:
int
- GetUsedMappingItems()¶
Return every mapping item used by generated analysis-package parameter sets.
ecu.test registers these mapping items for the stimulation package before generation. Define them here directly or load them from another source, but return the complete set of items that can later be supplied through
CycleData.AddMappingItem().Info
Overriding this method is optional and only necessary for parameter set generators used with analysis packages and overwriting mapping items.
Caution
This method is called before every other hook, including
PreGeneration(). If mapping data is normally read during preparation, load it here as well or move the loading to a reusable helper called from this method.- Returns:
Complete list of mapping items that may be used during generation.
- Return type:
list[MappingItem]
- IsValidForAnalysisPackages()¶
Return whether this parameter-set generator supports analysis packages.
Return
Falsewhen the implementation is intrinsically incompatible with analysis packages, so the UI can reject the configuration before execution. ReturningTruepermits the use; it does not make an otherwise invalid runtime implementation valid.- Returns:
Trueif this generator supports analysis packages, otherwiseFalse.- Return type:
bool
Info
Overriding this method is optional.
- OnInit(packageInfo)¶
Process read-only information about the associated package.
ecu.test calls this method before
PreGeneration()andGetDialog(). UsepackageInfoto discover package input and return-variable names, types, and descriptions before constructing generated cycles or configuration UI.- Parameters:
- packageInfo : PackageInfo¶
Read-only context for the associated package.
Info
Overriding this method is optional
- PostGeneration()¶
Clean up after generation.
This method runs after normal generation and after exceptions from generation, including
PreGeneration(). It is not guaranteed to run after an external user abort or an abort-on-error execution setting.Info
Overriding this method is optional.
- PreGeneration()¶
Prepare generation.
ecu.test calls this method before the specialized generation method. Use it to validate settings, read input files, create expensive resources, or prepare candidate data.
Info
Overriding this method is optional.
-
DESCRIPTION : str =
AbortError¶
- class AbortError¶
Raised when ecu.test aborts a callback parameter generator execution.
ecu.test raises this exception while a
Generate()implementation calls itstestRunFunction. Catch it only to release resources, then re-raise it so that the package execution remains aborted.
CallbackParamGenerator¶
- class CallbackParamGenerator¶
Base class for parameter generators that react to package return values.
Derive from this class instead of
ParamGeneratorwhen the next parameter set depends on the result of a previous package run or when the generator must decide explicitly when to execute a batch of cycles. ImplementGenerate(), createCycleDataobjects withCreateCycleData(), and pass one or more cycles to the suppliedtestRunFunction. That function executes the associated package synchronously from the generator’s perspective and returns one return-variable dictionary for every submitted cycle, in submission order.Typical workflow:
Prepare initial candidates in
PreGeneration().In
Generate(), calltestRunFunction(cycleData).Use the returned dictionaries, or
GetLastReturnSets(), to calculate the next cycles.Stop when the generator-specific completion criterion is met.
Use this model for feedback loops and optimizers. For independent, sequential cycles, use
ParamGeneratorinstead. The advanced optimizer examples demonstrate this execution model.-
DESCRIPTION : str =
''¶ A short description of the parameter generator.
Info
Setting this field is optional
-
ID : str =
''¶ A universally unique identifier to make the parameter generator unique. The ID should be generated using a UUID generator to be unique.
Info
Setting this field is mandatory
-
NAME : str =
''¶ The display name of the parameter generator.
Info
Setting this field is mandatory
-
SERIALIZE : dict[str, tuple[str, str] | tuple[str, str, object]] =
{}¶ Declaration of parameter-set generator instance variables that are exported to and imported from XML when a project is saved or loaded. Add one dictionary item for each persisted instance variable. Example:
SERIALIZE = { 'foo': ('FOO-VAR', 'integer', 23), 'bar': ('BAR', 'string'), 'params': ('PARAMETERS', 'list'), }The declaration key must match the corresponding instance-variable name. For example, an attribute named
self.foorequires the key'foo'. Each value is a tuple with at least two elements:<variable name>: (<variable alias>, <type alias>, [default value])Syntax and meaning of the tuple’s elements are:
<variable alias> declares the XML element name used to represent the variable.
<type alias> specifies the Python variable type. The following aliases are supported:
boolean: boolinteger: intlong: intfloat: floatstring: strunicode: strlist: listdict: dict
Important: Keys of serialized dictionaries must be strings. Values in lists and dictionaries, including nested lists and dictionaries, must be
bool,int,float,str,list, ordict.longandunicoderemain available only for compatibility and should not be used in new code.<default value> is an optional element. It specifies the variable’s default value. If the variable’s value equals its default value during export the variable is not exported at all. Conversely, the variable receives its default value during import if the XML data does not provide a value for the variable.
Info
Setting this field is optional
-
api =
None¶ Access to the internal ecu.test API. The API will be assigned at runtime, in order to be independent from ecu.test for testing purposes.
See also
-
projectPath : str | None =
None¶ Absolute path to the project file containing the generator. In case of direct execution, this is the source project. In case of static generation it is the destination project.
- classmethod GetDescription()¶
Returns the description of the parameter generator. The description can be specified by setting the class variable
DESCRIPTION.- Returns:
Description text of the parameter generator.
- Return type:
str
- classmethod GetId()¶
Returns the universally unique identifier of the parameter generator. The identifier should be specified by setting the class variable
ID.- Returns:
Unique identifier of the parameter generator.
- Return type:
str
- classmethod GetName()¶
Returns the name of the parameter generator. The name should be specified by setting the class variable
NAME.- Returns:
Display name of the parameter generator.
- Return type:
str
- Check()¶
Validate the generator configuration before generation.
Return user-visible error messages, or an empty list when the configuration is valid.
- Returns:
List of validation error messages.
- Return type:
list[str]
Info
Overriding this method is optional.
-
CreateCycleData(paramSet=
None, constSet=None, name=None)¶ Create a
CycleDataobject for one generated package run.The resulting object bundles input-variable values, optional constants, a report display name, recordings, mapping items, and additional report attributes. Prefer this helper to directly creating
CycleData, because ecu.test can replace it with a runtime-specific implementation.- Parameters:
- Returns:
Cycle object containing one generated package-run configuration.
- Return type:
- DryGenerationEnabled()¶
Return whether the generator runs in dry generation mode.
In this mode, ecu.test creates static parameter records instead of executing package runs. Runtime constants and package return values are unavailable.
- Returns:
Trueif dry generation mode is active, otherwiseFalse.- Return type:
bool
- abstractmethod Generate(testRunFunction)¶
Implement this method to generate and evaluate parameter sets. Each package run must be an instance of
CycleData, created withCreateCycleData().Start package runs by calling
testRunFunction. The callback accepts either one cycle or a list of cycles, allowing an implementation to evaluate candidates individually or in batches. It returns one return-variable dictionary for every submitted cycle, in the same order. In dry generation mode, no package runs occur and algorithms that require return values must handle the absent results accordingly.- Parameters:
- testRunFunction¶
Starts an ecu.test package run for one
CycleDatainstance or a list of instances and returns the corresponding return-variable dictionaries. If ecu.test aborts execution, it raisesAbortError. Catch this exception only to release resources, then re-raise it so the package execution remains aborted.
Info
Overriding this method is mandatory
- GetDialog()¶
Return a configuration dialog for this parameter-set generator.
The dialog should update this instance’s settings, normally the attributes declared in
SERIALIZE. ReturnNonewhen no configuration UI is required.- Returns:
Configuration dialog instance, or
Noneif no dialog is required.- Return type:
wx.Dialog | None
Info
Overriding this method is optional.
- GetLastReturnSets()¶
Return the return-variable dictionaries from the most recent
testRunFunctioncall.Call this method only from
Generate(), after at least one package run has completed in normal execution. It returns an empty list before the first callback execution and in dry generation mode, because no package return values are available there.- Returns:
Return-variable dictionaries from the latest callback execution.
- Return type:
list[dict]
- GetParameterText()¶
Return a short summary of the current settings for the properties column.
- Returns:
One-line summary text of the current generator settings.
- Return type:
str
Info
Overriding this method is optional.
- GetReportData()¶
Return custom information for the generator test step in the report.
Return
ReportDatato populate its value and comment columns. ReturnNoneto use the default report content.- Returns:
Custom report data, or
Noneto keep the default report output.- Return type:
ReportData | None
Info
Overriding this method is optional.
- GetTargetItemCount()¶
Return the expected number of generated package cycles for progress reporting.
ecu.test can call this method repeatedly while generation is running, so the value is an estimate and may be calculated dynamically.
- Returns:
Expected number of generated package cycles.
- Return type:
int
- GetUsedMappingItems()¶
Return every mapping item used by generated analysis-package parameter sets.
ecu.test registers these mapping items for the stimulation package before generation. Define them here directly or load them from another source, but return the complete set of items that can later be supplied through
CycleData.AddMappingItem().Info
Overriding this method is optional and only necessary for parameter set generators used with analysis packages and overwriting mapping items.
Caution
This method is called before every other hook, including
PreGeneration(). If mapping data is normally read during preparation, load it here as well or move the loading to a reusable helper called from this method.- Returns:
Complete list of mapping items that may be used during generation.
- Return type:
list[MappingItem]
- IsValidForAnalysisPackages()¶
Return whether this parameter-set generator supports analysis packages.
Return
Falsewhen the implementation is intrinsically incompatible with analysis packages, so the UI can reject the configuration before execution. ReturningTruepermits the use; it does not make an otherwise invalid runtime implementation valid.- Returns:
Trueif this generator supports analysis packages, otherwiseFalse.- Return type:
bool
Info
Overriding this method is optional.
- OnInit(packageInfo)¶
Process read-only information about the associated package.
ecu.test calls this method before
PreGeneration()andGetDialog(). UsepackageInfoto discover package input and return-variable names, types, and descriptions before constructing generated cycles or configuration UI.- Parameters:
- packageInfo : PackageInfo¶
Read-only context for the associated package.
Info
Overriding this method is optional
- PostGeneration()¶
Clean up after generation.
This method runs after normal generation and after exceptions from generation, including
PreGeneration(). It is not guaranteed to run after an external user abort or an abort-on-error execution setting.Info
Overriding this method is optional.
- PreGeneration()¶
Prepare generation.
ecu.test calls this method before the specialized generation method. Use it to validate settings, read input files, create expensive resources, or prepare candidate data.
Info
Overriding this method is optional.
CycleData¶
- class CycleData¶
Contain all data required for one generated package run.
Create a cycle through
ParamGeneratorBase.CreateCycleData(), fill it with parameters and optional constants, and yield it fromGenerationIteratoror pass it to a callback generatortestRunFunction.ParamSetsupplies values for package input variables, whileConstSetsupplies package constants before the run. The optionalNameis shown in the report.Use
AddRecordingInfo()to attach recordings to recording groups,AddMappingItem()for analysis-package mappings, and attributes for additional report data.ParamSetandConstSetmay initially beNone;AddParameter()andAddConst()create the corresponding dictionary on first use.- RECORDING_INFO_CLASS¶
alias of
RecordingInfo
- Attributes¶
Returns additional report attributes for this cycle.
Attribute values are stored as strings and are added or updated through
AddAttribute()andUpdateAttribute().- Returns:
Dictionary of additional report attributes.
- ConstSet¶
Returns the package constants for this cycle.
The dictionary keys must be valid package constant names. It is
Noneuntil values are supplied through the constructor orAddConst().- Returns:
Constant dictionary, or
Noneif no constants are set.
- Name¶
Return the name displayed for this cycle in the report.
- Returns:
Cycle display name.
- ParamSet¶
Returns the package input-variable values for this cycle.
The dictionary keys must be valid package input-variable names. It is
Noneuntil values are supplied through the constructor orAddParameter().- Returns:
Input-variable dictionary, or
Noneif no values are set.
- RecordingInfos¶
Returns recording metadata grouped by recording-group name.
Each dictionary value contains the
RecordingInfoobjects added for that group.- Returns:
Recording metadata grouped by recording-group name.
- AddAttribute(name, value)¶
Add an additional attribute to this cycle’s report data.
Attribute names must be unique within the cycle. The value is converted to
str. Calling this method with an existing name raisesValueError; useUpdateAttribute()to change an existing attribute.
- AddConst(name, value)¶
Add or replace a package constant for this cycle.
namemust be a valid package constant name. Supported values arestr,float,int, andbool. Calling this method again with the same name replaces the prior value.
- AddMappingItem(mappingItem)¶
Add a mapping item to the mapping space for this cycle.
When using analysis packages, also return every mapping item that can be added here from
ParamGeneratorBase.GetUsedMappingItems(), so ecu.test can register it before generation.- Parameters:
- mappingItem : MappingItem¶
Mapping item created through the Object API mapping interface.
- AddParameter(name, value)¶
Add or replace a value for a package input variable.
namemust be a valid package input-variable name. Supported values arestr,float,int, andbool. Calling this method again with the same name replaces the prior value.
- AddRecordingInfo(recordingGroupName, path)¶
Add one recording to a recording group for this cycle.
Reuse
recordingGroupNameto add multiple recordings to the same group. The returnedRecordingInforepresents the recording path and can be configured with its display name, number, type, and format-specific details.- Parameters:
- Returns:
The recording info object.
- Return type:
- GetAttributes()¶
Returns additional report attributes for this cycle.
Attribute values are stored as strings and are added or updated through
AddAttribute()andUpdateAttribute().- Returns:
Dictionary of additional report attributes.
- Return type:
dict[str, str]
- GetConstSet()¶
Returns the package constants for this cycle.
The dictionary keys must be valid package constant names. It is
Noneuntil values are supplied through the constructor orAddConst().- Returns:
Constant dictionary, or
Noneif no constants are set.- Return type:
dict | None
- GetName()¶
Return the name displayed for this cycle in the report.
- Returns:
Cycle display name.
- Return type:
str
- GetParamSet()¶
Returns the package input-variable values for this cycle.
The dictionary keys must be valid package input-variable names. It is
Noneuntil values are supplied through the constructor orAddParameter().- Returns:
Input-variable dictionary, or
Noneif no values are set.- Return type:
dict | None
- GetRecordingInfos()¶
Returns recording metadata grouped by recording-group name.
Each dictionary value contains the
RecordingInfoobjects added for that group.- Returns:
Recording metadata grouped by recording-group name.
- Return type:
dict[str, list[RecordingInfo]]
- UpdateAttribute(name, value)¶
Update an existing report attribute.
The value is converted to
str. Calling this method with an unknown name raisesValueError; useAddAttribute()to create a new attribute.
OptimizerParamGenerator¶
- class OptimizerParamGenerator¶
Base class for callback-based parameter optimization generators.
Derive from this class when an algorithm searches package input values according to package return values. Implement the inherited
Generate()method to evaluate candidates through the suppliedtestRunFunction. SetIDandNAMEas for every parameter-set generator and provide optimizer settings throughSERIALIZEwhen they must be persisted.The class extends
CallbackParamGeneratorwith:Management of minimum and maximum values for the package parameters
Optional parameter variation before the actual optimization
A dialog for managing minimum and maximum values, parameter variation and optimizer-specific settings
When
ENABLE_PARAMETER_VARIATIONisTrueand variation is activated, ecu.test runs it afterPreGeneration()and beforeGenerate(). Access its tested input/result pairs throughGetVariationResults()insideGenerate; they are cleared afterGeneratefinishes. Return parameter bounds fromGetMinMaxValues()as{inputVariableName: [minimum, maximum]}. Keys must be package input-variable names, and each bound must contain its lower value before its upper value. The optimizer dialog manages these persisted bounds. The differential-evolution example underexamples/AdvancedParametersetGeneratorExamplesdemonstrates this pattern.-
DESCRIPTION : str =
''¶ A short description of the parameter generator.
Info
Setting this field is optional
-
ENABLE_PARAMETER_VARIATION : bool =
True¶ Enables or disables the support of a parameter variation before the optimization starts.
Set this to
Falsewhen the optimizer does not support a pre-optimization variation. When enabled, users can configure the variation through the optimizer dialog.
-
ID : str =
''¶ A universally unique identifier to make the parameter generator unique. The ID should be generated using a UUID generator to be unique.
Info
Setting this field is mandatory
-
NAME : str =
''¶ The display name of the parameter generator.
Info
Setting this field is mandatory
-
SERIALIZE : dict[str, tuple[str, str] | tuple[str, str, object]] =
{}¶ Declaration of parameter-set generator instance variables that are exported to and imported from XML when a project is saved or loaded. Add one dictionary item for each persisted instance variable. Example:
SERIALIZE = { 'foo': ('FOO-VAR', 'integer', 23), 'bar': ('BAR', 'string'), 'params': ('PARAMETERS', 'list'), }The declaration key must match the corresponding instance-variable name. For example, an attribute named
self.foorequires the key'foo'. Each value is a tuple with at least two elements:<variable name>: (<variable alias>, <type alias>, [default value])Syntax and meaning of the tuple’s elements are:
<variable alias> declares the XML element name used to represent the variable.
<type alias> specifies the Python variable type. The following aliases are supported:
boolean: boolinteger: intlong: intfloat: floatstring: strunicode: str
Important: Keys of serialized dictionaries must be strings. Values in lists and dictionaries, including nested lists and dictionaries, must be
bool,int,float,str,list, ordict.longandunicoderemain available only for compatibility and should not be used in new code.<default value> is an optional element. It specifies the variable’s default value. If the variable’s value equals its default value during export the variable is not exported at all. Conversely, the variable receives its default value during import if the XML data does not provide a value for the variable.
Info
Setting this field is optional
-
api =
None¶ Access to the internal ecu.test API. The API will be assigned at runtime, in order to be independent from ecu.test for testing purposes.
See also
-
projectPath : str | None =
None¶ Absolute path to the project file containing the generator. In case of direct execution, this is the source project. In case of static generation it is the destination project.
- classmethod GetDescription()¶
Returns the description of the parameter generator. The description can be specified by setting the class variable
DESCRIPTION.- Returns:
Description text of the parameter generator.
- Return type:
str
- classmethod GetId()¶
Returns the universally unique identifier of the parameter generator. The identifier should be specified by setting the class variable
ID.- Returns:
Unique identifier of the parameter generator.
- Return type:
str
- classmethod GetName()¶
Returns the name of the parameter generator. The name should be specified by setting the class variable
NAME.- Returns:
Display name of the parameter generator.
- Return type:
str
- Check()¶
Validate the generator configuration before generation.
Return user-visible error messages, or an empty list when the configuration is valid.
- Returns:
List of validation error messages.
- Return type:
list[str]
Info
Overriding this method is optional.
-
CreateCycleData(paramSet=
None, constSet=None, name=None)¶ Create a
CycleDataobject for one generated package run.The resulting object bundles input-variable values, optional constants, a report display name, recordings, mapping items, and additional report attributes. Prefer this helper to directly creating
CycleData, because ecu.test can replace it with a runtime-specific implementation.- Parameters:
- Returns:
Cycle object containing one generated package-run configuration.
- Return type:
- DryGenerationEnabled()¶
Return whether the generator runs in dry generation mode.
In this mode, ecu.test creates static parameter records instead of executing package runs. Runtime constants and package return values are unavailable.
- Returns:
Trueif dry generation mode is active, otherwiseFalse.- Return type:
bool
- abstractmethod Generate(testRunFunction)¶
Implement this method to generate and evaluate parameter sets. Each package run must be an instance of
CycleData, created withCreateCycleData().Start package runs by calling
testRunFunction. The callback accepts either one cycle or a list of cycles, allowing an implementation to evaluate candidates individually or in batches. It returns one return-variable dictionary for every submitted cycle, in the same order. In dry generation mode, no package runs occur and algorithms that require return values must handle the absent results accordingly.- Parameters:
- testRunFunction¶
Starts an ecu.test package run for one
CycleDatainstance or a list of instances and returns the corresponding return-variable dictionaries. If ecu.test aborts execution, it raisesAbortError. Catch this exception only to release resources, then re-raise it so the package execution remains aborted.
Info
Overriding this method is mandatory
- GetDialog()¶
Return a configuration dialog for this parameter-set generator.
The dialog should update this instance’s settings, normally the attributes declared in
SERIALIZE. ReturnNonewhen no configuration UI is required.- Returns:
Configuration dialog instance, or
Noneif no dialog is required.- Return type:
wx.Dialog | None
Info
Overriding this method is optional.
- GetLastReturnSets()¶
Return the return-variable dictionaries from the most recent
testRunFunctioncall.Call this method only from
Generate(), after at least one package run has completed in normal execution. It returns an empty list before the first callback execution and in dry generation mode, because no package return values are available there.- Returns:
Return-variable dictionaries from the latest callback execution.
- Return type:
list[dict]
- GetMinMaxValues()¶
Return the configured minimum and maximum values for package input parameters.
Use package input-variable names as dictionary keys and a two-item
[minimum, maximum]list as each value. The lower value must be first. These bounds are persisted and are available to both the optimizer implementation and its configuration dialog. Example:{'speed': [100, 120], 'distance': [1000, 1500] }- Returns:
Dictionary that maps package input-variable names to
[minimum, maximum]bounds.- Return type:
dict
- GetParameterText()¶
Return a short summary of the current settings for the properties column.
- Returns:
One-line summary text of the current generator settings.
- Return type:
str
Info
Overriding this method is optional.
- GetReportData()¶
Return custom information for the generator test step in the report.
Return
ReportDatato populate its value and comment columns. ReturnNoneto use the default report content.- Returns:
Custom report data, or
Noneto keep the default report output.- Return type:
ReportData | None
Info
Overriding this method is optional.
- GetTargetItemCount()¶
Return the expected number of generated package cycles for progress reporting.
ecu.test can call this method repeatedly while generation is running, so the value is an estimate and may be calculated dynamically.
- Returns:
Expected number of generated package cycles.
- Return type:
int
- GetUsedMappingItems()¶
Return every mapping item used by generated analysis-package parameter sets.
ecu.test registers these mapping items for the stimulation package before generation. Define them here directly or load them from another source, but return the complete set of items that can later be supplied through
CycleData.AddMappingItem().Info
Overriding this method is optional and only necessary for parameter set generators used with analysis packages and overwriting mapping items.
Caution
This method is called before every other hook, including
PreGeneration(). If mapping data is normally read during preparation, load it here as well or move the loading to a reusable helper called from this method.- Returns:
Complete list of mapping items that may be used during generation.
- Return type:
list[MappingItem]
- GetVariationResults()¶
Return the parameter-variation results as
VariationResultobjects.Each result pairs the exact variation
CycleDatawith the corresponding package return values. Results are available only whileGenerate()runs after an active parameter variation has completed. In all other circumstances, including afterGeneratereturns, this method returns an empty list.- Returns:
List of variation input/result pairs available during active optimizer execution.
- Return type:
list[VariationResult]
- IsValidForAnalysisPackages()¶
Return whether this parameter-set generator supports analysis packages.
Return
Falsewhen the implementation is intrinsically incompatible with analysis packages, so the UI can reject the configuration before execution. ReturningTruepermits the use; it does not make an otherwise invalid runtime implementation valid.- Returns:
Trueif this generator supports analysis packages, otherwiseFalse.- Return type:
bool
Info
Overriding this method is optional.
- OnInit(packageInfo)¶
Process read-only information about the associated package.
ecu.test calls this method before
PreGeneration()andGetDialog(). UsepackageInfoto discover package input and return-variable names, types, and descriptions before constructing generated cycles or configuration UI.- Parameters:
- packageInfo : PackageInfo¶
Read-only context for the associated package.
Info
Overriding this method is optional
- PostGeneration()¶
Clean up after generation.
This method runs after normal generation and after exceptions from generation, including
PreGeneration(). It is not guaranteed to run after an external user abort or an abort-on-error execution setting.Info
Overriding this method is optional.
- PreGeneration()¶
Prepare generation.
ecu.test calls this method before the specialized generation method. Use it to validate settings, read input files, create expensive resources, or prepare candidate data.
Info
Overriding this method is optional.
- class VariationResult¶
Pair the input cycle of one parameter variation with its package return values.
Instances are provided by
OptimizerParamGenerator.GetVariationResults()whileOptimizerParamGenerator.Generate()runs.CycleDatacontains the exact parameter values and metadata used for the variation run.ReturnSetcontains the result from that same package run and can beNonewhen no result is available.- CycleData¶
Returns the cycle data object that contains the input data for the variation.
- Returns:
The cycle data object
- ReturnSet¶
Returns the return-variable dictionary from the package execution for this variation.
- Returns:
The return set as a dictionary, or
Nonewhen no result is available.
PackageInfo¶
- class PackageInfo¶
Provide read-only context about the package associated with a parameter generator.
ecu.test passes this object to
ParamGeneratorBase.OnInit()before configuration or generation begins. Use it to inspect the associated package name, path, and variables. The returnedVariableobjects distinguish package input parameters from return variables; use those names when constructingCycleDataparameter sets.- GetName()¶
Return the package filename without its extension, or
Nonewhen unavailable.- Returns:
Package filename without extension, or
None.- Return type:
str | None
- GetParameterVariables()¶
Return descriptors for package input variables used as generated parameters.
- Returns:
Sequence of input-variable descriptors.
- Return type:
Sequence[Variable]
- GetPath()¶
Return the absolute package-file path, or
Nonewhen unavailable.- Returns:
Absolute package-file path, or
None.- Return type:
str | None
RecordingInfo¶
- class RecordingInfo¶
Describe one recording assigned to a cycle recording group.
Obtain an instance from
CycleData.AddRecordingInfo(). The path is mandatory; the optional name, number, type, and format details describe how ecu.test should process the recording. Store severalRecordingInfoobjects in the same group by callingAddRecordingInforepeatedly with the same group name.- FormatDetails¶
Returns the format-specific details used to interpret this recording.
- Returns:
Format details of the recording.
- Path¶
Returns the path to the recording.
- Returns:
Path to the recording.
- RecordingName¶
Returns the display name of the recording.
Set this when the recording name shown by ecu.test should differ from the filename.
- Returns:
Name of the recording.
- RecordingNumber¶
Returns the recording number used by the configured recording type.
- Returns:
Number of the recording.
- RecordingType¶
Returns the recording type used by ecu.test to interpret this recording.
- Returns:
Type of the recording.
- GetFormatDetails()¶
Returns the format-specific details used to interpret this recording.
- Returns:
Format details of the recording.
- Return type:
str
- GetPath()¶
Returns the path to the recording.
- Returns:
Path to the recording.
- Return type:
str
- GetRecordingName()¶
Returns the display name of the recording.
Set this when the recording name shown by ecu.test should differ from the filename.
- Returns:
Name of the recording.
- Return type:
str
- GetRecordingNumber()¶
Returns the recording number used by the configured recording type.
- Returns:
Number of the recording.
- Return type:
int
- GetRecordingType()¶
Returns the recording type used by ecu.test to interpret this recording.
- Returns:
Type of the recording.
- Return type:
str
- SetFormatDetails(formatDetails)¶
Sets the format details of the recording.
- Parameters:
- formatDetails : str¶
Format details of the recording.
- SetRecordingName(recordingName)¶
Sets the name of the recording.
- Parameters:
- recordingName : str¶
Name of the recording.
- SetRecordingNumber(recordingNumber)¶
Sets the number of the recording.
- Parameters:
- recordingNumber : int¶
Number of the recording.
- SetRecordingType(recordingType)¶
Sets the type of the recording.
- Parameters:
- recordingType : str¶
Type of the recording.
ReportData¶
- class ReportData¶
Contain custom value and comment text for the generator test step in the report.
Return an instance from
ParamGeneratorBase.GetReportData()when a parameter generator should contribute its own value and comment columns to the report.- Comment¶
Returns the display string for the report comment column.
- Returns:
Report comment text.
- Value¶
Returns the display string for the report value column.
- Returns:
Report value text.
- GetComment()¶
Returns the display string for the report comment column.
- Returns:
Report comment text.
- Return type:
str
- GetValue()¶
Returns the display string for the report value column.
- Returns:
Report value text.
- Return type:
str
Variable¶
- class Variable
Provide read-only metadata for a variable defined in the associated package.
Obtain variable descriptors from
PackageInfo, typically inOnInit. UseIsInput()to identify variables that can be set throughCycleData.ParamSetandIsOutput()to identify values returned after a package run. The descriptor does not modify the package; it exposes its name, declared type, description, and initial value.- Description
Return the package-provided description of this variable.
- Returns:
Description text of the package variable.
- InitValue
Return the package-defined initial value, whose type depends on
VariableType.- Returns:
Initial value configured for this package variable.
- Name
Return the package variable name used as a parameter or return-set dictionary key.
- Returns:
Package variable name.
- VariableType
Return one of the
VariableTypestring constants for this variable.- Returns:
Variable type constant from
VariableType.
- GetDescription()
Return the package-provided description of this variable.
- Returns:
Description text of the package variable.
- Return type:
str
- GetInitValue()
Return the package-defined initial value, whose type depends on
VariableType.- Returns:
Initial value configured for this package variable.
- Return type:
object
- GetName()
Return the package variable name used as a parameter or return-set dictionary key.
- Returns:
Package variable name.
- Return type:
str
- GetVariableType()
Return one of the
VariableTypestring constants for this variable.- Returns:
Variable type constant from
VariableType.- Return type:
str
- IsInput()
Return whether the package accepts this variable as a generated input parameter.
- Returns:
Trueif the variable is an input variable.- Return type:
bool
- IsOutput()
Return whether this variable is provided as a package return value.
- Returns:
Trueif the variable is an output variable.- Return type:
bool
- IsVariable()
Return
Trueto identify this object as a package-variable descriptor.- Returns:
Trueif this object represents a package variable descriptor.- Return type:
bool
- class VariableType
Define the string constants returned by
Variable.VariableType.This class is an enumeration-like namespace, not an instance type. Compare a variable type with these constants when an
PackageInfoimplementation needs type-specific parameter generation.UNDEFINEDindicates that no specific variable type is assigned.NUMERIC,STRING,ENUM,TEXTTABLE, andBOOLidentify numeric, text, enum, text-table, and Boolean package variables respectively.
VariationResult¶
- class VariationResult
Pair the input cycle of one parameter variation with its package return values.
Instances are provided by
OptimizerParamGenerator.GetVariationResults()whileOptimizerParamGenerator.Generate()runs.CycleDatacontains the exact parameter values and metadata used for the variation run.ReturnSetcontains the result from that same package run and can beNonewhen no result is available.- CycleData
Returns the cycle data object that contains the input data for the variation.
- Returns:
The cycle data object
- ReturnSet
Returns the return-variable dictionary from the package execution for this variation.
- Returns:
The return set as a dictionary, or
Nonewhen no result is available.