aboutsummaryrefslogtreecommitdiffstats
path: root/compressor/compressor.go
blob: fc12f2657f2ec9fab86a7fec64e779f4f1336ec3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
package compressor

import (
	"time"

	"github.com/sam-anthony/volute/mass"
	"github.com/sam-anthony/volute/util"
)

type Compressor struct {
	Name     string
	FileName string
	// MinX is the distance of the y-axis from left of image in pixels.
	MinX int
	// MinY is the distance of the x-axis from the top of the image in
	//pixels.
	MinY int
	// MaxX is the distance of the end of the graph from the left of the
	// image in pixels.
	MaxX int
	// MaxY is the distance of the top of the graph from the top of the
	// image in pixels.
	MaxY int
	// MaxFlow is the mass flow rate at MaxX.
	MaxFlow mass.FlowRate
	// MaxPressureRatio is the pressure ratio at MaxY.
	MaxPressureRatio float32
}

var compressors = make(map[string]map[string]map[string]Compressor)

func init() {
	compressors["Garrett"] = make(map[string]map[string]Compressor)
	compressors["Garrett"]["G"] = make(map[string]Compressor)
	compressors["Garrett"]["G"]["25-660"] = garrettG25660()
	compressors["BorgWarner"] = make(map[string]map[string]Compressor)
	compressors["BorgWarner"]["K"] = make(map[string]Compressor)
	compressors["BorgWarner"]["K"]["03"] = borgwarnerK03()
	compressors["BorgWarner"]["K"]["04"] = borgwarnerK04()
	compressors["BorgWarner"]["EFR"] = make(map[string]Compressor)
	compressors["BorgWarner"]["EFR"]["6258"] = borgwarnerEFR6258()
}

func Compressors() map[string]map[string]map[string]Compressor {
	return compressors
}

func garrettG25660() Compressor {
	maxFlow, err := mass.NewFlowRate(
		mass.Mass{70, mass.Pound},
		time.Minute,
		mass.PoundsPerMinute,
	)
	util.Check(err)
	return Compressor{
		"Garrett G25-660",
		"compressor/res/garrett/g/25-660.jpg",
		204,
		1885,
		1665,
		25,
		maxFlow,
		4.0,
	}
}

func borgwarnerEFR6258() Compressor {
	maxFlow, err := mass.NewFlowRate(
		mass.Mass{0.50, mass.Kilogram},
		time.Second,
		mass.KilogramsPerSecond,
	)
	util.Check(err)
	return Compressor{
		"BorgWarner EFR6258",
		"compressor/res/borgwarner/efr/6258.jpg",
		47,
		455,
		773,
		6,
		maxFlow,
		3.8,
	}
}

func borgwarnerK04() Compressor {
	maxFlow, err := mass.NewFlowRate(
		mass.Mass{0.18, mass.Kilogram},
		time.Second,
		mass.KilogramsPerSecond,
	)
	util.Check(err)
	return Compressor{
		"Borgwarner K04",
		"compressor/res/borgwarner/k/04.jpg",
		33,
		712,
		1090,
		2,
		maxFlow,
		2.8,
	}
}

func borgwarnerK03() Compressor {
	maxFlow, err := mass.NewFlowRate(
		mass.Mass{0.13, mass.Kilogram},
		time.Second,
		mass.KilogramsPerSecond,
	)
	util.Check(err)
	return Compressor{
		"BorgWarner K03",
		"compressor/res/borgwarner/k/03.jpg",
		30,
		714,
		876,
		4,
		maxFlow,
		2.8,
	}
}