th7/thermocouple/thermocouple.go

74 lines
1.2 KiB
Go
Raw Normal View History

2022-11-12 14:20:29 +00:00
package thermocouple
import (
"th7/data/thermocouple"
)
func C(thermo thermocouple.Type, uv float64) (float64, error) {
switch thermo {
case thermocouple.None:
return 0, thermocouple.ErrThermocoupleNone
case thermocouple.B:
return b_uv_to_c(uv)
case thermocouple.E:
return e_uv_to_c(uv)
case thermocouple.J:
return j_uv_to_c(uv)
case thermocouple.K:
return k_uv_to_c(uv)
case thermocouple.N:
return n_uv_to_c(uv)
case thermocouple.R:
return r_uv_to_c(uv)
case thermocouple.S:
return s_uv_to_c(uv)
case thermocouple.T:
return t_uv_to_c(uv)
}
return 0, thermocouple.ErrUnimplemented
}
func UV(thermo thermocouple.Type, c float64) (float64, error) {
switch thermo {
case thermocouple.None:
return 0, thermocouple.ErrThermocoupleNone
case thermocouple.B:
return b_c_to_uv(c)
case thermocouple.E:
return e_c_to_uv(c)
case thermocouple.J:
return j_c_to_uv(c)
case thermocouple.K:
return k_c_to_uv(c)
case thermocouple.N:
return n_c_to_uv(c)
case thermocouple.R:
return r_c_to_uv(c)
case thermocouple.S:
return s_c_to_uv(c)
case thermocouple.T:
return t_c_to_uv(c)
}
return 0, thermocouple.ErrUnimplemented
}