From 32860d5ed0a4f8fb837d63d4a08bdeb7efed9dcb Mon Sep 17 00:00:00 2001 From: Ashutosh Date: Mon, 10 Aug 2026 02:08:51 +0200 Subject: [PATCH 1/3] feat: add a single cylinder race crankshaft engine --- Project.toml | 20 +- dyad/engine.dyad | 45 ++ generated/definitions.jl | 3 + viz_submission/crankshaft_dashboard.html | 774 +++++++++++++++++++++++ 4 files changed, 835 insertions(+), 7 deletions(-) create mode 100644 dyad/engine.dyad create mode 100644 viz_submission/crankshaft_dashboard.html diff --git a/Project.toml b/Project.toml index bcbd01c..a5e3562 100644 --- a/Project.toml +++ b/Project.toml @@ -4,30 +4,36 @@ authors = [" <>"] version = "0.1.0" [deps] -Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" +BlockComponents = "1ef5d832-be8e-447f-9f2c-8b5d17d15fd3" +DyadData = "cab12561-e36c-4498-ae70-c9a5e79fef2a" DyadInterface = "99806f68-afab-45ca-9d8c-ceff6bc61f54" JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" +Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78" Moshi = "2e0e35c7-a2e4-4343-998d-7ef72827ed2d" OrdinaryDiffEqDefault = "50262376-6c5a-4cf5-baba-aaf4f84d72d7" PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" +RotationalComponents = "824fa3ed-d7dc-4365-8bdf-ac77a1ac2011" RuntimeGeneratedFunctions = "7e49a35a-f44a-4d26-94aa-eba1b4ca6b47" TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76" [compat] -Markdown = "1" +BlockComponents = "4.5.1" +DyadData = "2.0.1" JSON = "0.21, 1" +Markdown = "1" +RotationalComponents = "2.5.4" TOML = "1" +[dyad] +kernel = "3.3.0" + [extras] -DyadEcosystemDependencies = "7bc808db-8006-421e-b546-062440d520b7" CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" +DyadEcosystemDependencies = "7bc808db-8006-421e-b546-062440d520b7" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["DyadEcosystemDependencies","CSV","DataFrames","Plots","Test"] - -[dyad] -kernel = "3.3.0" \ No newline at end of file +test = ["DyadEcosystemDependencies", "CSV", "DataFrames", "Plots", "Test"] diff --git a/dyad/engine.dyad b/dyad/engine.dyad new file mode 100644 index 0000000..fb3c542 --- /dev/null +++ b/dyad/engine.dyad @@ -0,0 +1,45 @@ +"Simple single-cylinder race-engine crankshaft model using standard Dyad components." +test component SingleCylinderRaceCrankshaft + "Fixed engine block reference." + fixed = RotationalComponents.Components.Fixed() + "Lumped crankshaft and flywheel inertia." + crank = RotationalComponents.Components.Inertia(J = 0.018) + "Ideal combustion torque actuator." + combustion = RotationalComponents.Sources.TorqueSource() + "Simplified periodic single-cylinder firing torque waveform." + firing_torque = BlockComponents.Sources.Sine(amplitude = 25.0, frequency = 100.0, offset = 80.0) + "Steady external load torque on the crankshaft." + load = RotationalComponents.Sources.ConstantTorque(tau_constant = -55.0) + "Viscous rotational loss representing bearings, oil drag, and windage." + losses = RotationalComponents.Components.Damper(d = 0.02) + "Crank angle sensor." + angle = RotationalComponents.Sensors.AngleSensor() + "Crank angular-speed sensor." + speed = RotationalComponents.Sensors.VelocitySensor() +relations + initial crank.phi = 0.0 + initial crank.w = 1256.6370614359173 + + connect(firing_torque.y, combustion.tau) + connect(combustion.spline, crank.spline_a) + connect(combustion.support, fixed.spline) + + connect(crank.spline_b, load.spline, losses.spline_a, angle.spline, speed.spline) + connect(load.support, fixed.spline) + connect(losses.spline_b, fixed.spline) +metadata { + "Dyad": { + "tests": { + "balanced_idle": { + "stop": 0.05, + "expect": {"initial": {"crank.phi": 0.0, "crank.w": 1256.6370614359173}} + } + } + } +} +end + +analysis SingleCylinderRaceCrankshaftTransient + extends TransientAnalysis(stop = 0.05) + model = SingleCylinderRaceCrankshaft() +end diff --git a/generated/definitions.jl b/generated/definitions.jl index ddf3423..ad0c9dc 100644 --- a/generated/definitions.jl +++ b/generated/definitions.jl @@ -16,7 +16,10 @@ if isfile(joinpath((@__DIR__) |> Base.dirname, "dyad", "definitions.jl")) include(joinpath((@__DIR__) |> Base.dirname, "dyad", "definitions.jl")) end +import BlockComponents +import DyadData import DyadInterface +import RotationalComponents @doc Markdown.doc""" This connector represents an electrical pin with voltage and current as the potential and flow variables, respectively. """ diff --git a/viz_submission/crankshaft_dashboard.html b/viz_submission/crankshaft_dashboard.html new file mode 100644 index 0000000..79197a7 --- /dev/null +++ b/viz_submission/crankshaft_dashboard.html @@ -0,0 +1,774 @@ + + + + + + Single-Cylinder Race Crankshaft Dashboard + + + +
+
+
+
+
EngineNewComponents · Dyad transient analysis
+

Single-cylinder race crankshaft

+
+ Live dashboard driven by the simulated crank angle, angular velocity, angular acceleration, and combustion torque. + The visible piston/rod mechanism is a kinematic animation coupled to the 1D rotational crankshaft model. +
+
+
+
+
Engine speed
rpm
+
Firing torque
N·m
+
Crank angle
deg
+
Angular accel.
rad/s²
+
+
+ +
+
+
+
+
+
Animated crank-slider view
+
Flywheel rotation, crank pin, connecting rod, piston motion, and flame intensity are updated from the transient solution.
+
+
t = — ms
+
+ +
+ +
+
Scrub simulation0%
+ +
+
+
Playback1.0×
+ +
+
+
+ +
+
+
RPM band
+ +
+
+
Torque pulse
+ +
+
+
+ +
+
+
Combustion torque waveform
+
Simplified periodic firing torque driving the ideal torque source.
+ +
+
+
Crankshaft speed ripple
+
Speed response of the lumped crank/flywheel inertia under torque, load, and viscous losses.
+ +
+
+
Crank phase trace
+
Torque plotted against crank angle over the simulated window.
+ +
+ Torque + Current frame + Speed +
+
+
+
+ +
+
Simulation duration
+
Crank revolutions
+
Torque range
+
RPM range
+
+
+ + + + From 56ea70172d3fd931d97724983e2a909a53ea0972 Mon Sep 17 00:00:00 2001 From: Ashutosh Date: Mon, 10 Aug 2026 02:11:09 +0200 Subject: [PATCH 2/3] fix: rename visualisation to index.html --- viz_submission/{crankshaft_dashboard.html => index.html} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename viz_submission/{crankshaft_dashboard.html => index.html} (100%) diff --git a/viz_submission/crankshaft_dashboard.html b/viz_submission/index.html similarity index 100% rename from viz_submission/crankshaft_dashboard.html rename to viz_submission/index.html From dc38d38c23fc0fbdb025a7a54bd792908600d64c Mon Sep 17 00:00:00 2001 From: Ashutosh Date: Mon, 10 Aug 2026 02:48:21 +0200 Subject: [PATCH 3/3] viz: update visualisation according to theme spec --- viz_submission/index.html | 1004 ++++++++++++++++++++----------------- 1 file changed, 531 insertions(+), 473 deletions(-) diff --git a/viz_submission/index.html b/viz_submission/index.html index 79197a7..27e4ac0 100644 --- a/viz_submission/index.html +++ b/viz_submission/index.html @@ -3,37 +3,45 @@ - Single-Cylinder Race Crankshaft Dashboard + Single-cylinder crankshaft dynamics + + + -
+
-
-
-
EngineNewComponents · Dyad transient analysis
-

Single-cylinder race crankshaft

-
- Live dashboard driven by the simulated crank angle, angular velocity, angular acceleration, and combustion torque. - The visible piston/rod mechanism is a kinematic animation coupled to the 1D rotational crankshaft model. -
-
+
+
accent slot 2 · azure · Dyad transient
+

Single-cylinder race crankshaft dynamics

+

A lumped crank/flywheel inertia is driven by a periodic combustion torque, opposed by steady load and viscous rotational losses. The dashboard animates the simulated crank angle, speed, acceleration, and torque.

+
-
-
Engine speed
rpm
-
Firing torque
N·m
-
Crank angle
deg
-
Angular accel.
rad/s²
+
+
engine speed
+
rpm
+
t = — ms
-
-
-
+
+
+
-
Animated crank-slider view
-
Flywheel rotation, crank pin, connecting rod, piston motion, and flame intensity are updated from the transient solution.
+
Animated crank-slider
+
The piston/rod view is a visual kinematic representation driven by the 1D crankshaft solution.
-
t = — ms
+
running
-
-
Scrub simulation0%
- +
+
scrub simulation0%
+
-
-
Playback1.0×
+
+
playback1.0×
-
+
-
-
+
+
+
torque
+
N·m
+
input to torque source
+
+
+
crank angle
+
deg
+
wrapped over two revolutions
+
+
+
angular acceleration
+
rad/s²
+
from crank inertia state
+
+
+ +
+
RPM band
- +
-
-
Torque pulse
- +
+
Torque band
+
-
+
-
-
+
+
Combustion torque waveform
-
Simplified periodic firing torque driving the ideal torque source.
- -
-
+
Primary series uses the assigned accent base.
+ +
+
Crankshaft speed ripple
-
Speed response of the lumped crank/flywheel inertia under torque, load, and viscous losses.
- -
-
-
Crank phase trace
-
Torque plotted against crank angle over the simulated window.
- -
- Torque - Current frame - Speed -
-
+
Speed response under firing torque, load torque, and damping.
+ + +
+
Torque vs crank phase
+
Two-revolution phase view with active crank position marker.
+ +
-
Simulation duration
-
Crank revolutions
-
Torque range
-
RPM range
+
duration
+
revolutions
+
torque range
+
rpm range
- +