private ConversionBase CreateConversion(string parameterIdentifier, double parameterMax)
        {
            var parameterFormat = this.csvAdapter.GetParameterFormat(parameterIdentifier, parameterMax);

            var conversionName = "conversion_" + parameterIdentifier;

            return(RationalConversion.CreateSimple1To1Conversion(
                       conversionName,
                       this.csvAdapter.GetParameterUnit(parameterIdentifier),
                       parameterFormat));
        }
        public static Parameter CreateTransientConfigurationForOneParameter(Session session)
        {
            const string ConversionFunctionName   = "CONV_MyParam:MyApp";
            const string ApplicationGroupName     = "MyApp";
            const string ParameterGroupIdentifier = "MyParamGroup";
            const string ParameterName            = "MyParam";
            const uint   MyParamChannelId         = 999999; //must be unique
            const int    ApplicationId            = 999;
            var          parameterIdentifier      = $"{ParameterName}:{ApplicationGroupName}";

            var transientConfigSet = session.CreateTransientConfiguration();

            var parameterGroup = new ParameterGroup(ParameterGroupIdentifier, "some description!");

            transientConfigSet.AddParameterGroup(parameterGroup);

            var applicationGroup = new ApplicationGroup(
                ApplicationGroupName,
                ApplicationGroupName + "App Group Desc!!",
                ApplicationId,
                new List <string>
            {
                parameterGroup.Identifier
            });

            transientConfigSet.AddGroup(applicationGroup);

            var conversion = RationalConversion.CreateSimple1To1Conversion(ConversionFunctionName, "myunit", "%5.2f");

            transientConfigSet.AddConversion(conversion);

            var paramFrequency = new Frequency(2, FrequencyUnit.Hz);

            var paramChannel = new Channel(
                MyParamChannelId,
                "MyParamChannel",
                paramFrequency.ToInterval(),
                DataType.Double64Bit,
                ChannelDataSourceType.Periodic,
                string.Empty,
                true);

            transientConfigSet.AddChannel(paramChannel);

            var myParameter = new Parameter(
                parameterIdentifier,
                ParameterName,
                ParameterName + "Description",
                400, //maximum value
                0,   //minimum value
                1,
                0,
                0,
                255,
                0,
                ConversionFunctionName,
                new List <string>
            {
                ParameterGroupIdentifier
            },
                paramChannel.Id,
                ApplicationGroupName);

            transientConfigSet.AddParameter(myParameter);

            transientConfigSet.Commit();

            return(myParameter);
        }