code: def elem_add(self, idx=None, name=None, **kwargs):
          
  
          idx = self.system.devman.register_element(dev_name=self._name, idx=idx)
          self.system.__dict__[self._group].register_element(self._name, idx)
  
          self.uid[idx] = self.n
          self.idx.append(idx)
  
          self.mdl_to.append(list())
          self.mdl_from.append(list())
  
          # self.n += 1
  
          if name is None:
              self.name.append(self._name + ' ' + str(self.n))
          else:
              self.name.append(name)
  
          # check mandatory parameters
          for key in self._mandatory:
              if key not in kwargs.keys():
                  self.log(
                      'Mandatory parameter <{:s}.{:s}> missing'.format(
                          self.name[-1], key), ERROR)
                  sys.exit(1)
  
          # set default values
          for key, value in self._data.items():
              self.__dict__[key].append(value)
  
          # overwrite custom values
          for key, value in kwargs.items():
              if key not in self._data:
                  self.log(
                      'Parameter <{:s}.{:s}> is not used.'.format(
                          self.name[-1], key), WARNING)
                  continue
              self.__dict__[key][-1] = value
  
              # check data consistency
              if not value and key in self._zeros:
                  if key == 'Sn':
                      default = self.system.mva
                  elif key == 'fn':
                      default = self.system.config.freq
                  else:
                      default = self._data[key]
                  self.__dict__[key][-1] = default
                  self.log(
                      'Using default value for <{:s}.{:s}>'.format(
                          self.name[-1], key), WARNING)
  
          return idx
docs: Add an element of this model
  
          :param idx: element idx
          :param name: element name
          :param kwargs: keyword arguments of the parameters
          :return: allocated idx