Code Snippets are written in C#.  In the MxSuite they are used for these purposes:

Defining Signal Patterns

Defining Signal Transformations

Defining Custom Tolerances

C# code is also used in Reactive TestCases and Scenarios.

Defining Signal Patterns

There are two ways to define a Signal pattern with a C# code snippet:

Use the C# Snippet Signal Generator.

Create a Reactive TestCase.

The C# Code Snippet is a simple way to construct a definition of how a Signal changes over time.  The code is compiled in the MxSuite automatically without the need for an external C# development environment.  For more complex C# Snippets, it may be useful to create and debug the C# algorithm in an external Visual Studio project.

Defining Signal Transformations

There are two ways to define a Signal transformation with a C# code snippet:

1.Transformations can be encoded in a C# Code Snippet In-Line Transform in the Signal Dictionary.  Construct a C# Code Snippet to transform the Signal data as it enters or leaves the TestCase.  For example, suppose that the requirement (and TestCase) are specified in terms of acceleration, but the only Signal available to be measured is a distance.  You could use a C# Code Snippet to differentiate the distance and derive the acceleration. This works well in many cases, but there are limitations. For example, the mapping between Signals is always one to one.

2.For other transformations a more generic approach is needed.  The fully generic approach is to use MxTransIt and construct the precise Virtual Wiring Harness needed for the situation. The Harness may include a C# Snippet Transform. This approach is a little more involved but is fully generic and scalable.

Defining Custom Tolerances

Standard tolerances allow a fixed delta (positive and negative) from the nominal time or value. Custom tolerances enable you to define the tolerance with C# code, for example, as a percentage.

Related Topics:

In-Line Transforms

Using the C# Snippet Transform: An Example

Signal Properties—Custom Tolerances