Sensor Based Plc Programming For A Discrete Event Control System