How do i resolve this index out of range issue?

I did multiple times fixing this problem, i also ask for help from ChatGPT, but its still not fixed. I crawl everywhere looking for this fix. I will attach the code down below, so you can see the code:

  VAR
    ChillerFB : STRING; (* Instance of the ChillerControlFB function block*)
    TempInlet : REAL; (* Inlet temperature(°C)*)
    TempOutlet : REAL; (* Outlet temperature(°C)*)
    PressureCurrent : REAL; (* Current pressure(bar)*)
    TempSetpoint : REAL := 15.0; (* Desired temperature(°C)*)
    PressureHighLimit : REAL := 10.0; (* High pressure limit(bar)*)
    PressureLowLimit : REAL := 1.5; (* Low pressure limit(bar)*)
    AutoMode : BOOL := TRUE; (* Automatic mode flag*)
    ManualStart : BOOL; (* Manual start of compressor*)
    ManualStop : BOOL; (* Manual stop of compressor*)
    TempArray : ARRAY [1..100] OF REAL; (* Array for temperatures*)
    TempIndex : INT := -1; (* Index for TempArray*)
    GeneralAlarm : BOOL; (* Alarm indicating system fault*)
    SystemHealthy : BOOL; (* System health status(healthy or not)*)
    DebugError : STRING; (* Debugging error log*)   END_VAR

I'm expecting the problem must be on this line:

 TempArray : ARRAY [1..100] OF REAL; (* Array for temperatures*)
   TempIndex : INT := -1; (* Index for TempArray*)

I don't really know how to fix this. I'm begging you who expert on this. Because i have to finish this program this week.

Upvotes: 0

Views: 22

Answers (0)

Related Questions