Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new device G #1380

Merged
merged 10 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Device/DeviceSubTypeEnum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ public enum DeviceSubType
HLA_VIRT, ///< Виртуальная сигнальная колонна (без привязки к модулям).
HLA_IOLINK, ///< Сигнальная колонна IO-Link (настраиваемая)

//G
G = 1, ///< IO-Link блок питания с автоматическим выключателем.
G_IOL_4, ///< Phoenix Contact 4 канала.
VadimZezyotkoATP marked this conversation as resolved.
Show resolved Hide resolved
G_IOL_8, ///< Phoenix Contact 8 каналов.
G_VIRT, ///< Виртуальный блок питания с автоматическим выключателем (без привязки к модулям).
VadimZezyotkoATP marked this conversation as resolved.
Show resolved Hide resolved

//GS
/// <summary> Датчик положения. </summary>
GS = 1,
Expand Down
1 change: 1 addition & 0 deletions src/Device/DeviceTypeEnum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public enum DeviceType
CAM, ///< Камера.
PDS, ///< Сигнальный датчик перепада давления
TS, ///< Сигнальный датчик температуры
G, ///< Блок питания с автоматическим выключателем.

// Эти устройства всегда в конце т.к их нет в контроллере.
Y, ///< Пневмоостров Festo
Expand Down
131 changes: 131 additions & 0 deletions src/Device/IODevices/G.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
using System.Collections.Generic;

namespace EplanDevice
{
/// <summary>
/// Технологическое устройство - блок питания с автоматическим выключателем.
/// </summary>
sealed public class G : IODevice
{
public G(string name, string eplanName, string description,
int deviceNumber, string objectName, int objectNumber,
string articleName) : base(name, eplanName, description,
deviceNumber, objectName, objectNumber)
{
dSubType = DeviceSubType.NONE;
dType = DeviceType.G;
ArticleName = articleName;
}

public override string SetSubType(string subtype)
{
base.SetSubType(subtype);

string errStr = string.Empty;
switch (subtype)
{
case "G":
case "":
dSubType = DeviceSubType.G;

AI.Add(new IOChannel("AI", -1, -1, -1, ""));
AO.Add(new IOChannel("AO", -1, -1, -1, ""));

SetIOLinkSizes(ArticleName);
break;

case "G_VIRT":
break;
VadimZezyotkoATP marked this conversation as resolved.
Show resolved Hide resolved

default:
errStr = string.Format("\"{0}\" - неверный тип" +
" (пустая строка, G, G_VIRT).\n",
Name);
break;
}

return errStr;
}

public override string Check()
{
string res = base.Check();

bool emptyArticle = ArticleName == string.Empty;
bool needCheckArticle = DeviceSubType != DeviceSubType.G_VIRT;
VadimZezyotkoATP marked this conversation as resolved.
Show resolved Hide resolved
if (needCheckArticle && emptyArticle)
{
res += $"\"{name}\" - не задано изделие.\n";
}

return res;
}

public override string GetDeviceSubTypeStr(DeviceType dt,
DeviceSubType dst)
{
switch (dt)
{
case DeviceType.G:
switch (dst)
{
case DeviceSubType.G:
return "G";
case DeviceSubType.G_VIRT:
return "G_VIRT";
}
break;
}

return string.Empty;
}
VadimZezyotkoATP marked this conversation as resolved.
Show resolved Hide resolved

public override Dictionary<string, int> GetDeviceProperties(
DeviceType dt, DeviceSubType dst)
{
switch (dt)
{
case DeviceType.G:
switch (dst)
{
case DeviceSubType.G_IOL_4:
return new Dictionary<string, int>()
{
{Tag.M, 1},
{Tag.V, 1},
{Tag.ST, 1},
{Tag.ERR, 1},
{Tag.ST_CH, 4},
{Tag.NOMINAL_CURRENT_CH, 4},
{Tag.LOAD_CURRENT_CH, 4},
{Tag.ERR_CH, 4},
};

case DeviceSubType.G_IOL_8:
return new Dictionary<string, int>()
{
{Tag.M, 1},
{Tag.V, 1},
{Tag.ST, 1},
{Tag.ERR, 1},
{Tag.ST_CH, 8},
{Tag.NOMINAL_CURRENT_CH, 8},
{Tag.LOAD_CURRENT_CH, 8},
{Tag.ERR_CH, 8},
};

case DeviceSubType.G_VIRT:
return new Dictionary<string, int>()
{
{Tag.M, 1},
{Tag.ST, 1},
{Tag.V, 1},
};
VadimZezyotkoATP marked this conversation as resolved.
Show resolved Hide resolved
}
break;
}

return null;
}
}
}
1 change: 1 addition & 0 deletions src/EasyEPlanner.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
<Compile Include="Device\IIODevice.cs" />
<Compile Include="Device\IOChannel.cs" />
<Compile Include="Device\IODevices\CAM.cs" />
<Compile Include="Device\IODevices\G.cs" />
<Compile Include="Device\IODevices\PDS.cs" />
<Compile Include="Device\IODevices\TS.cs" />
<Compile Include="Device\IOLinkSize.cs" />
Expand Down
Loading