Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
test = ["DyadEcosystemDependencies", "CSV", "DataFrames", "Plots", "Test"]
45 changes: 45 additions & 0 deletions dyad/engine.dyad
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions generated/definitions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down
Loading
Loading