Before Width: | Height: | Size: 20 KiB |
|
@ -56,7 +56,7 @@ public partial class SCADAService : Node,IProvider<string>,IActivable
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(_url))
|
if (string.IsNullOrEmpty(_url))
|
||||||
{
|
{
|
||||||
BIT4Log.Warnning("SCADA Url为空");
|
BIT4Log.Warning("SCADA Url为空");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,6 @@ public partial class BITAppForGodot : Node
|
||||||
BIT4Log.OnWarning += GD.PushWarning;
|
BIT4Log.OnWarning += GD.PushWarning;
|
||||||
BIT4Log.OnNextLine += () => GD.Print();
|
BIT4Log.OnNextLine += () => GD.Print();
|
||||||
BIT4Log.OnException += x=>GD.PrintErr(x.ToString());
|
BIT4Log.OnException += x=>GD.PrintErr(x.ToString());
|
||||||
BIT4Log.UseLogTime();
|
|
||||||
|
|
||||||
//启动BITApp
|
//启动BITApp
|
||||||
BITApp.Start(ProjectSettings.GetSetting("application/config/name").AsString());
|
BITApp.Start(ProjectSettings.GetSetting("application/config/name").AsString());
|
||||||
|
|
|
@ -17,7 +17,7 @@ public partial class Exec : Node
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BIT4Log.Warnning<Exec>($"未加载:{path}");
|
BIT4Log.Warning<Exec>($"未加载:{path}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,8 @@ public partial class GodotEntitiesService : Node,IEntitiesService
|
||||||
}
|
}
|
||||||
private readonly Dictionary<ulong,IEntity> _entities=new ();
|
private readonly Dictionary<ulong,IEntity> _entities=new ();
|
||||||
private CancellationTokenSource _cancellationTokenSource;
|
private CancellationTokenSource _cancellationTokenSource;
|
||||||
|
public event Action<IEntity> OnAdd;
|
||||||
|
public event Action<IEntity> OnRemove;
|
||||||
public IEntity[] Entities => _entities.Values.ToArray();
|
public IEntity[] Entities => _entities.Values.ToArray();
|
||||||
public bool Register(IEntity entity)
|
public bool Register(IEntity entity)
|
||||||
{
|
{
|
||||||
|
@ -40,11 +42,28 @@ public partial class GodotEntitiesService : Node,IEntitiesService
|
||||||
|
|
||||||
public CancellationToken CancellationToken => _cancellationTokenSource.Token;
|
public CancellationToken CancellationToken => _cancellationTokenSource.Token;
|
||||||
|
|
||||||
|
public IEntity Get(ulong id)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public IEntity[] Query<T>() where T : IEntityComponent
|
public IEntity[] Query<T>() where T : IEntityComponent
|
||||||
{
|
{
|
||||||
return _entities.Values.Where(x => x.TryGetComponent<T>(out _)).ToArray();
|
return _entities.Values.Where(x => x.TryGetComponent<T>(out _)).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
T[] IEntitiesService.QueryComponents<T>()
|
||||||
|
{
|
||||||
|
return _entities.Values
|
||||||
|
.Where(x => x.TryGetComponent<T>(out _))
|
||||||
|
.Select(x =>
|
||||||
|
{
|
||||||
|
var component = x.Components.Single(x => x is T);
|
||||||
|
return (T)component;
|
||||||
|
})
|
||||||
|
.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
public ValueTuple<T>[] QueryComponents<T>() where T : IEntityComponent
|
public ValueTuple<T>[] QueryComponents<T>() where T : IEntityComponent
|
||||||
{
|
{
|
||||||
return _entities.Values
|
return _entities.Values
|
||||||
|
@ -59,16 +78,6 @@ public partial class GodotEntitiesService : Node,IEntitiesService
|
||||||
}
|
}
|
||||||
public (T, T1)[] QueryComponents<T, T1>() where T : IEntityComponent where T1 : IEntityComponent
|
public (T, T1)[] QueryComponents<T, T1>() where T : IEntityComponent where T1 : IEntityComponent
|
||||||
{
|
{
|
||||||
// return _entities.Values
|
|
||||||
// .Where(x => x.TryGetComponent<T>(out _) && x.TryGetComponent<T1>(out _))
|
|
||||||
// .Select(x =>
|
|
||||||
// {
|
|
||||||
// var component = (T)x.Components.Single(x => x is T);
|
|
||||||
// var component1 = (T1)x.Components.Single(x => x is T1);
|
|
||||||
// (T, T1) value = new(component, component1);
|
|
||||||
// return value;
|
|
||||||
// })
|
|
||||||
// .ToArray();
|
|
||||||
var entities = _entities.Values.Where(x => x.TryGetComponent<T>(out _) && x.TryGetComponent<T1>(out _));
|
var entities = _entities.Values.Where(x => x.TryGetComponent<T>(out _) && x.TryGetComponent<T1>(out _));
|
||||||
var result = new List<(T, T1)>();
|
var result = new List<(T, T1)>();
|
||||||
foreach (var entity in entities)
|
foreach (var entity in entities)
|
||||||
|
|
|
@ -23,7 +23,7 @@ public static class LabelExtensions
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
BIT4Log.Warnning(path);
|
BIT4Log.Warning(path);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ public partial class HttpGet : Node,IActivable
|
||||||
}
|
}
|
||||||
catch (InvalidOperationException)
|
catch (InvalidOperationException)
|
||||||
{
|
{
|
||||||
BIT4Log.Warnning(url);
|
BIT4Log.Warning(url);
|
||||||
//返回并发数量
|
//返回并发数量
|
||||||
limitConcurrent.Release();
|
limitConcurrent.Release();
|
||||||
}
|
}
|
||||||
|
|
After Width: | Height: | Size: 129 KiB |
After Width: | Height: | Size: 106 KiB |
After Width: | Height: | Size: 916 KiB |
After Width: | Height: | Size: 98 KiB |
After Width: | Height: | Size: 127 KiB |
After Width: | Height: | Size: 816 KiB |
|
@ -1,4 +1,5 @@
|
||||||
# 标识解析演讲稿
|
# 标识解析演讲稿
|
||||||
|

|
||||||
## 故事线
|
## 故事线
|
||||||
在生产过程中会产生很多的标识数据,
|
在生产过程中会产生很多的标识数据,
|
||||||
|
|
||||||
|
@ -24,6 +25,7 @@
|
||||||
当然了,在注册温湿度传感器前,我们需要先创建一个温湿度传感器设备标识模板.才能对温湿度传感器进行标识注册
|
当然了,在注册温湿度传感器前,我们需要先创建一个温湿度传感器设备标识模板.才能对温湿度传感器进行标识注册
|
||||||
## 执行步骤
|
## 执行步骤
|
||||||
### 注册温湿度传感器标识
|
### 注册温湿度传感器标识
|
||||||
|

|
||||||
* 点击侧边栏的`创建标识模板`
|
* 点击侧边栏的`创建标识模板`
|
||||||
* 点击`创建模板`
|
* 点击`创建模板`
|
||||||
* 输入模板名称,例如:`温湿度传感器模板`,然后点击右侧的`保存`按钮
|
* 输入模板名称,例如:`温湿度传感器模板`,然后点击右侧的`保存`按钮
|
||||||
|
@ -38,20 +40,23 @@
|
||||||
* 点击`保存`按钮
|
* 点击`保存`按钮
|
||||||
> 很好,现在已经创建了温湿度传感器标识模板
|
> 很好,现在已经创建了温湿度传感器标识模板
|
||||||
### 接下来,我们将基于刚刚创建的标识模板,为温湿度传感器进行标识注册
|
### 接下来,我们将基于刚刚创建的标识模板,为温湿度传感器进行标识注册
|
||||||
|

|
||||||
* 点击侧边栏的`标识注册`
|
* 点击侧边栏的`标识注册`
|
||||||
* 点击`刷新`按钮
|
* 点击`刷新`按钮
|
||||||
* 点击已创建的`温湿度传感器模板`
|
* 点击已创建的`温湿度传感器模板`
|
||||||
* 在标识中添加温湿度记录的标识,例如:`8.123.99/th.sensor`
|
* 在`标识码`中填写:`8.123.99/th.sensor`
|
||||||
* 根据已定义的表单,填写需要的信息
|
* 根据已定义的表单,填写需要的信息
|
||||||
> 当然了,温湿度传感器的温度和湿度不需要填写,因为是基于设备自动注册的
|
> 当然了,温湿度传感器的温度和湿度不需要填写,因为是基于设备自动注册的
|
||||||
* 点击`注册`按钮
|
* 点击`注册`按钮
|
||||||
> 很好,我们已经完成了温湿度传感器的标识注册,接下来我们将进行数据采集与标识更新
|
> 很好,我们已经完成了温湿度传感器的标识注册,接下来我们将进行数据采集与标识更新
|
||||||
### 现在,我们要开始通过Modbus连接到温湿度传感器
|
### 现在,我们要开始通过Modbus连接到温湿度传感器
|
||||||
|

|
||||||
* 点击侧边栏的`温湿度传感器`
|
* 点击侧边栏的`温湿度传感器`
|
||||||
* 在`标识码`位置,输入注册的标识码,例如:`8.123.99/th.sensor`
|
* 在`标识码`位置,输入注册的标识码,例如:`8.123.99/th.sensor`
|
||||||
* 默认的ip和端口绑定为`192.168.3.7:502`,我们需要根据情况填写正确的ip和端口
|
* 默认的ip和端口绑定为`192.168.3.7:502`,我们需要根据情况填写正确的ip和端口
|
||||||
* 点击`连接`按钮
|
* 点击`连接`按钮
|
||||||
### 很好,我们已经成功连接到了温湿度传感器,接下来我们将进行数据采集
|
### 很好,我们已经成功连接到了温湿度传感器,接下来我们将进行数据采集
|
||||||
|

|
||||||
我们现在有两个选项:
|
我们现在有两个选项:
|
||||||
* 自动采集
|
* 自动采集
|
||||||
* 勾选`自动更新`即可
|
* 勾选`自动更新`即可
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="README.md" />
|
<Content Include="README.md" />
|
||||||
|
<Content Include="ReadMe\工业互联网标识解析与注册\img.png" />
|
||||||
<Content Include="ReadMe\工业互联网标识解析与注册\标识解析.md" />
|
<Content Include="ReadMe\工业互联网标识解析与注册\标识解析.md" />
|
||||||
<Content Include="ReadMe\工业互联网标识解析与注册\_Deprecated\Clip_20230629_005537.png" />
|
<Content Include="ReadMe\工业互联网标识解析与注册\_Deprecated\Clip_20230629_005537.png" />
|
||||||
<Content Include="ReadMe\工业互联网标识解析与注册\_Deprecated\Clip_20230629_005537.png.import" />
|
<Content Include="ReadMe\工业互联网标识解析与注册\_Deprecated\Clip_20230629_005537.png.import" />
|
||||||
|
|