Some bugfixes

- Config for max string power is now correctly calculated
- Adjusted timing for string and inverter timeout
This commit is contained in:
Matthias Heisig
2025-09-29 11:38:43 +02:00
parent 9cf02c1847
commit 698451cc1f
6 changed files with 45 additions and 38 deletions

View File

@@ -245,11 +245,11 @@ VAR_GLOBAL PERSISTENT
// Maximum allowed charging power (Watt) per String // Maximum allowed charging power (Watt) per String
// 24.000 W -> 2.000 W per Unit // 24.000 W -> 2.000 W per Unit
diMaxStringChargingPower : DINT := -48_000; diMaxStringChargingPower : DINT := -36_000;
// Maximum allowed discharging power (Watt) per String // Maximum allowed discharging power (Watt) per String
// 24.000 W -> 2.000 W per Unit // 24.000 W -> 2.000 W per Unit
diMaxStringDischargePower : DINT := 48_000; diMaxStringDischargePower : DINT := 36_000;
// Inverter ip address for string 1 // Inverter ip address for string 1
sInverterIpString1 : STRING := '192.168.42.10'; sInverterIpString1 : STRING := '192.168.42.10';
@@ -257,7 +257,7 @@ VAR_GLOBAL PERSISTENT
// Inverter ip address for string 2 // Inverter ip address for string 2
sInverterIpString2 : STRING := '192.168.42.20'; sInverterIpString2 : STRING := '192.168.42.20';
timInverterStartupTimeout : TIME := T#2m; timInverterStartupTimeout : TIME := T#3M;
// Absolute shutdown discharge power (Watt) // Absolute shutdown discharge power (Watt)
// 12.000 W -> 1.000 W per unit // 12.000 W -> 1.000 W per unit
@@ -280,7 +280,7 @@ VAR_GLOBAL PERSISTENT
timUnitBalancingStartupTime : TIME := T#3M; timUnitBalancingStartupTime : TIME := T#3M;
// All modules in string not ready timeout // All modules in string not ready timeout
timStringReadyTimeout : TIME := T#3M; timStringReadyTimeout : TIME := T#6M;
// Timeout for isolation error // Timeout for isolation error
timIsoErrorTimeout : TIME := T#20S; timIsoErrorTimeout : TIME := T#20S;

View File

@@ -273,8 +273,8 @@
<ProjectExtensions> <ProjectExtensions>
<PlcProjectOptions> <PlcProjectOptions>
<XmlArchive> <XmlArchive>
<Data> <Data>
<o xml:space="preserve" t="OptionKey"> <o xml:space="preserve" t="OptionKey">
<v n="Name">"&lt;ProjectRoot&gt;"</v> <v n="Name">"&lt;ProjectRoot&gt;"</v>
<d n="SubKeys" t="Hashtable" ckt="String" cvt="OptionKey"> <d n="SubKeys" t="Hashtable" ckt="String" cvt="OptionKey">
<v>{192FAD59-8248-4824-A8DE-9177C94C195A}</v> <v>{192FAD59-8248-4824-A8DE-9177C94C195A}</v>
@@ -2656,16 +2656,16 @@
</d> </d>
<d n="Values" t="Hashtable" /> <d n="Values" t="Hashtable" />
</o> </o>
</Data> </Data>
<TypeList> <TypeList>
<Type n="Boolean">System.Boolean</Type> <Type n="Boolean">System.Boolean</Type>
<Type n="Hashtable">System.Collections.Hashtable</Type> <Type n="Hashtable">System.Collections.Hashtable</Type>
<Type n="Int32">System.Int32</Type> <Type n="Int32">System.Int32</Type>
<Type n="OptionKey">{54dd0eac-a6d8-46f2-8c27-2f43c7e49861}</Type> <Type n="OptionKey">{54dd0eac-a6d8-46f2-8c27-2f43c7e49861}</Type>
<Type n="String">System.String</Type> <Type n="String">System.String</Type>
<Type n="UInt32">System.UInt32</Type> <Type n="UInt32">System.UInt32</Type>
</TypeList> </TypeList>
</XmlArchive> </XmlArchive>
</PlcProjectOptions> </PlcProjectOptions>
</ProjectExtensions> </ProjectExtensions>
</Project> </Project>

File diff suppressed because one or more lines are too long

View File

@@ -19,6 +19,10 @@ VAR
{attribute 'OPC.UA.DA' := '0'} {attribute 'OPC.UA.DA' := '0'}
_afbStrings : ARRAY[0..1] OF FB_String[('String 1'), ('String 2')]; _afbStrings : ARRAY[0..1] OF FB_String[('String 1'), ('String 2')];
// Calculate max and min power depending on number of active strings
_rMinPower : REAL;
_rMaxPower : REAL;
// Battery shutdown due to error // Battery shutdown due to error
_xErrorShutdown : BOOL := FALSE; _xErrorShutdown : BOOL := FALSE;
@@ -659,6 +663,12 @@ FOR _ui := 0 TO (GVL_CONFIG.uiNumberOfStrings-1) DO
END_IF END_IF
END_FOR END_FOR
// ===============================
// Calculate max and min power depending on number of active strings
// ===============================
_rMinPower := _uiNumberOfActiveStrings * DINT_TO_REAL(GVL_CONFIG.diMaxStringChargingPower);
_rMaxPower := _uiNumberOfActiveStrings * DINT_TO_REAL(GVL_CONFIG.diMaxStringDischargePower);
// =============================== // ===============================
// Calculate sum power for string balancing // Calculate sum power for string balancing
// =============================== // ===============================
@@ -1048,8 +1058,8 @@ _fbTowerLight(
END_IF END_IF
5: // Check if power command is within limits 5: // Check if power command is within limits
IF _rAutoPowerRequest <= DINT_TO_REAL(GVL_CONFIG.diMaxStringDischargePower) IF _rAutoPowerRequest <= _rMaxPower
AND _rAutoPowerRequest >= DINT_TO_REAL(GVL_CONFIG.diMaxStringChargingPower) THEN AND _rAutoPowerRequest >= _rMinPower THEN
_xEnableString := TRUE; _xEnableString := TRUE;
_xStartBalancing := FALSE; _xStartBalancing := FALSE;
_iState := 10; _iState := 10;

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<TargetSystemConfig Crc="2395715113" Version="1.5"> <TargetSystemConfig Crc="2694010443" Version="1.5">
<TargetSystemType>HSafetyPLC</TargetSystemType> <TargetSystemType>HSafetyPLC</TargetSystemType>
<TargetSystemSubType>EL2912</TargetSystemSubType> <TargetSystemSubType>EL2912</TargetSystemSubType>
<IsExternalDevice>false</IsExternalDevice> <IsExternalDevice>false</IsExternalDevice>
@@ -19,7 +19,4 @@
<TakeOverSafetyAliasDeviceNamesInProcessImage>true</TakeOverSafetyAliasDeviceNamesInProcessImage> <TakeOverSafetyAliasDeviceNamesInProcessImage>true</TakeOverSafetyAliasDeviceNamesInProcessImage>
<TakeOverStandardAliasDeviceNamesInProcessImage>true</TakeOverStandardAliasDeviceNamesInProcessImage> <TakeOverStandardAliasDeviceNamesInProcessImage>true</TakeOverStandardAliasDeviceNamesInProcessImage>
<BackupRestore Needed="0" Activated="false" RestoreUserAdministration="false" /> <BackupRestore Needed="0" Activated="false" RestoreUserAdministration="false" />
<Customizing>
<Group Id="87605930-f4c2-4c12-816d-f0103cb2103d" Value="2" />
</Customizing>
</TargetSystemConfig> </TargetSystemConfig>

View File

@@ -263,7 +263,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="{50AF3F57-0138-6597-C54A-9056797B90F0}" TmcPath="PLC\PLC.tmc"> <Instance Id="#x08502000" TcSmClass="TComPlcObjDef" KeepUnrestoredLinks="2" TmcHash="{E2BBA81A-0070-8077-2E9B-D9E795CC6B2F}" 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">