diff --git a/src/BMS/VFD/PHX3_VFD_ABB_ACH580_RTU/State_Fail.cpp b/src/BMS/VFD/PHX3_VFD_ABB_ACH580_RTU/State_Fail.cpp index 987b5fd..f5c2588 100644 --- a/src/BMS/VFD/PHX3_VFD_ABB_ACH580_RTU/State_Fail.cpp +++ b/src/BMS/VFD/PHX3_VFD_ABB_ACH580_RTU/State_Fail.cpp @@ -41,6 +41,10 @@ FailState::FailState(const std::vector& activeAlarms) { addStrategy("Output Voltage", new SingleValueStrategy(0.1f, 0.1f, 1000 )); addStrategy("DC Voltage", new SingleValueStrategy(0.1f, 0.1f, 1000 )); addStrategy("Motor Shaft Power", new SingleValueStrategy(0.1f, 0.1f, 1000 )); + + addStrategy("AI1 Scaled", new RampStrategy(0.0f, 2.0f, 1000 )); + addStrategy("AI2 Scaled", new RampStrategy(0.0f, 5.0f, 1000 )); + addStrategy("AO1 Actual", new RampStrategy(0.0f, 2.0f, 1000 )); } /** @@ -83,6 +87,7 @@ void FailState::enterState(Equipment* equipment) { setPointValue(equipment, "Nominal Speed", 1800); setPointValue(equipment, "Nominal Power", 50); setPointValue(equipment, "Run Status", 0); + setPointValue(equipment, "DI Status", 0); } /** @@ -93,5 +98,4 @@ template<> void FailState::exitState(Equipment* equipment) { // Cleanup logic to run when the equipment leaves this state Serial.println("Exit Fail State..."); - } \ No newline at end of file diff --git a/src/BMS/VFD/PHX3_VFD_ABB_ACH580_RTU/State_Running.cpp b/src/BMS/VFD/PHX3_VFD_ABB_ACH580_RTU/State_Running.cpp index 9fc5ab2..83dfa41 100644 --- a/src/BMS/VFD/PHX3_VFD_ABB_ACH580_RTU/State_Running.cpp +++ b/src/BMS/VFD/PHX3_VFD_ABB_ACH580_RTU/State_Running.cpp @@ -44,14 +44,18 @@ RunningState::RunningState() { addStrategy("Speed Feedback", new RampStrategy(1800.0f, 100.0f, 1000)); addStrategy("Motor Current", new RampStrategy(65.0f, 7.0f, 1000)); addStrategy("Motor Torque", new RampStrategy(90.0f, 10.0f, 1000)); - addStrategy("Inverter Temperature", new SquareStrategy(40.0f, 80.0f, 1000)); + addStrategy("Inverter Temperature", new RampStrategy(70.0f, 1.0f, 1000)); addStrategy("Output Frequency", new RampStrategy(60.0f, 3.0f, 1000 )); addStrategy("Output Voltage", new RampStrategy(480.0f, 15.0f, 1000 )); addStrategy("DC Voltage", new RampStrategy(678.0f, 20.0f, 1000 )); addStrategy("Motor Shaft Power", new RampStrategy(36.7f, 2.0f, 1000 )); - addStrategy("Inverter MWh counter", new TotalizerStrategy(1000)); - addStrategy("Inverter kWh counter", new TotalizerStrategy(1000)); + addStrategy("Inverter MWh counter", new TotalizerStrategy(5000)); + addStrategy("Inverter kWh counter", new TotalizerStrategy(5000)); + + addStrategy("AI1 Scaled", new RampStrategy(10.0f, 1.0f, 1000 )); + addStrategy("AI2 Scaled", new RampStrategy(20.0f, 1.0f, 1000 )); + addStrategy("AO1 Actual", new RampStrategy(10.0f, 1.0f, 1000 )); } /** @@ -87,11 +91,14 @@ State* RunningState::update(Equipment* equipmen float voltage_update = speed_pct * 480; float dc_voltage_update = speed_pct * 678; float current_update = speed_pct * speed_pct * 65; - float torque_update = speed_pct * speed_pct * 100; // This is a % of nominal motor torque + float torque_update = speed_pct * speed_pct * 100 * 10; // This is a % of nominal motor torque, x10 b/c is scaled by 100 in actual equipment, this register is only 10x float freq_update = speed_pct * 60; float power_update = speed_pct * speed_pct * speed_pct * 36.77f; // 50 hp ~ 36.77kW float currentSP = getPointValue(equipment, "Speed Cmd"); + float AI1_update = speed_pct *10; + float AI2_update = speed_pct *20; + float AO1_update = speed_pct *10; Strategy_Behavior* speedFeedback = getStrategy("Speed Feedback"); if (speedFeedback) { @@ -127,6 +134,21 @@ State* RunningState::update(Equipment* equipmen if (powerstrategy) { static_cast(powerstrategy)->setTarget(power_update); } + + Strategy_Behavior* AI1strategy = getStrategy("AI1 Scaled"); + if (AI1strategy) { + static_cast(AI1strategy)->setTarget(AI1_update); + } + + Strategy_Behavior* AI2strategy = getStrategy("AI2 Scaled"); + if (AI2strategy) { + static_cast(AI2strategy)->setTarget(AI2_update); + } + + Strategy_Behavior* AO1strategy = getStrategy("AO1 Actual"); + if (AO1strategy) { + static_cast(AO1strategy)->setTarget(AO1_update); + } // Apply any strategies defined for the standby state _applyStrategies(equipment); @@ -150,6 +172,7 @@ void RunningState::enterState(Equipment* equipment) { setPointValue(equipment, "Nominal Speed", 1800); setPointValue(equipment, "Nominal Power", 50); setPointValue(equipment, "Run Status", 1); + setPointValue(equipment, "DI Status", 1); } /** diff --git a/src/BMS/VFD/PHX3_VFD_ABB_ACH580_RTU/State_Standby.cpp b/src/BMS/VFD/PHX3_VFD_ABB_ACH580_RTU/State_Standby.cpp index 41b3048..3b5185f 100644 --- a/src/BMS/VFD/PHX3_VFD_ABB_ACH580_RTU/State_Standby.cpp +++ b/src/BMS/VFD/PHX3_VFD_ABB_ACH580_RTU/State_Standby.cpp @@ -39,6 +39,10 @@ StandbyState::StandbyState() { addStrategy("Output Voltage", new SingleValueStrategy(0.1f, 0.1f, 1000 )); addStrategy("DC Voltage", new SingleValueStrategy(0.1f, 0.1f, 1000 )); addStrategy("Motor Shaft Power", new SingleValueStrategy(0.1f, 0.1f, 1000 )); + + addStrategy("AI1 Scaled", new RampStrategy(0.0f, 2.0f, 1000 )); + addStrategy("AI2 Scaled", new RampStrategy(0.0f, 5.0f, 1000 )); + addStrategy("AO1 Actual", new RampStrategy(0.0f, 2.0f, 1000 )); } /** @@ -90,6 +94,7 @@ void StandbyState::enterState(Equipment* equipment) { setPointValue(equipment, "Nominal Speed", 1800); setPointValue(equipment, "Nominal Power", 50); setPointValue(equipment, "Run Status", 0); + setPointValue(equipment, "DI Status", 0); } /** diff --git a/src/BMS/VFD/PHX3_VFD_ABB_ACH580_RTU/config.h b/src/BMS/VFD/PHX3_VFD_ABB_ACH580_RTU/config.h index 78bff06..9aaac3f 100644 --- a/src/BMS/VFD/PHX3_VFD_ABB_ACH580_RTU/config.h +++ b/src/BMS/VFD/PHX3_VFD_ABB_ACH580_RTU/config.h @@ -6,7 +6,7 @@ * * This file contains important configurations for the Modbus RTU communication * and the specific register map for the emulated device. - * These are 32-bit modbus registers. + * These are 16-bit modbus registers. * Added "Run Status" and "Fault Status" to simulated hard IO points and send feedback to PLC during simulation. */ @@ -71,22 +71,22 @@ modbusMap mb_map[] = {HR, 112, 0, "Output Voltage"}, // 480 VAC {HR_10x, 116, 0, "Motor Shaft Power"}, // 50 hp ~ 36.77 kW {HR, 118, 0, "Inverter MWh counter"}, - {HR_10x, 119, 0, "Inverter kWh counter"}, + {HR, 119, 0, "Inverter kWh counter"}, {HR, 510, 0, "Inverter Temperature"}, // RJD: Changed from HR_10x to HR, % of fault limit {HR, 519, 0, "Diagnostic Word"}, // not used in program. Bit 9:Drive Over-Temp Alarm - {HR, 1000, 0, "DI Status"}, // not used in program. - {HR, 1211, 0, "AI1 Scaled"}, // not used in program. - {HR, 1221, 0, "AI2 Scaled"}, // not used in program. - {HR, 1310, 0, "AO1 Actual"}, // not used in program. - {HR, 1910, 0, "External Control Location"}, // not used in program. - {HR, 4600, 0, "Speed Scaling"}, // ADD: 1800 rpm - {HR, 4601, 0, "Frequency Scaling"}, // ADD: 60 Hz - {HR, 9905, 0, "Nominal Current"}, // ADD: 65 A - {HR_10x, 9906, 0, "Nominal Voltage"}, // ADD: 480 V - {HR_10x, 9907, 0, "Nominal Frequency"}, // ADD: 60 Hz - {HR, 9908, 0, "Nominal Speed"}, // ADD: 1800 rpm - {HR_10x, 9909, 0, "Nominal Power"}, // ADD: 50 hp + {HR, 1000, 0, "DI Status"}, // Bit 0: input 1, Bit 1: Input 2 + {HR, 1211, 0, "AI1 Scaled"}, // output frequency/speed reference, 0-10V + {HR, 1221, 0, "AI2 Scaled"}, // actual feedback 0-20mA + {HR, 1310, 0, "AO1 Actual"}, // output frequency 0-10V + {HR, 1910, 0, "External Control Location"}, // not used in program. Bit 13, 0:false, 1:true + {HR, 4600, 1800, "Speed Scaling"}, // 1800 rpm + {HR, 4601, 60, "Frequency Scaling"}, // 60 Hz + {HR, 9905, 65, "Nominal Current"}, // 65 A + {HR_10x, 9906, 4800, "Nominal Voltage"}, // 480 V + {HR_10x, 9907, 600, "Nominal Frequency"}, // 60 Hz + {HR, 9908, 1800, "Nominal Speed"}, // 1800 rpm + {HR_10x, 9909, 500, "Nominal Power"}, // 50 hp }; //Size of modbus map used in FOR cycles, automatically calculated.