Ejemplo n.º 1
0
        public static T ReconfigureInstance <T>(T instance, Type type, IComponentDirectory directory)
        {
            IRequiresConfiguration  required = new TypeRequiredConfiguration(type, instance);
            IComponentConfiguration config   = new StandardConfiguration();

            return((T)ConfigureComponentWithRequirements(required, config, directory));
        }
 /// <summary>Configures common settings related to the NR standard of the measured signal.</summary>
 /// <param name="nr">Specifies the NR signal to configure.</param>
 /// <param name="standardConfig">Specifies the NR standard settings to apply.</param>
 /// <param name="selectorString">Pass an empty string. The signal name that is passed when creating the signal configuration is used. See the RFmx help for more documention of this parameter.</param>
 public static void ConfigureStandard(RFmxNRMX nr, StandardConfiguration standardConfig, string selectorString = "")
 {
     nr.SetComponentCarrierSpacingType(selectorString, RFmxNRMXComponentCarrierSpacingType.Nominal); // nominal is assumed
     nr.SetLinkDirection(selectorString, standardConfig.LinkDirection);
     nr.SetFrequencyRange(selectorString, standardConfig.FrequencyRange);
     nr.SetBand(selectorString, standardConfig.Band);
     nr.SetAutoResourceBlockDetectionEnabled(selectorString, standardConfig.AutoResourceBlockDetectionEnabled);
     nr.ComponentCarrier.SetDownlinkTestModel(selectorString, standardConfig.DownlinkTestModel);
     nr.ComponentCarrier.SetDownlinkTestModelDuplexScheme(selectorString, standardConfig.DownlinkTestModelDuplexScheme);
     nr.ComponentCarrier.SetNumberOfComponentCarriers(selectorString, standardConfig.ComponentCarrierConfigurations.Length);
     for (int i = 0; i < standardConfig.ComponentCarrierConfigurations.Length; i++)
     {
         string carrierString = RFmxNRMX.BuildCarrierString(selectorString, i);
         ComponentCarrierConfiguration componentCarrierConfig = standardConfig.ComponentCarrierConfigurations[i];
         nr.ComponentCarrier.SetBandwidth(carrierString, componentCarrierConfig.Bandwidth_Hz);
         nr.ComponentCarrier.SetCellID(carrierString, componentCarrierConfig.CellId);
         nr.ComponentCarrier.SetPuschModulationType(carrierString, componentCarrierConfig.PuschModulationType);
         nr.ComponentCarrier.SetBandwidthPartSubcarrierSpacing(carrierString, componentCarrierConfig.SubcarrierSpacing_Hz);
         nr.ComponentCarrier.SetPuschResourceBlockOffset(carrierString, componentCarrierConfig.PuschResourceBlockOffset);
         nr.ComponentCarrier.SetPuschNumberOfResourceBlocks(carrierString, componentCarrierConfig.PuschNumberOfResourceBlocks);
         nr.ComponentCarrier.SetPuschTransformPrecodingEnabled(carrierString, componentCarrierConfig.PuschTransformPrecodingEnabled);
         nr.ComponentCarrier.SetPuschSlotAllocation(carrierString, componentCarrierConfig.PuschSlotAllocation);
         nr.ComponentCarrier.SetPuschSymbolAllocation(carrierString, componentCarrierConfig.PuschSymbolAllocation);
         nr.ComponentCarrier.SetPuschDmrsConfigurationType(carrierString, componentCarrierConfig.PuschDmrsConfigurationType);
         nr.ComponentCarrier.SetPuschMappingType(carrierString, componentCarrierConfig.PuschMappingType);
         nr.ComponentCarrier.SetPuschDmrsTypeAPosition(carrierString, componentCarrierConfig.PuschDmrsTypeAPosition);
         nr.ComponentCarrier.SetPuschDmrsDuration(carrierString, componentCarrierConfig.PuschDmrsDuration);
         nr.ComponentCarrier.SetPuschDmrsAdditionalPositions(carrierString, componentCarrierConfig.PuschDmrsAdditionalPositions);
     }
 }
        public IHost Build(string[] args)
        {
            IHostBuilder hostBuilder = Host.CreateDefaultBuilder(args);

            hostBuilder.UseContentRoot(Directory.GetCurrentDirectory());
            ConfigureLogging(hostBuilder);
            hostBuilder.ConfigureWebHostDefaults(webHostBuilder =>
            {
                IConfigurationRoot configuration = MakeConfiguration(args, webHostBuilder);
                webHostBuilder.UseConfiguration(configuration);
                StandardConfiguration standardConfiguration = configuration.GetSection("StandardConfiguration").Get <StandardConfiguration>();

                if (standardConfiguration.Http.HttpsEnabled)
                {
                    ConfigureWebHostForHttps(webHostBuilder, standardConfiguration);
                }
                else
                {
                    webHostBuilder.UseKestrel();
                    webHostBuilder.UseUrls($"http://0.0.0.0:{standardConfiguration.Http.HttpPort}");
                }

                webHostBuilder.UseStartup <STARTUP>();
            });

            return(hostBuilder.Build());
        }
        private InstallDestination CreateDestination(XmlNode sdest)
        {
            string asm = defaultAssembly;

            if ((sdest as XmlElement).HasAttribute(assemblyAttribute))
            {
                asm = sdest.Attributes[assemblyAttribute].Value;
            }

            string nsp = defaultDestinationNamespace;

            if ((sdest as XmlElement).HasAttribute(namespaceAttribute))
            {
                asm = sdest.Attributes[namespaceAttribute].Value;
            }

            string fullName = String.Format("{0}.{1}, {2}", nsp, sdest.Name, asm);
            Type   t        = Type.GetType(fullName);

            if (t != null)
            {
                InstallDestination inspected = t.GetConstructor(Type.EmptyTypes).Invoke(null) as InstallDestination;

                IComponentConfiguration config = new StandardConfiguration();
                foreach (XmlAttribute attribute in sdest.Attributes)
                {
                    config.Values[attribute.Name] = new Simple(attribute.Value);
                }

                return(ConfiguredComponent.ReconfigureInstance(inspected, inspected.GetType(), componentEnvironment, config));
            }

            throw new Exception(String.Format("The Install Destination {0} is not supported.", sdest.Name));
        }
 private static void ConfigureWebHostForHttps(IWebHostBuilder webHostBuilder, StandardConfiguration standardConfiguration)
 {
     webHostBuilder.UseUrls($"http://0.0.0.0:{standardConfiguration.Http.HttpPort}", $"https://0.0.0.0:{standardConfiguration.Http.HttpsPort}");
     webHostBuilder.UseKestrel(kestrelOptions =>
                               kestrelOptions.ConfigureHttpsDefaults(httpsOptions =>
     {
         httpsOptions.ServerCertificateSelector = SslCertificateSelector;
         httpsOptions.SslProtocols   = sslProtocols;
         httpsOptions.OnAuthenticate = SslOptionConfigurer;
     }));
 }
Ejemplo n.º 6
0
        public void SetUp()
        {
            try
            {
                ServiceLocator.SetLocatorProvider(() => null);

                LogManager.ResetConfiguration();
                Assert.That(LogManager.GetLogger(typeof(LoggingClientTransactionListener)).IsDebugEnabled, Is.False);

                StandardConfiguration.Initialize();
                TableInheritanceConfiguration.Initialize();

                SqlConnection.ClearAllPools();

                var masterAgent = new DatabaseAgent(DatabaseTest.MasterConnectionString);
                masterAgent.ExecuteBatchFile("DataDomainObjects_CreateDB.sql", false, DatabaseConfiguration.GetReplacementDictionary());
                var testDomainAgent = new DatabaseAgent(DatabaseTest.TestDomainConnectionString);
                testDomainAgent.ExecuteBatchFile("DataDomainObjects_SetupDB.sql", true, DatabaseConfiguration.GetReplacementDictionary());

                _standardMappingDatabaseAgent = new StandardMappingDatabaseAgent(DatabaseTest.TestDomainConnectionString);
                string sqlFileName = StandardMappingTest.CreateTestDataFileName;
                _standardMappingDatabaseAgent.ExecuteBatchFile(sqlFileName, true, DatabaseConfiguration.GetReplacementDictionary());
                string sqlFileName1 = TableInheritanceMappingTest.CreateTestDataFileName;
                _standardMappingDatabaseAgent.ExecuteBatchFile(sqlFileName1, true, DatabaseConfiguration.GetReplacementDictionary());
                _standardMappingDatabaseAgent.SetDatabaseReadOnly(DatabaseTest.DatabaseName);

                // We don't want the tests to initialize a default mapping; therefore, modify MappingConfiguration.s_mappingConfiguration so that it will
                // throw when asked to generate a new MappingConfiguration.

                _previousMappingConfigurationContainer = (DoubleCheckedLockingContainer <IMappingConfiguration>)PrivateInvoke.GetNonPublicStaticField(
                    typeof(MappingConfiguration),
                    "s_mappingConfiguration");
                var throwingMappingConfigurationContainer = new DoubleCheckedLockingContainer <IMappingConfiguration> (
                    () =>
                {
                    throw new InvalidOperationException(
                        "This test failed to setup the mapping configuration. Did you forget to derive from StandardMappingTest or to call base.SetUp?");
                });
                PrivateInvoke.SetNonPublicStaticField(typeof(MappingConfiguration), "s_mappingConfiguration", throwingMappingConfigurationContainer);
            }
            catch (Exception ex)
            {
                Console.WriteLine("SetUpFixture failed: " + ex);
                Console.WriteLine();
                throw;
            }
        }
Ejemplo n.º 7
0
 public void SetMapping(StandardConfiguration stdConfig, RgbConfiguration rgbConfig)
 {
     options[OptionStrings.BoardLabel].SetText(stdConfig.Label);
     options[OptionStrings.FlagsCheck].SetCheck(stdConfig.Flags);
     options[OptionStrings.Qe1Sensitivity].SetCombo(ConfigDefines.ByteToCombo(stdConfig.QE1Sens));
     options[OptionStrings.Qe1ReductionRatio].SetCombo(stdConfig.QE1ReductionRatio);
     options[OptionStrings.Qe2Sensitivity].SetCombo(ConfigDefines.ByteToCombo(stdConfig.QE2Sens));
     options[OptionStrings.Qe2ReductionRatio].SetCombo(stdConfig.QE2ReductionRatio);
     options[OptionStrings.Ps2Mode].SetCombo(stdConfig.PS2Mode);
     options[OptionStrings.RgbInterface].SetCombo(stdConfig.RgbInterface);
     options[OptionStrings.RgbBrightness].SetNumber(stdConfig.RgbBrightness);
     options[OptionStrings.DebounceTime].SetNumber(stdConfig.ButtonDebounce);
     options[OptionStrings.RgbMode].SetCombo(rgbConfig.Mode);
     options[OptionStrings.RgbConfig].SetButtonColor(0, rgbConfig.Led1Hue);
     options[OptionStrings.RgbConfig].SetButtonColor(1, rgbConfig.Led2Hue);
     options[OptionStrings.AxisDebounceTime].SetNumber(stdConfig.AxisDebounce);
     options[OptionStrings.AxisSustainTime].SetNumber(stdConfig.AxisSustain);
     options[OptionStrings.AscEmulation].SetCombo(stdConfig.AscEmulation);
     options[OptionStrings.ControllerOutput].SetCombo(stdConfig.ControllerOutput);
 }
Ejemplo n.º 8
0
        public void TestOfflineAnalysisSingleCarrierTdd()
        {
            RFmxInstrMX instr = new RFmxInstrMX("", "AnalysisOnly=1");
            RFmxLteMX   lte   = instr.GetLteSignalConfiguration();

            ConfigureCommon(lte, CommonConfiguration.GetDefault());
            StandardConfiguration signalConfig = StandardConfiguration.GetDefault();

            signalConfig.DuplexScheme = RFmxLteMXDuplexScheme.Tdd;
            ConfigureStandard(lte, signalConfig);
            ModAccConfiguration modAccConfig = ModAccConfiguration.GetDefault();

            modAccConfig.MeasurementOffset = 4;
            ConfigureModAcc(lte, modAccConfig);

            lte.Commit("");

            instr.GetRecommendedIQPreTriggerTime("", out double pretriggerTime);
            PrecisionTimeSpan timeOffset = new PrecisionTimeSpan(-pretriggerTime);

            Waveform wfm = LoadWaveformFromTDMS(@"Support Files\LTE_TDD_2.0.tdms");

            Buffer <ComplexSingle>         readBuffer  = wfm.Data.GetBuffer(true);
            WritableBuffer <ComplexSingle> writeBuffer = wfm.Data.GetWritableBuffer();

            int sampleOffset = (int)Math.Round(pretriggerTime * wfm.SampleRate);

            for (int i = 0; i < readBuffer.Size; i++)
            {
                writeBuffer[i] = readBuffer[(i - sampleOffset + readBuffer.Size) % readBuffer.Size];
            }
            wfm.Data.PrecisionTiming = PrecisionWaveformTiming.CreateWithRegularInterval(
                wfm.Data.PrecisionTiming.SampleInterval, timeOffset);

            lte.AnalyzeIQ("", "", wfm.Data, true, out _);
            ModAccResults modAccResults = FetchModAcc(lte);

            instr.Close();

            Assert.IsTrue(modAccResults.ComponentCarrierResults[0].MeanRmsCompositeEvm < 0.001);
        }
Ejemplo n.º 9
0
 /// <summary>Configures common settings related to the LTE standard of the measured signal.</summary>
 /// <param name="lte">Specifies the LTE signal to configure.</param>
 /// <param name="standardConfig">Specifies the LTE standard settings to apply.</param>
 /// <param name="selectorString">Pass an empty string. The signal name that is passed when creating the signal configuration is used. See the RFmx help for more documention of this parameter.</param>
 #region Measurement Configuration
 public static void ConfigureStandard(RFmxLteMX lte, StandardConfiguration standardConfig, string selectorString = "")
 {
     lte.ComponentCarrier.SetSpacingType(selectorString, RFmxLteMXComponentCarrierSpacingType.Nominal); // nominal spacing is assumed
     lte.ConfigureLinkDirection(selectorString, standardConfig.LinkDirection);
     lte.ConfigureDuplexScheme(selectorString, standardConfig.DuplexScheme, standardConfig.UplinkDownlinkConfiguration);
     lte.ConfigureBand(selectorString, standardConfig.Band);
     lte.ConfigureNumberOfComponentCarriers(selectorString, standardConfig.ComponentCarrierConfigurations.Length);
     for (int i = 0; i < standardConfig.ComponentCarrierConfigurations.Length; i++)
     {
         string carrierString = RFmxLteMX.BuildCarrierString(selectorString, i);
         ComponentCarrierConfiguration componentCarrierConfig = standardConfig.ComponentCarrierConfigurations[i];
         lte.ComponentCarrier.SetBandwidth(carrierString, componentCarrierConfig.Bandwidth_Hz);
         lte.ComponentCarrier.SetCellId(carrierString, componentCarrierConfig.CellId);
         lte.ComponentCarrier.ConfigurePuschModulationType(carrierString, componentCarrierConfig.PuschModulationType);
         lte.ComponentCarrier.ConfigurePuschResourceBlocks(carrierString, componentCarrierConfig.PuschResourceBlockOffset, componentCarrierConfig.PuschNumberOfResourceBlocks);
         lte.ComponentCarrier.ConfigureDownlinkTestModel(carrierString, componentCarrierConfig.DownlinkTestModel);
     }
     lte.ComponentCarrier.ConfigureAutoResourceBlockDetectionEnabled(selectorString, standardConfig.PuschAutoResourceBlockDetectionEnabled);
     lte.ConfigureAutoDmrsDetectionEnabled(selectorString, standardConfig.AutoDmrsDetectionEnabled);
     lte.ComponentCarrier.ConfigureDownlinkAutoCellIDDetectionEnabled(selectorString, standardConfig.DownlinkAutoCellIDDetectionEnabled);
 }
Ejemplo n.º 10
0
        public void PostComponentInit(IComponentDirectory directory)
        {
            concurrencyCount = (uint)(System.Environment.ProcessorCount * workerThreadsPerCore);

            for (int i = 0; i < System.Environment.ProcessorCount; ++i)
            {
                CPUWorkUnit masterWorkUnit = null;

                for (int j = 0; j < workerThreadsPerCore; ++j)
                {
                    IComponentConfiguration config = new StandardConfiguration();
                    config.Values["CoreNumber"]  = new Simple(i);
                    config.Values["SliceNumber"] = new Simple(j);
                    if (masterWorkUnit != null)
                    {
                        config.Values["Previous"] = new Simple(masterWorkUnit);
                    }
                    config.Values["SlicesPerCore"] = new Simple((int)workerThreadsPerCore);

                    ConfiguredComponent component = new ConfiguredComponent(
                        typeof(CPUWorkUnit).FullName,
                        config);

                    CPUWorkUnit wu =
                        Components.ConfigureInlineComponent(component) as CPUWorkUnit;

                    this.registry.Register(wu);

                    if (j == 0)
                    {
                        masterWorkUnit = wu;
                    }
                }
            }

            controlThread = new Thread(Controller);

            controlThreadTimer =
                new Timer(Schedule, null, TimeSpan.Zero, DefaultTimeSlice);
        }
 /// <summary>Configures common settings related to the WLAN standard of the measured signal.</summary>
 /// <param name="wlanSignal">Specifies the WLAN signal to configure.</param>
 /// <param name="standardConfig">Specifies the WLAN standard settings to apply.</param>
 /// <param name="selectorString">Pass an empty string. The signal name that is passed when creating the signal configuration is used.See the RFmx help for more documention of this parameter.</param>
 public static void ConfigureStandard(RFmxWlanMX wlanSignal, StandardConfiguration standardConfig, string selectorString = "")
 {
     wlanSignal.ConfigureStandard(selectorString, standardConfig.Standard);
     wlanSignal.ConfigureChannelBandwidth(selectorString, standardConfig.ChannelBandwidth_Hz);
 }
Ejemplo n.º 12
0
        public bool ReadConfig()
        {
            configBytes.Clear();
            HidStream hidStream;

            if (Device.TryOpen(out hidStream))
            {
                using (hidStream)
                {
                    try
                    {
                        int attempts = 0;
                        while (attempts < maxConfig)
                        {
                            byte[] config = new byte[64];
                            config[0] = 0xc0;
                            hidStream.GetFeature(config);
                            if (config[0] != 0xc0)
                            {
                                //StatusWrite("Mismatch in config report ID");
                            }
                            else
                            {
                                if (!configBytes.ContainsKey(config[1]))
                                {
                                    configBytes.Add(config[1], config);
                                    switch (config[1])
                                    {
                                    case 0:
                                        StdConfig = new StandardConfiguration(config);
                                        break;

                                    case 1:
                                        RgbConfig = new RgbConfiguration(config);
                                        break;

                                    case 2:
                                        KeyConfig = new KeyMappingConfiguration(config);
                                        break;

                                    case 3:
                                        DeviceConfig = new DeviceConfiguration(config);
                                        break;
                                    }
                                }
                                attempts++;
                            }
                        }
                        if (configBytes.Count == 0)
                        {
                            //StatusWrite("Failed to get any config reports.");
                        }
                        else
                        {
                            //StatusWrite($"Found {configBytes.Count} config reports.");
                        }
                    }
                    catch (Exception ex)
                    {
                        //StatusWrite("Failed to get config. Please disconnect and reconnect the board.");
                        return(false);
                    }
                }
            }
            else
            {
                //StatusWrite("Failed to open device. Please disconnect and reconnect.");
                return(false);
            }

            return(true);
        }
 protected StandardStartup(IWebHostEnvironment environment, IConfiguration configuration)
 {
     _environment           = environment;
     _configuration         = configuration;
     _standardConfiguration = _configuration.GetSection("StandardConfiguration").Get <StandardConfiguration>();
 }
Ejemplo n.º 14
0
        public bool ReadConfig()
        {
            configBytes.Clear();
            HidStream hidStream;

            if (Device.TryOpen(out hidStream))
            {
                using (hidStream)
                {
                    try
                    {
                        int attempts = 0;
                        while (attempts < maxConfig)
                        {
                            byte[] config = new byte[64];
                            config[0] = 0xc0;
                            hidStream.GetFeature(config);
                            if (config[0] != 0xc0)
                            {
                                //StatusWrite("Mismatch in config report ID");
                                attempts++;
                            }
                            else
                            {
                                if (!configBytes.ContainsKey(config[1]))
                                {
                                    configBytes.Add(config[1], config);
                                    switch (config[1])
                                    {
                                    case 0:
                                        StdConfig = new StandardConfiguration(config);
                                        break;

                                    case 1:
                                        RgbConfig = new RgbConfiguration(config);
                                        break;

                                    case 2:
                                        KeyConfig = new KeyMappingConfiguration(config);
                                        break;

                                    case 3:
                                        DeviceConfig = new DeviceConfiguration(config);
                                        break;
                                    }
                                }
                                attempts++;
                            }
                        }
                        NumConfigPages = configBytes.Count;
                    }
                    catch (Exception ex)
                    {
                        return(false);
                    }
                }
            }
            else
            {
                return(false);
            }

            return(true);
        }
        private InstallSource CreateSource(XmlNode src)
        {
            string asm = defaultAssembly;

            if ((src as XmlElement).HasAttribute(assemblyAttribute))
            {
                asm = src.Attributes[assemblyAttribute].Value;
            }

            string nsp = defaultSourceNamespace;

            if ((src as XmlElement).HasAttribute(namespaceAttribute))
            {
                asm = src.Attributes[namespaceAttribute].Value;
            }

            string fullName = String.Format("{0}.{1}, {2}", nsp, src.Name, asm);

            Type t = Type.GetType(fullName);

            if (t != null)
            {
                InstallSource inspected = t.GetConstructor(Type.EmptyTypes).Invoke(null) as InstallSource;

                IComponentConfiguration config = new StandardConfiguration();
                foreach (XmlAttribute attribute in src.Attributes)
                {
                    config.Values[attribute.Name] = new Simple(attribute.Value);
                }

                inspected = ConfiguredComponent.ReconfigureInstance(
                    inspected, inspected.GetType(), componentEnvironment, config);


                if (src.ChildNodes.Count == 1)
                {
                    PropertyInfo pinfo = t.GetProperty(childPropertyName);
                    if (pinfo == null)
                    {
                        throw new Exception(String.Format("Source {0} does not allow child sources", src.Name));
                    }
                    InstallSource child = CreateSource(src.ChildNodes[0]);
                    pinfo.SetValue(inspected, child, null);
                }

                else if (src.ChildNodes.Count > 1)
                {
                    PropertyInfo pinfo = t.GetProperty(childPropertyName);
                    if (pinfo == null)
                    {
                        throw new Exception(String.Format("Source {0} does not allow child sources", src.Name));
                    }

                    if (pinfo.GetIndexParameters().Length == 0)
                    {
                        throw new Exception(String.Format("Source {0} does not allow multiple child sources", src.Name));
                    }
                    int i = 0;
                    foreach (XmlNode node in src.ChildNodes)
                    {
                        InstallSource child = CreateSource(src.ChildNodes[0]);
                        pinfo.SetValue(inspected, child, new object[] { i });
                    }
                }

                return(inspected);
            }

            throw new Exception(String.Format("The Install Source {0} is not supported.", src.Name));
        }