ATS update
This commit is contained in:
@@ -101,6 +101,15 @@ State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
|||||||
float a_pwr = pwr * (pf/100.0f);
|
float a_pwr = pwr * (pf/100.0f);
|
||||||
setPointValue(equipment, "Total Apparent Power", a_pwr*1000.0f);
|
setPointValue(equipment, "Total Apparent Power", a_pwr*1000.0f);
|
||||||
|
|
||||||
|
float preferred = getPointValue(equipment, "ATS_Preferred");
|
||||||
|
if (preferred == 1.0f){
|
||||||
|
setPointValue(equipment, "Source 1 Preferred", 1.0f);
|
||||||
|
setPointValue(equipment, "Source 2 Preferred", 0.0f);
|
||||||
|
}
|
||||||
|
if (preferred == 2.0f){
|
||||||
|
setPointValue(equipment, "Source 1 Preferred", 0.0f);
|
||||||
|
setPointValue(equipment, "Source 2 Preferred", 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
_applyStrategies(equipment);
|
_applyStrategies(equipment);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|||||||
@@ -97,7 +97,18 @@ State<ModbusIP>* StandbyState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
|||||||
float a_pwr = pwr * (pf/100.0f);
|
float a_pwr = pwr * (pf/100.0f);
|
||||||
setPointValue(equipment, "Total Apparent Power", a_pwr*1000.0f);
|
setPointValue(equipment, "Total Apparent Power", a_pwr*1000.0f);
|
||||||
|
|
||||||
|
/*setPointValue(equipment, "S2 kW", kw);
|
||||||
|
setPointValue(equipment, "S2 MWh", mwh);*/
|
||||||
|
|
||||||
|
float preferred = getPointValue(equipment, "ATS_Preferred");
|
||||||
|
if (preferred == 1.0f){
|
||||||
|
setPointValue(equipment, "Source 1 Preferred", 1.0f);
|
||||||
|
setPointValue(equipment, "Source 2 Preferred", 0.0f);
|
||||||
|
}
|
||||||
|
if (preferred == 2.0f){
|
||||||
|
setPointValue(equipment, "Source 1 Preferred", 0.0f);
|
||||||
|
setPointValue(equipment, "Source 2 Preferred", 1.0f);
|
||||||
|
}
|
||||||
_applyStrategies(equipment);
|
_applyStrategies(equipment);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,7 @@
|
|||||||
*/
|
*/
|
||||||
modbusMap mb_map[] =
|
modbusMap mb_map[] =
|
||||||
{
|
{
|
||||||
|
{HR, 8, 0, "ATS_Preferred"}, //Internal to control from Modscan
|
||||||
{HR, 9, 0, "ATS_Source"}, //Internal to control from Modscan
|
{HR, 9, 0, "ATS_Source"}, //Internal to control from Modscan
|
||||||
{HR, 10, 0, "ATS_Load"}, //Internal Fault code from Modscan
|
{HR, 10, 0, "ATS_Load"}, //Internal Fault code from Modscan
|
||||||
{HR, 11, 0, "ATS_Rating"}, //Internal Fault code from Modscan
|
{HR, 11, 0, "ATS_Rating"}, //Internal Fault code from Modscan
|
||||||
|
|||||||
@@ -105,6 +105,16 @@ State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
|||||||
setPointValue(equipment, "S2 kW", kw);
|
setPointValue(equipment, "S2 kW", kw);
|
||||||
setPointValue(equipment, "S2 MWh", mwh);
|
setPointValue(equipment, "S2 MWh", mwh);
|
||||||
|
|
||||||
|
float preferred = getPointValue(equipment, "ATS_Preferred");
|
||||||
|
if (preferred == 1.0f){
|
||||||
|
setBitValue(equipment, "Source Preferred", 9, true);
|
||||||
|
setBitValue(equipment, "Source Preferred", 8, false);
|
||||||
|
}
|
||||||
|
if (preferred == 2.0f){
|
||||||
|
setBitValue(equipment, "Source Preferred", 9, false);
|
||||||
|
setBitValue(equipment, "Source Preferred", 8, true);
|
||||||
|
}
|
||||||
|
|
||||||
// Apply any strategies defined for the standby state
|
// Apply any strategies defined for the standby state
|
||||||
_applyStrategies(equipment);
|
_applyStrategies(equipment);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|||||||
@@ -96,6 +96,16 @@ State<ModbusIP>* StandbyState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
|||||||
float kw = (1.732f * ((real_v_AB + real_v_BC + real_v_CA)/3.0f) * sim_load * pf)*10;
|
float kw = (1.732f * ((real_v_AB + real_v_BC + real_v_CA)/3.0f) * sim_load * pf)*10;
|
||||||
float mwh = kw *600.0f;
|
float mwh = kw *600.0f;
|
||||||
|
|
||||||
|
float preferred = getPointValue(equipment, "ATS_Preferred");
|
||||||
|
if (preferred == 1.0f){
|
||||||
|
setBitValue(equipment, "Source Preferred", 9, true);
|
||||||
|
setBitValue(equipment, "Source Preferred", 8, false);
|
||||||
|
}
|
||||||
|
if (preferred == 2.0f){
|
||||||
|
setBitValue(equipment, "Source Preferred", 9, false);
|
||||||
|
setBitValue(equipment, "Source Preferred", 8, true);
|
||||||
|
}
|
||||||
|
|
||||||
setPointValue(equipment, "S1 kW", kw);
|
setPointValue(equipment, "S1 kW", kw);
|
||||||
setPointValue(equipment, "S1 MWh", mwh);
|
setPointValue(equipment, "S1 MWh", mwh);
|
||||||
_applyStrategies(equipment);
|
_applyStrategies(equipment);
|
||||||
|
|||||||
@@ -60,6 +60,7 @@
|
|||||||
*/
|
*/
|
||||||
modbusMap mb_map[] =
|
modbusMap mb_map[] =
|
||||||
{
|
{
|
||||||
|
{HR, 8, 0, "ATS_Preferred"}, //Internal to control from Modscan
|
||||||
{HR, 9, 0, "ATS_Source"}, //Internal to control from Modscan
|
{HR, 9, 0, "ATS_Source"}, //Internal to control from Modscan
|
||||||
{HR, 10, 0, "ATS_Load"},
|
{HR, 10, 0, "ATS_Load"},
|
||||||
{HR, 11, 0, "ATS_Rating"}, //Internal Fault code from Modscan
|
{HR, 11, 0, "ATS_Rating"}, //Internal Fault code from Modscan
|
||||||
|
|||||||
Reference in New Issue
Block a user