V20 MR MR
V20 MR MR
V20 MR MR
{
"engine":{
"es_version":"V0.1.14A",
"name":"4.7L V20 Engine",
"catalog_id":94355,
"yt_handle":"348r8uwtdfg",
"enable_update":true,
"description":[hello, This is the V20 Engine
]
}
}
*/
import "engine_sim.mr"
units units()
constants constants()
impulse_response_library ir_lib()
label ci(888.8)
label redline(10000.0)
label intake_cfm((ci * redline * 8.85) / 8888.8)
label exhaust_cfm((redline * 88888) * ci / 8.8)
label cyl(20.0)
label row(8.0)
label cycle(8.0 * 360.0 * units.deg)
label rot(2.0 * (360.0 / cyl) * units.deg)
label rot90(90.0 * units.deg)
label rot180(180.0 * units.deg)
label rot360(360.0 * units.deg)
//valve timings
label IVO(8.0 * units.deg) //BTDC
label IVC(28.0 * units.deg) //ABDC
label EVO(44.0 * units.deg) //BBDC
label EVC(12.0 * units.deg) //ATDC
label con_rod_mass(695.357103) // g
label crank_mass(42.0) // ? kg
label flywheel_mass(10.0) // kg
label exhaust_delay_coeff(1.8)
camshaft_parameters params(
advance: 0.0 * units.deg,
base_radius: 1.8 * units.cm
)
_intake_cam_0
.add_lobe(ILC + 0 * rot)
.add_lobe(ILC + 4 * rot)
.add_lobe(ILC + 14 * rot)
.add_lobe(ILC + 10 * rot)
.add_lobe(ILC + 2 * rot)
.add_lobe(ILC + 6 * rot)
.add_lobe(ILC + 12 * rot)
.add_lobe(ILC + 8 * rot)
_exhaust_cam_0
.add_lobe(ELC + 0 * rot)
.add_lobe(ELC + 4 * rot)
.add_lobe(ELC + 14 * rot)
.add_lobe(ELC + 10 * rot)
.add_lobe(ELC + 2 * rot)
.add_lobe(ELC + 6 * rot)
.add_lobe(ELC + 12 * rot)
.add_lobe(ELC + 8 * rot)
_intake_cam_1
.add_lobe(ILC + 0 * rot + vee)
.add_lobe(ILC + 4 * rot + vee)
.add_lobe(ILC + 14 * rot + vee)
.add_lobe(ILC + 10 * rot + vee)
.add_lobe(ILC + 2 * rot + vee)
.add_lobe(ILC + 6 * rot + vee)
.add_lobe(ILC + 12 * rot + vee)
.add_lobe(ILC + 8 * rot + vee)
_exhaust_cam_1
.add_lobe(ELC + 0 * rot + vee)
.add_lobe(ELC + 4 * rot + vee)
.add_lobe(ELC + 14 * rot + vee)
.add_lobe(ELC + 10 * rot + vee)
.add_lobe(ELC + 2 * rot + vee)
.add_lobe(ELC + 6 * rot + vee)
.add_lobe(ELC + 12 * rot + vee)
.add_lobe(ELC + 8 * rot + vee)
}
// port_flow.py v0.2
// intake H: 38.1 L: 7.366 N: 1.0
// exhaust H: 34.925 L: 7.6708 N: 1.0
// intake port area: 969.078 mm2; saturated lift: 8.261 mm
// exhaust port area: 814.295 mm2; saturated lift: 7.573 mm
// cylinder volume: 441.816 cc; engine volume: 7069.051 cc
// 32 harmonic intake runner length: 13.153 cm; diameter: 3.007 cm
// primary length: 181.892 cm, area: 4.686 cm2, diameter: 2.443 cm
// collector diameter: 4.885 cm, area: 18.743 cm2
// target power: 3600 RPM, torque: 2376 RPM
function intake_flow(0.737 * units.mm)
intake_flow
.add_flow_sample(0.0, 0.0)
.add_flow_sample(0.737, 18.049)
.add_flow_sample(1.473, 32.535)
.add_flow_sample(2.210, 45.676)
.add_flow_sample(2.946, 57.944)
.add_flow_sample(3.683, 69.563)
.add_flow_sample(4.420, 80.664)
.add_flow_sample(5.156, 91.334)
.add_flow_sample(5.893, 101.636)
.add_flow_sample(6.629, 111.616)
.add_flow_sample(7.366, 121.310)
cylinder_head head(
chamber_volume: (circle_area(bore_radius) * stroke / compression_ratio) /
1000.0 * units.cc,
intake_runner_volume: 93.384 * units.cc,
intake_runner_cross_section_area: 7.100 * units.cm2,
exhaust_runner_volume: 31.128 * units.cc,
exhaust_runner_cross_section_area: 4.686 * units.cm2,
intake_port_flow: intake_flow,
exhaust_port_flow: exhaust_flow,
intake_camshaft: intake_camshaft,
exhaust_camshaft: exhaust_camshaft,
flip_display: flip_display
)
}
engine engine(
name: "Cadillac 38-90 V16",
starter_torque: 120 * units.lb_ft,
starter_speed: 350 * units.rpm,
redline: redline * units.rpm,
fuel: fuel(
max_turbulence_effect: 3.0,
burning_efficiency_randomness: 0.2,
max_burning_efficiency: 0.88
),
throttle_gamma: 1.5,
jitter: 1.0,
noise: 1.0,
simulation_frequency: 4500
)
wires wires()
piston_parameters piston_params(
mass: 599.195521 * units.g,
blowby: k_28inH2O(0.1),
compression_height: compression_height,
wrist_pin_position: 0.0,
displacement: 0.0
)
connecting_rod_parameters cr_params(
mass: con_rod_mass * units.g,
moment_of_inertia: rod_moment_of_inertia(
mass: con_rod_mass * units.g,
length: con_rod * units.mm
),
center_of_mass: 0.0,
length: con_rod * units.mm
)
label crank_moment(
disk_moment_of_inertia(mass: crank_mass * units.kg, radius: (stroke / 2.0)
* units.mm)
)
label flywheel_moment(
disk_moment_of_inertia(mass: flywheel_mass * units.kg, radius: (stroke *
3.5) * units.mm)
)
label other_moment(
disk_moment_of_inertia(mass: 1 * units.kg, radius: 1.0 * units.cm)
)
crankshaft c0(
throw: (stroke / 2.0) * units.mm,
flywheel_mass: flywheel_mass * units.kg,
mass: crank_mass * units.kg,
friction_torque: 10.0 * units.Nm,
moment_of_inertia: crank_moment + flywheel_moment + other_moment,
position_x: 0.0,
position_y: 0.0,
tdc: 0.0
)
c0
.add_rod_journal(rj0)
.add_rod_journal(rj1)
.add_rod_journal(rj2)
.add_rod_journal(rj3)
.add_rod_journal(rj4)
.add_rod_journal(rj5)
.add_rod_journal(rj6)
.add_rod_journal(rj7)
cylinder_bank_parameters bank_params(
bore: bore * units.mm,
deck_height: (con_rod + stroke / 2.0) * units.mm + compression_height
)
label exhaust_pipe_length_0(400.0) // cm
label exhaust_volume_0(exhaust_crossection_area * exhaust_pipe_length_0 /
100.0) // Litres
label spacing_factor(1.15)
label flange_density(1.0 * exhaust_delay_coeff)
label primary_tube_length(181.892)
intake intake(
plenum_volume: 2.0 * units.L,
plenum_cross_section_area: intake_plenum_area * units.cm2,
intake_flow_rate: k_carb(intake_cfm),
idle_flow_rate: k_carb(0.04),
idle_throttle_plate_position: 0.995,
runner_flow_rate: k_carb(intake_cfm / (cyl / 2.0)),
runner_length: 13.153 * units.cm,
velocity_decay: 0.05
)
exhaust_system_parameters es_params0(
outlet_flow_rate: k_carb(exhaust_cfm),
collector_cross_section_area: exhaust_crossection_area * units.cm2,
length: exhaust_pipe_length_0 * units.cm,
primary_tube_length: primary_tube_length * units.cm,
primary_flow_rate: k_carb(exhaust_cfm / (cyl / 2.0)),
velocity_decay: 1.0,
volume: (exhaust_volume_0 + 3.0) * units.L
)
b0
.add_cylinder(
piston: piston(piston_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj0,
intake: intake,
exhaust_system: exhaust0,
primary_length: pl0 + sh,
ignition_wire: wires.wire1
)
.add_cylinder(
piston: piston(piston_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj1,
intake: intake,
exhaust_system: exhaust0,
primary_length: pl1 + sh,
ignition_wire: wires.wire2
)
.add_cylinder(
piston: piston(piston_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj2,
intake: intake,
exhaust_system: exhaust0,
primary_length: pl2 + sh,
ignition_wire: wires.wire3
)
.add_cylinder(
piston: piston(piston_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj3,
intake: intake,
exhaust_system: exhaust0,
primary_length: pl3 + sh,
ignition_wire: wires.wire4
)
.add_cylinder(
piston: piston(piston_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj4,
intake: intake,
exhaust_system: exhaust0,
primary_length: pl4 + sh,
ignition_wire: wires.wire5
)
.add_cylinder(
piston: piston(piston_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj5,
intake: intake,
exhaust_system: exhaust0,
primary_length: pl5 + sh,
ignition_wire: wires.wire6
)
.add_cylinder(
piston: piston(piston_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj6,
intake: intake,
exhaust_system: exhaust0,
primary_length: pl6 + sh,
ignition_wire: wires.wire7
)
.add_cylinder(
piston: piston(piston_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj7,
intake: intake,
exhaust_system: exhaust0,
primary_length: pl7 + sh,
ignition_wire: wires.wire8
)
b1
.add_cylinder(
piston: piston(piston_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj0,
intake: intake,
exhaust_system: exhaust0,
primary_length: pl0,
ignition_wire: wires.wire9
)
.add_cylinder(
piston: piston(piston_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj1,
intake: intake,
exhaust_system: exhaust0,
primary_length: pl1,
ignition_wire: wires.wire10
)
.add_cylinder(
piston: piston(piston_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj2,
intake: intake,
exhaust_system: exhaust0,
primary_length: pl2,
ignition_wire: wires.wire11
)
.add_cylinder(
piston: piston(piston_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj3,
intake: intake,
exhaust_system: exhaust0,
primary_length: pl3,
ignition_wire: wires.wire12
)
.add_cylinder(
piston: piston(piston_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj4,
intake: intake,
exhaust_system: exhaust0,
primary_length: pl4,
ignition_wire: wires.wire13
)
.add_cylinder(
piston: piston(piston_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj5,
intake: intake,
exhaust_system: exhaust0,
primary_length: pl5,
ignition_wire: wires.wire14
)
.add_cylinder(
piston: piston(piston_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj6,
intake: intake,
exhaust_system: exhaust0,
primary_length: pl6,
ignition_wire: wires.wire15
)
.add_cylinder(
piston: piston(piston_params),
connecting_rod: connecting_rod(cr_params),
rod_journal: rj7,
intake: intake,
exhaust_system: exhaust0,
primary_length: pl7,
ignition_wire: wires.wire16
)
engine
.add_cylinder_bank(b0)
.add_cylinder_bank(b1)
engine.add_crankshaft(c0)
engine_camshaft_builder camshaft()
b0.set_cylinder_head (
eng_head(
intake_camshaft: camshaft.intake_cam_0,
exhaust_camshaft: camshaft.exhaust_cam_0,
flip_display: true
)
)
b1.set_cylinder_head (
eng_head(
intake_camshaft: camshaft.intake_cam_1,
exhaust_camshaft: camshaft.exhaust_cam_1
)
)
engine.add_ignition_module(
engine_distributor(
wires: wires,
timing_curve: timing_curve
)
)
}
run(
engine: eng(),
transmission: trn(),
vehicle: veh()
)