Click or drag to resize

Axis Value Example

Below, an example implementation of a RelaxISPlugin_AxisValue is shown.

The function of the plugin is chosen for illustrative purposes.

Requirements
  • Reference to the RelaxIS_SDK.dll

  • .NET Framework 4.7.2 target (class library)

  • Recommended: Development environment with compiler e.g. RelaxIS SDK Code Editor, Microsoft Visual Studio

Demonstrates

This examples illustrates the implementation of an Axis Value plugin.

The plugin selects the phase angle from a value in a given transfer function.

Example
C#
// <copyright file="MyAxisValue.cs" company="rhd instruments GmbH and Co. KG">
// Copyright (c) rhd instruments GmbH and Co. KG. All rights reserved.
// Licensed under the MIT No Attribution (MIT-0) license. See section 'License' in the 'SDK Examples / Tutorials' topic for full license information.
// </copyright>

namespace RelaxIS_SDK_Examples.Plugins
{
    /***
     * AxisValue plugins are used to select a single, real value from a complex impedance value.
     * These values are most prominently used for creating plots – hence the origin of the name.
     * Moreover, the selected values may also be used in the future for custom fitting procedures.
     */

    using System;
    using RelaxIS_SDK.Plugins;

    /// <summary>
    /// Defines an example <see cref="RelaxISPlugin_AxisValue"/> class.
    /// </summary>
    public class MyAxisValue
        : RelaxISPlugin_AxisValue
    {
        /***
         * First, implement the default plugin properties Name and Description that describe the plugin.
         * This is mainly used for display purposes in the case of AxisValue plugins, e.g. the name appears in the list of available axis values.
         */

        /// <inheritdoc/>
        public override string Name
        {
            get { return "My Axis-Value"; }
        }

        /// <inheritdoc/>
        public override string Description
        {
            get { return "Calculates the phase angle of the transfer function"; }
        }

        /***
         * This property describes if the axis value has a preference for being displayed in logarithmic or linear form.
         * Return -1 to mean that no preference is given, 1 to prefer logarithmic or 0 to prefer linear scaling.
         */

        /// <inheritdoc/>
        public override int IsLogarithmicByDefault
        {
            get { return 0; } // Prefer linear scaling.
        }

        /***
         * These two functions define what is being displayed as an axis title for this axis value.
         * The display is typically 'Representation / Unit'. Both can be dependent on the used transfer function converter.
         * For example the 'Real part' axis value would use the Unit of the transfer function instead of a fixed unit like here.
         */

        /// <inheritdoc/>
        public override string Representation(RelaxISPlugin_TransferFunction converter)
        {
            return "Phase Angle (" + converter.Symbol + ")";
        }

        /// <inheritdoc/>
        public override string Unit(RelaxISPlugin_TransferFunction converter)
        {
            return "°";
        }

        /***
         * This is the function that implements the actual selection of a number from a complex datapoint.
         * Note, that the input values are the impedance values and you may need to first convert this value
         * into the active transfer function by using the given transfer function converter.
         */

        /// <inheritdoc/>
        public override double GetValue(double frequency, double zReal, double zImag, RelaxISPlugin_TransferFunction converter)
        {
            // Get converted value, i.e. value in another transfer function
            var converted = converter.ConvertValue(frequency, zReal, zImag);
            var phaseAngle = converted.Argument;
            return phaseAngle / Math.PI * 180.0;
        }
    }
}
See Also