Skip to content

Commit

Permalink
Add GS_INVERSE subtype (savushkin-r-d#1216)
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillGutyrchik authored Oct 3, 2023
1 parent fef708d commit ca95552
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 4 deletions.
19 changes: 18 additions & 1 deletion EasyEplanner.Tests/EplanDevice.Test/IODevice.Test/GS.Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class GSTest
const string Incorrect = "Incorrect";
const string GS = "GS";
const string GS_VIRT = "GS_VIRT";
const string GS_INVERSE = "GS_INVERSE";

const string AI = IODevice.IOChannel.AI;
const string AO = IODevice.IOChannel.AO;
Expand Down Expand Up @@ -46,6 +47,7 @@ private static object[] GetDeviceSubTypeStrTestData()
new object[] { string.Empty, Incorrect, GetRandomGSDevice() },
new object[] { GS, GS, GetRandomGSDevice() },
new object[] { GS_VIRT, GS_VIRT, GetRandomGSDevice() },
new object[] { GS_INVERSE, GS_INVERSE, GetRandomGSDevice() },
};
}

Expand Down Expand Up @@ -82,6 +84,8 @@ private static object[] SetSubTypeTestData()
GetRandomGSDevice() },
new object[] { DeviceSubType.GS_VIRT, GS_VIRT,
GetRandomGSDevice() },
new object[] { DeviceSubType.GS_INVERSE, GS_INVERSE,
GetRandomGSDevice() },
};
}

Expand Down Expand Up @@ -128,6 +132,7 @@ private static object[] GetDevicePropertiesTestData()
new object[] {exportForGS, GS, GetRandomGSDevice()},
new object[] {null, Incorrect, GetRandomGSDevice()},
new object[] {exportForGSVirt, GS_VIRT, GetRandomGSDevice()},
new object[] {exportForGS, GS_INVERSE, GetRandomGSDevice()},
};
}

Expand Down Expand Up @@ -188,6 +193,12 @@ private static object[] ParametersTestData()
Incorrect,
GetRandomGSDevice()
},
new object[]
{
defaultParameters,
GS_INVERSE,
GetRandomGSDevice()
},
};
}

Expand Down Expand Up @@ -268,7 +279,13 @@ private static object[] ChannelsTestData()
emptyChannels,
GS_VIRT,
GetRandomGSDevice()
}
},
new object[]
{
discreteSensorChannels,
GS_INVERSE,
GetRandomGSDevice()
},
};
}

Expand Down
4 changes: 3 additions & 1 deletion docs/user_manual/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ Phoenix Contact | AXC F 3152

#### 6.2.5 GS. Датчик положения ####
Обозначение: **GS**.
Подтипы: **GS**, **GS_INVERSE**.
Каналы ввода/вывода: **DI***1*.
Пример: **+OBJ2-GS1**. Объект №2. Датчик люка.

Expand Down Expand Up @@ -866,6 +867,7 @@ FS | Датчик наличия потока.
FS_VIRT | Виртуальный датчик наличия потока.
GS | Датчик положения.
GS_VIRT | Виртуальный датчик положения.
GS_INVERSE | Датчик положения инверсный (0 - активное значение).
HA | Сирена.
HA_VIRT | Виртуальная сирена.
HL | Сигнальная лампа.
Expand Down Expand Up @@ -1796,7 +1798,7 @@ _Примечание:_ для корректного экспорта базы
* M - ручной режим;
* V - аналоговое значение;
6. Устройство - **GS**
* **GS**
* **GS**, **GS_INVERSE**
* ST - состояние;
* M - ручной режим;
* P_DT - дельта;
Expand Down
8 changes: 6 additions & 2 deletions src/Device/DeviceSubTypeEnum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,12 @@ public enum DeviceSubType
HLA_IOLINK, ///< Сигнальная колонна IO-Link (настраиваемая)

//GS
GS = 1, ///< Датчик положения.
GS_VIRT, ///< Виртуальный датчик положения (без привязки к модулям).
/// <summary> Датчик положения. </summary>
GS = 1,
/// <summary> Виртуальный датчик положения (без привязки к модулям). </summary>
GS_VIRT,
/// <summary> Датчик положения инверсный (0 - активное значение). </summary>
GS_INVERSE,

//HA
HA = 1, ///< Сирена.
Expand Down
11 changes: 11 additions & 0 deletions src/Device/IODevices/GS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ public override string SetSubType(string subType)
DI.Add(new IOChannel("DI", -1, -1, -1, ""));
break;

case "GS_INVERSE":
parameters.Add(Parameter.P_DT, null);

dSubType = DeviceSubType.GS_INVERSE;

DI.Add(new IOChannel("DI", -1, -1, -1, ""));
break;

case "GS_VIRT":
break;

Expand Down Expand Up @@ -72,6 +80,8 @@ public override string GetDeviceSubTypeStr(DeviceType dt,
return "GS";
case DeviceSubType.GS_VIRT:
return "GS_VIRT";
case DeviceSubType.GS_INVERSE:
return nameof(DeviceSubType.GS_INVERSE);
}
break;
}
Expand All @@ -87,6 +97,7 @@ public override Dictionary<string, int> GetDeviceProperties(
case DeviceType.GS:
switch (dst)
{
case DeviceSubType.GS_INVERSE:
case DeviceSubType.GS:
return new Dictionary<string, int>()
{
Expand Down

0 comments on commit ca95552

Please sign in to comment.