ange-yaghi / engine-sim

Combustion engine simulator that generates realistic audio.
http://engine-sim.parts/
MIT License
8.7k stars 788 forks source link

Single Cylinder doesnt want to run #130

Closed HawkHunt closed 2 years ago

HawkHunt commented 2 years ago

Basically, I am trying to get to grips with creating engines.

I made this little CRF250 engine but it just does not want to run, I based a lot of the parts off of the Kohler engine so its not really a CRF250 engine but its close enough for me to learn.

I tried taking out timing, adding timing, lightening the crank, making the crank heavier (same with the flywheel) I gave the starter more RPM, but it just doesnt run.

`import "engine_sim.mr"

units units() constants constants() impulse_response_library ir_lib()

private node wires { output wire1: ignition_wire(); }

label cycle(2 360 units.deg)

public node singleCylinder_distributor { input wires; input timing_curve; input rev_limit: 5500 units.rpm; alias output __out: ignition_module(timing_curve: timing_curve, rev_limit: rev_limit) .connect_wire(wires.wire1, 0 units.deg); }

public node CRF250F { alias output __out: engine;

engine engine(
    name: "CRF250F",
    starter_torque: 50 * units.lb_ft,
    starter_speed: 1000 * units.rpm,
    redline: 3600 * units.rpm
)

wires wires()

crankshaft c0(
    throw: 63 * units.mm / 2,
    flywheel_mass: 10 * units.lb,
    mass: 10 * units.lb,
    friction_torque: 10.0 * units.lb_ft,
    moment_of_inertia: 0.22986844776863666 * 0.5,
    position_x: 0.0,
    position_y: 0.0,
    tdc: constants.pi / 4
)

rod_journal rj0(angle: 0.0)
c0
    .add_rod_journal(rj0)

piston_parameters piston_params(
    mass: 100 * units.g,
    //blowby: k_28inH2O(0.1),
    compression_height: 1.0 * units.inch,
    wrist_pin_position: 0.0,
    displacement: 0.0
)

connecting_rod_parameters cr_params(
    mass: 90.0 * units.g,
    moment_of_inertia: 0.0015884918028487504,
    center_of_mass: 0.0,
    length: 4.0 * units.inch
)

cylinder_bank_parameters bank_params(
    bore: 71 * units.mm,
    deck_height: (4.0 + 1) * units.inch + 69 * units.mm / 2
)

intake intake(
    plenum_volume: 1.0 * units.L,
    plenum_cross_section_area: 10.0 * units.cm2,
    intake_flow_rate: k_carb(50.0),
    idle_flow_rate: k_carb(0.0),
    idle_throttle_plate_position: 0.96,
    throttle_gamma: 1.0
)

exhaust_system_parameters es_params(
    outlet_flow_rate: k_carb(300.0),
    primary_tube_length: 10.0 * units.inch,
    primary_flow_rate: k_carb(200.0),
    velocity_decay: 1.0,
    volume: 20.0 * units.L
)

exhaust_system exhaust0(
    es_params,
    audio_volume: 1.0,
    impulse_response: ir_lib.default_0
)

cylinder_bank b0(bank_params, angle: 0 * units.deg)
b0
    .add_cylinder(
        piston: piston(piston_params, blowby: k_28inH2O(0.1)),
        connecting_rod: connecting_rod(cr_params),
        rod_journal: rj0,
        intake: intake,
        exhaust_system: exhaust0,
        ignition_wire: wires.wire1
    )

engine
    .add_cylinder_bank(b0)

engine.add_crankshaft(c0)

harmonic_cam_lobe lobe(
    duration_at_50_thou: 160 * units.deg,
    gamma: 1.1,
    lift: 200 * units.thou,
    steps: 100
)

vtwin90_camshaft_builder camshaft(
    lobe_profile: lobe,
    lobe_separation: 114 * units.deg,
    base_radius: 500 * units.thou
)

b0.set_cylinder_head (
    generic_small_engine_head(
        chamber_volume: 50 * units.cc,
        intake_camshaft: camshaft.intake_cam_0,
        exhaust_camshaft: camshaft.exhaust_cam_0
    )
)

function timing_curve(1000 * units.rpm)
timing_curve
    .add_sample(0000 * units.rpm, 50 * units.deg)
    .add_sample(1000 * units.rpm, 50 * units.deg)
    .add_sample(2000 * units.rpm, 50 * units.deg)
    .add_sample(3000 * units.rpm, 50 * units.deg)
    .add_sample(4000 * units.rpm, 50 * units.deg)

engine.add_ignition_module(
    singleCylinder_distributor(
        wires: wires,
        timing_curve: timing_curve,
        rev_limit: 5000 * units.rpm
    ))

} `

finicu212 commented 2 years ago

what a coincidence, I just made this engine: https://catalog.engine-sim.parts/parts/13

could do with some timing tuning, I think

HawkHunt commented 2 years ago

Finicu212 your version is 1000 times better than mine. I got it to run and rev, the crank was 90 deg out of position. I advanced it to 45 degrees infront of the bank angle and it fired up. My engine is terrible compared to yours though! I have so much more to learn

finicu212 commented 2 years ago

This is my first engine where I did everything properly. with a simulator as new as this, we're all beginners. I really recommend using the Discord as a learning resource, everyone in this community is very helpful, you can try out all the different engines shared in the #engine-sharing text channel, and ask for more help on the #support channel

Jckf commented 2 years ago

Please join our Discord for further assistance.