0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Engine Simulatorの作法 その5

Posted at

概要

Engine Simulatorの作法を調べてみた。
練習問題やってみた。

練習問題

90度V型2気筒の4サイクルエンジンを作れ。

写真

image.png

サンプルコード

import "engine_sim.mr"
units units()
constants constants()
impulse_response_library ir_lib()

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

public node make {
	alias output __out: engine;
	engine engine(
		name: "test4",
		starter_torque: 50 * units.lb_ft,
		starter_speed: 500 * units.rpm,
		redline: 3600 * units.rpm
	)
	wires wires()
	crankshaft c0(
		throw: 69 * units.mm / 2,
		flywheel_mass: 5 * units.lb,
		mass: 5 * 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)
	engine.add_crankshaft(c0)

	piston_parameters piston_params(
		mass: 400 * units.g,
		compression_height: 1.0 * units.inch,
		wrist_pin_position: 0.0,
		displacement: 0.0
	)
	connecting_rod_parameters cr_params(
		mass: 300.0 * units.g,
		moment_of_inertia: 0.0015884918028487504,
		center_of_mass: 0.0,
		length: 4.0 * units.inch
	)
	cylinder_bank_parameters bank_params(
		bore: 83 * 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: -45 * 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
	)
	cylinder_bank b1(bank_params, angle: 45.0 * units.deg)
	b1.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.wire2
	)
	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
		)
	)
	b1.set_cylinder_head (
		generic_small_engine_head(
			chamber_volume: 50 * units.cc,
			intake_camshaft: camshaft.intake_cam_1,
			exhaust_camshaft: camshaft.exhaust_cam_1,
			flip_display: true
		)
	)
	engine.add_cylinder_bank(b0).add_cylinder_bank(b1)

	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(
		vtwin90_distributor(
			wires: wires,
			timing_curve: timing_curve,
			rev_limit: 5000 * units.rpm
		)
	)
}

run(engine: make())




以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?