-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modified: Manifest.toml Update Unitful git-tree, repo-url format
modified: Project.toml Julia 1.5 adds a line modified: README.md New: Installation, Adding or removing units new file: examples/readme_example.jl Example from Readme.md new file: examples/torpedo_hangglider.jl New example modified: test/pretty-print.jl Test column vector
- Loading branch information
Showing
6 changed files
with
165 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Run line by line in the REPL, or ctrl + enter in VSCode | ||
using MechanicalUnits | ||
m_air = 1000kg; c_p = 1.00kJ/(kg*K) | ||
@import_expand ~W # Watt = Joule / Second is not exported by default. | ||
Q_cp(T1, T2) = m_air*c_p*(T2-T1) |> (kW*h) | ||
Q_cp(20°C, 985°C) | ||
dm |> upreferred | ||
preferunits(m) | ||
m_s = [30kg/m 28.8lb/ft] | ||
l_s = 93ft*[3 4]m/s | ||
m_s.*l_s |> (kg*m) | ||
E=206GPa; h_y = 100mm; b = 30mm; I = 1/12 * b * h_y^3 | ||
L = 2m; F=100kg*g |> N | ||
F*L^3/(3E*I) |> mm | ||
l_wire = 20m | ||
k(d) = E * 0.691 * π/4 * d^2 / l_wire |> N/mm | ||
k.([5 6 8]mm) | ||
δ(d)= F / k(d) |> mm | ||
δ.([5, 6, 8]mm) | ||
d = 6mm | ||
dimension(d) | ||
1d |> s | ||
@import_expand ~V ~W ~A G | ||
sqrt(1G²) | ||
[1V*12.0A 2W 1kg*g*1m/2s]*30minute |> kJ | ||
ω = 50*2π*rad/s | ||
t = (0:0.006:0.02)s | ||
u = 220V*exp.(im∙(ω∙t)) | ||
u*1.5A |> J | ||
import MechanicalUnits: @import_expand, ∙ | ||
@import_expand ~m # ~ : also import SI prefixes | ||
(1.0cm², 2.0mm∙m, 3.0dm⁴/m² ) .|> mm² | ||
@import_expand dyn # This unit is not exported by default | ||
typeof(dyn) | ||
1dyn |> μm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# What would the battery range be? The local start-up competition | ||
# considers a battery powered torpedo pulling a hang-glider! | ||
# | ||
# Run line by line in the REPL, or ctrl + enter in VSCode | ||
|
||
using MechanicalUnits | ||
@import_expand ~W | ||
kWh = kW*h | ||
|
||
begin | ||
"Battery capability" | ||
E_battery = 200kWh | ||
"Diameter torpedo" | ||
D_torpedo = 0.5m | ||
"Area, hangglider" | ||
A_hangglider = 20m² | ||
"Glide ratio, hangglider" | ||
Cl_per_Cd = 15 | ||
"Mass, hangglider and pilot" | ||
m_t = 22kg + 70kg | ||
"Efficiency, torpedo" | ||
η = 0.3 | ||
"Drag coefficient, torpedo" | ||
C_d = 0.2 | ||
"Density, water" | ||
ρ_w = 1026kg/m³ | ||
"Density, air" | ||
ρ_a = 1.25kg/m³ | ||
"Velocity, torpedo and hangglider" | ||
v = 50km/h | ||
|
||
" | ||
resistance(C, ρ::Density, v::Velocity, A::Area) | ||
-> ::Force | ||
" | ||
resistance(C, ρ::Density, v::Velocity, A::Area) = (1/2) * ρ * C * A * v^2 |> N | ||
end | ||
|
||
lift = m_t * g | ||
|
||
drag_hangglider = lift / Cl_per_Cd |> N | ||
|
||
drag_torpedo = resistance(C_d, ρ_w, v, (π / 4) * D_torpedo^2 ) | ||
|
||
range_torpedo_hangglider = E_battery * η / (drag_torpedo + drag_hangglider) |> km |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters