diff --git a/platformio.ini b/platformio.ini index 2bec804..ce2f5ec 100644 --- a/platformio.ini +++ b/platformio.ini @@ -10,10 +10,10 @@ [platformio] -default_envs = PHX3_CRAH_LIEBERT_80_SLAB_TCP ; Select here the name of the configuration you want to download +default_envs = PHX3_VFD_ABB_ACH580_RTU ; Select here the name of the configuration you want to download [env] -upload_port = COM9 +upload_port = COM13 [common_env_options] framework = arduino @@ -226,3 +226,10 @@ board = dfrobot_firebeetle2_esp32e extends = common_env_options build_flags = -D USE_MODBUS_IP build_src_filter = -<*> + + +[env:CRAH_UMAS_TCP] +platform = espressif32 +board = dfrobot_firebeetle2_esp32e +extends = common_env_options +build_flags = -D USE_MODBUS_IP +build_src_filter = -<*> + \ No newline at end of file diff --git a/src/BMS/CHILLER/CH_York_YVAA_RTU/config.h b/src/BMS/CHILLER/CH_York_YVAA_RTU/config.h index 79e7383..ee3284c 100644 --- a/src/BMS/CHILLER/CH_York_YVAA_RTU/config.h +++ b/src/BMS/CHILLER/CH_York_YVAA_RTU/config.h @@ -22,11 +22,11 @@ * @{ */ #include - const char *ssid = "wifi_name"; /**< @brief The SSID of the WiFi network. */ - const char *password = "wifi_password"; /**< @brief The password for the WiFi network. */ - IPAddress local_IP(192, 168, 1, 234); /**< @brief The static IP address for the device. */ - IPAddress gateway(192, 168, 1, 1); /**< @brief The gateway IP address. */ - IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */ + const char *ssid = "ArduinoWifiB"; /**< @brief The SSID of the WiFi network. */ + const char *password = "123abc456"; /**< @brief The password for the WiFi network. */ + IPAddress local_IP(172, 17, 32, 35); /**< @brief The static IP address for the device. */ + IPAddress gateway(172, 17, 32, 1); /**< @brief The gateway IP address. */ + IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */ ModbusIP mb; #else diff --git a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Fail.cpp b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Fail.cpp index eafcf6b..c2f9171 100644 --- a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Fail.cpp +++ b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Fail.cpp @@ -16,6 +16,7 @@ #include "Strategies/Strategy_Ramp.h" #include "Strategies/Strategy_SingleValue.h" #include "Strategies/Strategy_PID.h" +#include "Strategies/Strategy_Saw.h" #include "States/State_Standby.h" #include "States/State_Running.h" #include "States/State_Fail.h" @@ -57,7 +58,7 @@ FailState::FailState(const std::vector& activeAlarms) { addStrategy("Amps Fan 7", new RampStrategy(0.0f, 4.5f, 1000)); addStrategy("Amps Fan 8", new RampStrategy(0.0f, 4.5f, 1000)); addStrategy("Amps Fan 9", new RampStrategy(0.0f, 4.5f, 1000)); - + addStrategy("CRAH Heartbeat", new SawStrategy(0.0f, 60.0f, 1.0f, 1000)); } /** diff --git a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Running.cpp b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Running.cpp index f85524b..00cab5f 100644 --- a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Running.cpp +++ b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Running.cpp @@ -71,11 +71,11 @@ RunningState::RunningState() { addStrategy("Operating Hours Fan 7", new TotalizerStrategy(1000)); addStrategy("Operating Hours Fan 8", new TotalizerStrategy(1000)); addStrategy("Operating Hours Fan 9", new TotalizerStrategy(1000)); - addStrategy("Supply Air Temp", new SawStrategy(60.0f, 100.0f, 2.0f, 1000)); // Won't initialize at lower bound; always initializes at 0 b/c FLOAT; initialize manually via Modscan + addStrategy("Supply Air Temp", new SawStrategy(60.0f, 100.0f, 2.2f, 1000)); // Won't initialize at lower bound; always initializes at 0 b/c FLOAT; initialize manually via Modscan addStrategy("Return Air Temp", new SawStrategy(70.0f, 80.0f, 1.0f, 1000)); addStrategy("Filter Differential Pressure", new SawStrategy(0.0f, 5.0f, 0.2f, 1000)); addStrategy("CW Valve Position", new PIDStrategy("Supply Air Temp Setpoint", 1000, "Supply Air Temp")); // SAT must be greater than SAT Setpoint for this PID to work. - + addStrategy("CRAH Heartbeat", new SawStrategy(0.0f, 60.0f, 1.0f, 1000)); } /** diff --git a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Standby.cpp b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Standby.cpp index 70be6d4..a0f6b7d 100644 --- a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Standby.cpp +++ b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Standby.cpp @@ -61,7 +61,7 @@ StandbyState::StandbyState() { addStrategy("Amps Fan 7", new RampStrategy(0.0f, 4.5f, 1000)); addStrategy("Amps Fan 8", new RampStrategy(0.0f, 4.5f, 1000)); addStrategy("Amps Fan 9", new RampStrategy(0.0f, 4.5f, 1000)); - + addStrategy("CRAH Heartbeat", new SawStrategy(0.0f, 60.0f, 1.0f, 1000)); } /** diff --git a/src/BMS/CRAH/CRAH_UMAS_TCP/config.h b/src/BMS/CRAH/CRAH_UMAS_TCP/config.h index 9490535..fc381ad 100644 --- a/src/BMS/CRAH/CRAH_UMAS_TCP/config.h +++ b/src/BMS/CRAH/CRAH_UMAS_TCP/config.h @@ -21,10 +21,10 @@ * @{ */ #include - const char *ssid = "TP-Link_D91A"; /**< @brief The SSID of the WiFi network. */ - const char *password = "52761492"; /**< @brief The password for the WiFi network. */ - IPAddress local_IP(192, 168, 1, 234); /**< @brief The static IP address for the device. */ - IPAddress gateway(192, 168, 1, 1); /**< @brief The gateway IP address. */ + const char *ssid = "ArduinoWifiB"; /**< @brief The SSID of the WiFi network. */ + const char *password = "123abc456"; /**< @brief The password for the WiFi network. */ + IPAddress local_IP(172, 30, 22, 100); /**< @brief The static IP address for the device. */ + IPAddress gateway(172, 17, 32, 1); /**< @brief The gateway IP address. */ IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */ ModbusIP mb; @@ -135,7 +135,8 @@ modbusMap mb_map[] = {IR_FLOAT, 73, 0, "Amps Fan 6"}, {IR_FLOAT, 75, 0, "Amps Fan 7"}, {IR_FLOAT, 77, 0, "Amps Fan 8"}, - {IR_FLOAT, 79, 0, "Amps Fan 9"}, + {IR_FLOAT, 79, 0, "Amps Fan 9"}, + {IR_FLOAT, 99, 0, "CRAH Heartbeat"}, // Placeholder - we don't have this from UMAS yet. Not used in logic yet. {HR_FLOAT, 13, 0, "Fan Speed Setpoint"}, // Receive signal from PLC {HR_FLOAT, 17, 0, "Supply Air Temp Setpoint"}, // Receive signal from PLC @@ -143,7 +144,7 @@ modbusMap mb_map[] = {HR_FLOAT, 23, 0, "Fan Max Speed"}, // Send to PLC {HR, 25, 0, "BMS Control Source"}, // Receive signal from PLC 0:Speed, 1:Room Temp {HR, 26, 2, "BMS Enable Source"}, // Receive signal from PLC 0:Keypad, 1:DI, 2:BMS - {HR, 99, 0, "CRAH Heartbeat"} // Placeholder - we don't have this from UMAS yet. Not used in logic yet. + }; //Size of modbus map used in FOR cycles, automatically calculated. diff --git a/src/BMS/CRAH/PHX3_CRAH_LIEBERT_80_SLAB_TCP/config.h b/src/BMS/CRAH/PHX3_CRAH_LIEBERT_80_SLAB_TCP/config.h index f547b18..c027708 100644 --- a/src/BMS/CRAH/PHX3_CRAH_LIEBERT_80_SLAB_TCP/config.h +++ b/src/BMS/CRAH/PHX3_CRAH_LIEBERT_80_SLAB_TCP/config.h @@ -20,11 +20,10 @@ * @brief Parameters for Modbus TCP communication. * @{ */ - #include - const char *ssid = "TP-Link_D91A"; /**< @brief The SSID of the WiFi network. */ - const char *password = "52761492"; /**< @brief The password for the WiFi network. */ - IPAddress local_IP(192, 168, 1, 234); /**< @brief The static IP address for the device. */ - IPAddress gateway(192, 168, 1, 1); /**< @brief The gateway IP address. */ + const char *ssid = "ArduinoWifiB"; /**< @brief The SSID of the WiFi network. */ + const char *password = "123abc456"; /**< @brief The password for the WiFi network. */ + IPAddress local_IP(172, 17, 32, 63); /**< @brief The static IP address for the device. */ + IPAddress gateway(172, 17, 32, 1); /**< @brief The gateway IP address. */ IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */ ModbusIP mb; diff --git a/src/BMS/HUM/HUM_DriSteem_RTS_RX36_TCP/config.h b/src/BMS/HUM/HUM_DriSteem_RTS_RX36_TCP/config.h index 41b252c..a40b037 100644 --- a/src/BMS/HUM/HUM_DriSteem_RTS_RX36_TCP/config.h +++ b/src/BMS/HUM/HUM_DriSteem_RTS_RX36_TCP/config.h @@ -21,10 +21,10 @@ * @{ */ #include - const char *ssid = "TP-Link_D91A"; /**< @brief The SSID of the WiFi network. */ - const char *password = "52761492"; /**< @brief The password for the WiFi network. */ - IPAddress local_IP(192, 168, 1, 234); /**< @brief The static IP address for the device. */ - IPAddress gateway(192, 168, 1, 1); /**< @brief The gateway IP address. */ + const char *ssid = "ArduinoWifiB"; /**< @brief The SSID of the WiFi network. */ + const char *password = "123abc456"; /**< @brief The password for the WiFi network. */ + IPAddress local_IP(172, 17, 32, 67); /**< @brief The static IP address for the device. */ + IPAddress gateway(172, 17, 32, 1); /**< @brief The gateway IP address. */ IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */ ModbusIP mb; 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 f7b8919..987b5fd 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 @@ -32,9 +32,7 @@ */ template<> FailState::FailState(const std::vector& activeAlarms) { - addStrategy("Motor Speed Used", new RampStrategy(0.0f, 200.0f, 1000 )); addStrategy("Speed Feedback", new RampStrategy(0.0f, 200.0f, 1000 )); - addStrategy("Motor Speed estimated", new RampStrategy(0.0f, 200.0f, 1000 )); addStrategy("Motor Current", new RampStrategy(0.0f, 20.0f, 1000 )); addStrategy("Motor Torque", new RampStrategy(0.0f, 20.0f, 1000 )); addStrategy("Inverter Temperature", new RampStrategy(0.0f, 1.0f, 1000 )); @@ -42,7 +40,7 @@ FailState::FailState(const std::vector& activeAlarms) { addStrategy("Output Frequency", new SingleValueStrategy(0.1f, 0.2f, 1000 )); addStrategy("Output Voltage", new SingleValueStrategy(0.1f, 0.1f, 1000 )); addStrategy("DC Voltage", new SingleValueStrategy(0.1f, 0.1f, 1000 )); - addStrategy("Output Power", new SingleValueStrategy(0.1f, 0.1f, 1000 )); + addStrategy("Motor Shaft Power", new SingleValueStrategy(0.1f, 0.1f, 1000 )); } /** @@ -77,6 +75,13 @@ template<> void FailState::enterState(Equipment* equipment) { // Logic to run when the equipment enters this state Serial.println("Enter Fail State..."); + setPointValue(equipment, "Speed Scaling", 1800); + setPointValue(equipment, "Frequency Scaling", 60); + setPointValue(equipment, "Nominal Current", 65); + setPointValue(equipment, "Nominal Voltage", 480); + setPointValue(equipment, "Nominal Frequency", 60); + setPointValue(equipment, "Nominal Speed", 1800); + setPointValue(equipment, "Nominal Power", 50); setPointValue(equipment, "Run Status", 0); } 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 36d586d..5748056 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 @@ -41,9 +41,7 @@ */ template<> RunningState::RunningState() { - addStrategy("Motor Speed Used", new RampStrategy(1800.0f, 100.0f, 1000)); addStrategy("Speed Feedback", new RampStrategy(1800.0f, 100.0f, 1000)); - addStrategy("Motor Speed estimated", 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)); @@ -51,9 +49,9 @@ RunningState::RunningState() { 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("Output Power", new RampStrategy(36.7f, 2.0f, 1000 )); - addStrategy("Inverter kWh cnt", new TotalizerStrategy(1000)); - addStrategy("Hours Run", new TotalizerStrategy(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)); } /** @@ -94,25 +92,11 @@ State* RunningState::update(Equipment* equipmen float power_update = speed_pct * speed_pct * speed_pct * 36.77f; // 50 hp ~ 36.77kW float currentSP = getPointValue(equipment, "Speed Cmd"); - Strategy_Behavior* motorSpeedUsed = getStrategy("Motor Speed Used"); - // 2. Check if the strategy exists - if (motorSpeedUsed) { - // 3. Cast it to a RampStrategy pointer and call setSetpoint. - static_cast(motorSpeedUsed)->setTarget(currentSP); - } - Strategy_Behavior* speedFeedback = getStrategy("Speed Feedback"); if (speedFeedback) { static_cast(speedFeedback)->setTarget(currentSP); } - // To have Motor Speed estimated slightly different - for purposes of differentiating in Ignition - float rpm_est = currentSP * 0.98f; - Strategy_Behavior* motorSpeedEst = getStrategy("Motor Speed estimated"); - if (motorSpeedEst) { - static_cast(motorSpeedEst)->setTarget(rpm_est); - } - Strategy_Behavior* frequencystrategy = getStrategy("Output Frequency"); if (frequencystrategy) { static_cast(frequencystrategy)->setTarget(freq_update); @@ -138,7 +122,7 @@ State* RunningState::update(Equipment* equipmen static_cast(voltagestrategy)->setTarget(voltage_update); } - Strategy_Behavior* powerstrategy = getStrategy("Output Power"); + Strategy_Behavior* powerstrategy = getStrategy("Motor Shaft Power"); if (powerstrategy) { static_cast(powerstrategy)->setTarget(power_update); } @@ -157,6 +141,13 @@ template<> void RunningState::enterState(Equipment* equipment) { // Logic to run when the equipment enters this state Serial.println("Enter Running State..."); + setPointValue(equipment, "Speed Scaling", 1800); + setPointValue(equipment, "Frequency Scaling", 60); + setPointValue(equipment, "Nominal Current", 65); + setPointValue(equipment, "Nominal Voltage", 480); + setPointValue(equipment, "Nominal Frequency", 60); + setPointValue(equipment, "Nominal Speed", 1800); + setPointValue(equipment, "Nominal Power", 50); setPointValue(equipment, "Run 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 01629e0..41b3048 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 @@ -30,9 +30,7 @@ */ template<> StandbyState::StandbyState() { - addStrategy("Motor Speed Used", new RampStrategy(0.0f, 200.0f, 1000 )); addStrategy("Speed Feedback", new RampStrategy(0.0f, 200.0f, 1000 )); - addStrategy("Motor Speed estimated", new RampStrategy(0.0f, 200.0f, 1000 )); addStrategy("Motor Current", new RampStrategy(0.0f, 20.0f, 1000 )); addStrategy("Motor Torque", new RampStrategy(0.0f, 20.0f, 1000 )); addStrategy("Inverter Temperature", new RampStrategy(0.0f, 1.0f, 1000 )); @@ -40,7 +38,7 @@ StandbyState::StandbyState() { addStrategy("Output Frequency", new SingleValueStrategy(0.1f, 0.2f, 1000 )); addStrategy("Output Voltage", new SingleValueStrategy(0.1f, 0.1f, 1000 )); addStrategy("DC Voltage", new SingleValueStrategy(0.1f, 0.1f, 1000 )); - addStrategy("Output Power", new SingleValueStrategy(0.1f, 0.1f, 1000 )); + addStrategy("Motor Shaft Power", new SingleValueStrategy(0.1f, 0.1f, 1000 )); } /** @@ -84,6 +82,13 @@ template<> void StandbyState::enterState(Equipment* equipment) { // Logic to run when the equipment enters this state Serial.println("Enter Standby State..."); + setPointValue(equipment, "Speed Scaling", 1800); + setPointValue(equipment, "Frequency Scaling", 60); + setPointValue(equipment, "Nominal Current", 65); + setPointValue(equipment, "Nominal Voltage", 480); + setPointValue(equipment, "Nominal Frequency", 60); + setPointValue(equipment, "Nominal Speed", 1800); + setPointValue(equipment, "Nominal Power", 50); setPointValue(equipment, "Run 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 1389e79..e347759 100644 --- a/src/BMS/VFD/PHX3_VFD_ABB_ACH580_RTU/config.h +++ b/src/BMS/VFD/PHX3_VFD_ABB_ACH580_RTU/config.h @@ -63,25 +63,31 @@ modbusMap mb_map[] = {HR, 155, 1, "Fault Status"}, // arbitrary register number - 0:faulted, 1:not faulted (simulated hardwire IO). When = 0, will turn off VFD. {HR, 156, 0, "Speed Feedback"}, // arbitrary register number - send signal to PLC (simulated hardwire IO). Will be equal to Motor Speed Used register - {HR_FLOAT, 20201, 0, "Motor Speed Used"}, // RJD: 1800 rpm max - {HR_FLOAT, 20203, 0, "Motor Speed estimated"}, // RJD: 1800 rpm max - {HR_FLOAT, 20211, 0, "Output Frequency"}, // 60 Hz @100% speed - {HR_FLOAT, 20213, 0, "Motor Current"}, // RJD: Changed from HR_10x to HR, 65 FLA - {HR_FLOAT, 20219, 0, "Motor Torque"}, // % of nominal torque - {HR_FLOAT, 20221, 0, "DC Voltage"}, // approx 678 VDC @100% speed - {HR_FLOAT, 20225, 0, "Output Voltage"}, // RJD: 480 VAC - {HR_FLOAT, 20227, 0, "Output Power"}, //max 372580 // RJD: Changed from HR_10x to HR, 50 hp ~ 36.77 kW - {HR_FLOAT, 20239, 0, "Inverter kWh cnt"}, - {HR_FLOAT, 21005, 0, "Hours Run"}, - {HR_FLOAT, 21021, 0, "Inverter Temperature"}, // RJD: Changed from HR_10x to HR, % of fault limit + {HR_FLOAT, 100, 0, "Motor Speed Used"}, // 1800 rpm max + {HR_FLOAT, 105, 0, "Output Frequency"}, // 60 Hz @100% speed + {HR_FLOAT, 106, 0, "Motor Current"}, // 65 FLA + {HR_FLOAT, 109, 0, "Motor Torque"}, // % of nominal torque + {HR_FLOAT, 110, 0, "DC Voltage"}, // approx 678 VDC @100% speed + {HR_FLOAT, 112, 0, "Output Voltage"}, // 480 VAC + {HR_FLOAT, 116, 0, "Motor Shaft Power"}, // 50 hp ~ 36.77 kW + {HR_FLOAT, 118, 0, "Inverter MWh counter"}, + {HR_FLOAT, 119, 0, "Inverter kWh counter"}, + {HR_FLOAT, 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, 21243, 0, "HOA Status Word"}, // not used in program - {HR, 20801, 0, "Trip Fault"}, // not used in program - {HR, 20821, 0, "Last Fault"}, // not used in program - {HR, 20823, 0, "2nd to last Fault"}, // not used in program - {HR, 20825, 0, "3rd to last Fault"}, // not used in program - {HR, 21221, 0, "Main Status Word"}, // not used in program - {HR, 21231, 0, "Drive Status Word 1"}, // not used in program + {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_FLOAT, 4600, 0, "Speed Scaling"}, // ADD: 1800 rpm + {HR_FLOAT, 4601, 0, "Frequency Scaling"}, // ADD: 60 Hz + {HR_FLOAT, 9905, 0, "Nominal Current"}, // ADD: 65 A + {HR_FLOAT, 9906, 0, "Nominal Voltage"}, // ADD: 480 V + {HR_FLOAT, 9907, 0, "Nominal Frequency"}, // ADD: 60 Hz + {HR_FLOAT, 9908, 0, "Nominal Speed"}, // ADD: 1800 rpm + {HR_FLOAT, 9909, 0, "Nominal Power"}, // ADD: 50 hp + }; //Size of modbus map used in FOR cycles, automatically calculated. /**