Examples of THistorySpecification


Examples of de.desy.tine.server.histories.THistorySpecification

    }
    return addLocalHistoryRecord(recordIndex,device,property,dataSize,dataFormat,arrayType);
  }
  public int addLocalHistoryRecord(int recordIndex,String device,String property,int dataSize,int dataFormat,int arrayType)
  {
    THistorySpecification spc = THistorySpecification.getDefaultInstance();
    return addLocalHistoryRecord(recordIndex,device,property,dataSize,dataFormat,arrayType,spc);
  }
View Full Code Here

Examples of de.desy.tine.server.histories.THistorySpecification

  }
  public void dumpHistoryManifest()
  {
    int nHistoryRecords = gLclHstList.size();
    THistoryRecord hst = null;
    THistorySpecification spc = null;
    TInitializer initializer = TInitializerFactory.getInstance().getInitializer();
    String eqm = getLocalName();
    String filename = initializer.getFecHome()+File.separator+eqm;
    String nl = System.getProperty("line.separator");
    try
    {
      new File(filename).mkdirs();
      filename += File.separator+"hstmf.csv";
      FileWriter fw = new FileWriter(filename);
      String ln = hstmfHdr + nl;
      fw.write(ln);
      for (int i=0; i<nHistoryRecords; i++)
      {
        hst = (THistoryRecord)gLclHstList.get(i);
        if (hst.getEqm() != this) continue;
        spc = hst.getHspec();
        ln = ""+hst.getRcdIdx()+", "+eqm+", "+hst.getPrp()+", "+hst.getDev()+
             ", "+hst.getArraySize()+", "+ TFormat.toString(hst.getFmt())+
             ", "+spc.getHeartbeat()+", "+spc.getPollngRate()+", "+spc.getArchiveRate()+
             ", "+getStrToleranceForManifest(spc.getAbsoluteTolerance(),spc.getPercentTolerance())+
             ", "+spc.getDepthShort()+", "+spc.getDepthLong()+nl;
        fw.write(ln);   
      }   
      fw.close();
      MsgLog.log("dumpHistoryManifest", "wrote history manifest for <"+eqm+">",0,null,0);
    }
View Full Code Here

Examples of de.desy.tine.server.histories.THistorySpecification

  protected void historyCycle(boolean isScheduled)
  {
    if (!hasInitialized) return;
    long thisCycleTime = System.currentTimeMillis();
    THistoryRecord hst = null;
    THistorySpecification spc = null;
    TDataType dout = null;
    TDataType din = new TDataType();
    TAccess access = new TAccess(TAccess.CA_HIST + TAccess.CA_READ);
    int cc = 0;
    boolean skip;
    if (!isScheduled && thisCycleTime-lastHistoryCycleTime < historyCycleInterval) return;
    lastHistoryCycleTime = thisCycleTime;
    int nHistoryRecords = gLclHstList.size();
    if (nHistoryRecords == 0) return;
    TEquipmentModuleFactory f = getEquipmentModuleFactory();
    f.setCurrentContractEntry(f.hstcon);
    for (int i=0; i<nHistoryRecords; i++)
    {
      hst = (THistoryRecord)gLclHstList.get(i);
      spc = hst.getHspec();
      if (spc.getDepthShort() <= 0) continue;
      if (hst.needsToFillSTS) hst.fillSTS();
      hst.setArchiveFileName(thisCycleTime); // will also remove outdated files if necessary
      skip = (thisCycleTime-hst.getTimestamp()) < spc.getPollngRate();
      if (hst.isScheduled()) skip = false;
      hst.setScheduled(false);
      if (skip) continue;
      dout = new TDataType(hst.getArraySize(),hst.getFmt());
      dout.setDataTimeStamp(TDataTime.getDataTimeStamp());
View Full Code Here

Examples of de.desy.tine.server.histories.THistorySpecification

    return;
  }
  private boolean needToArchiveRecord(THistoryRecord hst)
  {
    long ts = System.currentTimeMillis();
    THistorySpecification spc;

    if (hst == null) return false;
    if (!hst.isPastFilter()) return false;
    if((spc=hst.getHspec()) == null) return false;
    if (spc.getArchiveRate() < 0 ||
        spc.getHeartbeat() < 0   ||
        spc.getDepthLong() <= 0) return false;/* no long term storage */
    if (hst.getRngBufferSize() <= 0) return false;
    if (hst.getTimestamp() <= hst.getLastArchiveTime()) return false;/* data timestamp hasn't changed */
    if (!hst.isScheduled() &&
         ts < hst.getLastArchiveTime() + spc.getArchiveRate()) return false;
    if (ts >= hst.getLastArchiveTime() + spc.getHeartbeat()*1000) return true; /* archive no matter what */
    if (hst.isWithinTolerance()) return false;
    return true;   
  }
View Full Code Here

Examples of de.desy.tine.server.histories.THistorySpecification

            { // wasn't in list
              TExportProperty p = getPropertyList().getFirstProperty(prp);
              TPropertyDescription pd = p.getDescription();
              int at = pd != null ? pd.getArrayType() : TArrayType.AT_UNKNOWN;
              int idx = TEquipmentModuleFactory.getInstance().getNextHistoryRecordIndex();
              THistorySpecification hspec = new THistorySpecification(hrs[0].getPollingRate(), hrs[0].getArchiveRate(), hrs[0].getDepthShort(), hrs[0].getDepthLong(), hrs[0].getHeartbeat(), hrs[0].getPercentTolerance(), hrs[0].getAbsoluteTolerance(), null);
              addLocalHistoryRecord(idx, dev, prp, hrs[0].getSize(), hrs[0].getFormat(),at,hspec);
              dumpHistoryManifest();
            }
            else
            { // just an edit ...
              THistorySpecification hsp = hr.getHspec();
              hsp.setAbsoluteTolerance(hrs[0].getAbsoluteTolerance());
              hsp.setPercentTolerance(hrs[0].getPercentTolerance());
              hsp.setArchiveRate(hrs[0].getArchiveRate());
              hsp.setPollngRate(hrs[0].getPollingRate());
              hsp.setDepthLong(hrs[0].getDepthLong());
              hsp.setDepthShort(hrs[0].getDepthShort());
              hsp.setHeartbeat(hrs[0].getHeartbeat());
            }
            return 0;
          }
          else
          {
View Full Code Here

Examples of de.desy.tine.server.histories.THistorySpecification

      String context,String server, String property, String device,
      int datasiz,int datafmt,int pollInterval,int archInterval,
      int depthShort,int depthLong,int heartBeat,float pTolerance,float aTolerance)
  {
    THistoryRecordStruct[] hrs = new THistoryRecordStruct[1];
    THistorySpecification hsp = new THistorySpecification(pollInterval, archInterval, depthShort, depthLong, heartBeat, pTolerance, aTolerance, null);
    hrs[0] = new THistoryRecordStruct(device, property, datasiz, datafmt, hsp);
    String dev = "/"+context+"/"+server;
    TLink lnk = new TLink(dev,"ADDHISTORY",null,new TDataType(hrs),TAccess.CA_WRITE);
    return lnk.executeAndClose();
  }
View Full Code Here

Examples of de.desy.tine.server.histories.THistorySpecification

  protected void historyCycle(boolean isScheduled)
  {
    if (!hasInitialized) return;
    long thisCycleTime = System.currentTimeMillis();
    THistoryRecord hst = null;
    THistorySpecification spc = null;
    TDataType dout = null;
    TDataType din = new TDataType();
    TAccess access = new TAccess(TAccess.CA_HIST + TAccess.CA_READ);
    int cc = 0;
    boolean skip;
    if (!isScheduled && thisCycleTime-lastHistoryCycleTime < historyCycleInterval) return;
    lastHistoryCycleTime = thisCycleTime;
    int nHistoryRecords = gLclHstList.size();
    if (nHistoryRecords == 0) return;
    TEquipmentModuleFactory f = getEquipmentModuleFactory();
    f.setCurrentContractEntry(f.hstcon);
    for (int i=0; i<nHistoryRecords; i++)
    {
      hst = (THistoryRecord)gLclHstList.get(i);
      spc = hst.getHspec();
      if (spc.getDepthShort() <= 0) continue;
      if (hst.needsToFillSTS) hst.fillSTS();
      hst.setArchiveFileName(thisCycleTime); // will also remove outdated files if necessary
      skip = (thisCycleTime-hst.getTimestamp()) < spc.getPollngRate();
      if (hst.isScheduled()) skip = false;
      hst.setScheduled(false);
      if (skip) continue;
      dout = new TDataType(hst.getArraySize(),hst.getFmt());
      dout.setDataTimeStamp(TDataTime.getDataTimeStamp());
View Full Code Here

Examples of de.desy.tine.server.histories.THistorySpecification

    return;
  }
  private boolean needToArchiveRecord(THistoryRecord hst)
  {
    long ts = System.currentTimeMillis();
    THistorySpecification spc;

    if (hst == null) return false;
    if((spc=hst.getHspec()) == null) return false;
    if (spc.getArchiveRate() < 0 ||
        spc.getHeartbeat() < 0   ||
        spc.getDepthLong() <= 0) return false;/* no long term storage */
    if (hst.getRngBufferSize() <= 0) return false;
    if (hst.getTimestamp() <= hst.getLastArchiveTime()) return false;/* data timestamp hasn't changed */
    if (!hst.isScheduled() &&
         ts < hst.getLastArchiveTime() + spc.getArchiveRate()) return false;
    if (ts >= hst.getLastArchiveTime() + spc.getHeartbeat()*1000) return true; /* archive no matter what */
    if (hst.isWithinTolerance()) return false;
    return true;   
  }
View Full Code Here

Examples of de.desy.tine.server.histories.THistorySpecification

            { // wasn't in list
              TExportProperty p = getPropertyList().getFirstProperty(prp);
              TPropertyDescription pd = p.getDescription();
              int at = pd != null ? pd.getArrayType() : TArrayType.AT_UNKNOWN;
              int idx = TEquipmentModuleFactory.getInstance().getNextHistoryRecordIndex();
              THistorySpecification hspec = new THistorySpecification(hrs[0].getPollingRate(), hrs[0].getArchiveRate(), hrs[0].getDepthShort(), hrs[0].getDepthLong(), hrs[0].getHeartbeat(), hrs[0].getPercentTolerance(), hrs[0].getAbsoluteTolerance(), null);
              addLocalHistoryRecord(idx, dev, prp, hrs[0].getSize(), hrs[0].getFormat(),at,hspec);
              dumpHistoryManifest();
            }
            else
            { // just an edit ...
              THistorySpecification hsp = hr.getHspec();
              hsp.setAbsoluteTolerance(hrs[0].getAbsoluteTolerance());
              hsp.setPercentTolerance(hrs[0].getPercentTolerance());
              hsp.setArchiveRate(hrs[0].getArchiveRate());
              hsp.setPollngRate(hrs[0].getPollingRate());
              hsp.setDepthLong(hrs[0].getDepthLong());
              hsp.setDepthShort(hrs[0].getDepthShort());
              hsp.setHeartbeat(hrs[0].getHeartbeat());
            }
            return 0;
          }
          else
          {
View Full Code Here

Examples of de.desy.tine.server.histories.THistorySpecification

      String context,String server, String property, String device,
      int datasiz,int datafmt,int pollInterval,int archInterval,
      int depthShort,int depthLong,int heartBeat,float pTolerance,float aTolerance)
  {
    THistoryRecordStruct[] hrs = new THistoryRecordStruct[1];
    THistorySpecification hsp = new THistorySpecification(pollInterval, archInterval, depthShort, depthLong, heartBeat, pTolerance, aTolerance, null);
    hrs[0] = new THistoryRecordStruct(device, property, datasiz, datafmt, hsp);
    String dev = "/"+context+"/"+server;
    TLink lnk = new TLink(dev,"ADDHISTORY",null,new TDataType(hrs),TAccess.CA_WRITE);
    return lnk.executeAndClose();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.