浏览代码

首页实时展示频率

xusl 1 年之前
父节点
当前提交
23b33e9fe3

+ 4 - 2
backend/src/main/java/com/jiayue/pfr/config/MybatisPlusConfig.java

@@ -5,8 +5,6 @@ import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
 import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
 import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
 
-import com.jiayue.pfr.service.cmf.SysParameterService;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
@@ -20,6 +18,8 @@ import org.springframework.context.annotation.Configuration;
  */
 @Configuration
 public class MybatisPlusConfig {
+
+
     /**
      * MybatisPlus注册
      * @return MybatisPlusInterceptor
@@ -34,4 +34,6 @@ public class MybatisPlusConfig {
         interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
         return interceptor;
     }
+
+
 }

+ 29 - 0
backend/src/main/java/com/jiayue/pfr/config/StartConfig.java

@@ -0,0 +1,29 @@
+package com.jiayue.pfr.config;
+
+
+import com.jiayue.pfr.constant.CacheConstants;
+import com.jiayue.pfr.entity.ElectricField;
+import com.jiayue.pfr.service.di.impl.ElectricFieldService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * fu程序启动配置
+ *
+ * @author xsl
+ * @version 3.0
+ */
+@Configuration
+@Slf4j
+public class StartConfig {
+    @Autowired
+    ElectricFieldService electricFieldService;
+
+    @Bean
+    public void initElectricField() {
+        ElectricField electricField = electricFieldService.queryElectricField();
+        CacheConstants.electricFieldConcurrentHashMap.put(electricField.getId(),electricField);
+    }
+}

+ 48 - 38
backend/src/main/java/com/jiayue/pfr/config/TestFmRandom.java

@@ -1,9 +1,8 @@
 package com.jiayue.pfr.config;
 
-import cn.hutool.core.date.DateUtil;
 import com.jiayue.pfr.constant.CacheConstants;
-import com.jiayue.pfr.protocol.frequency.DataBean;
-import com.jiayue.pfr.protocol.frequency.DataBeanPacker;
+import com.jiayue.pfr.service.cmf.SysParameterService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
@@ -11,48 +10,59 @@ import java.math.BigDecimal;
 import java.security.SecureRandom;
 
 /**
+ * 模拟频率、有功类
  * @author jy
  * @since 2023/11/03
  */
 @Configuration
 public class TestFmRandom {
-    private SecureRandom random;
-    private BigDecimal minFrequency;
-    private BigDecimal maxFrequency;
-    private long testPrevTime = 0;
+    @Autowired
+    SysParameterService sysParameterService;
 
     @Bean
     public void generateFrequency() throws Exception{
-//        new Thread(()->{
-//            this.random = new SecureRandom();
-//            this.minFrequency = new BigDecimal("49.9");
-//            this.maxFrequency = new BigDecimal("200.1");
-//            while (true){
-//                // 返回一个在此范围内(包括边界)的随机BigDecimal值。
-//                BigDecimal range = maxFrequency.subtract(minFrequency);
-//                BigDecimal fraction = new BigDecimal(random.nextDouble());
-//                BigDecimal fm = minFrequency.add(range.multiply(fraction)).setScale(3, BigDecimal.ROUND_HALF_UP);
-//                if (testPrevTime==0){
-//                    CacheConstants.activePower = fm;
-//                }
-//                else{
-//                    // 判断当前时间与上次时间是否同一秒内
-//                    if (DateUtil.date(System.currentTimeMillis()).getSeconds()!=DateUtil.date(testPrevTime).getSeconds()){
-//                        CacheConstants.activePower = fm;
-//                    }
-//                }
-//                testPrevTime = System.currentTimeMillis();
-//
-//                // 往池子里加入频率
-//                DataBean dataBean = new DataBean();
-//                dataBean.setF(new BigDecimal("50"));
-//                DataBeanPacker.getInstance().setLastDataBean(dataBean);
-//                try {
-//                    Thread.sleep(200);
-//                } catch (InterruptedException e) {
-//                    throw new RuntimeException(e);
-//                }
-//            }
-//        }).start();
+        new Thread(()->{
+            while (true){
+                String debugging = sysParameterService.queryByKey("debugging","OFF");
+                if ("ON".equals(debugging)){
+                    SecureRandom random = new SecureRandom();
+                    // 获取参数基础值
+                    String testFm = sysParameterService.queryByKey("testFm","");
+                    String testAct = sysParameterService.queryByKey("testAct","");
+                    if (!"".equals(testFm)){
+                        BigDecimal maxFrequency = new BigDecimal(testFm).add(new BigDecimal("0.003"));
+                        BigDecimal minFrequency = new BigDecimal(testFm).subtract(new BigDecimal("0.003"));
+                        BigDecimal range = maxFrequency.subtract(minFrequency);
+                        BigDecimal fraction = new BigDecimal(random.nextDouble());
+                        BigDecimal newFm = minFrequency.add(range.multiply(fraction)).setScale(3, BigDecimal.ROUND_HALF_UP);
+                        CacheConstants.testFm = newFm;
+                    }
+
+                    if (!"".equals(testAct)){
+                        BigDecimal act;
+                        if (CacheConstants.debuggerPower.compareTo(new BigDecimal("0"))==1){
+                            // 一次调频介入计算
+                            act = CacheConstants.debuggerPower;
+                        }
+                        else
+                        {
+                            act = new BigDecimal(testAct);
+                        }
+                        BigDecimal maxAct = act.add(new BigDecimal("2"));
+                        BigDecimal minAct = act.subtract(new BigDecimal("0"));
+                        BigDecimal range = maxAct.subtract(minAct);
+                        BigDecimal fraction = new BigDecimal(random.nextDouble());
+                        BigDecimal newAct = minAct.add(range.multiply(fraction)).setScale(3, BigDecimal.ROUND_HALF_UP);
+                        CacheConstants.testAct = newAct;
+                    }
+                }
+
+                try {
+                    Thread.sleep(1000);
+                } catch (InterruptedException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        }).start();
     }
 }

+ 24 - 2
backend/src/main/java/com/jiayue/pfr/constant/CacheConstants.java

@@ -1,10 +1,14 @@
 package com.jiayue.pfr.constant;
 
+import cn.hutool.cache.Cache;
+import cn.hutool.cache.CacheUtil;
 import com.jiayue.pfr.dto.FmDataBeanDto;
+import com.jiayue.pfr.entity.ElectricField;
 import com.jiayue.pfr.protocol.frequency.DataBean;
 
 import java.math.BigDecimal;
 import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
@@ -14,17 +18,35 @@ import java.util.concurrent.ConcurrentHashMap;
  * @author ruoyi
  */
 public class CacheConstants {
+    public static ConcurrentHashMap<Integer, ElectricField> electricFieldConcurrentHashMap = new ConcurrentHashMap<>();
     /**
      * 验证码 redis key
      */
     public static final String CAPTCHA_CODE_KEY = "captcha_codes:";
-
+    /**
+     * 保存所有时间点的频率和有功
+     */
     public static ConcurrentHashMap<Long, FmDataBeanDto> fmMap = new ConcurrentHashMap<>();
+    /**
+     * 首页频率数据
+     */
+    public static Cache<Long,FmDataBeanDto> dashboardFmMapCache = CacheUtil.newFIFOCache(604);
 
-//    public static FmDataBeanDto lastFmDataBeanDto = new FmDataBeanDto();
+    // 存储模拟数据最新缓存
+    public static BigDecimal testFm = new BigDecimal(-99);
+    public static BigDecimal testAct = new BigDecimal(-99);
 
+    // 真实环境有功
     public static BigDecimal activePower = new BigDecimal(-99);
 
+
+
+
+    // 调试时有功
+    public static BigDecimal debuggerPower = new BigDecimal("0");
+    // 调频时初始值
+    public static BigDecimal fmInitPower = new BigDecimal("0");
+
     // 调频动作信号 ON: 动作信号 , OFF: 复归信号
     public static String fmAct = "OFF";
 

+ 22 - 15
backend/src/main/java/com/jiayue/pfr/job/GetFmJob.java

@@ -2,6 +2,7 @@ package com.jiayue.pfr.job;
 
 import com.jiayue.pfr.constant.CacheConstants;
 import com.jiayue.pfr.dto.FmDataBeanDto;
+import com.jiayue.pfr.entity.ElectricField;
 import com.jiayue.pfr.protocol.frequency.DataBean;
 import com.jiayue.pfr.protocol.frequency.DataBeanPacker;
 import com.jiayue.pfr.service.alg.listener.GetFmEvent;
@@ -34,23 +35,29 @@ public class GetFmJob {
 
     @Scheduled(fixedRate = 200)
     void startFmCal() throws Exception{
-        // 从池子里取频率信息
-        DataBean dataBean = DataBeanPacker.getInstance().getLastDataBean();
-        // 存入应用缓存
-//        long currentTime = System.currentTimeMillis();
-//        FmDataBeanDto fmDataBeanDto = new FmDataBeanDto();
-//        fmDataBeanDto.setF(dataBean.getF());
-//        fmDataBeanDto.setTime(currentTime);
-//        CacheConstants.fmMap.put(currentTime,fmDataBeanDto);
-
-        FmDataBeanDto fmDataBeanDto = new FmDataBeanDto();
-        fmDataBeanDto.setF(dataBean.getF());
-        fmDataBeanDto.setActivePower(CacheConstants.activePower);
+        String debugging = sysParameterService.queryByKey("debugging","OFF");
         long currentTime = System.currentTimeMillis();
+        FmDataBeanDto fmDataBeanDto = new FmDataBeanDto();
         fmDataBeanDto.setTime(DateFormatUtils.format(currentTime, "yyyy-MM-dd HH:mm:ss.SSS"));
-        fmDataBeanDto.setCapacity(electricFieldService.queryElectricField().getCapacity());
-//        CacheConstants.lastFmDataBeanDto = fmDataBeanDto;
-//        fLogger.info("获取频率定时");
+        ElectricField electricField = CacheConstants.electricFieldConcurrentHashMap.get(1);
+        fmDataBeanDto.setCapacity(electricField.getCapacity());
+
+        if ("ON".equals(debugging)){
+            // 模拟调试存入应用缓存
+            fmDataBeanDto.setF(CacheConstants.testFm);
+            fmDataBeanDto.setActivePower(CacheConstants.testAct);
+        }
+        else{
+            // 真实环境从池子里取频率信息
+            DataBean dataBean = DataBeanPacker.getInstance().getLastDataBean();
+            // 存入应用缓存
+            fmDataBeanDto.setF(dataBean.getF());
+            fmDataBeanDto.setActivePower(CacheConstants.activePower);
+        }
+
+        CacheConstants.fmMap.put(currentTime,fmDataBeanDto);
+        CacheConstants.dashboardFmMapCache.put(currentTime,fmDataBeanDto);
+
         // 调用事件
         applicationEventPublisher.publishEvent(new GetFmEvent(fmDataBeanDto));
 

+ 4 - 4
backend/src/main/java/com/jiayue/pfr/protocol/agc/Master104ForAgcApplication.java

@@ -23,8 +23,8 @@ import wei.yigulu.iec104.util.SendCommandHelper;
  */
 @Service
 public class Master104ForAgcApplication {
-    @Autowired
-    Iec104MasterBuilder agc104MasterBuilder;
+//    @Autowired
+//    Iec104MasterBuilder agc104MasterBuilder;
 
     public void Master104ForAgcApplication(){
     // 间隔10分钟左右在发一次
@@ -39,8 +39,8 @@ public class Master104ForAgcApplication {
         asdu.setCommonAddress(1);
         Apdu apdu=new Apdu().setAsdu(asdu);
         try {
-            ProtocolTunnelContainer.getInstance().getTunnel(3).get
-            agc104MasterBuilder.sendFrameToOpposite(apdu.encode());
+//            ProtocolTunnelContainer.getInstance().getTunnel(3).get
+//            agc104MasterBuilder.sendFrameToOpposite(apdu.encode());
         } catch (Exception e) {
             throw new RuntimeException(e);
         }

+ 4 - 6
backend/src/main/java/com/jiayue/pfr/service/alg/listener/AgcLockListener.java

@@ -33,8 +33,8 @@ public class AgcLockListener implements ApplicationListener<AgcEvent> {
 
     @Autowired
     BizYaoDataService bizYaoDataService;
-    @Autowired
-    Iec104MasterBuilder agc104MasterBuilder;
+//    @Autowired
+//    Iec104MasterBuilder agc104MasterBuilder;
 
     @Async
     @Override
@@ -46,14 +46,13 @@ public class AgcLockListener implements ApplicationListener<AgcEvent> {
             fLogger.info("AGC闭锁开始");
             boolean bsBoolean = false;
             try {
-                bsBoolean = SendCommandHelper.sendBooleanCommand(agc104MasterBuilder, 0, 1, 25089, true);
+//                bsBoolean = SendCommandHelper.sendBooleanCommand(agc104MasterBuilder, 0, 1, 25089, true);
             } catch (Exception e) {
                 throw new RuntimeException(e);
             }
 
             if (bsBoolean){
                 bizYaoData.setAgcLock("0");
-                bizYaoData.setAction("0");
                 bizYaoDataService.update(bizYaoData);
                 fLogger.info("AGC闭锁成功");
             }
@@ -64,7 +63,7 @@ public class AgcLockListener implements ApplicationListener<AgcEvent> {
         else if (obj.toString().equals(ActionResetEnum.RESET.getCode())){
             boolean bsBoolean = false;
             try {
-                bsBoolean = SendCommandHelper.sendBooleanCommand(agc104MasterBuilder, 0, 1, 25089, false);
+//                bsBoolean = SendCommandHelper.sendBooleanCommand(agc104MasterBuilder, 0, 1, 25089, false);
             } catch (Exception e) {
                 throw new RuntimeException(e);
             }
@@ -72,7 +71,6 @@ public class AgcLockListener implements ApplicationListener<AgcEvent> {
             if (bsBoolean){
                 // 复归
                 bizYaoData.setAgcLock("1");
-                bizYaoData.setAction("1");
                 bizYaoDataService.update(bizYaoData);
                 fLogger.info("AGC解锁成功");
             }

+ 36 - 5
backend/src/main/java/com/jiayue/pfr/service/alg/listener/CoreAlgListener.java

@@ -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结果

+ 2 - 1
backend/src/main/java/com/jiayue/pfr/service/alg/listener/SendFmSocketListener.java

@@ -1,6 +1,7 @@
 package com.jiayue.pfr.service.alg.listener;
 
 import cn.hutool.json.JSONUtil;
+import com.jiayue.pfr.constant.CacheConstants;
 import com.jiayue.pfr.entity.ElectricField;
 import com.jiayue.pfr.service.cmf.SysParameterService;
 import com.jiayue.pfr.service.di.WebSocketServer;
@@ -30,7 +31,7 @@ public class SendFmSocketListener implements ApplicationListener<GetFmEvent> {
     @Override
     public void onApplicationEvent(GetFmEvent getFmEvent) {
         try {
-            WebSocketServer.sendInfo(JSONUtil.toJsonStr(getFmEvent.getFmDataBeanDto()));
+            WebSocketServer.sendInfo(JSONUtil.toJsonStr(CacheConstants.dashboardFmMapCache));
         } catch (IOException e) {
             throw new RuntimeException(e);
         }

+ 3 - 2
backend/src/main/java/com/jiayue/pfr/service/di/impl/ElectricFieldService.java

@@ -2,6 +2,7 @@ package com.jiayue.pfr.service.di.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
+import com.jiayue.pfr.constant.CacheConstants;
 import com.jiayue.pfr.entity.ElectricField;
 import com.jiayue.pfr.mapper.di.ElectricFieldMapper;
 import lombok.extern.slf4j.Slf4j;
@@ -25,7 +26,7 @@ public class ElectricFieldService  extends ServiceImpl<ElectricFieldMapper, Elec
      * 查询场站信息
      * @return ElectricField
      */
-    @Cacheable(cacheNames = "pfrcache", key = "'ef'")
+//    @Cacheable(cacheNames = "pfrcache", key = "'ef'")
     public ElectricField queryElectricField(){
         return this.getOne(null);
     }
@@ -36,8 +37,8 @@ public class ElectricFieldService  extends ServiceImpl<ElectricFieldMapper, Elec
      * @param electricField 参数实体
      */
     @Transactional(propagation = Propagation.SUPPORTS)
-    @CachePut(cacheNames = "pfrcache", key = "'ef'")
     public void updateElectricField(ElectricField electricField) {
         this.updateById(electricField);
+        CacheConstants.electricFieldConcurrentHashMap.put(electricField.getId(),electricField);
     }
 }

+ 62 - 32
ui/src/views/largeScreen/index.vue

@@ -5,18 +5,30 @@
       <div class="btuGroup"><span class="topRightBtuBg topRightBtu" style="cursor: pointer;" @click="push()">后台管理</span>
       </div>
     </div>
-    <div id="fline" style="float:left;width: 900px;height: 450px"></div>
+    <div id="fline" style="float:left;width: 900px;height: 800px"></div>
     <div style="float:right;top:50px;width: 900px;height: 450px">
       <div>
         <el-form ref="testform" :model="rtForm" label-width="250px" size="small">
           <fieldset>
             <legend>实时区</legend>
-            <el-form-item label="当前频率">
-              <el-input v-model="rtForm.fm" style="width: 240px" readonly></el-input>
-            </el-form-item>
-            <el-form-item label="当前有功">
-              <el-input v-model="rtForm.act" style="width: 240px" readonly></el-input>
-            </el-form-item>
+            <el-row>
+              <el-col :span="10">
+                <el-form-item label="当前频率(Hz)">
+                  <el-input v-model="rtForm.fm" style="width: 240px" readonly></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="6">
+                <el-form-item label="当前有功(MW)">
+                  <el-input v-model="rtForm.act" style="width: 240px" readonly></el-input>
+                </el-form-item>
+              </el-col>
+            </el-row>
+<!--            <el-form-item label="当前频率">-->
+<!--              <el-input v-model="rtForm.fm" style="width: 240px" readonly></el-input>-->
+<!--            </el-form-item>-->
+<!--            <el-form-item label="当前有功">-->
+<!--              <el-input v-model="rtForm.act" style="width: 240px" readonly></el-input>-->
+<!--            </el-form-item>-->
           </fieldset>
         </el-form>
       </div>
@@ -167,7 +179,7 @@ export default {
             name: '功率',
             min: -1,
             max: [],
-            interval: 50,
+
             axisLabel: {
               formatter: '{value} MW'
             },
@@ -182,8 +194,8 @@ export default {
             splitLine: {show: false},
             position: 'right',
             name: '频率',
-            min: 49.5,
-            max: 50.5,
+            min: 49.8,
+            max: 50.2,
             interval: 0.1,
             axisLabel: {
               formatter: '{value} Hz'
@@ -274,37 +286,55 @@ export default {
       // console.log("收到服务器信息",event.data);
       let data=event.data
       var tempFm = JSON.parse(data)
-      if (tempFm.f==-99){
-        tempFm.f=null
-      }
-      if (tempFm.activePower==-99){
-        tempFm.activePower=null
+
+      this.fms=[]
+      this.activePower=[]
+      for (let i=0;i<tempFm.length;i++) {
+        if (tempFm[i].f == -99) {
+          tempFm[i].f = null
+        }
+        if (tempFm[i].activePower == -99) {
+          tempFm[i].activePower = null
+        }
+        this.fms.push({name: tempFm[i].time, value: [tempFm[i].time, tempFm[i].f]})
+        this.activePower.push({name: tempFm[i].time, value: [tempFm[i].time, tempFm[i].activePower]})
       }
+
+      // console.log('接收后端===============')
+      // console.log(tempFm)
+      // if (tempFm.f==-99){
+      //   tempFm.f=null
+      // }
+      // if (tempFm.activePower==-99){
+      //   tempFm.activePower=null
+      // }
       // 存入频率数组
-      this.fms.push({name: tempFm.time, value: [tempFm.time, tempFm.f]})
-      this.activePower.push({name: tempFm.time, value: [tempFm.time, tempFm.activePower]})
+      // this.fms.push({name: tempFm[i].time, value: [tempFm[i].time, tempFm[i].f]})
+      // this.activePower.push({name: tempFm.time, value: [tempFm.time, tempFm.activePower]})
 
-      if (this.fms.length>604){
-        this.fms.shift()
-        this.activePower.shift()
-      }
+      // if (this.fms.length>604){
+      //   this.fms.shift()
+      //   this.activePower.shift()
+      // }
 
       // 对时间轴最大最小时间更新
-        this.fmMaxTime=tempFm.time
-        let tempTime=new Date(tempFm.time)
-        this.fmMinTime=new Date(tempTime.valueOf()-1000*60*2)
 
-        this.fmOption.xAxis.min=this.fmMinTime
-        this.fmOption.xAxis.max=this.fmMaxTime
-        this.fmOption.yAxis[0].max=tempFm.capacity
-        this.fmOption.series[0].data=this.activePower
-        this.fmOption.series[1].data=this.fms
-        this.chart.setOption(this.fmOption,true)
+
+      this.fmMaxTime=tempFm[tempFm.length-1].time
+      let tempTime=new Date(tempFm[tempFm.length-1].time)
+      this.fmMinTime=new Date(tempTime.valueOf()-1000*60*2)
+
+      this.fmOption.xAxis.min=this.fmMinTime
+      this.fmOption.xAxis.max=this.fmMaxTime
+      this.fmOption.yAxis[0].max=tempFm[tempFm.length-1].capacity
+      this.fmOption.series[0].data=this.activePower
+      this.fmOption.series[1].data=this.fms
+      this.chart.setOption(this.fmOption,true)
 
 
 
-        this.rtForm.fm = tempFm.f
-        this.rtForm.act = tempFm.activePower
+      this.rtForm.fm = tempFm[tempFm.length-1].f
+      this.rtForm.act = tempFm[tempFm.length-1].activePower
     },
     websocketsend(msg) {
       //向服务器发送信息