()
return 0
Run the simulation
Run the simulation
Run the simulation
def main() -> int:
    """Run the simulation"""
    parser = argparse.ArgumentParser(
        prog="opentrons_simulate", description="Simulate an OT-2 protocol"
    )
    parser = get_arguments(parser)

    args = parser.parse_args()
    # Try to migrate api v1 containers if needed

    duration_estimator = DurationEstimator() if args.estimate_duration else None

    runlog, maybe_bundle = simulate(
        args.protocol,
        args.protocol.name,
        getattr(args, "custom_labware_path", []),
        getattr(args, "custom_data_path", []) + getattr(args, "custom_data_file", []),
        duration_estimator=duration_estimator,
        hardware_simulator_file_path=getattr(args, "custom_hardware_simulator_file"),
        log_level=args.log_level,
    )

    if maybe_bundle:
        bundle_name = getattr(args, "bundle", None)
        if bundle_name == args.protocol.name:
            raise RuntimeError("Bundle path and input path must be different")
        bundle_dest = _get_bundle_dest(
            bundle_name, "PROTOCOL.ot2.zip", args.protocol.name
        )
        if bundle_dest:
            bundle.create_bundle(maybe_bundle, bundle_dest)

    if args.output == "runlog":
        print(format_runlog(runlog))

    if duration_estimator:
        duration_seconds = duration_estimator.get_total_duration()
        hours = int(duration_seconds / 60 / 60)
        minutes = int((duration_seconds % (60 * 60)) / 60)
        print("--------------------------------------------------------------")
        print(f"Estimated protocol duration: {hours}h:{minutes}m")
        print("--------------------------------------------------------------")
        print("WARNING: Protocol duration estimation is an experimental feature")

    return 0
def main ( ) -> int : parser = argparse . ArgumentParser ( prog = "opentrons_simulate" , description = "Simulate an OT-2 protocol" ) parser = get_arguments ( parser ) args = parser . parse_args ( ) # Try to migrate api v1 containers if needed duration_estimator = DurationEstimator ( ) if args . estimate_duration else None runlog , maybe_bundle = simulate ( args . protocol , args . protocol . name , getattr ( args , "custom_labware_path" , [ ] ) , getattr ( args , "custom_data_path" , [ ] ) + getattr ( args , "custom_data_file" , [ ] ) , duration_estimator = duration_estimator , hardware_simulator_file_path = getattr ( args , "custom_hardware_simulator_file" ) , log_level = args . log_level , ) if maybe_bundle : bundle_name = getattr ( args , "bundle" , None ) if bundle_name == args . protocol . name : raise RuntimeError ( "Bundle path and input path must be different" ) bundle_dest = _get_bundle_dest ( bundle_name , "PROTOCOL.ot2.zip" , args . protocol . name ) if bundle_dest : bundle . create_bundle ( maybe_bundle , bundle_dest ) if args . output == "runlog" : print ( format_runlog ( runlog ) ) if duration_estimator : duration_seconds = duration_estimator . get_total_duration ( ) hours = int ( duration_seconds / 60 / 60 ) minutes = int ( ( duration_seconds % ( 60 * 60 ) ) / 60 ) print ( "--------------------------------------------------------------" ) print ( f"Estimated protocol duration: {hours}h:{minutes}m" ) print ( "--------------------------------------------------------------" ) print ( "WARNING: Protocol duration estimation is an experimental feature" ) return 0