work
This commit is contained in:
parent
a2fef8a2a4
commit
066c0187f2
Binary file not shown.
@ -5,11 +5,13 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text.RegularExpressions;
|
||||
using NLog;
|
||||
|
||||
namespace DataClient
|
||||
{
|
||||
public static class ByteConverter
|
||||
{
|
||||
private static Logger log = LogManager.GetCurrentClassLogger();
|
||||
public static TechCycle[] BytesToTechcycles(byte[] arr)
|
||||
{
|
||||
var res = new List<TechCycle>();
|
||||
@ -66,12 +68,51 @@ namespace DataClient
|
||||
}
|
||||
catch { throw; }
|
||||
}
|
||||
public static (DateTime date, byte[] bytes)[] BytesToTimeLine(byte[] arr, DateTime date)
|
||||
public static (DateTime date, byte?[] bytes)[] BytesToTimeLine(byte[] arr, DateTime date)
|
||||
{
|
||||
var res = new List<(DateTime date, byte[] bytes)>();
|
||||
|
||||
|
||||
|
||||
var res = new List<(DateTime date, byte?[] bytes)>();
|
||||
var matrix = new List<byte?>();
|
||||
var currdate = new DateTime(date.Year, date.Month, date.Day, 0, 0, 0);
|
||||
var cursor = 0;
|
||||
var halfseconds = 0;
|
||||
try
|
||||
{
|
||||
while (cursor < arr.Length)
|
||||
{
|
||||
switch (arr[cursor])
|
||||
{
|
||||
case 0xfb:
|
||||
halfseconds = BitConverter.ToInt32(arr, ++cursor);
|
||||
cursor += 4;
|
||||
break;
|
||||
case 0xfc:
|
||||
for (var i = 0; i < matrix.Count; i++) matrix[i] = null;
|
||||
res.Add((currdate.AddSeconds(++halfseconds / 2D), matrix.ToArray()));
|
||||
halfseconds = BitConverter.ToInt32(arr, ++cursor);
|
||||
cursor += 4;
|
||||
break;
|
||||
case 0xfe:
|
||||
halfseconds += BitConverter.ToInt16(arr, ++cursor);
|
||||
cursor += 2;
|
||||
break;
|
||||
case 0xff:
|
||||
res.Add((currdate.AddSeconds(halfseconds / 2D), matrix.ToArray()));
|
||||
cursor++;
|
||||
halfseconds++;
|
||||
break;
|
||||
default:
|
||||
while (matrix.Count < arr[cursor]) matrix.Add(null);
|
||||
matrix[arr[cursor]] = arr[cursor + 1];
|
||||
cursor += 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
log.Warn(e, "Error in structure AD file.");
|
||||
return res.ToArray();
|
||||
}
|
||||
return res.ToArray();
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,368 @@
|
||||
[
|
||||
{
|
||||
"deleteAll": true,
|
||||
"delete": [],
|
||||
"add": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "Test",
|
||||
"short_name": "Test",
|
||||
"measure": "kg",
|
||||
"precision": 1,
|
||||
"min": -100,
|
||||
"max": 100,
|
||||
"default": 0,
|
||||
"logarithm": false
|
||||
"name": "Ток дуги",
|
||||
"sname": "I д",
|
||||
"measure": "кА",
|
||||
"mul": 0.1,
|
||||
"byteId": [ 0, 1 ]
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Напряжение дуги",
|
||||
"sname": "U д",
|
||||
"measure": "В",
|
||||
"mul": 0.1,
|
||||
"byteId": [ 2, 3 ]
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "Ток рабочего двигателя",
|
||||
"sname": "I рд",
|
||||
"measure": "А",
|
||||
"mul": 0.1,
|
||||
"byteId": [4,5]
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"name": "U рабочего двигателя",
|
||||
"sname": "U рд",
|
||||
"measure": "В",
|
||||
"mul": 0.1,
|
||||
"byteId": [6,7]
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"name": "Ток соленоида",
|
||||
"sname": "I сол",
|
||||
"measure": "А",
|
||||
"mul": 0.1,
|
||||
"byteId": [8,9]
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"name": "U соленоида",
|
||||
"sname": "U сол",
|
||||
"measure": "В",
|
||||
"mul": 0.1,
|
||||
"byteId": [10,11]
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"name": "Ток задания",
|
||||
"sname": "I рз",
|
||||
"measure": "кА",
|
||||
"mul": 0.1,
|
||||
"byteId": [12,13]
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"name": "t кристаллизатора на входе",
|
||||
"sname": "t кр.вых",
|
||||
"measure": "гр.С",
|
||||
"byteId": [14,15]
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"name": "t кристаллизатора на выходе",
|
||||
"sname": "t кр.вх",
|
||||
"measure": "гр.С",
|
||||
"byteId": [16,17]
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"name": "t вакуум-камеры",
|
||||
"sname": "t вак-кам",
|
||||
"measure": "гр.С",
|
||||
"byteId": [18,19]
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"name": "t штока",
|
||||
"sname": "t шт",
|
||||
"measure": "гр.С",
|
||||
"byteId": [20,21]
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"name": "Перемещение 0.1",
|
||||
"sname": "S шт",
|
||||
"measure": "мм",
|
||||
"mul": 0.1,
|
||||
"byteId": [22,23]
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"name": "Перемещение",
|
||||
"sname": "S шт",
|
||||
"measure": "мм",
|
||||
"byteId": [24,25]
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"name": "Остаточное давление",
|
||||
"measure": "мкм.рт.ст",
|
||||
"mul": -1,
|
||||
"byteId": [26,27]
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"name": "Изоляция шток-крышка",
|
||||
"sname": "R шт-кр",
|
||||
"measure": "В",
|
||||
"mul": 0.1,
|
||||
"byteId": [28,29]
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"name": "Изоляция крышка-камера",
|
||||
"sname": "R кр-кам",
|
||||
"measure": "В",
|
||||
"mul": 0.1,
|
||||
"byteId": [30,31]
|
||||
},
|
||||
{
|
||||
"id": 16,
|
||||
"name": "Расход воды",
|
||||
"sname": "Q в.кр",
|
||||
"measure": "м^3/ч",
|
||||
"byteId": [ 32, 33 ]
|
||||
},
|
||||
{
|
||||
"id": 17,
|
||||
"name": "Капельные замыкания",
|
||||
"sname": "Кап.зам.",
|
||||
"mul": 0.01,
|
||||
"byteId": [34,35]
|
||||
},
|
||||
{
|
||||
"id": 18,
|
||||
"name": "Усреднённая ширина импульсов КЗ",
|
||||
"sname": "Кап.зым.",
|
||||
"mul": 0.1,
|
||||
"byteId": [36,37]
|
||||
},
|
||||
{
|
||||
"id": 19,
|
||||
"name": "Проток воды фланца",
|
||||
"sname": "Qв. фл.",
|
||||
"measure": "м^3/ч",
|
||||
"mul": 0.01,
|
||||
"byteId": [38,39]
|
||||
},
|
||||
{
|
||||
"id": 20,
|
||||
"name": "Проток воды штока",
|
||||
"sname": "Qв. шт.",
|
||||
"measure": "м^3/ч",
|
||||
"mul": 0.01,
|
||||
"byteId": [40,41]
|
||||
},
|
||||
{
|
||||
"id": 21,
|
||||
"name": "Давление воды крист.+1,5",
|
||||
"sname": "P в.кр",
|
||||
"measure": "кгс/см^2",
|
||||
"mul": 0.01,
|
||||
"byteId": [42,43]
|
||||
},
|
||||
{
|
||||
"id": 22,
|
||||
"name": "Проток воды камеры",
|
||||
"sname": "Qв. кам.",
|
||||
"measure": "м^3/ч",
|
||||
"mul": 0.01,
|
||||
"byteId": [44,45]
|
||||
},
|
||||
{
|
||||
"id": 23,
|
||||
"name": "Ток задания источника(САУ)",
|
||||
"sname": "I з.ист САУ",
|
||||
"measure": "кА",
|
||||
"mul": 0.1,
|
||||
"byteId": [58,59]
|
||||
},
|
||||
{
|
||||
"id": 25,
|
||||
"name": "ПИД-рег. основная уставка",
|
||||
"sname": "ПИД-осн",
|
||||
"measure": "В",
|
||||
"mul": 0.1,
|
||||
"byteId": [62,63]
|
||||
},
|
||||
{
|
||||
"id": 26,
|
||||
"name": "ПИД-рег. макс. скорость",
|
||||
"sname": "ПИД-макс",
|
||||
"measure": "В",
|
||||
"mul": 0.1,
|
||||
"byteId": [64,65]
|
||||
},
|
||||
{
|
||||
"id": 27,
|
||||
"name": "t фланца вакуум-камеры",
|
||||
"sname": "t фл.",
|
||||
"measure": "гр.С",
|
||||
"byteId": [66,67]
|
||||
},
|
||||
{
|
||||
"id": 28,
|
||||
"name": "t подставки",
|
||||
"sname": "t под.",
|
||||
"measure": "гр.С",
|
||||
"byteId": [68,69]
|
||||
},
|
||||
{
|
||||
"id": 29,
|
||||
"name": "Проток воды подставки",
|
||||
"sname": "Qв. под.",
|
||||
"measure": "м^3/ч",
|
||||
"mul": 0.01,
|
||||
"byteId": [70,71]
|
||||
},
|
||||
{
|
||||
"id": 30,
|
||||
"name": "Задание соленоида",
|
||||
"sname": "Зад. сол.",
|
||||
"measure": "А",
|
||||
"mul": 0.1,
|
||||
"byteId": [72,73]
|
||||
},
|
||||
{
|
||||
"id": 31,
|
||||
"name": "Ток задания источника(преобраз.)",
|
||||
"sname": "I з.ист. преоб.",
|
||||
"measure": "кА",
|
||||
"mul": 0.1,
|
||||
"byteId": [74,75]
|
||||
},
|
||||
{
|
||||
"id": 33,
|
||||
"name": "Вакуум по МЕТРАН-1200",
|
||||
"sname": "МЕТРАН-1200",
|
||||
"measure": "мм.рт.ст",
|
||||
"mul": 0.1,
|
||||
"byteId": [78,79]
|
||||
},
|
||||
{
|
||||
"id": 34,
|
||||
"name": "Вакуум по МЕТРАН-18,75",
|
||||
"sname": "МЕТРАН-18,25",
|
||||
"measure": "мм.рт.ст",
|
||||
"mul": 0.001,
|
||||
"byteId": [80,81]
|
||||
},
|
||||
{
|
||||
"id": 35,
|
||||
"name": "Давление газа в баллоне",
|
||||
"sname": "P г.балл.",
|
||||
"measure": "кгс/см^2",
|
||||
"mul": 0.1,
|
||||
"byteId": [82,83]
|
||||
},
|
||||
{
|
||||
"id": 36,
|
||||
"name": "Давление воды поддона",
|
||||
"sname": "P в.подд.",
|
||||
"measure": "кгс/см^2",
|
||||
"byteId": [84,85]
|
||||
},
|
||||
{
|
||||
"id": 37,
|
||||
"name": "Задание тока дуги (ЦАП)",
|
||||
"sname": "Зад.I, ЦАП",
|
||||
"measure": "кА",
|
||||
"mul": 0.1,
|
||||
"byteId": [86,87]
|
||||
},
|
||||
{
|
||||
"id": 38,
|
||||
"name": "Задание скорости рабочего двигателя",
|
||||
"sname": "Зад.ск.раб.дв",
|
||||
"measure": "В",
|
||||
"mul": 0.01,
|
||||
"byteId": [88,89]
|
||||
},
|
||||
{
|
||||
"id": 39,
|
||||
"name": "Ток двигателя насоса ARPW",
|
||||
"sname": "I дв. ARPW",
|
||||
"measure": "А",
|
||||
"mul": 0.01,
|
||||
"byteId": [90,91]
|
||||
},
|
||||
{
|
||||
"id": 40,
|
||||
"name": "Энергия плавильного пролёта",
|
||||
"sname": "Эн.пролёта, МВт",
|
||||
"measure": "МВт",
|
||||
"mul": 0.1,
|
||||
"byteId": []
|
||||
},
|
||||
{
|
||||
"id": 41,
|
||||
"name": "Среднее напряжение плавл. за 1 мин.",
|
||||
"sname": "U ср. 1мин, В",
|
||||
"measure": "В",
|
||||
"mul": 0.1,
|
||||
"byteId": [92,93]
|
||||
},
|
||||
{
|
||||
"id": 42,
|
||||
"name": "ГМП: ток катушки 1",
|
||||
"sname": "I кат1 ГМП",
|
||||
"measure": "А",
|
||||
"byteId": [94,95]
|
||||
},
|
||||
{
|
||||
"id": 43,
|
||||
"name": "ГМП: ток катушки 2",
|
||||
"sname": "I кат2 ГМП",
|
||||
"measure": "А",
|
||||
"byteId": [96,97]
|
||||
},
|
||||
{
|
||||
"id": 44,
|
||||
"name": "ГМП: ток катушки 3",
|
||||
"sname": "I кат3 ГМП",
|
||||
"measure": "А",
|
||||
"byteId": [98,99]
|
||||
},
|
||||
{
|
||||
"id": 45,
|
||||
"name": "ГМП: частота",
|
||||
"sname": "Част. ГМП",
|
||||
"measure": "Гц",
|
||||
"mul": 0.1,
|
||||
"byteId": [100,101]
|
||||
},
|
||||
{
|
||||
"id": 46,
|
||||
"name": "ПИД: коэффицинт Кp",
|
||||
"mul": 0.01,
|
||||
"byteId": [102,103]
|
||||
},
|
||||
{
|
||||
"id": 47,
|
||||
"name": "ПИД: коэффицинт Кi",
|
||||
"mul": 0.01,
|
||||
"byteId": [104,105]
|
||||
},
|
||||
{
|
||||
"id": 49,
|
||||
"name": "Количество точек усреднения",
|
||||
"byteId": [106,107]
|
||||
},
|
||||
{
|
||||
"id": 50,
|
||||
"name": "Пороговое U ДКЗ",
|
||||
"measure": "В",
|
||||
"mul": 0.1,
|
||||
"byteId": [108,109]
|
||||
}
|
||||
]
|
||||
|
||||
]
|
||||
}
|
||||
|
19
DataClient/Config/analog/default.json.bak
Normal file
19
DataClient/Config/analog/default.json.bak
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"deleteAll": true,
|
||||
"delete": [],
|
||||
"add": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "Test",
|
||||
"sname": "Test",
|
||||
"measure": "kg",
|
||||
"mul": 1,
|
||||
"min": -100,
|
||||
"max": 100,
|
||||
"zero": 0,
|
||||
"logarithm": false,
|
||||
"byteId": [ 1, 12, 3 ]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
89
DataClient/Configuration.cs
Normal file
89
DataClient/Configuration.cs
Normal file
@ -0,0 +1,89 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DataClient.Struct;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NLog;
|
||||
|
||||
namespace DataClient
|
||||
{
|
||||
public static class Configuration
|
||||
{
|
||||
private static Logger log = LogManager.GetCurrentClassLogger();
|
||||
public static Dictionary<int,ConfAnalog[]> InitAnalogList(string confDir, int[] listVdp)
|
||||
{
|
||||
var res = new Dictionary<int, ConfAnalog[]>();
|
||||
string jsonString;
|
||||
var confFile = Path.Combine(confDir, "default.json");
|
||||
try { jsonString = File.ReadAllText(confFile); }
|
||||
catch (Exception e) { log.Error(e, "Can't read config file from " + confDir + "."); throw; }
|
||||
var subres = InitAnalogVdp(confDir);
|
||||
foreach(var vdp in listVdp)
|
||||
{
|
||||
if (res.ContainsKey(vdp)) continue;
|
||||
var tmp = InitAnalogVdp(confDir, vdp, subres);
|
||||
res.Add(vdp, tmp);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public static ConfAnalog[] InitAnalogVdp(string confDir, int vdp = -1, ConfAnalog[] analogs = null)
|
||||
{
|
||||
if (analogs == null) analogs = Array.Empty<ConfAnalog>();
|
||||
var res = new List<ConfAnalog>(analogs);
|
||||
var searchPattern = vdp == -1 ? "*default.json" : "*" + vdp.ToString() + "*.json";
|
||||
var files = Directory.GetFiles(confDir, searchPattern);
|
||||
foreach (var file in files)
|
||||
{
|
||||
//check file
|
||||
if (vdp != -1)
|
||||
if (!int.TryParse(Path.GetFileNameWithoutExtension(file), out int fVdp) || fVdp != vdp)
|
||||
continue;
|
||||
//check JSON
|
||||
string jsonString;
|
||||
try { jsonString = File.ReadAllText(file); }
|
||||
catch (Exception e) { log.Warn(e, "Can't read config file from " + confDir + "."); continue; }
|
||||
//try json
|
||||
var conf = (JObject)JsonConvert.DeserializeObject(jsonString);
|
||||
if (!conf.HasValues) { continue; };
|
||||
//check deleteAll
|
||||
if (conf["deleteAll"].Type == JTokenType.Boolean && (bool)conf["deleteAll"])
|
||||
res.Clear();
|
||||
//check deleteIdAnalog
|
||||
if (conf["delete"].Type == JTokenType.Array)
|
||||
foreach (var idAnalog in conf["delete"])
|
||||
if (idAnalog.Type == JTokenType.Integer)
|
||||
res.RemoveAll(x => x.id == (int)idAnalog);
|
||||
//check add
|
||||
if (conf["add"].Type == JTokenType.Array)
|
||||
foreach (var a in conf["add"])
|
||||
{
|
||||
var ca = new ConfAnalog();
|
||||
if (a["id"].Type != JTokenType.Integer || (int)a["id"] < 0) continue;
|
||||
else ca.id = (int)a["id"];
|
||||
if (a["name"].Type == JTokenType.String) ca.name = (string)a["name"];
|
||||
if (a["sname"].Type == JTokenType.String) ca.sname = (string)a["sname"];
|
||||
else ca.sname = ca.name;
|
||||
if (a["measure"].Type == JTokenType.String) ca.measure = (string)a["measure"];
|
||||
if (a["mul"].Type == JTokenType.Integer || a["mul"].Type == JTokenType.Float) ca.mul = (float)a["mul"];
|
||||
if (a["min"].Type == JTokenType.Integer || a["min"].Type == JTokenType.Float) ca.min = (float)a["min"];
|
||||
if (a["max"].Type == JTokenType.Integer || a["max"].Type == JTokenType.Float) ca.max = (float)a["max"];
|
||||
if (a["zero"].Type == JTokenType.Integer || a["zero"].Type == JTokenType.Float) ca.zero = (float)a["zero"];
|
||||
if (a["logarithm"].Type == JTokenType.Boolean) ca.logarithm = (bool)a["logarithm"];
|
||||
var bi = new List<int>();
|
||||
if (a["byteId"].Type == JTokenType.Array)
|
||||
foreach (var b in a["byteId"])
|
||||
if (b.Type == JTokenType.Integer)
|
||||
bi.Add((int)b);
|
||||
ca.byteId = bi.ToArray();
|
||||
res.RemoveAll(x => x.id == ca.id);
|
||||
res.Add(ca);
|
||||
}
|
||||
}
|
||||
return res.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
@ -18,6 +18,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Config\analog\default.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Config\config.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
@ -6,6 +6,7 @@ using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using DataClient.Struct;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataClient
|
||||
{
|
||||
@ -16,8 +17,10 @@ namespace DataClient
|
||||
{
|
||||
//Переменные
|
||||
Logger log = LogManager.GetCurrentClassLogger();
|
||||
string confDir = Path.Combine(Directory.GetCurrentDirectory(), "Config", "config.json");
|
||||
string confDir = Path.Combine(Directory.GetCurrentDirectory(), "Config");
|
||||
private List<server> servers = new List<server>();
|
||||
private Dictionary<int,ConfAnalog[]> confAnalog = new Dictionary<int, ConfAnalog[]>();
|
||||
private List<(int num, string name)> vdpList = new List<(int num, string name)>();
|
||||
int serverDefault = -1;
|
||||
//Геттеры и сеттеры
|
||||
/// <summary>Номер сервера, используемого по умолчанию.</summary>
|
||||
@ -181,9 +184,10 @@ namespace DataClient
|
||||
private void Config()
|
||||
{
|
||||
string jsonString;
|
||||
var confFile = Path.Combine(confDir, "config.json");
|
||||
try
|
||||
{
|
||||
jsonString = File.ReadAllText(confDir);
|
||||
jsonString = File.ReadAllText(confFile);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -212,6 +216,15 @@ namespace DataClient
|
||||
if (!res)
|
||||
log.Trace("Can't add or change server #" + count + " from conf file.");
|
||||
}
|
||||
//init vdp
|
||||
for (var i = 0; i < 49; i++)
|
||||
vdpList.Add(new (i, i == 0 ? "Общие" : "Печь " + i.ToString("D2")));
|
||||
for (var i = 91; i < 95; i++)
|
||||
vdpList.Add((i, "Печь " + i.ToString("D2")));
|
||||
//init analog
|
||||
var tmpvdp = new List<int>();
|
||||
foreach (var v in vdpList) tmpvdp.Add(v.num);
|
||||
confAnalog = Configuration.InitAnalogList(Path.Combine(confDir, "analog"), tmpvdp.ToArray());
|
||||
}
|
||||
/// <summary>Создание экземпляра класса.</summary>
|
||||
public STPClient()
|
||||
@ -228,12 +241,42 @@ namespace DataClient
|
||||
Config();
|
||||
}
|
||||
|
||||
public TechCycle[] GetTechCycle(int vdp, DateTime tS, DateTime tE)
|
||||
public TechCycle[] GetTechCycles(int vdp, DateTime tS, DateTime tE)
|
||||
{
|
||||
//Use File with ID = 3
|
||||
var res = new List<TechCycle>();
|
||||
return res.ToArray();
|
||||
}
|
||||
public Analog[] GetAnalogs(int vdp, DateTime tS, DateTime tE)
|
||||
{
|
||||
var res = new List<Analog>();
|
||||
var net = new NETClient(servers[serverDefault].ip, servers[serverDefault].port);
|
||||
if (!net.Connect()) return Array.Empty<Analog>();
|
||||
var s1 = new List<Task<byte[]>>();
|
||||
for (var d = new DateTime(tS.Year, tS.Month, tS.Day); d.Year <= tE.Year && d.Month <= tE.Month && d.Day <= tE.Day; d = d.AddDays(1))
|
||||
{
|
||||
var t = new Task<byte[]>(() => net.Full_Download(d, vdp, 01));
|
||||
t.Start();
|
||||
s1.Add(t);
|
||||
}
|
||||
var s2 = new List<Task<Analog[]>>();
|
||||
while(s1.Count > 0)
|
||||
{
|
||||
for(var i = 0; i < s1.Count; i++)
|
||||
if (s1[i].IsCompleted)
|
||||
{
|
||||
var t = new Task<Analog[]>( () => {
|
||||
if (!s1[i].IsCompletedSuccessfully)
|
||||
return new Analog[0];
|
||||
return s1[i].Result
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return res.ToArray();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -6,23 +6,22 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace DataClient.Struct
|
||||
{
|
||||
public class ConfAnalog
|
||||
{
|
||||
public int id = 0;
|
||||
public string name = null;
|
||||
public string sname = null;
|
||||
public string measure = null;
|
||||
public double min = double.MinValue;
|
||||
public double max = double.MaxValue;
|
||||
public double norm = 0;
|
||||
public int precision = 0;
|
||||
public double mul = 1;
|
||||
public bool log = false;
|
||||
public int[] byteId = Array.Empty<int>();
|
||||
}
|
||||
public class Analog
|
||||
{
|
||||
public double? value = null;
|
||||
public DateTime date = DateTime.Now;
|
||||
}
|
||||
public class ConfAnalog
|
||||
{
|
||||
public int id = -1;
|
||||
public string name = null;
|
||||
public string sname = null;
|
||||
public string measure = null;
|
||||
public double min = double.MinValue;
|
||||
public double max = double.MaxValue;
|
||||
public double zero = 0;
|
||||
public double mul = 1;
|
||||
public bool logarithm = false;
|
||||
public int[] byteId = Array.Empty<int>();
|
||||
}
|
||||
}
|
||||
|
13
DataClient/StructConverter.cs
Normal file
13
DataClient/StructConverter.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataClient
|
||||
{
|
||||
static class StructConverter
|
||||
{
|
||||
Analog[]
|
||||
}
|
||||
}
|
18
DataClient/bin/Debug/net5.0/Config/analog/default.json
Normal file
18
DataClient/bin/Debug/net5.0/Config/analog/default.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"deleteAll": true,
|
||||
"delete": [],
|
||||
"add": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "Test",
|
||||
"short_name": "Test",
|
||||
"measure": "kg",
|
||||
"mul": 1,
|
||||
"min": -100,
|
||||
"max": 100,
|
||||
"zero": 0,
|
||||
"logarithm": false,
|
||||
"byteId": [ 1, 12, 3 ]
|
||||
}
|
||||
]
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
||||
e010c6259d9b17fd3c989d08c8f3519898d03bc0
|
||||
a35e80ad0f3cac2804cec2e84481a2b816e18b57
|
||||
|
@ -12,3 +12,4 @@ D:\GIT\ASCKU_PC\DataClient\obj\Debug\net5.0\ref\DataClient.dll
|
||||
D:\GIT\ASCKU_PC\DataClient\obj\Debug\net5.0\DataClient.pdb
|
||||
D:\GIT\ASCKU_PC\DataClient\bin\Debug\net5.0\DataClient.xml
|
||||
D:\GIT\ASCKU_PC\DataClient\obj\Debug\net5.0\DataClient.csproj.AssemblyReference.cache
|
||||
D:\GIT\ASCKU_PC\DataClient\bin\Debug\net5.0\Config\analog\default.json
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -22,6 +22,7 @@ namespace Test2
|
||||
//var t = new Task(() => T1());
|
||||
//t.Start();
|
||||
//T1();
|
||||
var str = new STPClient();
|
||||
OLD1();
|
||||
Console.WriteLine("End acc.");
|
||||
Console.ReadKey();
|
||||
|
18
Test2/bin/Debug/net5.0/Config/analog/default.json
Normal file
18
Test2/bin/Debug/net5.0/Config/analog/default.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"deleteAll": true,
|
||||
"delete": [],
|
||||
"add": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "Test",
|
||||
"short_name": "Test",
|
||||
"measure": "kg",
|
||||
"mul": 1,
|
||||
"min": -100,
|
||||
"max": 100,
|
||||
"zero": 0,
|
||||
"logarithm": false,
|
||||
"byteId": [ 1, 12, 3 ]
|
||||
}
|
||||
]
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -29,3 +29,4 @@ D:\GIT\ASCKU_PC\Test2\bin\Debug\net5.0\DataClient.dll
|
||||
D:\GIT\ASCKU_PC\Test2\bin\Debug\net5.0\DataClient.pdb
|
||||
D:\GIT\ASCKU_PC\Test2\bin\Debug\net5.0\DataClient.xml
|
||||
D:\GIT\ASCKU_PC\Test2\obj\Debug\net5.0\Test2.csproj.AssemblyReference.cache
|
||||
D:\GIT\ASCKU_PC\Test2\bin\Debug\net5.0\Config\analog\default.json
|
||||
|
Binary file not shown.
Binary file not shown.
BIN
~$струкция по формированию и ведению базы данных.doc
Normal file
BIN
~$струкция по формированию и ведению базы данных.doc
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user