• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Measurement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Measurement的典型用法代码示例。如果您正苦于以下问题:C# Measurement类的具体用法?C# Measurement怎么用?C# Measurement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Measurement类属于命名空间,在下文中一共展示了Measurement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ChannelInfoShouldGiveCompleteITCChannelInfo

        public void ChannelInfoShouldGiveCompleteITCChannelInfo(
            [Values((ushort)0, (ushort)1, (ushort)8)] 
            ushort channelNumber,
    [Values(StreamType.AO, StreamType.DO_PORT, StreamType.XO)] 
            StreamType streamType
            )
        {
            var controller = new HekaDAQController();
            const string name = "UNUSED_NAME";
            var s = new HekaDAQOutputStream(name,
                streamType,
                channelNumber,
                controller);

            const decimal sampleRate = 9000;
            var srate = new Measurement(sampleRate, "Hz");
            controller.SampleRate = srate;

            ITCMM.ITCChannelInfo info = s.ChannelInfo;

            Assert.AreEqual(channelNumber, info.ChannelNumber);
            Assert.AreEqual((int)streamType, info.ChannelType);
            Assert.AreEqual(s.SampleRate.QuantityInBaseUnits, info.SamplingRate);
            Assert.AreEqual(ITCMM.USE_FREQUENCY, info.SamplingIntervalFlag);
            Assert.AreEqual(0, info.Gain);
            Assert.AreEqual(IntPtr.Zero, info.FIFOPointer);
        }
开发者ID:Symphony-DAS,项目名称:symphony-core,代码行数:27,代码来源:HekaDAQStreamTests.cs


示例2: FixedUpdate

    void FixedUpdate()
    {
        m_position = null;
	
		switch(ubitrackEvent)
		{
		case UbitrackEventType.Pull:{				
				ulong lastTimestamp =  UbiMeasurementUtils.getUbitrackTimeStamp();
				if(m_positionPull.getPosition3D(m_simplePosition, lastTimestamp))
				{					
                    m_position = UbiMeasurementUtils.ubitrackToUnity(m_simplePosition);    
				}	
				break;
			}
		case UbitrackEventType.Push:{
            m_position = m_positionReceiver.getData();
				break;
			}
		default:
		break;
		}

        if (m_position != null)
        {
            UbiUnityUtils.setGameObjectPosition(relative, gameObject, m_position.data());
        }
        	
    }
开发者ID:Ozelotl,项目名称:Portfolio,代码行数:28,代码来源:PositionSink.cs


示例3: receivePositionList3D

 public override void receivePositionList3D(SimplePositionList3D position3dList)
 {
     lock (thisLock)
     {
         m_data = UbiMeasurementUtils.ubitrackToUnity(position3dList);
     }
 }
开发者ID:Ozelotl,项目名称:Portfolio,代码行数:7,代码来源:Unity3DListReceiver.cs


示例4: receivePosition3D

 public override void receivePosition3D(SimplePosition3D newPosition)
 {
     lock (thisLock)
     {			
         m_position = UbiMeasurementUtils.ubitrackToUnity(newPosition);            
     }
 }
开发者ID:Ozelotl,项目名称:Portfolio,代码行数:7,代码来源:UnityPositionReceiver.cs


示例5: DelegatesBlocks

        public void DelegatesBlocks()
        {
            var parameters = new Dictionary<string, object>();
            parameters["sampleRate"] = new Measurement(1000, "Hz");

            var s = new DelegatedStimulus("DelegatedStimulus", "units",
                                          parameters,
                                          (p, b) => new OutputData(Enumerable.Range(0, (int)(b.TotalSeconds * (double)((IMeasurement)p["sampleRate"]).QuantityInBaseUnit))
                                                                       .Select(i => new Measurement(i, "units")).ToList(),
                                                                   (IMeasurement)p["sampleRate"],
                                                                   false),
                                          (p) => Option<TimeSpan>.None());

            var block = TimeSpan.FromMilliseconds(100);
            IEnumerator<IOutputData> iter = s.DataBlocks(block).GetEnumerator();
            int n = 0;
            while (iter.MoveNext() && n < 100)
            {
                var expected =
                    new OutputData(
                        Enumerable.Range(0, (int)(block.TotalSeconds * (double)((IMeasurement)parameters["sampleRate"]).QuantityInBaseUnit))
                            .Select(i => new Measurement(i, "units")).ToList(),
                        (IMeasurement)parameters["sampleRate"],
                        false);

                Assert.That(iter.Current.Duration, Is.EqualTo(expected.Duration));
                Assert.That(iter.Current.Data, Is.EqualTo(expected.Data));
                n++;
            }
        }
开发者ID:physion,项目名称:symphony-core,代码行数:30,代码来源:StimulusTests.cs


示例6: CreateCounterExample2

        public static Animation CreateCounterExample2(Lifetime life)
        {
            var animation = new Animation();

            var state = Ani.Anon(step => {
                var t = (step.TotalSeconds * 8).SmoothCycle(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);

                var t1 = TimeSpan.Zero;
                var t2 = t.Seconds();

                var ra = new EndPoint("Robot A", skew: 0.Seconds() + t1);
                var rb = new EndPoint("Robot B", skew: 0.Seconds() + t2);

                var graph = new EndPointGraph(
                    new[] { ra, rb },
                    new Dictionary<Tuple<EndPoint, EndPoint>, TimeSpan> {
                        {Tuple.Create(ra, rb), 2.Seconds() + t2 - t1},
                        {Tuple.Create(rb, ra), 2.Seconds() + t1 - t2},
                    });

                var m1 = new Message("I think it's t=0s.", graph, ra, rb, ra.Skew + 0.Seconds());
                var m2 = new Message("Received at t=2s", graph, rb, ra, m1.ArrivalTime);

                var s1 = new Measurement("Apparent Time Mistake = 2s+2s", ra, ra, m2.ArrivalTime, m2.ArrivalTime + 4.Seconds(), 60);
                var s2 = new Measurement("Time mistake = RTT - 4s", ra, ra, m2.ArrivalTime + 4.Seconds(), m2.ArrivalTime + 4.Seconds(), 140);

                return new GraphMessages(graph, new[] { m1, m2}, new[] { s1, s2});
            });

            return CreateNetworkAnimation(animation, state, life);
        }
开发者ID:siddht1,项目名称:AnimatronTheTerrible,代码行数:31,代码来源:NetworkSequenceDiagram.cs


示例7: AddMeasurement

        // Add a measurement to the database and collections.
        public void AddMeasurement(Measurement newMeasurement)
        {
            // Add a measurement to the data context.
            measurementDB.Measurements.InsertOnSubmit(newMeasurement);

            // Save changes to the database.
            measurementDB.SubmitChanges();

            // Add a measurement to the "all" observable collection.
            App.MainPageViewModel.AllMeasurements.Add(newMeasurement);

            // Add a measurement to the appropriate filtered collection.
            switch (newMeasurement.Type.Name)
            {
                case "Weight":
                    App.MainPageViewModel.WeightMeasurements.Add(newMeasurement);
                    break;
                case "Pulse":
                    App.MainPageViewModel.PulseMeasurements.Add(newMeasurement);
                    break;
                case "Pressure":
                    App.MainPageViewModel.PressureMeasurements.Add(newMeasurement);
                    break;
                default:
                    break;
            }
            // Save changes to the database.
            measurementDB.SubmitChanges();
        }
开发者ID:EduardoSerra,项目名称:wp7-health-app,代码行数:30,代码来源:NewMeasurementPageViewModel.cs


示例8: Measure

 //--- Class Methods ---
 protected static Measurement[] Measure(string testname, Func<int> callback)
 {
     var result = new Measurement[_iterations.Length];
     for(var j = 0; j < 100; ++j) {
         callback();
     }
     for(int i = 0; i < _iterations.Length; ++i) {
         var count = _iterations [i];
         var sw = new Stopwatch();
         GC.Collect();
         GC.WaitForPendingFinalizers();
         var memory = GC.GetTotalMemory(true);
         sw.Start();
         for(var j = 0; j < count; ++j) {
             callback();
         }
         sw.Stop();
         memory = GC.GetTotalMemory(false) - memory;
         result[i] = new Measurement(memory, sw.Elapsed);
     }
     Console.WriteLine();
     Console.WriteLine("        --- {0} ---", testname);
     for(var i = 0; i < result.Length; ++i) {
         Console.WriteLine("        #{0}: {1:#,##0} bytes, {2:#,##0.000} ms", i + 1, result[i].MemoryUsage, result[i].Duration.TotalMilliseconds);
     }
     return result;
 }
开发者ID:bjorg,项目名称:Optimus,代码行数:28,代码来源:TestBase.cs


示例9: GenerateReports

        public void GenerateReports(Measurement m)
        {
            RawAnalysisReport rep = new AnalysisDefs.RawAnalysisReport(ctrllog);
            rep.GenerateReport(m);
            ResultsReport = rep.replines;
            MethodResultsReport mrep = new AnalysisDefs.MethodResultsReport(ctrllog);
            mrep.GenerateReport(m);
            foreach (List<string> r in mrep.INCCResultsReports)
            {
                INCCResultsReports.Add(r);
            }
            if (NC.App.AppContext.CreateINCC5TestDataFile)
            { 
                TestDataFile mdat = new AnalysisDefs.TestDataFile(ctrllog);
                mdat.GenerateReport(m);
                foreach (List<string> r in mdat.INCCTestDataFiles)
                {
                    TestDataFiles.Add(r);
                }
            }

            if (NC.App.AppContext.OpenResults)
            {
                string notepadPath = System.IO.Path.Combine(Environment.SystemDirectory, "notepad.exe");
                if (System.IO.File.Exists(notepadPath))
                {
                    foreach (string fname in m.INCCResultsFileNames)
                        System.Diagnostics.Process.Start(notepadPath, fname);
                }
                // todo:optional enablement
                // Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application();
                //Microsoft.Office.Interop.Excel.Workbook wb = excel.Workbooks.Open(m.ResultsFileName);
                //excel.Visible = true;
            }
        }
开发者ID:tempbottle,项目名称:INCC6,代码行数:35,代码来源:ReportBase.cs


示例10: receivePose

 public override void receivePose(SimplePose newPose)
 {
     lock (thisLock)
     {			
         m_pose = UbiMeasurementUtils.ubitrackToUnity(newPose);            
     }
 }
开发者ID:Ozelotl,项目名称:Portfolio,代码行数:7,代码来源:UnityPoseReceiver.cs


示例11: FrameworkPlugins_SingleContextGet

        public void FrameworkPlugins_SingleContextGet()
        {
            // engine data objects (not plugin-able business logic)
            Model model = CreateModel();
            var measurement = new Measurement();
            // plugin definition (unique and parameters)
            const string commandUnique = "pluginB_single_get";
            const string commandParameters = "parameter1=P1; parameter2=P2; material1=M1; material2=M2; threshold=0.4";

            var containerFramework = new ContainerFramework();
            var dataFramework = new DataFramework(containerFramework);
            dataFramework.Add<IModelDataEntity>(new ModelDataEntity(model));
            dataFramework.Add<IMeasurementDataEntity>(new MeasurementDataEntity(measurement));

            var commandFramework = new CommandFramework(containerFramework, dataFramework);
            commandFramework.AddPluginsFolder(new DataFolder(@"..\..\..\@PluginsBinaries"));
            commandFramework.AddPluginsBinary(new DataFile(@".\EngineAPI.dll"));
            commandFramework.Init();
//            var service1 = commandFramework.FindPlugin("model_get_measurement_properties").Value as IMeasurementPropertiesService;   //TODO should be implemented automatically
//            commandFramework.RegisterService<IMeasurementPropertiesService>(service1);
//            var service2 = commandFramework.FindPlugin("get_material_properties").Value as IMaterialPropertiesService;   //TODO should be implemented automatically
//            commandFramework.RegisterService<IMaterialPropertiesService>(service2);

            IDataEntity commandResult = commandFramework.RunCommand(commandUnique, commandParameters);
            Assert.IsInstanceOf<ModelParametersDataEntity>(commandResult);
        }
开发者ID:constructor-igor,项目名称:TechSugar,代码行数:26,代码来源:PluginFrameworkTests.cs


示例12: ShouldConstructFromInteger

        public void ShouldConstructFromInteger()
        {
            const int expected = 1;
            var m = new Measurement(expected, "V");

            Assert.That((int)m.Quantity, Is.EqualTo(expected));
        }
开发者ID:physion,项目名称:symphony-core,代码行数:7,代码来源:MeasurementTests.cs


示例13: ShouldConvertNegativeValues

        public void ShouldConvertNegativeValues()
        {
            var sample = new Measurement(-0.75, "units");

            var expected = new Measurement(-75, "units");
            Assert.That(CalibratedDevice.ConvertOutput(sample, LUT.Keys.ToList(), LUT.Values.ToList()), Is.EqualTo(expected));
        }
开发者ID:Symphony-DAS,项目名称:symphony-core,代码行数:7,代码来源:ExternalDeviceTests.cs


示例14: FixedUpdate

    void FixedUpdate()
    {
        m_pose = null;

		switch(ubitrackEvent)
		{
		case UbitrackEventType.Pull:{				
				ulong lastTimestamp =  UbiMeasurementUtils.getUbitrackTimeStamp();
				if(m_posePull.getPose(m_simplePose, lastTimestamp))
				{					
                    m_pose = UbiMeasurementUtils.ubitrackToUnity(m_simplePose);    
				}	
				break;
			}
		case UbitrackEventType.Push:{
            m_pose = m_poseReceiver.getData();
				break;
			}
		default:
		break;
		}

        if (m_pose != null)
        {
            UbiUnityUtils.setGameObjectPose(relative, gameObject, m_pose.data(), applyData);
        }
        lastPose = m_pose;
    }   
开发者ID:Ozelotl,项目名称:Portfolio,代码行数:28,代码来源:PoseSink.cs


示例15: Write_WithValidMeasurementFields_IsSuccessful

        public async Task Write_WithValidMeasurementFields_IsSuccessful()
        {
            //  Arrange
            InfluxManager mgr = new InfluxManager(_influxEndpoint, _influxDatabase);
            Measurement m = new Measurement()
            {
                Name = "unittest",
                IntegerFields = new List<IntegerField>()
                {
                    new IntegerField() { Name="count", Value=44 }
                },
                Timestamp = DateTime.Parse("10/26/2015 13:48")
            };

            //  Act
            Task<HttpResponseMessage> asyncretval = mgr.Write(m);
            Debug.WriteLine(DateTime.Now); // Log the time right after the call:

            HttpResponseMessage retval = await asyncretval; // Await the return
            Debug.WriteLine(DateTime.Now); // Log the time right after the return:

            //  Assert
            Assert.IsNotNull(retval);
            Assert.AreEqual(204, (int)retval.StatusCode);
        }
开发者ID:andymac4182,项目名称:InfluxClient,代码行数:25,代码来源:ManagerTests.cs


示例16: PrendiDaFile

        /// <summary>
        /// Prende da file i dati quando la rete non funziona
        /// </summary>
        /// <param name="percorso">Percorso e nome del file del log dei dati</param>
        public void PrendiDaFile(string percorso)
        {
            //TODO: il programma deve fare:
            // XXXX
            try
            {
                // vedere se questo codice si può riutilizzare
                using (StreamReader sr = new StreamReader(percorso))
                {
                    char[] buffer = new char[endRead];
                    sr.Read(buffer,startRead,endRead);
                    string lettura="";

                    for(int i= 0; i < buffer.Length -1; i++)
                    {
                        lettura = lettura + buffer[i];
                    }

                    string[] slitlettura = lettura.Split(' ');
                    Measurement sensore = new Measurement();

                    //DA FINIRE
                }
            }
            catch
            {
                throw new Exception();
            }
        }
开发者ID:gamondue,项目名称:GOR-4H-16,代码行数:33,代码来源:GorDbWriter.cs


示例17: ShouldConvertKeyDirectlyToValue

        public void ShouldConvertKeyDirectlyToValue()
        {
            var sample = new Measurement(10, "units");

            var expected = new Measurement(200, "units");
            Assert.That(CalibratedDevice.ConvertOutput(sample, LUT.Keys.ToList(), LUT.Values.ToList()), Is.EqualTo(expected));
        }
开发者ID:Symphony-DAS,项目名称:symphony-core,代码行数:7,代码来源:ExternalDeviceTests.cs


示例18: receiveMatrix4x4

 public override void receiveMatrix4x4(SimpleMatrix4x4 newMatrix)
 {
     lock (thisLock)
     {
         m_matrix = UbiMeasurementUtils.ubitrackToUnity(newMatrix);
     }
 }
开发者ID:Ozelotl,项目名称:Portfolio,代码行数:7,代码来源:Unity4x4MatrixReceiver.cs


示例19: PacketMeasurement

 public PacketMeasurement(Measurement measurement, string physicianName, string sessionType, string username)
 {
     this.measurement = measurement;
     this.physicianName = physicianName;
     this.sessionType = sessionType;
     this.username = username;
 }
开发者ID:xrgman,项目名称:CycleMasterPro2000,代码行数:7,代码来源:PacketMeasurement.cs


示例20: UnitNames

        public void UnitNames()
        {
            var meter = new Unit("meter")
                .IsAlsoCalled("metre")
                .CanBeAbbreviated("m", "mtr")
                .UsePluralFormat("{0}s");

            var feet = new Unit("foot")
                .PluralizeAs("feet")
                .CanBeAbbreviated("ft");

            var system = new ConversionGraph()
                .RoundToDecimalPlaces(5);

            system.AddConversion(Conversions.One(meter).In(feet).Is(3.28084M));

            var meterMeasurement = new Measurement(meter, 1);
            var feetMeasurement = new Measurement(feet, 2);

            var x = system.Convert(meterMeasurement, feet);

            Assert.That(system.Convert(meterMeasurement, feet) == 3.28084M);
            Assert.That(system.Convert(meterMeasurement, "ft") == 3.28084M);
            Assert.That(system.Convert(feetMeasurement, "metre") == 0.6096M);
            Assert.That(system.Convert(feetMeasurement, "mtr") == 0.6096M);
            Assert.That(system.Convert(feetMeasurement, "m") == 0.6096M);

            Assert.That(meterMeasurement.ToAbbreviatedString() == "1 m");
            Assert.That(meterMeasurement.ToString() == "1 meter");

            Assert.That(feetMeasurement.ToAbbreviatedString() == "2 ft");
            Assert.That(feetMeasurement.ToString() == "2 feet");
        }
开发者ID:hartez,项目名称:Convertinator,代码行数:33,代码来源:ReadmeExamples.cs



注:本文中的Measurement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Media类代码示例发布时间:2022-05-24
下一篇:
C# MazeDirection类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap