Industrielle styresystemer - Wiki
Industrielle styresystemer - Wiki
thread : INT := 1;
power : BOOL := FALSE;
stop : BOOL := FALSE;
poweredOn : BOOL;
Output:
motorStartup : BOOL;
motorShutoff : BOOL;
idle : BOOL;
freeMove : BOOL;
continiousTarget : BOOL;
home : BOOL;
Beskrivelse
Description:
MQTT utganger kobles til StateManager som input, som gjør at programmer også kan skiftes gjennom ekstern GUI, i tillegg til signal som start, stopp og Power
1. Use Statemanager as the 'brain' of the
program. Starting, stopping, powering and
changing programs happens thorough the
StateManager, which is a CFC.
2. It switches to different programs based
on the value of the State input. At startup,
the program will always start in idle and be
ready to receive new commands.
3. If too high a torque is reached, the
program will automatically switch to Idle and
stop the motors when the cable robot is
operated.
4. MQTT outputs are connected to the
StateManager as inputs, which allows programs
to also be changed through an external GUI, in
addition to signals for start, stop and
power on.
Info |
---|
Type: Function Responsible: Kenneth |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
FUNCTION_BLOCK state_manager VAR_INPUT thread : INT := 1; power : BOOL := FALSE; stop : BOOL := FALSE; poweredOn : BOOL; END_VAR VAR_OUTPUT motorStartup : BOOL; motorShutoff : BOOL; idle : BOOL; freeMove : BOOL; continiousTarget : BOOL; home : BOOL; END_VAR VAR state : INT := 1; END_VARstate := thread; IF power THEN (* Power up *) motorStartup := TRUE; motorShutoff := FALSE; idle := FALSE; freeMove := FALSE; continiousTarget := FALSE; home := FALSE; END_IF; IF NOT stop THEN IF poweredOn AND state = 1 THEN (* idle *) motorShutoff := FALSE; idle := TRUE; freeMove := FALSE; continiousTarget := FALSE; home := FALSE; ELSIF state = 2 AND poweredOn THEN (* Free Move *) motorShutoff := FALSE; idle := FALSE; freeMove := TRUE; continiousTarget := FALSE; home := FALSE; ELSIF state = 3 AND poweredOn THEN (* Move to target *) motorShutoff := FALSE; idle := FALSE; freeMove := FALSE; continiousTarget := TRUE; home := FALSE; ELSIF state = 4 AND poweredOn THEN (* Homing *) motorShutoff := FALSE; idle := FALSE; freeMove := FALSE; continiousTarget := FALSE; home := TRUE; END_IF END_IF IF stop THEN motorShutoff := TRUE; idle := TRUE; freeMove := FALSE; continiousTarget := FALSE; home := FALSE; state := 1; END_IF |