Prusa MINI Firmware overview
sim_nozzle.c File Reference
#include "sim_nozzle.h"
#include <inttypes.h>
#include <stdlib.h>

Classes

struct  sim_nozzle_t
 

Functions

void sim_nozzle_init (void)
 
float sim_nozzle_cycle (float dt)
 
void sim_nozzle_set_power (float P)
 

Variables

sim_nozzle_t sim_nozzle
 

Function Documentation

◆ sim_nozzle_init()

void sim_nozzle_init ( void  )
28  {
29  sim_nozzle.C = 10.4F; // [J/K] total heat capacity of entire heat block
30  sim_nozzle.R = 22.0F; // [K/W] absolute thermal resistance between heat block and ambient
31  sim_nozzle.Cs = 0.6F; // [J/K] total heat capacity of sensor
32  sim_nozzle.Rs = 9.0F; // [K/W] absolute thermal resistance between sensor and heat block
33  sim_nozzle.Ta = 298.15F; // [K] ambient temperature
34  sim_nozzle.T = sim_nozzle.Ta; // [K] heat block temperature (avg)
35  sim_nozzle.Ts = sim_nozzle.T; // [K] sensor temperature (avg)
36  sim_nozzle.P = 0; // [W] heater power
37  sim_nozzle.Ex = 0.2; // [J/mm] extrussion energy factor
38  sim_nozzle.vex = 0; // [mm/s] extrussion speed
39 }

◆ sim_nozzle_cycle()

float sim_nozzle_cycle ( float  dt)
41  {
42  float E = sim_nozzle.C * sim_nozzle.T; //[J] total heat energy stored in heater block
43  float Es = sim_nozzle.Cs * sim_nozzle.Ts; //[J] total heat energy stored in sensor
44  float Pl = (sim_nozzle.T - sim_nozzle.Ta) / sim_nozzle.R; //[W] power from heater block to ambient (leakage power)
45  float Ps = (sim_nozzle.T - sim_nozzle.Ts) / sim_nozzle.Rs; //[W] power from heater to sensor
46  float Ed = (sim_nozzle.P - (Pl + Ps)) * dt; //[J] heater block energy increase
47  float Esd = (Ps * dt); //[J] sensor energy increase
48  float Ex = (sim_nozzle.Ex * sim_nozzle.vex * dt);
49  Ed -= Ex;
50  E += Ed; //[J] heater block result total heat energy
51  Es += Esd; //[J] sensor result total heat energy
52  sim_nozzle.T = E / sim_nozzle.C; //[K] result heater temperature
53  sim_nozzle.Ts = Es / sim_nozzle.Cs; //[K] result sensor temperature
54  return sim_nozzle.Ts;
55 }

◆ sim_nozzle_set_power()

void sim_nozzle_set_power ( float  P)
57  {
58  sim_nozzle.P = P;
59 }
Here is the caller graph for this function:

Variable Documentation

◆ sim_nozzle

sim_nozzle_t sim_nozzle
sim_nozzle_t::R
float R
Definition: sim_nozzle.c:13
sim_nozzle_t::Rs
float Rs
Definition: sim_nozzle.c:15
sim_nozzle_t::vex
float vex
Definition: sim_nozzle.c:21
sim_nozzle_t::Cs
float Cs
Definition: sim_nozzle.c:14
sim_nozzle_t::Ts
float Ts
Definition: sim_nozzle.c:18
sim_nozzle_t::P
float P
Definition: sim_nozzle.c:19
sim_nozzle_t::C
float C
Definition: sim_nozzle.c:12
sim_nozzle_t::T
float T
Definition: sim_nozzle.c:17
sim_nozzle_t::Ta
float Ta
Definition: sim_nozzle.c:16
sim_nozzle
sim_nozzle_t sim_nozzle
Definition: sim_nozzle.c:26
sim_nozzle_t::Ex
float Ex
Definition: sim_nozzle.c:20