Example #1
0
        private void Read()
        {
            Stopwatch stopwatch = new Stopwatch();

            for (int i = 0; i < 1000000; i++)
            {
                stopwatch.Restart();
                var a = plc.Reads(Equipments.SelectMany(t => t.EquipmentProps).ToList());
                stopwatch.Stop();
                if (a.Success)
                {
                    Console.WriteLine($"线程:{Thread.CurrentThread.ManagedThreadId},读取次数:{i},耗时:{stopwatch.ElapsedMilliseconds.ToString()},{string.Join("||", Equipments.Select(t => t.EquipmentProps).Select(t => $"设备:{t[0].Equipment.Code},读取值:{string.Join(",", t.Select(n => n.Value))}").ToList())}");
                }
                else
                {
                    MessageBox.Show(a.Msg);
                    return;
                }
            }
        }