code: def resolve_simulation(self, fc, ct):
          for run in ct.simulation.runs:
              try:
                  run2 = Run(fc.component_references[run.component].referenced_component,
                             run.variable,
                             fc.parameters[run.increment].numeric_value,
                             fc.parameters[run.total].numeric_value)
              except:
                  raise ModelError("Unable to resolve simulation run parameters in component '{0}'",
                                   fc.id)
              fc.simulation.add(run2)
          for record in ct.simulation.records:
              try:
                  record2 = Record(fc.paths[record.quantity].value,
                                   fc.parameters[record.scale].numeric_value if record.scale else 1,
                                   fc.texts[record.color].value if record.color else '
              except:
                  raise ModelError("Unable to resolve simulation record parameters in component '{0}'",
                                   fc.id)
              fc.simulation.add(record2)
          for event_record in ct.simulation.event_records:
              try:
                  event_record2 = EventRecord(fc.paths[event_record.quantity].value,
                                   fc.texts[event_record.eventPort].value)
              except:
                  raise ModelError("Unable to resolve simulation event_record parameters in component '{0}'",
                                   fc.id)
              fc.simulation.add(event_record2)
          for dd in ct.simulation.data_displays:
              try:
                  dd2 = DataDisplay(fc.texts[dd.title].value,
                                    '')
                  if 'timeScale' in fc.parameters:
                      dd2.timeScale = fc.parameters['timeScale'].numeric_value
              except:
                  raise ModelError("Unable to resolve simulation display parameters in component '{0}'",
                                   fc.id)
              fc.simulation.add(dd2)
          for dw in ct.simulation.data_writers:
              try:
                  path = '.'
                  if fc.texts[dw.path] and fc.texts[dw.path].value:
                      path = fc.texts[dw.path].value
                  dw2 = DataWriter(path,
                                   fc.texts[dw.file_name].value)
              except:
                  raise ModelError("Unable to resolve simulation writer parameters in component '{0}'",
                                   fc.id)
              fc.simulation.add(dw2)
          for ew in ct.simulation.event_writers:
              try:
                  path = '.'
                  if fc.texts[ew.path] and fc.texts[ew.path].value:
                      path = fc.texts[ew.path].value
                  ew2 = EventWriter(path,
                                   fc.texts[ew.file_name].value,
                                   fc.texts[ew.format].value)
              except:
                  raise ModelError("Unable to resolve simulation writer parameters in component '{0}'",
                                   fc.id)
              fc.simulation.add(ew2)