65 lines
2.2 KiB
C
65 lines
2.2 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
|
|
uint32_t sr_addr;
|
|
float scale;
|
|
};
|
|
|
|
const PROGMEM RegisterMap registers[] = {
|
|
{0x0000, 4, 402910, 1.0}, // Status Word
|
|
{3060, 6, 402911, 1.0}, // Min Active Value
|
|
{3000, 5, 402912, 1.0}, // Thermal Sense
|
|
{3110, 2, 402913, 10.0}, // Frequency
|
|
{1840, 1, 402914, 1.0}, // Running Hours
|
|
{1840, 1, 402916, 1.0}, // Operating Hours
|
|
{2700, 2, 402918, 1.0}, // kWh Counter
|
|
{3060, 2, 402920, 100.0}, // Input Power kW
|
|
{3060, 6, 402922, 134.102}, // Input Power HP
|
|
{3006, 2, 402924, 100.0}, // Motor Current
|
|
{3000, 2, 402926, 100.0}, // Phase I1
|
|
{3002, 2, 402928, 100.0}, // Phase I2
|
|
{3004, 2, 402930, 100.0}, // Phase I3
|
|
{3110, 7, 402932, 60.0}, // Motor RPM
|
|
{3028, 2, 402934, 10.0}, // Motor Voltage
|
|
{3060, 6, 402935, 1.0}, // Torque Nm
|
|
{3000, 5, 402936, 1.0}, // Motor Thermal
|
|
{3000, 5, 402937, 1.0}, // Heatsink Temp
|
|
{3000, 5, 402938, 1.0}, // Card Temp
|
|
{3000, 5, 402939, 1.0}, // Inverter Thermal
|
|
{3028, 2, 402940, 1.0}, // DC Link Voltage
|
|
{3060, 6, 402941, 1.0}, // Motor Torque %
|
|
{3006, 2, 402942, 100.0}, // Inverter Nominal Current
|
|
{3006, 2, 402944, 100.0}, // Inverter Max Current
|
|
{0x0000, 4, 402946, 1.0}, // Alarm Word 1
|
|
{0x0000, 4, 402948, 1.0}, // Alarm Word 2
|
|
{0x0000, 4, 402950, 1.0}, // Warning Word 1
|
|
{0x0000, 4, 402952, 1.0}, // Warning Word 2
|
|
{0x0000, 4, 402954, 1.0}, // Power Ups
|
|
{3000, 5, 402955, 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 |