454 vtec
4 removals
258 lines
17 additions
270 lines
import "engine_sim.mr"
import "engine_sim.mr"
units units()
units units()
constants constants()
constants constants()
impulse_response_library ir_lib()
impulse_response_library ir_lib()
private node wires {
private node wires {
output wire1: ignition_wire();
output wire1: ignition_wire();
output wire2: ignition_wire();
output wire2: ignition_wire();
output wire3: ignition_wire();
output wire3: ignition_wire();
output wire4: ignition_wire();
output wire4: ignition_wire();
output wire5: ignition_wire();
output wire5: ignition_wire();
output wire6: ignition_wire();
output wire6: ignition_wire();
output wire7: ignition_wire();
output wire7: ignition_wire();
output wire8: ignition_wire();
output wire8: ignition_wire();
}
}
public node chevy_bbc_peanut_port_head {
public node chevy_bbc_peanut_port_head {
input intake_camshaft;
input intake_camshaft;
input exhaust_camshaft;
input exhaust_camshaft;
input vtec_intake_camshaft;
input vtec_exhaust_camshaft;
input flip_display: false;
input flip_display: false;
alias output __out: head;
alias output __out: head;
function intake_flow(50 * units.thou)
function intake_flow(50 * units.thou)
intake_flow
intake_flow
.add_flow_sample(0, 0)
.add_flow_sample(0, 0)
.add_flow_sample(50, 25)
.add_flow_sample(50, 25)
.add_flow_sample(100, 75)
.add_flow_sample(100, 75)
.add_flow_sample(150, 100)
.add_flow_sample(150, 100)
.add_flow_sample(200, 130)
.add_flow_sample(200, 130)
.add_flow_sample(250, 180)
.add_flow_sample(250, 180)
.add_flow_sample(300, 190)
.add_flow_sample(300, 190)
.add_flow_sample(350, 220)
.add_flow_sample(350, 220)
.add_flow_sample(400, 240)
.add_flow_sample(400, 240)
.add_flow_sample(450, 250)
.add_flow_sample(450, 250)
.add_flow_sample(500, 260)
.add_flow_sample(500, 260)
.add_flow_sample(550, 260)
.add_flow_sample(550, 260)
.add_flow_sample(600, 260)
.add_flow_sample(600, 260)
.add_flow_sample(650, 255)
.add_flow_sample(650, 255)
.add_flow_sample(700, 250)
.add_flow_sample(700, 250)
function exhaust_flow(50 * units.thou)
function exhaust_flow(50 * units.thou)
exhaust_flow
exhaust_flow
.add_flow_sample(0, 0)
.add_flow_sample(0, 0)
.add_flow_sample(50, 25)
.add_flow_sample(50, 25)
.add_flow_sample(100, 50)
.add_flow_sample(100, 50)
.add_flow_sample(150, 75)
.add_flow_sample(150, 75)
.add_flow_sample(200, 100)
.add_flow_sample(200, 100)
.add_flow_sample(250, 125)
.add_flow_sample(250, 125)
.add_flow_sample(300, 160)
.add_flow_sample(300, 160)
.add_flow_sample(350, 175)
.add_flow_sample(350, 175)
.add_flow_sample(400, 180)
.add_flow_sample(400, 180)
.add_flow_sample(450, 190)
.add_flow_sample(450, 190)
.add_flow_sample(500, 200)
.add_flow_sample(500, 200)
.add_flow_sample(550, 205)
.add_flow_sample(550, 205)
.add_flow_sample(600, 210)
.add_flow_sample(600, 210)
.add_flow_sample(650, 210)
.add_flow_sample(650, 210)
.add_flow_sample(700, 210)
.add_flow_sample(700, 210)
cylinder_head head(
generic_cylinder_head head(
chamber_volume: 118.0 * units.cc,
chamber_volume: 118.0 * units.cc,
intake_runner_volume: 189.0 * units.cc,
intake_runner_volume: 189.0 * units.cc,
intake_runner_cross_section_area: 37.8 * units.cm2,
intake_runner_cross_section_area: 37.8 * units.cm2,
intake_port_flow: intake_flow,
intake_port_flow: intake_flow,
exhaust_port_flow: exhaust_flow,
exhaust_port_flow: exhaust_flow,
intake_camshaft: intake_camshaft,
valvetrain: vtec_valvetrain(
exhaust_camshaft: exhaust_camshaft,
min_rpm: 3000 * units.rpm,
intake_camshaft: intake_camshaft,
exhaust_camshaft: exhaust_camshaft,
vtec_intake_camshaft: vtec_intake_camshaft,
vtec_exhaust_camshaft: vtec_exhaust_camshaft
),
flip_display: flip_display
flip_display: flip_display
)
)
}
}
public node chev_truck_454 {
public node chev_truck_454_vtec {
alias output __out: engine;
alias output __out: engine;
wires wires()
wires wires()
engine engine(
engine engine(
name: "Chev. 454 V8",
name: "Chev. 454 V8",
starter_torque: 200 * units.lb_ft,
starter_torque: 200 * units.lb_ft,
redline: 5500 * units.rpm,
redline: 5500 * units.rpm,
fuel: fuel(
fuel: fuel(
max_turbulence_effect: 3.0,
max_turbulence_effect: 3.0,
burning_efficiency_randomness: 0.5,
burning_efficiency_randomness: 0.5,
max_burning_efficiency: 0.85),
max_burning_efficiency: 0.85),
throttle_gamma: 1.5
throttle_gamma: 1.5
)
)
crankshaft c0(
crankshaft c0(
throw: 2.0 * units.inch,
throw: 2.0 * units.inch,
flywheel_mass: 29 * 2 * units.lb,
flywheel_mass: 29 * 2 * units.lb,
mass: 75 * units.lb,
mass: 75 * units.lb,
friction_torque: 10.0 * units.lb_ft,
friction_torque: 10.0 * units.lb_ft,
moment_of_inertia: 0.22986844776863666 * 2,
moment_of_inertia: 0.22986844776863666 * 2,
position_x: 0.0,
position_x: 0.0,
position_y: 0.0,
position_y: 0.0,
tdc: constants.pi / 4
tdc: constants.pi / 4
)
)
rod_journal rj0(angle: 0.0)
rod_journal rj0(angle: 0.0)
rod_journal rj1(angle: -constants.pi / 2)
rod_journal rj1(angle: -constants.pi / 2)
rod_journal rj2(angle: -3.0 * constants.pi / 2)
rod_journal rj2(angle: -3.0 * constants.pi / 2)
rod_journal rj3(angle: constants.pi)
rod_journal rj3(angle: constants.pi)
c0
c0
.add_rod_journal(rj0)
.add_rod_journal(rj0)
.add_rod_journal(rj1)
.add_rod_journal(rj1)
.add_rod_journal(rj2)
.add_rod_journal(rj2)
.add_rod_journal(rj3)
.add_rod_journal(rj3)
piston_parameters piston_params(
piston_parameters piston_params(
mass: 880 * units.g,
mass: 880 * units.g,
blowby: 0,
blowby: 0,
compression_height: 1.640 * units.inch,
compression_height: 1.640 * units.inch,
wrist_pin_position: 0.0,
wrist_pin_position: 0.0,
displacement: 0.0
displacement: 0.0
)
)
connecting_rod_parameters cr_params(
connecting_rod_parameters cr_params(
mass: 785.0 * units.g,
mass: 785.0 * units.g,
moment_of_inertia: 0.0015884918028487504,
moment_of_inertia: 0.0015884918028487504,
center_of_mass: 0.0,
center_of_mass: 0.0,
length: 6.135 * units.inch
length: 6.135 * units.inch
)
)
cylinder_bank_parameters bank_params(
cylinder_bank_parameters bank_params(
bore: 4.25 * units.inch,
bore: 4.25 * units.inch,
deck_height: 9.8 * units.inch
deck_height: 9.8 * units.inch
)
)
chevy_bbc_stock_intake intake(
chevy_bbc_stock_intake intake(
carburetor_cfm: 650.0,
carburetor_cfm: 650.0,
idle_flow_rate_cfm: 0.007,
idle_flow_rate_cfm: 0.007,
idle_throttle_plate_position: 0.991
idle_throttle_plate_position: 0.991
)
)
exhaust_system_parameters es_params(
exhaust_system_parameters es_params(
outlet_flow_rate: k_carb(550.0),
outlet_flow_rate: k_carb(550.0),
primary_tube_length: 10.0 * units.inch,
primary_tube_length: 10.0 * units.inch,
primary_flow_rate: k_carb(90.0),
primary_flow_rate: k_carb(90.0),
velocity_decay: 1.0, //0.5
velocity_decay: 1.0, //0.5
volume: 50.0 * units.L
volume: 50.0 * units.L
)
)
exhaust_system exhaust0(es_params, audio_volume: 1.0, impulse_response: ir_lib.default_0)
exhaust_system exhaust0(es_params, audio_volume: 1.0, impulse_response: ir_lib.default_0)
exhaust_system exhaust1(es_params, audio_volume: 0.1, impulse_response: ir_lib.default_0)
exhaust_system exhaust1(es_params, audio_volume: 0.1, impulse_response: ir_lib.default_0)
cylinder_bank b0(bank_params, angle: -45 * units.deg)
cylinder_bank b0(bank_params, angle: -45 * units.deg)
b0
b0
.add_cylinder(
.add_cylinder(
piston: piston(piston_params, blowby: k_28inH2O(0.2)),
piston: piston(piston_params, blowby: k_28inH2O(0.2)),
connecting_rod: connecting_rod(cr_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj0,
rod_journal: rj0,
intake: intake,
intake: intake,
exhaust_system: exhaust0,
exhaust_system: exhaust0,
ignition_wire: wires.wire1
ignition_wire: wires.wire1
)
)
.add_cylinder(
.add_cylinder(
piston: piston(piston_params, blowby: k_28inH2O(0.6)),
piston: piston(piston_params, blowby: k_28inH2O(0.6)),
connecting_rod: connecting_rod(cr_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj1,
rod_journal: rj1,
intake: intake,
intake: intake,
exhaust_system: exhaust0,
exhaust_system: exhaust0,
ignition_wire: wires.wire3
ignition_wire: wires.wire3
)
)
.add_cylinder(
.add_cylinder(
piston: piston(piston_params, blowby: k_28inH2O(0.6)),
piston: piston(piston_params, blowby: k_28inH2O(0.6)),
connecting_rod: connecting_rod(cr_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj2,
rod_journal: rj2,
intake: intake,
intake: intake,
exhaust_system: exhaust0,
exhaust_system: exhaust0,
ignition_wire: wires.wire5
ignition_wire: wires.wire5
)
)
.add_cylinder(
.add_cylinder(
piston: piston(piston_params, blowby: k_28inH2O(0.4)),
piston: piston(piston_params, blowby: k_28inH2O(0.4)),
connecting_rod: connecting_rod(cr_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj3,
rod_journal: rj3,
intake: intake,
intake: intake,
exhaust_system: exhaust0,
exhaust_system: exhaust0,
ignition_wire: wires.wire7
ignition_wire: wires.wire7
)
)
cylinder_bank b1(bank_params, angle: 45.0 * units.deg)
cylinder_bank b1(bank_params, angle: 45.0 * units.deg)
b1
b1
.add_cylinder(
.add_cylinder(
piston: piston(piston_params, blowby: k_28inH2O(0.2)),
piston: piston(piston_params, blowby: k_28inH2O(0.2)),
connecting_rod: connecting_rod(cr_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj0,
rod_journal: rj0,
intake: intake,
intake: intake,
exhaust_system: exhaust1,
exhaust_system: exhaust1,
ignition_wire: wires.wire2
ignition_wire: wires.wire2
)
)
.add_cylinder(
.add_cylinder(
piston: piston(piston_params, blowby: k_28inH2O(0.2)),
piston: piston(piston_params, blowby: k_28inH2O(0.2)),
connecting_rod: connecting_rod(cr_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj1,
rod_journal: rj1,
intake: intake,
intake: intake,
exhaust_system: exhaust1,
exhaust_system: exhaust1,
ignition_wire: wires.wire4
ignition_wire: wires.wire4
)
)
.add_cylinder(
.add_cylinder(
piston: piston(piston_params, blowby: k_28inH2O(0.6)),
piston: piston(piston_params, blowby: k_28inH2O(0.6)),
connecting_rod: connecting_rod(cr_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj2,
rod_journal: rj2,
intake: intake,
intake: intake,
exhaust_system: exhaust1,
exhaust_system: exhaust1,
ignition_wire: wires.wire6
ignition_wire: wires.wire6
)
)
.add_cylinder(
.add_cylinder(
piston: piston(piston_params, blowby: k_28inH2O(0.6)),
piston: piston(piston_params, blowby: k_28inH2O(0.6)),
connecting_rod: connecting_rod(cr_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj3,
rod_journal: rj3,
intake: intake,
intake: intake,
exhaust_system: exhaust1,
exhaust_system: exhaust1,
ignition_wire: wires.wire8
ignition_wire: wires.wire8
)
)
engine
engine
.add_cylinder_bank(b0)
.add_cylinder_bank(b0)
.add_cylinder_bank(b1)
.add_cylinder_bank(b1)
engine.add_crankshaft(c0)
engine.add_crankshaft(c0)
chevy_454_stock_camshaft camshaft()
chevy_454_stock_camshaft camshaft()
comp_cams_magnum_11_470_8 vtec_camshaft()
b0.set_cylinder_head (
b0.set_cylinder_head (
chevy_bbc_peanut_port_head(
chevy_bbc_peanut_port_head(
intake_camshaft: camshaft.intake_cam_0,
intake_camshaft: camshaft.intake_cam_0,
exhaust_camshaft: camshaft.exhaust_cam_0
exhaust_camshaft: camshaft.exhaust_cam_0,
vtec_intake_camshaft: vtec_camshaft.intake_cam_0,
vtec_exhaust_camshaft: vtec_camshaft.exhaust_cam_0
)
)
)
)
b1.set_cylinder_head (
b1.set_cylinder_head (
chevy_bbc_peanut_port_head(
chevy_bbc_peanut_port_head(
intake_camshaft: camshaft.intake_cam_1,
intake_camshaft: camshaft.intake_cam_1,
exhaust_camshaft: camshaft.exhaust_cam_1,
exhaust_camshaft: camshaft.exhaust_cam_1,
vtec_intake_camshaft: vtec_camshaft.intake_cam_1,
vtec_exhaust_camshaft: vtec_camshaft.exhaust_cam_1,
flip_display: true
flip_display: true
)
)
)
)
function timing_curve(1000 * units.rpm)
function timing_curve(1000 * units.rpm)
timing_curve
timing_curve
.add_sample(0000 * units.rpm, 12 * units.deg)
.add_sample(0000 * units.rpm, 12 * units.deg)
.add_sample(1000 * units.rpm, 12 * units.deg)
.add_sample(1000 * units.rpm, 12 * units.deg)
.add_sample(2000 * units.rpm, 20 * units.deg)
.add_sample(2000 * units.rpm, 20 * units.deg)
.add_sample(3000 * units.rpm, 30 * units.deg)
.add_sample(3000 * units.rpm, 30 * units.deg)
.add_sample(4000 * units.rpm, 38 * units.deg)
.add_sample(4000 * units.rpm, 38 * units.deg)
.add_sample(5000 * units.rpm, 38 * units.deg)
.add_sample(5000 * units.rpm, 38 * units.deg)
.add_sample(6000 * units.rpm, 38 * units.deg)
.add_sample(6000 * units.rpm, 38 * units.deg)
engine.add_ignition_module(
engine.add_ignition_module(
chevy_bbc_distributor(
chevy_bbc_distributor(
wires: wires,
wires: wires,
timing_curve: timing_curve,
timing_curve: timing_curve,
rev_limit: 7000 * units.rpm
rev_limit: 7000 * units.rpm
)
)
)
)
}
}