code: def set_state(self, t, state):
          
          self.time.update(t)
  
          for key, value in state.items():
              # TODO Implement map with reference between component and stateful element?
              component_name = utils.get_value_by_insensitive_key_or_value(key, self.components._namespace)
              if component_name is not None:
                  stateful_name = '_integ_%s' % component_name
              else:
                  component_name = key
                  stateful_name = key
  
              # Try to update stateful component
              if hasattr(self.components, stateful_name):
                  try:
                      element = getattr(self.components, stateful_name)
                      element.update(value)
                  except AttributeError:
                      print("'%s' has no state elements, assignment failed")
                      raise
              else:
                  # Try to override component
                  try:
                      setattr(self.components, component_name, self._constant_component(value))
                  except AttributeError:
                      print("'%s' has no component, assignment failed")
                      raise
docs: Set the system state.
  
          Parameters
          ----------
          t : numeric
              The system time
  
          state : dict
              A (possibly partial) dictionary of the system state.
              The keys to this dictionary may be either pysafe names or original model file names