Added Kaco inverter for sensor ripple testing

- Iso error in string will now only be active if the dc circuit breaker is not closed
- Added some delay between closing dc circuit breaker and enabling inverter so that the dc bus voltage can stabilize itself
This commit is contained in:
Matthias Heisig
2025-05-08 10:07:16 +02:00
parent 0d201a140a
commit 1677d34d9c
9 changed files with 1422 additions and 302 deletions

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project Crc="305376177" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> <Project Crc="176752349" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
@@ -65,4 +65,5 @@
<Folder Include="Not_Halt_Global\Alias Devices" /> <Folder Include="Not_Halt_Global\Alias Devices" />
<Folder Include="User FBs" /> <Folder Include="User FBs" />
</ItemGroup> </ItemGroup>
<ProjectExtensions />
</Project> </Project>

View File

@@ -153,6 +153,9 @@
<Compile Include="POUs\MAIN.TcPOU"> <Compile Include="POUs\MAIN.TcPOU">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="POUs\Sunspec\FB_PowerSupplyKaco.TcPOU">
<SubType>Code</SubType>
</Compile>
<Compile Include="POUs\Sunspec\FB_PowerSupplySunspec.TcPOU"> <Compile Include="POUs\Sunspec\FB_PowerSupplySunspec.TcPOU">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>

File diff suppressed because one or more lines are too long

View File

@@ -170,7 +170,8 @@ VAR
_sName : STRING; _sName : STRING;
// String inverter // String inverter
_fbInverter : FB_PowerSupplySunspec(Name); //_fbInverter : FB_PowerSupplySunspec(Name);
_fbInverter : FB_PowerSupplyKaco(Name);
// Internal inverter power command // Internal inverter power command
_rPowerInverterInternal : REAL; _rPowerInverterInternal : REAL;
@@ -179,7 +180,7 @@ VAR
_xEnableInverter : BOOL; _xEnableInverter : BOOL;
// Fault timer for inverter startup // Fault timer for inverter startup
_tonInverterStartupTimeout : TON := (PT := T#2M); _tonInverterStartupTimeout : TON := (PT := T#3M);
// Fault timer for inverter shutdown // Fault timer for inverter shutdown
_tonInverterShutdownError : TON := (PT := T#10S); _tonInverterShutdownError : TON := (PT := T#10S);
@@ -214,6 +215,8 @@ VAR
// Internal SOC // Internal SOC
_rSOC : REAL; _rSOC : REAL;
_fbTONDCSettlingTime : TON := (PT := T#10S);
END_VAR END_VAR
VAR PERSISTENT VAR PERSISTENT
@@ -262,7 +265,7 @@ END_IF
// ISO Error handling // ISO Error handling
// =============================== // ===============================
// Mute iso error when inverter is enabled // Mute iso error when inverter is enabled
_xIsoError := ((NOT xIsoErrorL1) OR (NOT xIsoErrorL2)) AND (NOT _fbInverter.xActive); _xIsoError := ((NOT xIsoErrorL1) OR (NOT xIsoErrorL2)) AND (NOT _fbInverter.xActive) AND (xDCCBOpen);
_fbTONIsoError(IN := _xIsoError, PT := GVL_CONFIG.timIsoErrorTimeout); _fbTONIsoError(IN := _xIsoError, PT := GVL_CONFIG.timIsoErrorTimeout);
// _fbInverter // _fbInverter
@@ -670,7 +673,6 @@ CASE _iState OF
20: // Check if DC relais closed and safety is ok 20: // Check if DC relais closed and safety is ok
IF NOT xDCCBOpen THEN IF NOT xDCCBOpen THEN
_tonErrorDCCBNotClosed.IN := FALSE; _tonErrorDCCBNotClosed.IN := FALSE;
_xEnableInverter := TRUE;
_rPowerInverterInternal := rPowerInverter; _rPowerInverterInternal := rPowerInverter;
//_rPowerInverterInternal := 0.0; //_rPowerInverterInternal := 0.0;
IF xInSafetyCheckMode THEN IF xInSafetyCheckMode THEN
@@ -701,7 +703,15 @@ CASE _iState OF
_iState := 1000; _iState := 1000;
END_IF END_IF
21: // Wait for inverter to be ready 21: // Wait some time for inverter dc bus voltage settling
_fbTONDCSettlingTime(IN := TRUE);
IF _fbTONDCSettlingTime.Q THEN
_fbTONDCSettlingTime(IN := FALSE);
_xEnableInverter := TRUE;
_iState := 22;
END_IF
22: // Wait for inverter to be ready
_tonInverterStartupTimeout(IN := TRUE); _tonInverterStartupTimeout(IN := TRUE);
IF _fbInverter.xActive AND (NOT _fbInverter.xError) THEN IF _fbInverter.xActive AND (NOT _fbInverter.xError) THEN
_iState := 30; _iState := 30;

View File

@@ -160,6 +160,9 @@ VAR
_uiNumberOfActiveStrings : UINT; _uiNumberOfActiveStrings : UINT;
_xGetPowerMeterData : BOOL; _xGetPowerMeterData : BOOL;
//_fbKaco : FB_PowerSupplyKaco('Kaco');
//_xEnableKaco : BOOL;
END_VAR END_VAR
]]></Declaration> ]]></Declaration>
<Implementation> <Implementation>
@@ -674,7 +677,23 @@ IF _xConfirmAlarms OR _rtHardwareResetButton.Q THEN
_xConfirmAlarms := FALSE; _xConfirmAlarms := FALSE;
END_IF END_IF
_fbPowerMeter24V();]]></ST> _fbPowerMeter24V();
// _fbKaco(
// sInverterIPAddr:= '192.168.42.14',
// xEnable:= _xEnableKaco,
// rPower:= 0.0,
// xReset:= _xConfirmAlarms,
// rMaxBattPower:= 10_000,
// uiMinDisVoltage := ,
// uiMaxChaVoltage := ,
// uiMaxDisCurrent := ,
// uiMaxChaCurrent := ,
// xActive=> ,
// xError=> ,
// xHeartbeatOk=> ,
// stCurrentValues=> ,
// );]]></ST>
</Implementation> </Implementation>
<Action Name="SM_AUTO" Id="{b5166e16-4fea-442b-9560-02c156f9a9ad}"> <Action Name="SM_AUTO" Id="{b5166e16-4fea-442b-9560-02c156f9a9ad}">
<Implementation> <Implementation>

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,6 @@ VAR_INPUT
sInverterIPAddr : STRING; sInverterIPAddr : STRING;
xEnable : BOOL; xEnable : BOOL;
rPower : REAL; rPower : REAL;
//rReactivePower : REAL := 0.0;
xReset : BOOL; xReset : BOOL;
rMaxBattPower : REAL := 40_000; // 24kW rMaxBattPower : REAL := 40_000; // 24kW
END_VAR END_VAR

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<MultiSetting Crc="1297388008" Version="1.2"> <MultiSetting Crc="1554816737" Version="1.2">
<ProjectData> <ProjectData>
<Id>1</Id> <Id>1</Id>
<TargetSystem> <TargetSystem>
@@ -214,12 +214,6 @@
<SubType>EL2912</SubType> <SubType>EL2912</SubType>
<ObjectId>50462856</ObjectId> <ObjectId>50462856</ObjectId>
<SafeAddress>28</SafeAddress> <SafeAddress>28</SafeAddress>
<Customizing>
<Group Id="87605930-f4c2-4c12-816d-f0103cb2103d" Value="3" />
<Group Id="530dd5e0-70c2-408e-8aef-31b019560f77" Value="3" />
<Group Id="ff73f95d-f766-4a11-ae64-a777e602935b" Value="3" />
<Group Id="30895aa4-60ed-464f-bf62-57093e34a5cd" Value="3" />
</Customizing>
</TargetSystem> </TargetSystem>
<SafetyAliasDevice> <SafetyAliasDevice>
<SdsId>36</SdsId> <SdsId>36</SdsId>

View File

@@ -269,7 +269,7 @@
</System> </System>
<Plc> <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"> <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="{E390DC7C-3CE5-6E71-B398-9A07BB7A8621}" TmcPath="PLC\PLC.tmc"> <Instance Id="#x08502000" TcSmClass="TComPlcObjDef" KeepUnrestoredLinks="2" TmcHash="{ACBA32A1-5F9B-54BD-EC2D-EA219550F6C3}" TmcPath="PLC\PLC.tmc">
<Name>PLC Instance</Name> <Name>PLC Instance</Name>
<CLSID ClassFactory="TcPlc30">{08500001-0000-0000-F000-000000000064}</CLSID> <CLSID ClassFactory="TcPlc30">{08500001-0000-0000-F000-000000000064}</CLSID>
<Vars VarGrpType="2" AreaNo="1"> <Vars VarGrpType="2" AreaNo="1">