52 lines
1.1 KiB
C
52 lines
1.1 KiB
C
/*
|
|
* cm_heatsink_emulator.h
|
|
*
|
|
* Created on: 14 Oct 2025
|
|
* Author: Christian L. V. Madsen (OZ1CM)
|
|
*/
|
|
|
|
#ifndef CM_HEATSINK_EMULATOR_H_
|
|
#define CM_HEATSINK_EMULATOR_H_
|
|
#include <stdio.h>
|
|
#include <stdint.h>
|
|
|
|
typedef struct {
|
|
char label[32];
|
|
union{
|
|
float R_th; // In Kelvin/Watt or Celsius/Watt (you can mix!)
|
|
float R_th_MinFan; // In case you need to emulate a fan
|
|
};
|
|
float R_th_MaxFan; // In case you need to emulate a fan
|
|
|
|
union{
|
|
float C_th;
|
|
float C_th_MinFan;
|
|
};
|
|
float C_th_MaxFan;
|
|
|
|
|
|
// Dynamic
|
|
float temperature;
|
|
|
|
}cm_heatsink_thermalElement_t;
|
|
|
|
typedef struct {
|
|
|
|
cm_heatsink_thermalElement_t *thermalElements;
|
|
int thermalElements_Counts;
|
|
|
|
float power;
|
|
float ambientTemp;
|
|
|
|
// Dynamic
|
|
float prev_time;
|
|
float fan_speed;
|
|
|
|
}cm_heatsinkEmul_t;
|
|
|
|
int cm_heatsinkEmul_iterate(cm_heatsinkEmul_t *inst, float dtime);
|
|
float cm_heatsinkEmul_getElementTemp(cm_heatsinkEmul_t *inst, int element_idx);
|
|
int cm_heatsinkEmul_init(cm_heatsinkEmul_t *inst, cm_heatsink_thermalElement_t *elements, int elements_Count, float C_th, float power, float ambientTemp);
|
|
|
|
#endif /* CM_HEATSINK_EMULATOR_H_ */
|