<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def apply(self, actual_time):
 """Check time and apply faults"""

        if self.time != actual_time:
            self.time = actual_time
        else:
            return

        for i in range(self.n):
            if self.tf[i] == self.time:
                logger.info(
                    ' <Fault> Applying fault on Bus <{}> at t={}.'.format(
                        self.bus[i], self.tf[i]))
                self.u[i] = 1
                self.active += 1
                self.angle0 = self.system.dae.y[self.system.Bus.a]
                self.volt0 = self.system.dae.y[self.system.Bus.n:]
                self.system.dae.factorize = True

            elif self.tc[i] == self.time:
                logger.info(
                    ' <Fault> Clearing fault on Bus <{}> at t={}.'.format(
                        self.bus[i], self.tc[i]))
                self.u[i] = 0
                self.active -= 1
                self.system.dae.y[self.system.Bus.n:] = self.volt0
                # self.system.dae.y[self.a] = self.anglepre
                self.system.dae.factorize = True