PDawg21
Hi there, new to programming and trying to design a ladder logic system with the assistance of ai. Im struggling to get to this tab? could anyone help?

VAR_INPUT
(* your linked inputs would appear here *)
VAR_OUTPUT
(* your linked outputs would appear here *)
VAR
(* ← click the green + here to add your M-bits *)
END_VAR

i want to have these alarms
M0_LowTankAlarm : BOOL; (* low-tank alarm flag *)
M1_FilterClogged : BOOL; (* filter-clogged alarm flag *)

Reply 0 0
thiagoralves
That’s the problem with AI, when it doesn’t know the answer it makes things up. I think it would be way easier if you just look at some YouTube videos on OpenPLC to get an idea of how things work. I’ve publish a few of the myself at YouTube.com/@openplc
Reply 0 0
fg71
When it comes to AI-Assistant and structured text you need to describe what you like to do in steps, and use a description like 5 year old child.
If the first respond is not good you could describe what you like to add to the first respond, you could repeat this to you have a good solution.
 
Question:
make 3 example in structured text as function block, with function for low level alarm, and logged alarm flag, both is data type bool
 
FUNCTION_BLOCK LowLevelAlarm
VAR_INPUT
    Level : REAL; // Measured level
    Threshold : REAL; // Alarm threshold
END_VAR
VAR_OUTPUT
    Alarm : BOOL; // Low-level alarm flag
END_VAR

IF Level < Threshold THEN
    Alarm := TRUE;
ELSE
    Alarm := FALSE;
END_IF;
END_FUNCTION_BLOCK
 
FUNCTION_BLOCK LoggedAlarm
VAR_INPUT
    AlarmTrigger : BOOL; // Alarm condition trigger
    Reset : BOOL; // Manual reset
END_VAR
VAR_OUTPUT
    LoggedAlarmFlag : BOOL; // Latched alarm flag
END_VAR

IF AlarmTrigger THEN
    LoggedAlarmFlag := TRUE; // Latch alarm flag when triggered
END_IF;

IF Reset THEN
    LoggedAlarmFlag := FALSE; // Reset alarm flag
END_IF;
END_FUNCTION_BLOCK
 
FUNCTION_BLOCK AlarmManager
VAR_INPUT
    Level : REAL; // Measured level
    Threshold : REAL; // Alarm threshold
    Reset : BOOL; // Manual reset
END_VAR
VAR_OUTPUT
    LowLevelAlarm : BOOL; // Alarm flag for low level
    LoggedAlarmFlag : BOOL; // Latched alarm flag
END_VAR

IF Level < Threshold THEN
    LowLevelAlarm := TRUE;
    LoggedAlarmFlag := TRUE;
ELSE
    LowLevelAlarm := FALSE;
END_IF;

IF Reset THEN
    LoggedAlarmFlag := FALSE;
END_IF;
END_FUNCTION_BLOCK
 
Reply 0 0
Reply