Compare commits
6 Commits
7043974bb5
...
9ef1d05a42
Author | SHA1 | Date |
---|---|---|
atse | 9ef1d05a42 | |
atse | 204336aaf3 | |
atse | 0eb1d492e4 | |
atse | bb4f43fe1c | |
atse | 9df0fe406f | |
topquark12 | 5ba74c6d9b |
|
@ -184,7 +184,7 @@ postfilter rate can be tuned with the `postfilter` command.
|
|||
- Connect TEC module device 1 to TEC1- and TEC1+.
|
||||
- The GND pin is for shielding not for sinking TEC module currents.
|
||||
|
||||
When using a TEC module with the Thermostat, the Thermostat expects the thermal load (where the thermistor is located) to heat up with a positive software current set point, and cool down with a negative current set point.
|
||||
When using a TEC module with the Thermostat, the Thermostat expects the thermal load (where the thermistor is located) to cool down with a positive software current set point, and heat up with a negative current set point.
|
||||
|
||||
Testing heat flow direction with a low set current is recommended before installation of the TEC module.
|
||||
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
use smoltcp::time::{Duration, Instant};
|
||||
use uom::si::{
|
||||
f64::{
|
||||
ElectricCurrent,
|
||||
ElectricPotential,
|
||||
ElectricalResistance,
|
||||
ThermodynamicTemperature,
|
||||
Time,
|
||||
},
|
||||
electric_current::ampere,
|
||||
electric_potential::volt,
|
||||
electrical_resistance::ohm,
|
||||
thermodynamic_temperature::degree_celsius,
|
||||
|
@ -26,11 +28,10 @@ pub struct ChannelState {
|
|||
pub adc_calibration: ad7172::ChannelCalibration,
|
||||
pub adc_time: Instant,
|
||||
pub adc_interval: Duration,
|
||||
/// VREF for the TEC (1.5V)
|
||||
pub vref: ElectricPotential,
|
||||
/// i_set 0A center point
|
||||
pub center: CenterPoint,
|
||||
pub dac_value: ElectricPotential,
|
||||
pub i_set: ElectricCurrent,
|
||||
pub pid_engaged: bool,
|
||||
pub pid: pid::Controller,
|
||||
pub sh: sh::Parameters,
|
||||
|
@ -44,10 +45,9 @@ impl ChannelState {
|
|||
adc_time: Instant::from_secs(0),
|
||||
// default: 10 Hz
|
||||
adc_interval: Duration::from_millis(100),
|
||||
// updated later with Channels.read_vref()
|
||||
vref: ElectricPotential::new::<volt>(1.5),
|
||||
center: CenterPoint::Vref,
|
||||
dac_value: ElectricPotential::new::<volt>(0.0),
|
||||
i_set: ElectricCurrent::new::<ampere>(0.0),
|
||||
pid_engaged: false,
|
||||
pid: pid::Controller::new(pid::Parameters::default()),
|
||||
sh: sh::Parameters::default(),
|
||||
|
|
|
@ -58,7 +58,6 @@ impl Channels {
|
|||
let pwm = pins.pwm;
|
||||
let mut channels = Channels { channel0, channel1, adc, pins_adc, pwm };
|
||||
for channel in 0..CHANNELS {
|
||||
channels.channel_state(channel).vref = channels.read_vref(channel);
|
||||
channels.calibrate_dac_value(channel);
|
||||
channels.set_i(channel, ElectricCurrent::new::<ampere>(0.0));
|
||||
}
|
||||
|
@ -117,11 +116,7 @@ impl Channels {
|
|||
}
|
||||
|
||||
pub fn get_i(&mut self, channel: usize) -> ElectricCurrent {
|
||||
let center_point = self.get_center(channel);
|
||||
let r_sense = ElectricalResistance::new::<ohm>(R_SENSE);
|
||||
let voltage = self.get_dac(channel);
|
||||
let i_tec = (voltage - center_point) / (10.0 * r_sense);
|
||||
i_tec
|
||||
self.channel_state(channel).i_set
|
||||
}
|
||||
|
||||
/// i_set DAC
|
||||
|
@ -142,6 +137,7 @@ impl Channels {
|
|||
let voltage = i_tec * 10.0 * r_sense + center_point;
|
||||
let voltage = self.set_dac(channel, voltage);
|
||||
let i_tec = (voltage - center_point) / (10.0 * r_sense);
|
||||
self.channel_state(channel).i_set = i_tec;
|
||||
i_tec
|
||||
}
|
||||
|
||||
|
@ -429,7 +425,6 @@ impl Channels {
|
|||
}
|
||||
|
||||
fn report(&mut self, channel: usize) -> Report {
|
||||
let vref = self.channel_state(channel).vref;
|
||||
let i_set = self.get_i(channel);
|
||||
let i_tec = self.read_itec(channel);
|
||||
let tec_i = self.get_tec_i(channel);
|
||||
|
@ -446,7 +441,6 @@ impl Channels {
|
|||
.map(|temperature| temperature.get::<degree_celsius>()),
|
||||
pid_engaged: state.pid_engaged,
|
||||
i_set,
|
||||
vref,
|
||||
dac_value,
|
||||
dac_feedback: self.read_dac_feedback(channel),
|
||||
i_tec,
|
||||
|
@ -544,7 +538,6 @@ pub struct Report {
|
|||
temperature: Option<f64>,
|
||||
pid_engaged: bool,
|
||||
i_set: ElectricCurrent,
|
||||
vref: ElectricPotential,
|
||||
dac_value: ElectricPotential,
|
||||
dac_feedback: ElectricPotential,
|
||||
i_tec: ElectricPotential,
|
||||
|
|
Loading…
Reference in New Issue