code: def timeseries(self):
          
          if self._timeseries is None:
              # calculate time series for active and reactive power
              try:
                  timeseries = \
                      self.grid.network.timeseries.generation_dispatchable[
                          self.type].to_frame('p')
              except KeyError:
                  try:
                      timeseries = \
                          self.grid.network.timeseries.generation_dispatchable[
                              'other'].to_frame('p')
                  except KeyError:
                      logger.exception("No time series for type {} "
                                       "given.".format(self.type))
                      raise
  
              timeseries = timeseries * self.nominal_capacity
              if self.timeseries_reactive is not None:
                  timeseries['q'] = self.timeseries_reactive
              else:
                  timeseries['q'] = timeseries['p'] * self.q_sign * tan(acos(
                      self.power_factor))
  
              return timeseries
          else:
              return self._timeseries.loc[
                     self.grid.network.timeseries.timeindex, :]
docs: Feed-in time series of generator
  
          It returns the actual dispatch time series used in power flow analysis.
          If :attr:`_timeseries` is not :obj:`None`, it is returned. Otherwise,
          :meth:`timeseries` looks for time series of the according type of
          technology in :class:`~.grid.network.TimeSeries`. If the reactive
          power time series is provided through :attr:`_timeseries_reactive`,
          this is added to :attr:`_timeseries`. When :attr:`_timeseries_reactive`
          is not set, the reactive power is also calculated in
          :attr:`_timeseries` using :attr:`power_factor` and
          :attr:`reactive_power_mode`. The :attr:`power_factor` determines the
          magnitude of the reactive power based on the power factor and active
          power provided and the :attr:`reactive_power_mode` determines if the
          reactive power is either consumed (inductive behaviour) or provided
          (capacitive behaviour).
  
          Returns
          -------
          :pandas:`pandas.DataFrame<dataframe>`
              DataFrame containing active power in kW in column 'p' and
              reactive power in kvar in column 'q'.