|
@@ -5,8 +5,10 @@ import com.jiayue.pfr.constant.CacheConstants;
|
|
|
import com.jiayue.pfr.dto.FmDataBeanDto;
|
|
|
import com.jiayue.pfr.dto.SagFormulaDto;
|
|
|
import com.jiayue.pfr.entity.BizYaoData;
|
|
|
+import com.jiayue.pfr.entity.ElectricField;
|
|
|
import com.jiayue.pfr.service.alg.BizYaoDataService;
|
|
|
import com.jiayue.pfr.service.cmf.SysParameterService;
|
|
|
+import com.jiayue.pfr.service.di.impl.ElectricFieldService;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -33,6 +35,8 @@ public class CoreAlgListener implements ApplicationListener<GetFmEvent> {
|
|
|
ApplicationEventPublisher applicationEventPublisher;
|
|
|
@Autowired
|
|
|
BizYaoDataService bizYaoDataService;
|
|
|
+ @Autowired
|
|
|
+ ElectricFieldService electricFieldService;
|
|
|
|
|
|
@Async
|
|
|
@Override
|
|
@@ -45,14 +49,32 @@ public class CoreAlgListener implements ApplicationListener<GetFmEvent> {
|
|
|
// 投入,获取最新频率
|
|
|
FmDataBeanDto fmDataBeanDto = getFmEvent.getFmDataBeanDto();
|
|
|
if (fmDataBeanDto.getF().compareTo(new BigDecimal("-99"))!=0){
|
|
|
+ // 生成下垂公式属性
|
|
|
SagFormulaDto sagFormulaDto = genSagFormulaAttr(fmDataBeanDto);
|
|
|
BizYaoData bizYaoData = bizYaoDataService.queryCache();
|
|
|
+ String debugging = sysParameterService.queryByKey("debugging","OFF");
|
|
|
// 判断频率是否超死区
|
|
|
if (!"".equals(sagFormulaDto.getFmDisturb())){
|
|
|
// 判断是否有过动作信号
|
|
|
- if ("1".equals(bizYaoData.getAction())){
|
|
|
+ if ("0".equals(bizYaoData.getAction())){
|
|
|
+ // 保存调频时初始功率
|
|
|
+// if (CacheConstants.fmInitPower.compareTo(new BigDecimal("0"))==0){
|
|
|
+// CacheConstants.fmInitPower = fmDataBeanDto.getActivePower();
|
|
|
+// }
|
|
|
+
|
|
|
+ bizYaoData.setAction("1");
|
|
|
+ bizYaoData = bizYaoDataService.update(bizYaoData);
|
|
|
+
|
|
|
// 计算有功-频率下垂公式=>∆P
|
|
|
BigDecimal dtp = sagFormulaCal(sagFormulaDto,fmDataBeanDto);
|
|
|
+ if ("ON".equals(debugging)){
|
|
|
+ // 增量值加入缓存
|
|
|
+ CacheConstants.debuggerPower = fmDataBeanDto.getActivePower().add(dtp);
|
|
|
+ System.out.println("==============频率调整后目标值==============");
|
|
|
+ System.out.println(dtp.toString());
|
|
|
+ System.out.println(fmDataBeanDto.getActivePower().toString());
|
|
|
+ System.out.println(CacheConstants.debuggerPower.toString());
|
|
|
+ }
|
|
|
// 给AGC闭锁调用104
|
|
|
applicationEventPublisher.publishEvent(new AgcEvent(ActionResetEnum.ACTION.getCode(),bizYaoData));
|
|
|
// 上传PMU、EMS数据
|
|
@@ -60,8 +82,16 @@ public class CoreAlgListener implements ApplicationListener<GetFmEvent> {
|
|
|
}
|
|
|
}
|
|
|
else{
|
|
|
+ if ("ON".equals(debugging) && "1".equals(bizYaoData.getAction())){
|
|
|
+ // 增量值加入缓存
|
|
|
+ String testAct = sysParameterService.queryByKey("testAct","OFF");
|
|
|
+ CacheConstants.testAct = new BigDecimal(testAct);
|
|
|
+ CacheConstants.debuggerPower=new BigDecimal("0");
|
|
|
+ }
|
|
|
// 判断是否有过动作信号
|
|
|
- if ("0".equals(bizYaoData.getAction())){
|
|
|
+ if ("1".equals(bizYaoData.getAction())){
|
|
|
+ bizYaoData.setAction("0");
|
|
|
+ bizYaoData = bizYaoDataService.update(bizYaoData);
|
|
|
fLogger.info("频率恢复,当前频率:"+fmDataBeanDto.getF()+" 时间:"+fmDataBeanDto.getTime());
|
|
|
applicationEventPublisher.publishEvent(new AgcEvent(ActionResetEnum.RESET.getCode(),bizYaoData));
|
|
|
// 做复归通知,AGC和PMU
|
|
@@ -84,8 +114,9 @@ public class CoreAlgListener implements ApplicationListener<GetFmEvent> {
|
|
|
String dbMin = sysParameterService.queryByKey("dbMin","49.95");
|
|
|
String dbMax = sysParameterService.queryByKey("dbMax","50.05");
|
|
|
// 获取场站额定功率
|
|
|
- String capacity = sysParameterService.queryByKey("capacity","100");
|
|
|
- sagFormulaDto.setCapacity(new BigDecimal(capacity));
|
|
|
+ ElectricField electricField = CacheConstants.electricFieldConcurrentHashMap.get(1);
|
|
|
+ BigDecimal capacity = electricField.getCapacity();
|
|
|
+ sagFormulaDto.setCapacity(capacity);
|
|
|
// 判断频率是否超死区
|
|
|
if (fmDataBeanDto.getF().compareTo(new BigDecimal(dbMax))==1){
|
|
|
// 频率上扰
|
|
@@ -117,7 +148,7 @@ public class CoreAlgListener implements ApplicationListener<GetFmEvent> {
|
|
|
* @return
|
|
|
*/
|
|
|
private BigDecimal sagFormulaCal(SagFormulaDto sagFormulaDto,FmDataBeanDto fmDataBeanDto){
|
|
|
- BigDecimal difference = fmDataBeanDto.getF().subtract(sagFormulaDto.getLimit());
|
|
|
+ BigDecimal difference = fmDataBeanDto.getF().subtract(sagFormulaDto.getDb());
|
|
|
BigDecimal differencetemp = difference.divide(new BigDecimal("50"),4,BigDecimal.ROUND_HALF_UP);
|
|
|
BigDecimal eptemp = new BigDecimal("-1").divide(sagFormulaDto.getEp(),4,BigDecimal.ROUND_HALF_UP);
|
|
|
// ∆P结果
|