first commit
This commit is contained in:
31
cm_heatsink_emulator.c
Normal file
31
cm_heatsink_emulator.c
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* cm_heatsink_emulator.c
|
||||||
|
*
|
||||||
|
* Created on: 14 Oct 2025
|
||||||
|
* Author: Christian L. V. Madsen (OZ1CM)
|
||||||
|
*/
|
||||||
|
#include "cm_heatsink_emulator.h"
|
||||||
|
#include "math.h"
|
||||||
|
|
||||||
|
#define EULER_NUM 2.7182818284590452353602
|
||||||
|
|
||||||
|
static float deltaTempElement(cm_heatsink_thermalElement_t *element, float temperature, float power){
|
||||||
|
|
||||||
|
return temperature + (power * element->thermal_resistance);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
float cm_heatsinkEmul_getRespon(cm_heatsinkEmul_t *inst, float dt){
|
||||||
|
|
||||||
|
float t = 0.0;
|
||||||
|
|
||||||
|
for(int i = inst->thermalElements_len; i > 0; i--){
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
inst->heatsinkTemperature = inst->heatsinkTemperature + (1.0 / inst->thermal_capacity) * (pj5_ThermEmul_Heatsink_RespVal(inst) - inst->heatsinkTemperature) * dt;
|
||||||
|
|
||||||
|
return v_prev;
|
||||||
|
|
||||||
|
}
|
||||||
33
cm_heatsink_emulator.h
Normal file
33
cm_heatsink_emulator.h
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* 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_
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char label[32];
|
||||||
|
float thermal_resistance; // In Kelvin/Watt or Celsius/Watt (you can mix!)
|
||||||
|
|
||||||
|
}cm_heatsink_thermalElement_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
|
||||||
|
cm_heatsink_thermalElement_t *thermalElements;
|
||||||
|
int thermalElements_len;
|
||||||
|
|
||||||
|
float power;
|
||||||
|
float ambientTemp;
|
||||||
|
float thermal_capacity;
|
||||||
|
|
||||||
|
// Dynamic
|
||||||
|
float heatsinkTemperature;
|
||||||
|
|
||||||
|
}cm_heatsinkEmul_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* CM_HEATSINK_EMULATOR_H_ */
|
||||||
Reference in New Issue
Block a user