Files
infineon_scheduler/PLC/POUs/Stations/FB_Robot.TcPOU
m.heisig 92276e4f4b First working implementation
- Currently only with one sided gripper
2026-02-19 15:42:54 +01:00

71 lines
1.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1">
<POU Name="FB_Robot" Id="{dc28987f-6f20-437a-aca7-b51d3eb98f94}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_Robot EXTENDS FB_BaseTransport
VAR_INPUT
END_VAR
VAR_OUTPUT
END_VAR
VAR_IN_OUT
fbScheduler : FB_Scheduler;
END_VAR
VAR
_tonTransportDone : TON;
_timTransportTime : TIME := T#5S;
_itfSourceStation : I_Station;
_itfTargetStation : I_Station;
_iFlowRecIdx : INT;
_iState : INT;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[CASE _iState OF
// Idle, check for new transport job
0:
IF fbJobQueue.M_GetHighest(stJob => _stTransJon) THEN
_xAvailable := FALSE;
// Get station interfaces
_itfSourceStation := fbScheduler.M_GetStation(_stTransJon.uiFromStation);
_itfTargetStation := fbScheduler.M_GetStation(_stTransJon.uiToStation);
_iState := 10;
END_IF
// Move to pickup station
10:
_tonTransportDone(IN := TRUE, PT := _timTransportTime);
IF _tonTransportDone.Q THEN
_tonTransportDone(IN := FALSE);
// Get product from station
_iFlowRecIdx := _itfSourceStation.M_RemoveProduct();
_iState := 20;
END_IF
// Move to drop station
20:
_tonTransportDone(IN := TRUE, PT := _timTransportTime);
IF _tonTransportDone.Q THEN
_tonTransportDone(IN := FALSE);
// Put product into station
_itfTargetStation.M_InsertProduct(_iFlowRecIdx);
_iState := 30;
END_IF
// Release all station reservations
30:
_itfSourceStation.M_Release(uiHandle := _stTransJon.uiFromStationHandle);
_itfTargetStation.M_Release(uiHandle := _stTransJon.uiToStationHandle);
_xAvailable := TRUE;
_iState := 0;
END_CASE]]></ST>
</Implementation>
</POU>
</TcPlcObject>