63 lines
1.8 KiB
C
63 lines
1.8 KiB
C
|
|
#include <stdint.h>
|
|
#ifndef REGISTER_MAP_VSD_H
|
|
#define REGISTER_MAP_VSD_H
|
|
struct RegisterMap {
|
|
uint16_t regaddr;
|
|
uint8_t regtype; // 1=UINT16, 2=FLOAT32, 3=INT64, 4=Status, 5=Thermal, 6=Power, 7=RPM
|
|
float scale;
|
|
};
|
|
|
|
const PROGMEM RegisterMap registers[] = {
|
|
{2910, 4, 1.0}, // Status Word
|
|
{2911, 6, 1.0}, // Min Active Value
|
|
{2912, 5, 1.0}, // Thermal Sense
|
|
{2913, 2, 10.0}, // Frequency
|
|
{2914, 1, 1.0}, // Running Hours
|
|
{2916, 1, 1.0}, // Operating Hours
|
|
{2918, 2, 1.0}, // kWh Counter
|
|
{2920, 2, 100.0}, // Input Power kW
|
|
{2922, 6, 134.102}, // Input Power HP
|
|
{2924, 2, 100.0}, // Motor Current
|
|
{2926, 2, 100.0}, // Phase I1
|
|
{2928, 2, 100.0}, // Phase I2
|
|
{2930, 2, 100.0}, // Phase I3
|
|
{2932, 7, 60.0}, // Motor RPM
|
|
{2934, 2, 10.0}, // Motor Voltage
|
|
{2935, 6, 1.0}, // Torque Nm
|
|
{2936, 5, 1.0}, // Motor Thermal
|
|
{2937, 5, 1.0}, // Heatsink Temp
|
|
{2938, 5, 1.0}, // Card Temp
|
|
{2939, 5, 1.0}, // Inverter Thermal
|
|
{2940, 2, 1.0}, // DC Link Voltage
|
|
{2941, 6, 1.0}, // Motor Torque %
|
|
{2942, 2, 100.0}, // Inverter Nominal Current
|
|
{2944, 2, 100.0}, // Inverter Max Current
|
|
{2946, 4, 1.0}, // Alarm Word 1
|
|
{2948, 4, 1.0}, // Alarm Word 2
|
|
{2950, 4, 1.0}, // Warning Word 1
|
|
{2952, 4, 1.0}, // Warning Word 2
|
|
{2954, 4, 1.0}, // Power Ups
|
|
{3000, 5, 1.0} // Over Temp Counter
|
|
};
|
|
|
|
float calculateStatusWord(float* values) {
|
|
uint16_t status = 0;
|
|
if(values[0] > 0) status |= 0x0001; // Running
|
|
if(values[1] > 100) status |= 0x0002; // Overload
|
|
return status;
|
|
}
|
|
|
|
float calculateThermal(float* values) {
|
|
return (values[0] / 100.0) * 100.0;
|
|
}
|
|
|
|
float calculatePower(float* values) {
|
|
return values[0] * 0.746; // kW to HP conversion
|
|
}
|
|
|
|
float calculateRPM(float* values) {
|
|
return values[0] * 60.0;
|
|
}
|
|
|
|
#endif |