diff --git a/SchematicDrawing/DrawingShape.cs b/SchematicDrawing/DrawingShape.cs
index 81b2e9878..aef66bc4e 100644
--- a/SchematicDrawing/DrawingShape.cs
+++ b/SchematicDrawing/DrawingShape.cs
@@ -581,6 +581,22 @@ namespace SchematicDrawing
Shapes[DrShIx(Shape.UniCB, Sz.M)] = Shapes[DrShIx(Shape.UniCB, Sz.L)];
Shapes[DrShIx(Shape.UniCB, Sz.XL)] = Shapes[DrShIx(Shape.UniCB, Sz.L)];
+ /// Clamping device
+ Shapes[DrShIx(Shape.Clamping, Sz.XL)] = new DrawingShape(Shape.Clamping, Sz.XL, 5, 5, new Node[] { }, null, 0, 0, 50, 50,
+ Properties.Resources.Clamping_XL_on,
+ Properties.Resources.Clamping_XL_off);
+ Shapes[DrShIx(Shape.Clamping, Sz.S)] = Shapes[DrShIx(Shape.Clamping, Sz.XL)];
+ Shapes[DrShIx(Shape.Clamping, Sz.M)] = Shapes[DrShIx(Shape.Clamping, Sz.XL)];
+ Shapes[DrShIx(Shape.Clamping, Sz.L)] = Shapes[DrShIx(Shape.Clamping, Sz.XL)];
+
+ /// Cover device
+ Shapes[DrShIx(Shape.Cover, Sz.XL)] = new DrawingShape(Shape.Cover, Sz.XL, 6, 5, new Node[] { }, null, 0, 0, 60, 50,
+ Properties.Resources.Cover_XL_on,
+ Properties.Resources.Cover_XL_off);
+ Shapes[DrShIx(Shape.Cover, Sz.S)] = Shapes[DrShIx(Shape.Cover, Sz.XL)];
+ Shapes[DrShIx(Shape.Cover, Sz.M)] = Shapes[DrShIx(Shape.Cover, Sz.XL)];
+ Shapes[DrShIx(Shape.Cover, Sz.L)] = Shapes[DrShIx(Shape.Cover, Sz.XL)];
+
/// Emergency stop
Shapes[DrShIx(Shape.EmergencyStop, Sz.XL)] = new DrawingShape(Shape.EmergencyStop, Sz.XL, 5, 5, new Node[] { }, null, 0, 0, 50, 50,
Properties.Resources.EmergencyStop_XL_on,
diff --git a/SchematicDrawing/Enums.cs b/SchematicDrawing/Enums.cs
index 9938bc885..7ad5dc782 100644
--- a/SchematicDrawing/Enums.cs
+++ b/SchematicDrawing/Enums.cs
@@ -29,8 +29,11 @@ namespace SchematicDrawing
public enum Shape
{
Ambient,
+ Clamping,
+ Cover,
Cross,
Div,
+ EmergencyStop,
FlowM,
Junction,
Knee,
@@ -44,11 +47,10 @@ namespace SchematicDrawing
Tank,
Tee,
TempM,
+ UniCB,
Vacuum,
Valve,
WaterM,
- UniCB,
- EmergencyStop,
Count
}
diff --git a/SchematicDrawing/Pictures/Clamping-XL-off.png b/SchematicDrawing/Pictures/Clamping-XL-off.png
new file mode 100644
index 000000000..27635d50b
Binary files /dev/null and b/SchematicDrawing/Pictures/Clamping-XL-off.png differ
diff --git a/SchematicDrawing/Pictures/Clamping-XL-on.png b/SchematicDrawing/Pictures/Clamping-XL-on.png
new file mode 100644
index 000000000..5c46b5dda
Binary files /dev/null and b/SchematicDrawing/Pictures/Clamping-XL-on.png differ
diff --git a/SchematicDrawing/Pictures/Cover-XL-off.png b/SchematicDrawing/Pictures/Cover-XL-off.png
new file mode 100644
index 000000000..6d0245e6a
Binary files /dev/null and b/SchematicDrawing/Pictures/Cover-XL-off.png differ
diff --git a/SchematicDrawing/Pictures/Cover-XL-on.png b/SchematicDrawing/Pictures/Cover-XL-on.png
new file mode 100644
index 000000000..9c0fbb985
Binary files /dev/null and b/SchematicDrawing/Pictures/Cover-XL-on.png differ
diff --git a/SchematicDrawing/Properties/Resources.Designer.cs b/SchematicDrawing/Properties/Resources.Designer.cs
index 92e8e5ef0..fad9b2f68 100644
--- a/SchematicDrawing/Properties/Resources.Designer.cs
+++ b/SchematicDrawing/Properties/Resources.Designer.cs
@@ -60,6 +60,46 @@ namespace SchematicDrawing.Properties {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Clamping_XL_off {
+ get {
+ object obj = ResourceManager.GetObject("Clamping_XL_off", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Clamping_XL_on {
+ get {
+ object obj = ResourceManager.GetObject("Clamping_XL_on", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Cover_XL_off {
+ get {
+ object obj = ResourceManager.GetObject("Cover_XL_off", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Cover_XL_on {
+ get {
+ object obj = ResourceManager.GetObject("Cover_XL_on", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
diff --git a/SchematicDrawing/Properties/Resources.resx b/SchematicDrawing/Properties/Resources.resx
index a87ab6579..2546e19f8 100644
--- a/SchematicDrawing/Properties/Resources.resx
+++ b/SchematicDrawing/Properties/Resources.resx
@@ -382,4 +382,16 @@
..\Pictures\EmergencyStop-XL-on.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Pictures\Clamping-XL-off.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Pictures\Clamping-XL-on.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Pictures\Cover-XL-off.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Pictures\Cover-XL-on.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
diff --git a/SchematicDrawing/SchematicDrawing.csproj b/SchematicDrawing/SchematicDrawing.csproj
index ac24cfe68..de57fbf5f 100644
--- a/SchematicDrawing/SchematicDrawing.csproj
+++ b/SchematicDrawing/SchematicDrawing.csproj
@@ -94,6 +94,10 @@
+
+
+
+
diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs
index f7ab9a3f2..1a2f92849 100644
--- a/TBF/Properties/AssemblyInfo.cs
+++ b/TBF/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
-[assembly: AssemblyVersion("3.1.1856.0")]
-[assembly: AssemblyFileVersion("3.1.1856.0")]
+[assembly: AssemblyVersion("3.1.1857.0")]
+[assembly: AssemblyFileVersion("3.1.1857.0")]
diff --git a/TBF/Resources/Strings.Designer.cs b/TBF/Resources/Strings.Designer.cs
index 29e62b45c..4f7700020 100644
--- a/TBF/Resources/Strings.Designer.cs
+++ b/TBF/Resources/Strings.Designer.cs
@@ -807,6 +807,15 @@ namespace TBF.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Clamping.
+ ///
+ internal static string Clamping {
+ get {
+ return ResourceManager.GetString("Clamping", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Class.
///
@@ -1140,6 +1149,15 @@ namespace TBF.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Cover.
+ ///
+ internal static string Cover {
+ get {
+ return ResourceManager.GetString("Cover", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Create DB.
///
diff --git a/TBF/Resources/Strings.cs.resx b/TBF/Resources/Strings.cs.resx
index 6a0b0a8fc..376d2f97e 100644
--- a/TBF/Resources/Strings.cs.resx
+++ b/TBF/Resources/Strings.cs.resx
@@ -1704,4 +1704,10 @@
Spracování statistik
+
+ Upínač
+
+
+ Kryt
+
\ No newline at end of file
diff --git a/TBF/Resources/Strings.resx b/TBF/Resources/Strings.resx
index abea1244e..1827e1b78 100644
--- a/TBF/Resources/Strings.resx
+++ b/TBF/Resources/Strings.resx
@@ -2359,4 +2359,10 @@
Processing statistics
+
+ Clamping
+
+
+ Cover
+
\ No newline at end of file
diff --git a/TBF/Rig/TbfComponents.cs b/TBF/Rig/TbfComponents.cs
index dcc0c0321..087bce075 100644
--- a/TBF/Rig/TbfComponents.cs
+++ b/TBF/Rig/TbfComponents.cs
@@ -186,6 +186,8 @@ namespace TBF.Rig
Factories.Add(new TestMethods.StandingStartMassCollection.HeatMeters.Factory());
Factories.Add(new BuiltIn.Valve.ValveFactory());
Factories.Add(new BuiltIn.ValveEx.ValveFactory());
+ Factories.Add(new Various.Clamping.Factory());
+ Factories.Add(new Various.CoverTest.Factory());
Factories.Add(new Various.Drawing.Junction.Factory());
Factories.Add(new Various.Drawing.Knee.Factory());
Factories.Add(new Various.Drawing.Pipes.Factory());
diff --git a/TBF/Rig/Various/Clamping/Component.cs b/TBF/Rig/Various/Clamping/Component.cs
new file mode 100644
index 000000000..b63fa1b1d
--- /dev/null
+++ b/TBF/Rig/Various/Clamping/Component.cs
@@ -0,0 +1,27 @@
+///
+/// Copyright (c) 2022 Sensus Slovensko a.s.
+///
+using log4net;
+
+namespace TBF.Rig.Various.Clamping
+{
+ public class Component : ComponentBase, SchematicDrawing.IDrawingItCmpnt
+ {
+ private static readonly ILog log = LogManager.GetLogger(typeof(Component));
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
+
+ readonly Configuration myCfg;
+ public SchematicDrawing.IDrawingItem DrawingItem { get { return myCfg as SchematicDrawing.IDrawingItem; } }
+
+ public Component() { }
+
+ public Component(Generic.IComponentCfg cfg)
+ : base(cfg)
+ {
+ myCfg = cfg as Configuration;
+ log.Warn(this.ToString());
+ }
+
+ public override void Initialize() { }
+ }
+}
diff --git a/TBF/Rig/Various/Clamping/Configuration.cs b/TBF/Rig/Various/Clamping/Configuration.cs
new file mode 100644
index 000000000..d8c35da1d
--- /dev/null
+++ b/TBF/Rig/Various/Clamping/Configuration.cs
@@ -0,0 +1,160 @@
+///
+/// Copyright (c) 2022 Sensus Slovensko a.s.
+///
+using System.Collections.Generic;
+using System.Xml.Serialization;
+using Common;
+using Config.Entities;
+using SchematicDrawing;
+using TBF.Resources;
+using TBF.Rig.Generic;
+
+namespace TBF.Rig.Various.Clamping
+{
+ public class Configuration : ComponentCfgBase, IComponentCfg, IParamsProvider, IRouteBasedDrawingItem
+ {
+ public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(Configuration) })[0];
+ public override XmlSerializer GetSerializer() { return Serializer; }
+
+ public IComponentCfgCtrl GetControl(IList cmpntEntities)
+ {
+ return new Configs.ParamsProvider.ComponentCfgCtrl(this, null);
+ }
+
+ ///
+ /// Serialized parameters
+ ///
+ public int BitNr { get; set; } /// Bit-position
+ public bool Inverted { get; set; } /// When true the valve function is inverted: 0 = open, 1 = closed
+
+ public Shape Shape { get; set; }
+ public int X { get; set; }
+ public int Y { get; set; }
+ public Sz Sz { get; set; }
+ public Orient Orient { get; set; }
+ public bool Flip { get; set; }
+ public int LblX { get; set; }
+ public int LblY { get; set; }
+ public Orient LblOrient { get; set; }
+
+ [XmlIgnore]
+ public IList GNodes { get; set; }
+ [XmlIgnore]
+ public IList EdgesToSet { get; set; }
+
+ public Configuration()
+ {
+ GNodes = new List();
+ EdgesToSet = new List();
+ }
+
+ public Configuration(string name, IComponentFactory factory)
+ : this()
+ {
+ Name = name;
+ ParentName = string.Empty;
+ Factory = factory;
+ Shape = Shape.Clamping;
+ Sz = Sz.XL;
+ LblX = 43;
+ LblY = 22;
+
+ InitializeAll();
+ }
+
+ public string ComponentName { get { return Name; } }
+
+ public void InitializeAll()
+ {
+ BitNr = 97;
+ Inverted = false;
+ }
+
+ string[] paramNames = new string[]
+ {
+ "Bit number",
+ "Inverted",
+ };
+ public string ParamName(int i) { return paramNames[i]; }
+ public int ParamsCount() { return paramNames.Length; }
+
+ public ICollection ParamValues(int i)
+ {
+ switch (i)
+ {
+ default:
+ case 0:
+ return null;
+ case 1:
+ return new string[] { Strings.yes, Strings.no };
+ }
+ }
+
+ public string ToString(int i)
+ {
+ switch (i)
+ {
+ case 0:
+ return BitNr.ToString();
+ case 1:
+ return Inverted ? Strings.yes : Strings.no;
+ default:
+ return string.Format("name={0} x={1} y={2} sz={3} orient={4}", Name, X, Y, Sz, Orient);
+ }
+ }
+
+ public CfgUpdateFlags UpdateParam(int i, string str)
+ {
+ switch (i)
+ {
+ case 0:
+ BitNr = int.Parse(str);
+ return CfgUpdateFlags.RestartRqrd;
+ case 1:
+ Inverted = str == Strings.yes;
+ return CfgUpdateFlags.RestartRqrd;
+ default:
+ return CfgUpdateFlags.None;
+ }
+ }
+
+ public bool ValidateParam(int i, string str, out string message)
+ {
+ message = string.Empty;
+ int idummy;
+ switch (i)
+ {
+ case 0:
+ if (int.TryParse(str, out idummy) && idummy >= 1 && idummy <= 254) return true;
+ break;
+ case 1:
+ if (ParamValues(i).Contains(str)) return true;
+ break;
+ default:
+ message = "Invalid index";
+ return false;
+ }
+
+ message = ParamName(i) + " is invalid";
+ return false;
+ }
+
+ void CopyContentTo(Configuration prms)
+ {
+ prms.BitNr = BitNr;
+ prms.Inverted = Inverted;
+ }
+
+ public IParamsProvider Clone()
+ {
+ Configuration pars = new Configuration();
+ CopyContentTo(pars);
+ return pars;
+ }
+
+ public bool UpdateEmbeddedDbEntity()
+ {
+ return true; /// =OK, do nothing
+ }
+ }
+}
diff --git a/TBF/Rig/Various/Clamping/Factory.cs b/TBF/Rig/Various/Clamping/Factory.cs
new file mode 100644
index 000000000..a630b65b8
--- /dev/null
+++ b/TBF/Rig/Various/Clamping/Factory.cs
@@ -0,0 +1,26 @@
+///
+/// Copyright (c) 2022 Sensus Slovensko a.s.
+///
+using System.Collections.Generic;
+using TBF.Resources;
+using TBF.Rig.Generic;
+
+namespace TBF.Rig.Various.Clamping
+{
+ public class Factory : IComponentFactory
+ {
+ public string ClassName { get { return this.GetType().Namespace.Substring(8); } }
+ public override string ToString() { return ClassName; }
+
+ public IComponent DummyComponent() { return new Component(); }
+
+ public IComponent GetComponent(IComponentCfg cfg, IList components) { return new Component(cfg); }
+
+ public IComponentCfg DefaultConfig() { return new Configuration(Strings.Clamping, this); }
+
+ public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
+ {
+ return ComponentCfgBase.CreateFromDbEntity(Configuration.Serializer, component, this);
+ }
+ }
+}
diff --git a/TBF/Rig/Various/CoverTest/CoverTest.cs b/TBF/Rig/Various/CoverTest/CoverTest.cs
index 82ec55810..5b542ea8a 100644
--- a/TBF/Rig/Various/CoverTest/CoverTest.cs
+++ b/TBF/Rig/Various/CoverTest/CoverTest.cs
@@ -15,15 +15,12 @@ namespace TBF.Rig.Various.CoverTest
{
private static readonly ILog log = LogManager.GetLogger(typeof(CoverTest));
private static readonly ILog bypassLog = LogManager.GetLogger("BypassLog");
-
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
- readonly CoverTestCfg coverTestCfg;
-
- readonly IControlBoard controlBoard;
-
- int bitPosition; /// 0 .. 127
- UInt128 mask; /// derived from bitPosition in the constructor
+ readonly CoverTestCfg myCfg;
+
+ public int BitPosition { get { return myCfg == null ? 0: myCfg.BitNr; } }
+ public UInt128 Mask; /// derived from bitPosition in the constructor
UInt128 target;
string message;
Common.GID[] bypassLevel;
@@ -34,26 +31,22 @@ namespace TBF.Rig.Various.CoverTest
public CoverTest(Generic.IComponentCfg cfg, IList components)
: base(cfg)
{
- coverTestCfg = cfg as CoverTestCfg;
-
- controlBoard = TbfComponents.FindComponent(cfg.ParentName, components) as IControlBoard;
- if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
-
- log.Warn(this.ToString());
+ myCfg = cfg as CoverTestCfg;
}
public override void Initialize()
{
- bitPosition = coverTestCfg.BitNr;
- mask = (((UInt128)1) << coverTestCfg.BitNr);
- target = coverTestCfg.Inverted ? 0 : mask;
- message = coverTestCfg.Message;
+ Mask = (((UInt128)1) << BitPosition);
+ target = myCfg.Inverted ? 0 : Mask;
+ message = myCfg.Message;
var groups = new List();
- if (coverTestCfg.BypassGroup1 != Common.GID.None) groups.Add(coverTestCfg.BypassGroup1);
- if (coverTestCfg.BypassGroup2 != Common.GID.None) groups.Add(coverTestCfg.BypassGroup2);
- if (coverTestCfg.BypassGroup3 != Common.GID.None) groups.Add(coverTestCfg.BypassGroup3);
- if (coverTestCfg.BypassGroup4 != Common.GID.None) groups.Add(coverTestCfg.BypassGroup4);
+ if (myCfg.BypassGroup1 != Common.GID.None) groups.Add(myCfg.BypassGroup1);
+ if (myCfg.BypassGroup2 != Common.GID.None) groups.Add(myCfg.BypassGroup2);
+ if (myCfg.BypassGroup3 != Common.GID.None) groups.Add(myCfg.BypassGroup3);
+ if (myCfg.BypassGroup4 != Common.GID.None) groups.Add(myCfg.BypassGroup4);
bypassLevel = groups.ToArray();
+
+ log.FatalFormat("{0} - Successfully initialized", Name);
}
@@ -108,7 +101,7 @@ namespace TBF.Rig.Various.CoverTest
/// Event.ResultsPrinted
public Event Run()
{
- bool conditionMet = ((controlBoard.Route & mask) == target);
+ bool conditionMet = ((StateMachine.ControlBoard.Route & Mask) == target);
if (completed || conditionMet)
{
diff --git a/TBF/Rig/Various/CoverTest/CoverTestCfg.cs b/TBF/Rig/Various/CoverTest/CoverTestCfg.cs
index 1a927dd6a..766a180b0 100644
--- a/TBF/Rig/Various/CoverTest/CoverTestCfg.cs
+++ b/TBF/Rig/Various/CoverTest/CoverTestCfg.cs
@@ -59,9 +59,8 @@ namespace TBF.Rig.Various.CoverTest
public CoverTestCfg(string name, IComponentFactory factory)
: this()
{
- //Shape = Shape.RtBasedArrow;
- Shape = Shape.Pump;
- Sz = Sz.M;
+ Shape = Shape.Cover;
+ Sz = Sz.XL;
Name = name;
Factory = factory;
ParentName = string.Empty;
@@ -72,7 +71,7 @@ namespace TBF.Rig.Various.CoverTest
public void InitializeAll()
{
- BitNr = 22;
+ BitNr = 80;
Inverted = false;
Message = Strings.Close_the_cover;
BypassGroup1 = GID.TestingSpecialists;
diff --git a/TBF/Rig/Various/CoverTest/Factory.cs b/TBF/Rig/Various/CoverTest/Factory.cs
index 8f8db8ab3..97ccf410e 100644
--- a/TBF/Rig/Various/CoverTest/Factory.cs
+++ b/TBF/Rig/Various/CoverTest/Factory.cs
@@ -2,6 +2,7 @@
/// Copyright (c) 2017-2021 Sensus Slovensko a.s.
///
using System.Collections.Generic;
+using TBF.Resources;
using TBF.Rig.Generic;
namespace TBF.Rig.Various.CoverTest
@@ -15,7 +16,7 @@ namespace TBF.Rig.Various.CoverTest
public IComponent GetComponent(IComponentCfg cfg, IList components) { return new CoverTest(cfg, components); }
- public IComponentCfg DefaultConfig() { return new CoverTestCfg("Cover", this); }
+ public IComponentCfg DefaultConfig() { return new CoverTestCfg(Strings.Cover, this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
diff --git a/TBF/TBF.csproj b/TBF/TBF.csproj
index c856bd1ca..c1906c02c 100644
--- a/TBF/TBF.csproj
+++ b/TBF/TBF.csproj
@@ -1709,6 +1709,9 @@
+
+
+