Skip to content
Merged
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
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
name = "LyoPronto"
uuid = "86014da0-a5b3-40a4-ad76-3e66dfc3e269"
authors = ["Isaac Wheeler <ickaser@gmail.com>"]
version = "0.3.2"
authors = ["Isaac Wheeler <ickaser@gmail.com>"]

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
ConcreteStructs = "2569d6c7-a4a2-43d3-a901-331e8e4be471"
ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
Expand All @@ -23,12 +22,12 @@ Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
SavitzkyGolay = "c4bf5708-b6a6-4fbe-bcd0-6850ed671584"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
TransformVariables = "84d833dd-6860-57f9-a1a7-6da5db126cff"
TypedTables = "9d95f2ec-7b3d-5a63-8d20-e2491e220bb9"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"

[compat]
ADTypes = "1.14"
Accessors = "0.1"
CSV = "0.10"
ColorTypes = "0.11.2, 0.12"
ConcreteStructs = "0.2.3"
ConstructionBase = "1"
Expand All @@ -45,5 +44,6 @@ Roots = "2"
SavitzkyGolay = "0.9.1"
SpecialFunctions = "1, 2"
TransformVariables = "0.8.19"
TypedTables = "1.4"
Unitful = "1.20"
julia = "1.10"
2 changes: 1 addition & 1 deletion src/LyoPronto.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ using TransformVariables
using TransformVariables: logit
using RecipesBase
using ColorTypes: RGB
using CSV
using TypedTables
using PrecompileTools
using SpecialFunctions: besselj0, besselj1
using DataInterpolations
Expand Down
88 changes: 59 additions & 29 deletions src/get_vial_dims.jl
Original file line number Diff line number Diff line change
@@ -1,17 +1,55 @@
# Get dimensions from here: https://www.schott.com/en-us/products/vials/-/media/project/onex/products/v/vials/application-variants/schott-brochure-schott-vials-english-20092017.pdf

# Added to "vial_sizes.csv", read in here
const VIAL_DIMS = CSV.File((@__DIR__) * raw"/vial_sizes.csv")
# That table is compact enough to include here as a commented-out CSV

# Size,overflow,overflow_tol,a,d1,d1_tol,d2,d3,d4,h1,h1_tol,h2,h3,h3_tol,r1,r2,s1,s1_tol,s2,t,mass
# 2R,4,0.5,1,16,0.15,13,10.5,7,35,0.5,22,8,0.5,2.5,1.5,1,0.04,0.6,0.7,4.4
# 4R,6,0.5,1,16,0.15,13,10.5,7,45,0.5,32,8,0.5,2.5,1.5,1,0.04,0.6,0.7,5.7
# 6R,10,0.5,1.2,22,0.2,20,16.5,12.6,40,0.5,26,8.5,0.5,3.5,2,1,0.04,0.7,0.7,7.9
# 8R,11.5,0.5,1.2,22,0.2,20,16.5,12.6,45,0.5,31,8.5,0.5,3.5,2,1,0.04,0.7,0.7,8.7
# 10R,13.5,1,1.2,24,0.2,20,16.5,12.6,45,0.5,30,9,0.5,4,2,1,0.04,0.7,0.7,9.5
# 15R,19,1,1.2,24,0.2,20,16.5,12.6,60,0.5,45,9,0.5,4,2,1,0.04,0.7,0.7,12
# 20R,26,1.5,1.5,30,0.25,20,17.5,12.6,55,0.7,35,10,0.75,5.5,2.5,1.2,0.05,0.7,1,16.2
# 25R,32.5,1.5,1.5,30,0.25,20,17.5,12.6,65,0.7,45,10,0.75,5.5,2.5,1.2,0.05,0.7,1,18.9
# 30R,37.5,1.5,1.5,30,0.25,20,17.5,12.6,75,0.7,55,10,0.75,5.5,2.5,1.2,0.05,0.7,1,21.9
# 50R,62,4,2.5,40,0.4,20,17.5,12.6,73,0.75,49,10,0.75,6,4,1.5,0.07,0.9,1.5,34.5
# 100R,123,7,3.5,47,0.5,20,17.5,12.6,100,0.75,75,10,0.75,6.5,4,1.7,0.07,0.9,1.5,60

# This is transformed mostly-programmatically into the following DictTable:

VIAL_DIMS = DictTable(
Size = ["2R", "4R", "6R", "8R", "10R", "15R", "20R", "25R", "30R", "50R", "100R"],
overflow = [4.0, 6.0, 10.0, 11.5, 13.5, 19.0, 26.0, 32.5, 37.5, 62.0, 123.0]*u"mL",
overflow_tol = [0.5, 0.5, 0.5, 0.5, 1.0, 1.0, 1.5, 1.5, 1.5, 4.0, 7.0]*u"mL",
a = [1.0, 1.0, 1.2, 1.2, 1.2, 1.2, 1.5, 1.5, 1.5, 2.5, 3.5]*u"mm",
d1 = [16, 16, 22, 22, 24, 24, 30, 30, 30, 40, 47]*u"mm",
d1_tol = [0.15, 0.15, 0.2, 0.2, 0.2, 0.2, 0.25, 0.25, 0.25, 0.4, 0.5]*u"mm",
d2 = [13, 13, 20, 20, 20, 20, 20, 20, 20, 20, 20]*u"mm",
d3 = [10.5, 10.5, 16.5, 16.5, 16.5, 16.5, 17.5, 17.5, 17.5, 17.5, 17.5]*u"mm",
d4 = [7.0, 7.0, 12.6, 12.6, 12.6, 12.6, 12.6, 12.6, 12.6, 12.6, 12.6]*u"mm",
h1 = [35, 45, 40, 45, 45, 60, 55, 65, 75, 73, 100]*u"mm",
h1_tol = [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.7, 0.7, 0.7, 0.75, 0.75]*u"mm",
h2 = [22, 32, 26, 31, 30, 45, 35, 45, 55, 49, 75]*u"mm",
h3 = [8.0, 8.0, 8.5, 8.5, 9.0, 9.0, 10.0, 10.0, 10.0, 10.0, 10.0]*u"mm",
h3_tol = [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.75, 0.75, 0.75, 0.75, 0.75]*u"mm",
r1 = [2.5, 2.5, 3.5, 3.5, 4.0, 4.0, 5.5, 5.5, 5.5, 6.0, 6.5]*u"mm",
r2 = [1.5, 1.5, 2.0, 2.0, 2.0, 2.0, 2.5, 2.5, 2.5, 4.0, 4.0]*u"mm",
s1 = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.2, 1.2, 1.2, 1.5, 1.7]*u"mm",
s1_tol = [0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.05, 0.05, 0.05, 0.07, 0.07]*u"mm",
s2 = [0.6, 0.6, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.9, 0.9]*u"mm",
t = [0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 1.0, 1.0, 1.0, 1.5, 1.5]*u"mm",
mass = [4.4, 5.7, 7.9, 8.7, 9.5, 12.0, 16.2, 18.9, 21.9, 34.5, 60.0]*u"g",
)

const VIAL_DIMS_SOURCE_DOC = """
Uses a table from a SCHOTT manual, stored internally in a CSV.
"""

function select_size(vialsize::String)
alldims = filter(x->x.Size == vialsize, VIAL_DIMS)
if length(alldims) != 1
if vialsize ∉ VIAL_DIMS.Size
error("bad vial size passed: $vialsize")
end
alldims = alldims[1] # Extract object corresponding to row of table
return VIAL_DIMS[vialsize]
end

"""
Expand All @@ -23,8 +61,8 @@ $(VIAL_DIMS_SOURCE_DOC)
"""
function get_vial_radii(vialsize::String)
alldims = select_size(vialsize)
rad_o = alldims.d1 / 2 * u"mm"
rad_i = rad_o - alldims.s1 * u"mm"
rad_o = alldims.d1 / 2
rad_i = rad_o - alldims.s1
return rad_i, rad_o
end

Expand All @@ -35,11 +73,7 @@ Return vial wall thickness for given ISO vial size.

$(VIAL_DIMS_SOURCE_DOC)
"""
function get_vial_thickness(vialsize::String)
alldims = select_size(vialsize)
thickness = alldims.s1*u"mm"
return thickness
end
get_vial_thickness(vialsize::String) = select_size(vialsize).s1

"""
$(SIGNATURES)
Expand All @@ -48,11 +82,7 @@ Return vial mass for given ISO vial size.

$(VIAL_DIMS_SOURCE_DOC)
"""
function get_vial_mass(vialsize::String)
alldims = select_size(vialsize)
mass = alldims.mass*u"g"
return mass
end
get_vial_mass(vialsize::String) = select_size(vialsize).mass

"""
get_vial_shape(vialsize::String)
Expand All @@ -63,15 +93,15 @@ $(VIAL_DIMS_SOURCE_DOC)
"""
function get_vial_shape(vialsize::String)
alldims = select_size(vialsize)
rad_o = alldims.d1 / 2 * u"mm"
rad_i = rad_o - alldims.s1 * u"mm"
bot_thick = alldims.s2*u"mm"
full_height = alldims.h1*u"mm"
curve_height = full_height - alldims.h3*u"mm"
barrel_height = alldims.h2*u"mm"
neck_inner = alldims.d4/2*u"mm"
neck_outer = alldims.d3/2*u"mm"
neck_curve = alldims.r1*u"mm"
rad_o = alldims.d1 / 2
rad_i = rad_o - alldims.s1
bot_thick = alldims.s2
full_height = alldims.h1
curve_height = full_height - alldims.h3
barrel_height = alldims.h2
neck_inner = alldims.d4/2
neck_outer = alldims.d3/2
neck_curve = alldims.r1
dims = (; rad_i, rad_o, bot_thick, barrel_height, curve_height, full_height, neck_inner, neck_outer, neck_curve)
return dims
end
Expand All @@ -88,8 +118,8 @@ function make_outlines(dims, Vfill)
(; rad_o, rad_i, bot_thick, neck_inner, neck_outer, curve_height, barrel_height, full_height) = dims

vpoints = [
(-rad_o, 0*u"mm"),
( rad_o, 0*u"mm"),
(-rad_o, 0.0*u"mm"),
( rad_o, 0.0*u"mm"),
( rad_o, barrel_height),
( neck_outer, curve_height),
( neck_outer, full_height),
Expand All @@ -104,7 +134,7 @@ function make_outlines(dims, Vfill)
(-neck_outer, full_height),
(-neck_outer, curve_height),
(-rad_o, barrel_height),
(-rad_o, 0*u"mm"),
(-rad_o, 0.0*u"mm"),
]
fheight = Vfill / (π*rad_i^2)
fpoints = [
Expand Down
12 changes: 0 additions & 12 deletions src/vial_sizes.csv

This file was deleted.

Loading