feat: Initial commit for LFP_Manager_DBG (V1.1.0.22)

This commit is contained in:
2026-09-22 11:37:05 +09:00
commit df038ae86b
158 changed files with 78308 additions and 0 deletions

View File

@@ -0,0 +1,189 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using LFP_Manager.DataStructure;
namespace LFP_Manager.Controls
{
public partial class ucModuleMainB : DevExpress.XtraEditors.XtraUserControl
{
#region VARIABLES
private int mID = 0;
private CommConfig Config;
private DeviceSystemData SystemData;
private DeviceParamData ParamData;
private DeviceCalibration CalibData;
public event CommandEvent OnCommand = null;
#endregion
#region CONSTRUCTORS
public ucModuleMainB()
{
InitializeComponent();
}
public ucModuleMainB(CommConfig aConfig, int aID, ref DeviceSystemData mSystemData)
{
InitializeComponent();
Config = aConfig;
mID = aID;
SystemData = mSystemData;
lbModuleNumber.Text = String.Format("#{0:00}", mID);
}
#endregion
#region PUBLIC FUNCTION
public void UpdateData(ref DeviceSystemData mSystemData)
{
SystemData = mSystemData;
}
#endregion
#region TIMER EVENT
private void tmrDisplay_Tick(object sender, EventArgs e)
{
DisplayValue();
DisplayStatusAndAlarm();
}
#endregion
#region BUTTON EVENT
private void btnModuleDetail_Click(object sender, EventArgs e)
{
OnCommand?.Invoke(mID, 2, 0, 1, ref ParamData, ref CalibData);
}
#endregion
#region DISPLAY DATA
private void DisplayMainStatus()
{
if (SystemData.CommFail == false)
{
}
else
{
pnModuleNumber.BackColor = System.Drawing.Color.Orange;
}
}
private void DisplayValue()
{
gaugeVoltage.Text = String.Format("{0:0.0}", (double)SystemData.ValueData.voltageOfPack / 10);
gaugeCurrent.Text = String.Format("{0:0.0}", (double)SystemData.ValueData.current / 10);
gaugeSOC.Text = String.Format("{0:0.0}", (double)SystemData.ValueData.rSOC / 10);
gaugeSOH.Text = String.Format("{0:0.0}", (double)SystemData.ValueData.stateOfHealth / 10);
gaugeTempMax.Text = String.Format("{0:0.0}", (double)SystemData.AvgData.maxTemp / 10);
gaugeGapV.Text = String.Format("{0:0.000}", (double)SystemData.AvgData.diffCellVoltage / 1000);
}
private void DisplayStatusAndAlarm()
{
if (SystemData.CommFail == false)
{
if (SystemData.ShelfCommFail == false)
{
switch (SystemData.StatusData.status)
{
case 0x0000: // Stand by
slbOpStatus.Text = "STANDBY";
slbOpStatus.AppearanceItemCaption.ForeColor = System.Drawing.Color.Black;
break;
case 0x0001: // Charging
slbOpStatus.Text = "CHARGING";
slbOpStatus.AppearanceItemCaption.ForeColor = System.Drawing.Color.Blue;
break;
case 0x0002: // Discharging
slbOpStatus.Text = "DISCHARGING";
slbOpStatus.AppearanceItemCaption.ForeColor = System.Drawing.Color.Magenta;
break;
case 0x0003: // Float Charging
slbOpStatus.Text = "FLOATING";
slbOpStatus.AppearanceItemCaption.ForeColor = System.Drawing.Color.Black;
break;
case 0x0004: // Warming Up
slbOpStatus.Text = "WARMING UP";
slbOpStatus.AppearanceItemCaption.ForeColor = System.Drawing.Color.Black;
break;
default:
slbOpStatus.Text = "UNKNOWN";
slbOpStatus.AppearanceItemCaption.ForeColor = System.Drawing.Color.Black;
break;
}
// Alarm Display
if (SystemData.StatusData.batteryStatus == 0)
{
slbAlarm.Text = "NORMAL";
slbAlarm.AppearanceItemCaption.ForeColor = System.Drawing.Color.Green;
pnModuleNumber.BackColor = System.Drawing.Color.Green;
}
else if (SystemData.StatusData.batteryStatus == 1)
{
slbAlarm.Text = "WARNING";
slbAlarm.AppearanceItemCaption.ForeColor = System.Drawing.Color.Orange;
pnModuleNumber.BackColor = System.Drawing.Color.Orange;
}
else if (SystemData.StatusData.batteryStatus == 2)
{
slbAlarm.Text = "FAULT";
slbAlarm.AppearanceItemCaption.ForeColor = System.Drawing.Color.Red;
pnModuleNumber.BackColor = System.Drawing.Color.Red;
}
else if (SystemData.StatusData.batteryStatus == 3)
{
slbAlarm.Text = "WARMING UP";
slbAlarm.AppearanceItemCaption.ForeColor = System.Drawing.Color.Green;
pnModuleNumber.BackColor = System.Drawing.Color.Green;
}
else
{
slbAlarm.Text = "UNKNOWN";
slbAlarm.AppearanceItemCaption.ForeColor = System.Drawing.Color.Red;
pnModuleNumber.BackColor = System.Drawing.Color.Orange;
}
}
else
{
slbOpStatus.Text = "COMM FAIL";
slbOpStatus.AppearanceItemCaption.ForeColor = System.Drawing.Color.Red;
slbAlarm.Text = "COMM FAIL";
slbAlarm.AppearanceItemCaption.ForeColor = System.Drawing.Color.Red;
pnModuleNumber.BackColor = System.Drawing.Color.Orange;
}
}
else
{
slbOpStatus.Text = "OFF LINE";
slbOpStatus.AppearanceItemCaption.ForeColor = System.Drawing.Color.Red;
slbAlarm.Text = "OFF LINE";
slbAlarm.AppearanceItemCaption.ForeColor = System.Drawing.Color.Red;
pnModuleNumber.BackColor = System.Drawing.Color.Orange;
}
// Charge Relay Status Display
}
#endregion
}
}