Various changes done when adding new components (parents, etc.)

This commit is contained in:
Milan Hanajik
2021-02-24 15:27:35 +01:00
parent 878e7be9fa
commit a9d6fa631c
11 changed files with 29 additions and 31 deletions
@@ -148,8 +148,13 @@ namespace TBF.BenchControl.Modbus.PumpFM.DanfossVLT
modbus = (GenericDevices.IModbus)TbfComponents.FindComponent(cfg.ParentName, components);
if (modbus == null) throw new Exception("Cannot find " + Name + " parent");
controlBoard = TbfComponents.FindComponent("CB", components) as IControlBoard; /// TODO: replace "CB"
if (controlBoard == null) throw new Exception("Cannot find a control board");
controlBoard = null;
foreach (var name in new string[] { "CB", "UniCB" })
{
if ((controlBoard = TbfComponents.FindComponent(name, components) as IControlBoard) != null)
break;
}
if (controlBoard == null) throw new Exception("Cannot find a control board");
bitNr = pumpCfg.BitNr;
Mask = (((UInt128)1) << bitNr);
@@ -19,14 +19,14 @@ namespace TBF.BenchControl.Modbus.TempMeter.Groch
readonly TempMeterCfg tempMtrCfg;
public SchematicDrawing.IDrawingItem DrawingItem { get { return tempMtrCfg as SchematicDrawing.IDrawingItem; } }
public readonly CBoard ControlBoard;
readonly Common.Modbus modbus;
public int Idx0 { get { return tempMtrCfg.Idx0; } } /// 0..15
public double A1 { get { return tempMtrCfg.A1; } }
public double A2 { get { return tempMtrCfg.A2; } }
public double A3 { get { return tempMtrCfg.A3; } }
public double A4 { get { return tempMtrCfg.A4; } }
public double A5 { get { return tempMtrCfg.A5; } }
int Idx0 { get { return tempMtrCfg.Idx0; } } /// 0..15
double A1 { get { return tempMtrCfg.A1; } }
double A2 { get { return tempMtrCfg.A2; } }
double A3 { get { return tempMtrCfg.A3; } }
double A4 { get { return tempMtrCfg.A4; } }
double A5 { get { return tempMtrCfg.A5; } }
public TempMeter()
{
@@ -37,15 +37,8 @@ namespace TBF.BenchControl.Modbus.TempMeter.Groch
{
tempMtrCfg = cfg as TempMeterCfg;
ControlBoard = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components);
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
/// Prepare data for SendCalibData() control board component method
ControlBoard.TempCalibData[Idx0, 0] = (float)A1;
ControlBoard.TempCalibData[Idx0, 1] = (float)A2;
ControlBoard.TempCalibData[Idx0, 2] = (float)A3;
ControlBoard.TempCalibData[Idx0, 3] = (float)A4;
ControlBoard.TempCalibData[Idx0, 4] = (float)A5;
modbus = TbfComponents.FindComponent(cfg.ParentName, components) as Common.Modbus;
if (modbus == null) throw new Exception("Cannot find " + Name + " parent");
log.Warn(this.ToString());
}
@@ -86,7 +79,7 @@ namespace TBF.BenchControl.Modbus.TempMeter.Groch
{
if (Cfg.DebugLevel == Config.Entities.DebugMode.Normal)
{
return Config.Formulas.CorrectedValue((double)ControlBoard.Temperature(Idx0), Corrections);
return 0; // Config.Formulas.CorrectedValue((double)ControlBoard.Temperature(Idx0), Corrections);
}
else if (Cfg.DebugLevel == Config.Entities.DebugMode.Simulate)
{
@@ -43,7 +43,7 @@ namespace TBF.BenchControl.Modbus.TempMeter.Groch
{
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Modbus.Common.Factory)
{
parentNameComboBox.Items.Add(cmpnt.Name);
}