WIP: Aktueller stand für fehlersuche Sensorrauschen

This commit is contained in:
Matthias Heisig
2024-05-22 17:43:26 +02:00
parent cf0d144987
commit 0d9a4d9c72
27 changed files with 1667 additions and 824 deletions

View File

@@ -886,7 +886,7 @@ CASE _iState OF
sIPAddr:= sInverterIPAddr,
nTCPPort:= 502,
nUnitID:= 16#FF, // 16#FF for Modbus TCP
nQuantity:= 10,
nQuantity:= 22,
nMBAddr:= AC_VALUES_START_REGISTER,
cbLength:= SIZEOF(_awCurrentACValues),
pDestAddr:= ADR(_awCurrentACValues),
@@ -903,11 +903,15 @@ CASE _iState OF
IF NOT _fbReadRegister.bError THEN
// Go back to polling state
_iState := 90;
stCurrentValues.rActACPower := LREAL_TO_REAL(WORD_TO_INT(_awCurrentACValues[0]) * EXPT(10,WORD_TO_INT(_awCurrentACValues[1])));
stCurrentValues.rActACFreq := LREAL_TO_REAL(WORD_TO_UINT(_awCurrentACValues[2]) * EXPT(10,WORD_TO_INT(_awCurrentACValues[3])));
stCurrentValues.rActApparentPower := LREAL_TO_REAL(WORD_TO_INT(_awCurrentACValues[4]) * EXPT(10,WORD_TO_INT(_awCurrentACValues[5])));
stCurrentValues.rActReactivePower := LREAL_TO_REAL(WORD_TO_INT(_awCurrentACValues[6]) * EXPT(10,WORD_TO_INT(_awCurrentACValues[7])));
stCurrentValues.rActPowerFactor := LREAL_TO_REAL(WORD_TO_INT(_awCurrentACValues[8]) * EXPT(10,WORD_TO_INT(_awCurrentACValues[9])));
stCurrentValues.rActACCurrent := LREAL_TO_REAL(WORD_TO_INT(_awCurrentACValues[0]) * EXPT(10,WORD_TO_INT(_awCurrentACValues[4])));
stCurrentValues.rActtACPhaseACurrent := LREAL_TO_REAL(WORD_TO_INT(_awCurrentACValues[1]) * EXPT(10,WORD_TO_INT(_awCurrentACValues[4])));
stCurrentValues.rActtACPhaseBCurrent := LREAL_TO_REAL(WORD_TO_INT(_awCurrentACValues[2]) * EXPT(10,WORD_TO_INT(_awCurrentACValues[4])));
stCurrentValues.rActtACPhaseCCurrent := LREAL_TO_REAL(WORD_TO_INT(_awCurrentACValues[3]) * EXPT(10,WORD_TO_INT(_awCurrentACValues[4])));
stCurrentValues.rActACPower := LREAL_TO_REAL(WORD_TO_INT(_awCurrentACValues[12]) * EXPT(10,WORD_TO_INT(_awCurrentACValues[13])));
stCurrentValues.rActACFreq := LREAL_TO_REAL(WORD_TO_UINT(_awCurrentACValues[14]) * EXPT(10,WORD_TO_INT(_awCurrentACValues[15])));
stCurrentValues.rActApparentPower := LREAL_TO_REAL(WORD_TO_INT(_awCurrentACValues[16]) * EXPT(10,WORD_TO_INT(_awCurrentACValues[17])));
stCurrentValues.rActReactivePower := LREAL_TO_REAL(WORD_TO_INT(_awCurrentACValues[18]) * EXPT(10,WORD_TO_INT(_awCurrentACValues[19])));
stCurrentValues.rActPowerFactor := LREAL_TO_REAL(WORD_TO_INT(_awCurrentACValues[20]) * EXPT(10,WORD_TO_INT(_awCurrentACValues[21])));
ELSE
// Read error register
_iState := 1000;
@@ -1334,9 +1338,9 @@ _fbErrorInverterAlarm.ipArguments.Clear().AddString(_sName);]]></ST>
<LineId Id="1737" Count="0" />
<LineId Id="1739" Count="19" />
<LineId Id="1781" Count="0" />
<LineId Id="1759" Count="2" />
<LineId Id="1774" Count="0" />
<LineId Id="1776" Count="1" />
<LineId Id="1759" Count="0" />
<LineId Id="4066" Count="7" />
<LineId Id="1777" Count="0" />
<LineId Id="1762" Count="4" />
<LineId Id="1738" Count="0" />
<LineId Id="3213" Count="0" />

View File

@@ -0,0 +1,145 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<DUT Name="ST_SunspecInverterThreePhase" Id="{f9acf95c-14fe-4c1e-9c73-dff4af6d43b5}">
<Declaration><![CDATA[// Sunspec register 40.070 - 40.120 (Size 52)
TYPE ST_SunspecInverterThreePhase :
STRUCT
// Model value
uiID : UINT;
// Model length
uiL : UINT;
// AC current. Sum of active phases
iA : INT;
// AC current. Phase A
iAphA : INT;
// AC current. Phase B
iAphB : INT;
// AC current. Phase C
iAphC : INT;
// AC current scaling factor
iASF : INT;
// Phase voltage AB
uiPPVphAB : UINT;
// Phase voltage BC
uiPPVphBC : UINT;
// Phase voltage CA
uiPPVphCA : UINT;
// Phase voltage AN
uiPhVphA : UINT;
// Phase voltage BN
uiPhVphB : UINT;
// Phase voltage CN
uiPhVphC : UINT;
// Phase voltage scaling factor
iVSF : INT;
// AC Power
iW : INT;
// AC power scaling factor
iWSF : INT;
// Line frequency
uiHz : UINT;
// Line frequency scaling factor
iHzSF : INT;
// AC apparent power
iVA : INT;
// AC apparent power scaling factor
iVASF : INT;
// AC reactive power
iVAr : INT;
// AC reactive power scaling factor
iVArSF : INT;
// AC power factor
iPF : INT;
// AC power factor scaling factor
iPFSF : INT;
// AC Energy
udiWH : UDINT;
// AC Energy scaling factor
iWHSF : INT;
// DC current
uiDCA : UINT;
// DC current scaling factor
iDCASF : INT;
// DC voltage
uiDCV : UINT;
// DC voltage scaling factor
iDCVSF : INT;
// DC power
iDCW : INT;
// DC power scaling factor
iDCWSF : INT;
// Cabinet temperature
iTmpCab : INT;
// Heat sink temperature
iTmpSnk : INT;
// Transformer temperature
iTmpTrns : INT;
// Other temperature
iTmpOt : INT;
// Temperature scaling factor
iTmpSF : INT;
// Operating state
wSt : WORD;
// Vendor specific operating state
wStVnd : WORD;
// Bitmask value. Event fields.
dwEvt1 : DWORD;
// Reserved for future use
dwEvt2 : DWORD;
// Vendor defined events 1
dwEvtVnd1 : DWORD;
// Vendor defined events 2
dwEvtVnd2 : DWORD;
// Vendor defined events 3
dwEvtVnd3 : DWORD;
// Vendor defined events 4
dwEvtVnd4 : DWORD;
END_STRUCT
END_TYPE
]]></Declaration>
</DUT>
</TcPlcObject>

View File

@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<DUT Name="ST_SunspecNameplateRatings" Id="{d43d4b8b-dd50-4ed8-ac51-53563f3eb7b3}">
<Declaration><![CDATA[// Sunspec register 40.122 - 40.149 (Size 28)
TYPE ST_SunspecNameplateRatings :
STRUCT
// Model value
uiID : UINT;
// Model length
uiL : UINT;
// Type of DER device
wDERTyp : WORD;
// Continuous power output capability of the inverter
uiWRtg : UINT;
// Continuous power output capability of the inverter scaling factor
uiWRtgSF : INT;
// Continuous volt-ampere output capability of the inverter
uiVARtg : UINT;
// Continuous volt-ampere output capability of the inverter scaling factor
uiVARtgSF : INT;
// Continuous VAR capability of the inverter in quadrant 1
iVArRtgQ1 : INT;
// Continuous VAR capability of the inverter in quadrant 2
iVArRtgQ2 : INT;
// Continuous VAR capability of the inverter in quadrant 3
iVArRtgQ3 : INT;
// Continuous VAR capability of the inverter in quadrant 4
iVArRtgQ4 : INT;
// Continuous VAR capability of the inverter in quadrant 1-4 scaling factor
iVArRtgSF : INT;
// Maximum RMS AC current level capability of the inverter
uiARtg : UINT;
// Maximum RMS AC current level capability of the inverter scaling factor
uiARtgSF : INT;
// Minimum power factor capability of the inverter in quadrant 1
iPFRtgQ1 : INT;
// Minimum power factor capability of the inverter in quadrant 2
iPFRtgQ2 : INT;
// Minimum power factor capability of the inverter in quadrant 3
iPFRtgQ3 : INT;
// Minimum power factor capability of the inverter in quadrant 4
iPFRtgQ4 : INT;
// Minimum power factor capability of the inverter in quadrant 1-4 scaling factor
iPFRtgSF : INT;
// Nominal energy rating of storage device
uiWHRtg : UINT;
// Nominal energy rating of storage device scaling factor
uiWHRtgSF : INT;
// The usable capacity of the battery
uiAhrRtg : UINT;
// The usable capacity of the battery scaling factor
uiAhrRtgSF : INT;
// Maximum rate of energy transfer into the storage device
uiMaxChaRte : UINT;
// Maximum rate of energy transfer into the storage device scaling factor
uiMaxChaRteSF : INT;
// Maximum rate of energy transfer out of the storage device
uiMaxDisChaRte : UINT;
// Maximum rate of energy transfer out of the storage device scaling factor
uiMaxDisChaRteSF : INT;
// Padding register
wPad : WORD;
END_STRUCT
END_TYPE
]]></Declaration>
</DUT>
</TcPlcObject>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<Itf Name="I_SunspecStateEvents" Id="{9f2878c1-5bc9-4cdb-9e46-4b259f381081}">
<Declaration><![CDATA[INTERFACE I_SunspecStateEvents
]]></Declaration>
<Method Name="Error" Id="{506b8d17-6aa9-4aab-bfd8-11f2ebedfcfc}">
<Declaration><![CDATA[METHOD Error : BOOL
VAR_INPUT
END_VAR
]]></Declaration>
</Method>
<Method Name="PowerSetpointChanged" Id="{3dcaeb52-d0ac-4f7e-99ba-b5f155953486}">
<Declaration><![CDATA[METHOD PowerSetpointChanged : BOOL
VAR_INPUT
END_VAR
]]></Declaration>
</Method>
<Property Name="sDescription" Id="{330ef48f-f9ea-4ee7-a639-0ea32e088efd}">
<Declaration><![CDATA[PROPERTY sDescription : STRING]]></Declaration>
<Get Name="Get" Id="{2bcfde01-0834-4a30-8867-40b073885fa2}">
<Declaration><![CDATA[]]></Declaration>
</Get>
</Property>
<Method Name="Start" Id="{f29f72f2-1d04-48a4-8608-368ea20f3369}">
<Declaration><![CDATA[METHOD Start : BOOL
VAR_INPUT
END_VAR
]]></Declaration>
</Method>
</Itf>
</TcPlcObject>

View File

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<POU Name="FB_SunspecErrorState" Id="{32768020-5348-440d-ba86-8c22b89748ca}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FINAL FB_SunspecErrorState IMPLEMENTS I_SunspecStateEvents
VAR_INPUT
END_VAR
VAR_OUTPUT
END_VAR
VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
<Method Name="Error" Id="{179954d6-9aec-4f12-920f-8ebcc939e9f0}">
<Declaration><![CDATA[{warning 'Methodenimplementierung hinzufügen'}
METHOD Error : BOOL
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
</Method>
<Method Name="PowerSetpointChanged" Id="{13d718a0-4c83-4300-bbaa-e213ad7aa8af}">
<Declaration><![CDATA[{warning 'Methodenimplementierung hinzufügen'}
METHOD PowerSetpointChanged : BOOL
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
</Method>
<Property Name="sDescription" Id="{d53971e2-a389-4522-ba1a-c5ff9ecf2f10}">
<Declaration><![CDATA[{warning 'Eigenschaftenimplementierung hinzufügen'}
PROPERTY sDescription : STRING
]]></Declaration>
<Get Name="Get" Id="{de420402-9047-4ee6-9fc9-cc905acb4d0f}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[sDescription := 'Inverter has error']]></ST>
</Implementation>
</Get>
</Property>
<Method Name="Start" Id="{2cda83e0-be11-442b-bf87-a7ac125ff2e7}">
<Declaration><![CDATA[{warning 'Methodenimplementierung hinzufügen'}
METHOD Start : BOOL
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
</Method>
<LineIds Name="FB_SunspecErrorState">
<LineId Id="9" Count="0" />
</LineIds>
<LineIds Name="FB_SunspecErrorState.Error">
<LineId Id="4" Count="0" />
</LineIds>
<LineIds Name="FB_SunspecErrorState.PowerSetpointChanged">
<LineId Id="4" Count="0" />
</LineIds>
<LineIds Name="FB_SunspecErrorState.sDescription.Get">
<LineId Id="2" Count="0" />
</LineIds>
<LineIds Name="FB_SunspecErrorState.Start">
<LineId Id="4" Count="0" />
</LineIds>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<POU Name="FB_SunspecOffState" Id="{e011d22f-f815-46e1-94fd-3c9f3920043c}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FINAL FB_SunspecOffState IMPLEMENTS I_SunspecStateEvents
VAR_INPUT
END_VAR
VAR_OUTPUT
END_VAR
VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
<Method Name="Error" Id="{d664cadd-ac2b-4ff0-bcb2-b0337fcba29b}">
<Declaration><![CDATA[{warning 'Methodenimplementierung hinzufügen'}
METHOD Error : BOOL
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
</Method>
<Method Name="PowerSetpointChanged" Id="{381d5fe1-608f-4100-85b9-2a00e88d6ec8}">
<Declaration><![CDATA[{warning 'Methodenimplementierung hinzufügen'}
METHOD PowerSetpointChanged : BOOL
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
</Method>
<Property Name="sDescription" Id="{6bb22c27-a09d-421c-ba72-b88d70f45bf4}">
<Declaration><![CDATA[{warning 'Eigenschaftenimplementierung hinzufügen'}
PROPERTY sDescription : STRING
]]></Declaration>
<Get Name="Get" Id="{8e1a3f8b-86f3-43a4-b3ca-5e780a9a61e0}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[sDescription := 'Inverter off']]></ST>
</Implementation>
</Get>
</Property>
<Method Name="Start" Id="{6bd7c404-10c1-4936-a0c8-70f2c38a5fbf}">
<Declaration><![CDATA[{warning 'Methodenimplementierung hinzufügen'}
METHOD Start : BOOL
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
</Method>
<LineIds Name="FB_SunspecOffState">
<LineId Id="9" Count="0" />
</LineIds>
<LineIds Name="FB_SunspecOffState.Error">
<LineId Id="4" Count="0" />
</LineIds>
<LineIds Name="FB_SunspecOffState.PowerSetpointChanged">
<LineId Id="4" Count="0" />
</LineIds>
<LineIds Name="FB_SunspecOffState.sDescription.Get">
<LineId Id="2" Count="0" />
</LineIds>
<LineIds Name="FB_SunspecOffState.Start">
<LineId Id="4" Count="0" />
</LineIds>
</POU>
</TcPlcObject>