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
|
||||
|
||||
@@ -263,7 +263,7 @@
|
||||
</System>
|
||||
<Plc>
|
||||
<Project GUID="{9AE64910-5EB2-4866-93FD-EFE059C38C36}" Name="PLC" PrjFilePath="PLC\PLC.plcproj" TmcFilePath="PLC\PLC.tmc" ReloadTmc="true" AmsPort="851" FileArchiveSettings="#x000e" CopyTmcToTarget="true" CopyTpyToTarget="false" SymbolicMapping="true">
|
||||
<Instance Id="#x08502000" TcSmClass="TComPlcObjDef" KeepUnrestoredLinks="2" TmcHash="{6789674A-C83D-5D1A-BF00-40D98F100E42}" TmcPath="PLC\PLC.tmc">
|
||||
<Instance Id="#x08502000" TcSmClass="TComPlcObjDef" KeepUnrestoredLinks="2" TmcHash="{50AF3F57-0138-6597-C54A-9056797B90F0}" TmcPath="PLC\PLC.tmc">
|
||||
<Name>PLC Instance</Name>
|
||||
<CLSID ClassFactory="TcPlc30">{08500001-0000-0000-F000-000000000064}</CLSID>
|
||||
<Vars VarGrpType="2" AreaNo="1">
|
||||
|
||||
Reference in New Issue
Block a user