docs: def build_event_connections(self, component, runnable, structure):
          """
          Adds event connections to a runnable component based on the structure
          specifications in the component model.
  
          @param component: Component model containing structure specifications.
          @type component: lems.model.component.FatComponent
  
          @param runnable: Runnable component to which structure is to be added.
          @type runnable: lems.sim.runnable.Runnable
  
          @param structure: The structure object to be used to add
          structure code in the runnable component.
          @type structure: lems.model.structure.Structure
          """
          if self.debug: print("\n++++++++ Calling build_event_connections of %s with runnable %s, parent %s"%(component.id, runnable.id, runnable.parent))
          # Process event connections
          for ec in structure.event_connections:
              if self.debug: print(ec.toxml())
              source = runnable.parent.resolve_path(ec.from_)
              target = runnable.parent.resolve_path(ec.to)
              if ec.receiver:
                  receiver_template = self.build_runnable(ec.receiver,
                                                              target)
                                                              
                  #receiver = copy.deepcopy(receiver_template)
                  receiver = receiver_template.copy()
                  receiver.id = "{0}__{1}__".format(component.id,
                                                    receiver_template.id)
  
                  if ec.receiver_container:
                      target.add_attachment(receiver, ec.receiver_container)
                  target.add_child(receiver_template.id, receiver)
                  target = receiver
              else:
                  source = runnable.resolve_path(ec.from_)
                  target = runnable.resolve_path(ec.to)
  
              source_port = ec.source_port
              target_port = ec.target_port
  
              if not source_port:
                  if len(source.event_out_ports) == 1:
                      source_port = source.event_out_ports[0]
                  else:
                      raise SimBuildError(("No source event port "
                                           "uniquely identifiable"
                                           " in '{0}'").format(source.id))
              if not target_port:
                  if len(target.event_in_ports) == 1:
                      target_port = target.event_in_ports[0]
                  else:
                      raise SimBuildError(("No destination event port "
                                           "uniquely identifiable "
                                           "in '{0}'").format(target))
               
              if self.debug: print("register_event_out_callback\n   Source: %s, %s (port: %s) \n   -> %s, %s (port: %s)"%(source, id(source), source_port, target, id(target), target_port))
              source.register_event_out_callback(\
                  source_port, lambda: target.inc_event_in(target_port))