Update Battery250UPRecord.Api.cs and modbus

This commit is contained in:
atef 2024-07-11 09:01:43 +02:00
parent 15638f639c
commit 42bb676784
2 changed files with 11 additions and 26 deletions

View File

@ -16,13 +16,11 @@ public partial class Battery250UpRecord
public Dc_ Dc => new Dc_(this); public Dc_ Dc => new Dc_(this);
public Leds_ Leds => new Leds_(this); public Leds_ Leds => new Leds_(this);
public Temperatures_ Temperatures => new Temperatures_(this); public Temperatures_ Temperatures => new Temperatures_(this);
public StringActive_ BatteryStrings => new StringActive_(this); public AuxBitInformation_ AuxBitInformation => new AuxBitInformation_(this);
public IoStatus_ IoStatus => new IoStatus_(this);
public Boolean Eoc => ParseEocReached();//Leds is { Green: On, Amber: Off, Blue : Off }; // ParseEocReached(); // public Boolean Eoc => ParseEocReached();//Leds is { Green: On, Amber: Off, Blue : Off }; // ParseEocReached(); //
public UInt16 IoStates => _IoStates; public UInt16 IoStates => _IoStates;
public UInt16 LimpBitMap => _LimpBitMap;
public String BatteryState => ParseBatteryState(); public String BatteryState => ParseBatteryState();
@ -61,29 +59,16 @@ public partial class Battery250UpRecord
} }
public readonly struct StringActive_
public readonly struct AuxBitInformation_
{ {
public Boolean String1Active => (Self._LimpBitMap & 1) == 0; public Boolean DischargeEnabled => ((Self._IoStates >> 0) & 1) == 1;
public Boolean String2Active => (Self._LimpBitMap & 2) == 0; public Boolean ChargeEnabled => ((Self._IoStates >> 1) & 1) == 1;
public Boolean String3Active => (Self._LimpBitMap & 4) == 0; public Boolean WarmUpActive => ((Self._IoStates >> 2) & 1) == 1;
public Boolean String4Active => (Self._LimpBitMap & 8) == 0; public Boolean TOCRequested => ((Self._IoStates >> 3) & 1) == 1;
public Boolean String5Active => (Self._LimpBitMap & 16) == 0; public Boolean EOCReached => ((Self._IoStates >> 4) & 1) == 1;
internal StringActive_(Battery250UpRecord self) => Self = self; internal AuxBitInformation_(Battery250UpRecord self) => Self = self;
private Battery250UpRecord Self { get; }
}
public readonly struct IoStatus_
{
public Boolean ConnectedToDcBus => ((Self._IoStates >> 0) & 1) == 0;
public Boolean AlarmOutActive => ((Self._IoStates >> 1) & 1) == 0;
public Boolean InternalFanActive => ((Self._IoStates >> 2) & 1) == 1;
public Boolean VoltMeasurementAllowed => ((Self._IoStates >> 3) & 1) == 1;
public Boolean AuxRelayBus => ((Self._IoStates >> 4) & 1) == 0;
public Boolean RemoteStateActive => ((Self._IoStates >> 5) & 1) == 1;
public Boolean RiscActive => ((Self._IoStates >> 6) & 1) == 1;
internal IoStatus_(Battery250UpRecord self) => Self = self;
private Battery250UpRecord Self { get; } private Battery250UpRecord Self { get; }
} }

View File

@ -39,7 +39,7 @@ public partial class Battery250UpRecord
[InputRegister(1056)] private UInt16 _SerialNum2; [InputRegister(1056)] private UInt16 _SerialNum2;
[InputRegister(1057)] private UInt16 _SerialNum3; [InputRegister(1057)] private UInt16 _SerialNum3;
[InputRegister(1058)] private UInt16 _SerialNum4; [InputRegister(1058)] private UInt16 _SerialNum4;
[InputRegister(1059)] private UInt16 _LimpBitMap; [InputRegister(1059)] private UInt16 _defined;
[InputRegister(1060)] private UInt16 _BatteryState1; [InputRegister(1060)] private UInt16 _BatteryState1;
[InputRegister(1061)] private UInt16 _BatteryState2; [InputRegister(1061)] private UInt16 _BatteryState2;
@ -55,7 +55,7 @@ public partial class Battery250UpRecord
//[InputRegister(1063)] private UInt16 _TotalBatteryCycle; //[InputRegister(1063)] private UInt16 _TotalBatteryCycle;
[InputRegister(1068)] private UInt16 _AuxBitInformation;
private LedState ParseLed(LedColor led) => (LedState)((_LedStates >> (Int32)led) & 3); private LedState ParseLed(LedColor led) => (LedState)((_LedStates >> (Int32)led) & 3);