Various.Clamping added, Various.CoverTest modified, ver. 3.1.1857

This commit is contained in:
Milan Hanajik 2022-01-21 16:08:03 +01:00
parent 899b379cf7
commit f96bf993d8
21 changed files with 346 additions and 31 deletions

View File

@ -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,

View File

@ -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
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

View File

@ -60,6 +60,46 @@ namespace SchematicDrawing.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Clamping_XL_off {
get {
object obj = ResourceManager.GetObject("Clamping_XL_off", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Clamping_XL_on {
get {
object obj = ResourceManager.GetObject("Clamping_XL_on", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Cover_XL_off {
get {
object obj = ResourceManager.GetObject("Cover_XL_off", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Cover_XL_on {
get {
object obj = ResourceManager.GetObject("Cover_XL_on", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View File

@ -382,4 +382,16 @@
<data name="EmergencyStop_XL_on" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\EmergencyStop-XL-on.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Clamping_XL_off" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\Clamping-XL-off.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Clamping_XL_on" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\Clamping-XL-on.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Cover_XL_off" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\Cover-XL-off.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Cover_XL_on" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\Cover-XL-on.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -94,6 +94,10 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Pictures\Clamping-XL-off.png" />
<Content Include="Pictures\Clamping-XL-on.png" />
<None Include="Pictures\Cover-XL-off.png" />
<None Include="Pictures\Cover-XL-on.png" />
<Content Include="Pictures\Div-L-sink-dry.png" />
<Content Include="Pictures\Div-L-sink-wet.png" />
<Content Include="Pictures\Div-L-tank-dry.png" />

View File

@ -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")]

View File

@ -807,6 +807,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Clamping.
/// </summary>
internal static string Clamping {
get {
return ResourceManager.GetString("Clamping", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Class.
/// </summary>
@ -1140,6 +1149,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Cover.
/// </summary>
internal static string Cover {
get {
return ResourceManager.GetString("Cover", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Create DB.
/// </summary>

View File

@ -1704,4 +1704,10 @@
<data name="Processing_statistics" xml:space="preserve">
<value>Spracování statistik</value>
</data>
<data name="Clamping" xml:space="preserve">
<value>Upínač</value>
</data>
<data name="Cover" xml:space="preserve">
<value>Kryt</value>
</data>
</root>

View File

@ -2359,4 +2359,10 @@
<data name="Processing_statistics" xml:space="preserve">
<value>Processing statistics</value>
</data>
<data name="Clamping" xml:space="preserve">
<value>Clamping</value>
</data>
<data name="Cover" xml:space="preserve">
<value>Cover</value>
</data>
</root>

View File

@ -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());

View File

@ -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() { }
}
}

View File

@ -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<Config.Entities.Component> 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<GNode> GNodes { get; set; }
[XmlIgnore]
public IList<GEdge> EdgesToSet { get; set; }
public Configuration()
{
GNodes = new List<GNode>();
EdgesToSet = new List<GEdge>();
}
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<string> 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
}
}
}

View File

@ -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<IComponent> 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);
}
}
}

View File

@ -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<Generic.IComponent> 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<Common.GID>();
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
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
bool conditionMet = ((controlBoard.Route & mask) == target);
bool conditionMet = ((StateMachine.ControlBoard.Route & Mask) == target);
if (completed || conditionMet)
{

View File

@ -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;

View File

@ -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<IComponent> 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)
{

View File

@ -1709,6 +1709,9 @@
<Compile Include="Rig\Various\ErrorFlags\TestParams.cs" />
<Compile Include="Rig\Various\ErrorFlags\Errors.cs" />
<Compile Include="Rig\Various\ErrorFlags\ErrorsCfg.cs" />
<Compile Include="Rig\Various\Clamping\Component.cs" />
<Compile Include="Rig\Various\Clamping\Configuration.cs" />
<Compile Include="Rig\Various\Clamping\Factory.cs" />
<Compile Include="Rig\Various\ManualLevelMsrmnt\ManualLevelMsrmnt.cs" />
<Compile Include="Rig\Various\ManualLevelMsrmnt\Factory.cs" />
<Compile Include="Rig\Various\ManualLevelMsrmnt\WaterLevelForm.cs">