Class B oven plant.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include <asf.h>
Functions | |
float | oven_plant_get_state_temp (uint8_t no) |
Read the internal simulation states. More... | |
void | oven_plant_init (void) |
Initialize the oven's physical state. More... | |
void | oven_plant_sim_step (enum pot_t pot) |
Perform a simulation step. More... | |
float oven_plant_get_state_temp | ( | uint8_t | no | ) |
Read the internal simulation states.
no | The state variable to get, 0 for plate and 1 for pot |
References C_PLATE, C_POT, and state.
Referenced by main_execute_simulation_step().
void oven_plant_init | ( | void | ) |
void oven_plant_sim_step | ( | enum pot_t | pot | ) |
Perform a simulation step.
This function first reads the received frequency signal representing the power level the plate element is actuated with, then performs a simulation step and outputs the simulated temperature of the plate element as an analog value via DACB on the pin marked ADC2.
The simulation plant is a discretized version of the continuous system: \( \dot{x} = \mathbf{F}*\vec{x} + \mathbf{B}*\vec{u} \), where:
\[ \begin{array}{c} \mathbf{F} = \left[ \begin{array}{c c} \frac{-1}{C_\textnormal{plate} * K_\textnormal{plate}} & 0 \\ \\ 0 & \frac{-1}{C_\textnormal{pot} * K_\textnormal{pot}} \end{array} \right] \\ \vec{x} = \left[ \begin{array}{c} E_\textnormal{plate} \\ \\ E_\textnormal{pot} \end{array} \right] \\ \mathbf{B} = \left[ \begin{array}{c c} 1 & 0 \\ \\ 0 & 1 \end{array} \right] \\ \vec{u} = \left[ \begin{array}{c} \frac{T_\textnormal{environment}}{K_\textnormal{plate}} \\ \\ \frac{T_\textnormal{environment}}{K_\textnormal{pot}} \end{array} \right] \end{array} \\ \]
in the case when the pot is OFF the plate.
This corresponds to the plate and the pot cooling separately by Newton's law of cooling because no power can be induced when the pot is not on the plate.
When the pot is ON the stove, the system is similar, but F is modified by adding heat transfer between the plate and the contents of the pot, and disregarding heat loss from the plate to the environment. Likewise u is modified by adding energy induction into the bottom of the pot, simplified here as being the same point as the plate:
\[ \begin{array}{c} \mathbf{F} = \left[ \begin{array}{c c} \frac{-1}{C_\textnormal{plate}* K_\textnormal{plate}} & \frac{1}{C_\textnormal{pot}* K_\textnormal{plate}} \\ \\ \frac{1}{C_\textnormal{plate}* K_\textnormal{plate}} & \frac{-1}{C_\textnormal{pot}* K_\textnormal{plate}} - \frac{1}{C_\textnormal{pot} * K_\textnormal{pot}} \end{array} \right] \\ \vec{u} = \left[ \begin{array}{c} \delta E_\textnormal{induced} \\ \\ \frac{T_\textnormal{environment}}{K_\textnormal{pot}} \end{array} \right] \end{array} \]
pot | Whether the pot is on or off the plate. |
References C_PLATE, C_POT, DAC_CH0, dac_set_channel_value(), dac_wait_for_channel_ready(), ENV_TEMP, K_PLATE, K_POT, oven_plant_calculate_u_from_period(), oven_plant_read_signal_period(), POT_OFF, POT_ON, and state.
Referenced by main_execute_simulation_step().