Fixed inverter not showing negative dc current
This commit is contained in:
388
PLC/PLC.tmc
388
PLC/PLC.tmc
File diff suppressed because one or more lines are too long
@@ -191,6 +191,9 @@ VAR
|
||||
|
||||
// Inverter name for alarm message
|
||||
_sName : STRING;
|
||||
|
||||
// Buffer for word switching in reading current dc values
|
||||
_wBuffer : WORD;
|
||||
END_VAR
|
||||
VAR CONSTANT
|
||||
// Battery limits registers (Model 64202)
|
||||
@@ -214,7 +217,7 @@ VAR CONSTANT
|
||||
|
||||
// Start of register with the current dc values
|
||||
// Size 4
|
||||
DC_VALUES_START_REGISTER : WORD := 40097;
|
||||
DC_VALUES_START_REGISTER : WORD := 40156;
|
||||
|
||||
// Start of register with the current ac values
|
||||
// SIZE 10
|
||||
@@ -651,11 +654,28 @@ CASE _iStateCyclicData OF
|
||||
IF (NOT _fbReadDCValues.bBusy) THEN
|
||||
_fbReadDCValues(bExecute := FALSE);
|
||||
_iStateCyclicData := 51;
|
||||
|
||||
// Switch words
|
||||
// DC current
|
||||
_wBuffer := _awCurrentDCValues[0];
|
||||
_awCurrentDCValues[0] := _awCurrentDCValues[1];
|
||||
_awCurrentDCValues[1] := _wBuffer;
|
||||
|
||||
// DC voltage
|
||||
_wBuffer := _awCurrentDCValues[2];
|
||||
_awCurrentDCValues[2] := _awCurrentDCValues[3];
|
||||
_awCurrentDCValues[3] := _wBuffer;
|
||||
_wBuffer := _awCurrentDCValues[4];
|
||||
|
||||
// DC power
|
||||
_awCurrentDCValues[4] := _awCurrentDCValues[5];
|
||||
_awCurrentDCValues[5] := _wBuffer;
|
||||
|
||||
// If there was no error and the converter has no error continue
|
||||
IF (NOT _fbReadDCValues.bError) THEN
|
||||
stCurrentValues.rActDCCurrent := LREAL_TO_REAL(WORD_TO_INT(_awCurrentDCValues[0]) * EXPT(10,WORD_TO_INT(_awCurrentDCValues[1])));
|
||||
stCurrentValues.rActDCVoltage := LREAL_TO_REAL(WORD_TO_UINT(_awCurrentDCValues[2]) * EXPT(10,WORD_TO_INT(_awCurrentDCValues[3])));
|
||||
stCurrentValues.rActDCPower := LREAL_TO_REAL(WORD_TO_INT(_awCurrentDCValues[4]) * EXPT(10,WORD_TO_INT(_awCurrentDCValues[5])));
|
||||
MEMCPY(ADR(stCurrentValues.rActDCCurrent), ADR(_awCurrentDCValues[0]), 4);
|
||||
MEMCPY(ADR(stCurrentValues.rActDCVoltage), ADR(_awCurrentDCValues[2]), 4);
|
||||
MEMCPY(ADR(stCurrentValues.rActDCPower), ADR(_awCurrentDCValues[4]), 4);
|
||||
ELSE
|
||||
// Dont throw comm error here because this is just
|
||||
// informational data and not process critical
|
||||
|
||||
Reference in New Issue
Block a user