Update Schneider meter reading from the device and upload doc files for the new battery 250 UP

This commit is contained in:
atef 2024-07-01 15:12:12 +02:00
parent bb5b91b380
commit dca4543a13
7 changed files with 17 additions and 71 deletions

View File

@ -31,9 +31,11 @@ public static class Controller
{ {
var mode = s.SelectControlMode().WriteLine(); var mode = s.SelectControlMode().WriteLine();
if (mode is EssMode.Off) if (mode is EssMode.Off)
{
return EssControl.Default; return EssControl.Default;
}
if (mode is EssMode.NoGridMeter) if (mode is EssMode.NoGridMeter)
return new EssControl return new EssControl
{ {
@ -152,7 +154,7 @@ public static class Controller
private static Double MaxBatteryChargePower(this StatusRecord s) private static Double MaxBatteryChargePower(this StatusRecord s)
{ {
// This introduce a limit when we don't have communication with batteries // This introduces a limit when we don't have communication with batteries
// Otherwise the limit will be 0 and the batteries will be not heated // Otherwise the limit will be 0 and the batteries will be not heated
var batteries = s.GetBatteries(); var batteries = s.GetBatteries();
@ -205,64 +207,42 @@ public static class Controller
(calibrationChargeForced == CalibrationChargeType.AdditionallyOnce && additionalCalibrationRequired) || (calibrationChargeForced == CalibrationChargeType.AdditionallyOnce && additionalCalibrationRequired) ||
(calibrationChargeForced == CalibrationChargeType.RepetitivelyEvery && repetitiveCalibrationRequired); (calibrationChargeForced == CalibrationChargeType.RepetitivelyEvery && repetitiveCalibrationRequired);
Console.WriteLine("Next Repetitive calibration charge date is "+statusRecord.Config.DayAndTimeForRepetitiveCalibration); Console.WriteLine("Next Repetitive calibration charge date is "+ statusRecord.Config.DayAndTimeForRepetitiveCalibration);
Console.WriteLine("Next Additional calibration charge date is "+statusRecord.Config.DayAndTimeForAdditionalCalibration); Console.WriteLine("Next Additional calibration charge date is "+ statusRecord.Config.DayAndTimeForAdditionalCalibration);
if (statusRecord.Battery is not null) if (statusRecord.Battery is not null)
{ {
if (calibrationChargeForced == CalibrationChargeType.AdditionallyOnce && statusRecord.Battery.Eoc ) if (calibrationChargeForced == CalibrationChargeType.AdditionallyOnce && statusRecord.Battery.Eoc )
{ {
statusRecord.Config.ForceCalibrationChargeState = CalibrationChargeType.RepetitivelyEvery; statusRecord.Config.ForceCalibrationChargeState = CalibrationChargeType.RepetitivelyEvery;
//_hasAdditionalCalibrationChargeChecked = false;
} }
else if (calibrationChargeForced == CalibrationChargeType.RepetitivelyEvery && statusRecord.Battery.Eoc && _hasRepetitiveCalibrationChargeChecked) else if (calibrationChargeForced == CalibrationChargeType.RepetitivelyEvery && statusRecord.Battery.Eoc && _hasRepetitiveCalibrationChargeChecked)
{ {
statusRecord.Config.DayAndTimeForRepetitiveCalibration = statusRecord.Config.DayAndTimeForRepetitiveCalibration.AddDays(7); statusRecord.Config.DayAndTimeForRepetitiveCalibration = statusRecord.Config.DayAndTimeForRepetitiveCalibration.AddDays(7);
_hasRepetitiveCalibrationChargeChecked = false; _hasRepetitiveCalibrationChargeChecked = false;
} }
} }
return mustDoCalibrationCharge; return mustDoCalibrationCharge;
} }
private static Boolean RepetitiveCalibrationDateHasBeenPassed(DateTime calibrationChargeDate) private static Boolean RepetitiveCalibrationDateHasBeenPassed(DateTime calibrationChargeDate)
{ {
// if (!_hasRepetitiveCalibrationChargeChecked)
// {
// if (DateTime.Now >= calibrationChargeDate )
// {
// _hasRepetitiveCalibrationChargeChecked = true;
// return true;
// }
// return false;
// }
// return true;
if (DateTime.Now >= calibrationChargeDate ) if (DateTime.Now >= calibrationChargeDate )
{ {
_hasRepetitiveCalibrationChargeChecked = true; _hasRepetitiveCalibrationChargeChecked = true;
return true; return true;
} }
return false; return false;
} }
private static Boolean AdditionalCalibrationDateHasBeenPassed(DateTime calibrationChargeDate) private static Boolean AdditionalCalibrationDateHasBeenPassed(DateTime calibrationChargeDate)
{ {
// if (!_hasAdditionalCalibrationChargeChecked) if (DateTime.Now >= calibrationChargeDate )
// { {
if (DateTime.Now >= calibrationChargeDate ) return true;
{ }
//_hasAdditionalCalibrationChargeChecked = true; return false;
return true;
}
return false;
// }
// return true;
} }
private static Double ControlGridPower(this StatusRecord status, Double targetPower) private static Double ControlGridPower(this StatusRecord status, Double targetPower)

View File

@ -8,8 +8,8 @@ public static class Config
public const String Version = "1.0"; public const String Version = "1.0";
public const String BusName = "com.victronenergy.grid.Schneider"; public const String BusName = "com.victronenergy.grid.Schneider";
public const Byte ModbusNodeId = 1; public const Byte ModbusNodeId = 1;
public const String OwnAddress = "192.168.1.246"; public const String OwnAddress = "192.168.3.147";
public const String PeerAddress = "192.168.1.82"; public const String PeerAddress = "192.168.3.63";
//public const String PeerAddress = "127.0.0.1"; //public const String PeerAddress = "127.0.0.1";
public const UInt16 PeerPort = 502; public const UInt16 PeerPort = 502;

View File

@ -49,7 +49,7 @@ chmod +x /opt/innovenergy/SchneiderMeterDriver/service/log/run
# Create the symbolic link for the service # Create the symbolic link for the service
ln -sf /opt/innovenergy/SchneiderMeterDriver/service /service/SchneiderMeterDriver ln -sf /opt/innovenergy/SchneiderMeterDriver/service /service/SchneiderMeterDriver
# Wait a bit for the symlink to be recongnized # Wait a bit for the symlink to be recognized
sleep 2 sleep 2

View File

@ -14,41 +14,7 @@ public partial class Battery250UpRecord
{ {
[InputRegister(1004)] private UInt16 _LedStates; [InputRegister(1004)] private UInt16 _LedStates;
[InputRegister<UInt64>(1005)] private UInt64 _WarningFlags; [InputRegister<UInt64>(1005)] private UInt64 _WarningFlags;
//mine
[InputRegister<UInt64>(1006)] private UInt64 _WarningFlags16to31;
[InputRegister<UInt64>(1007)] private UInt64 _WarningFlags32to47;
[InputRegister<UInt64>(1008)] private UInt64 _WarningFlags48to63;
[InputRegister<UInt64>(1009)] private UInt64 _AlarmFlags; [InputRegister<UInt64>(1009)] private UInt64 _AlarmFlags;
//mine
[InputRegister<UInt64>(1010)] private UInt64 _AlarmFlags16to31;
[InputRegister<UInt64>(1011)] private UInt64 _AlarmFlags32to47;
[InputRegister<UInt64>(1012)] private UInt64 _AlarmFlags48to63;
[InputRegister(1013)] private UInt16 _IoStates; [InputRegister(1013)] private UInt16 _IoStates;
[InputRegister(999, Scale = 0.01)] private Double _CellsVoltage; [InputRegister(999, Scale = 0.01)] private Double _CellsVoltage;