Package com.serotonin.m2m2.rt.dataImage.types

Examples of com.serotonin.m2m2.rt.dataImage.types.NumericValue


    }

    @Override
    public DataValue change(DataValue currentValue) {
        double newValue = RANDOM.nextDouble();
        return new NumericValue((vo.getMax() - vo.getMin()) * newValue + vo.getMin());
    }
View Full Code Here


     
      //This Equation needs work to make sense with the inputs
      double angularFreq = 2d * Math.PI * (1d/vo.getPeriod());
        double newValue = vo.getOffset() + vo.getAmplitude()*Math.sin(angularFreq*time + vo.getPhaseShift());
        time = time + 1d;
        return new NumericValue(newValue);
    }
View Full Code Here

                    decrement = true;
                }
            }
        }

        return new NumericValue(newValue);
    }
View Full Code Here

        DataPointRT point = Common.runtimeManager.getDataPoint(vo.getAttractionPointId());
        if (point == null) {
            if (log.isDebugEnabled())
                log.debug("Attraction point is not enabled");
            // Point is not currently active.
            return new NumericValue(current);
        }

        DataValue attractorValue = PointValueTime.getValue(point.getPointValue());
        if (attractorValue == null) {
            if (log.isDebugEnabled())
                log.debug("Attraction point has not vaue");
            return new NumericValue(current);
        }

        double attraction = attractorValue.getDoubleValue();

        // Move half the distance toward the attractor...
        double change = (attraction - current) / 2;

        // ... subject to the maximum change allowed...
        if (change < 0 && -change > vo.getMaxChange())
            change = -vo.getMaxChange();
        else if (change > vo.getMaxChange())
            change = vo.getMaxChange();

        // ... and a random fluctuation.
        change += RANDOM.nextDouble() * vo.getVolatility() * 2 - vo.getVolatility();

        if (log.isDebugEnabled())
            log.debug("attraction=" + attraction + ", change=" + change);

        return new NumericValue(current + change);
    }
View Full Code Here

        int i  = b.getInt();
        dataValue = new MultistateValue(i);
        break;
      case DataTypes.NUMERIC:
        double d  = b.getDouble();
        dataValue = new NumericValue(d);
        break;
      default:
        throw new ShouldNeverHappenException("Data type of " + dataType + " is not supported");
    }
   
View Full Code Here

                    new Object[] { point.getReportPointId() }, new RowCallbackHandler() {
                        @Override
                        public void processRow(ResultSet rs) throws SQLException {
                            switch (dataType) {
                            case (DataTypes.NUMERIC):
                                edv.setValue(new NumericValue(rs.getDouble(1)));
                                break;
                            case (DataTypes.BINARY):
                                edv.setValue(new BinaryValue(rs.getDouble(1) == 1));
                                break;
                            case (DataTypes.MULTISTATE):
View Full Code Here

        return "publisherEdit.squwk";
    }

    @Override
    protected PublisherVO<? extends PublishedPointVO> createPublisherVO() {
        return new SquwkSenderVO();
    }
View Full Code Here

        model.put("NUMERIC", DataTypes.NUMERIC);
        model.put("IMAGE", DataTypes.IMAGE);

        // Create the individual point charts
        for (PointStatistics pointStat : pointStatistics) {
            PointTimeSeriesCollection ptsc = new PointTimeSeriesCollection(timeZone);

            if (pointStat.getNumericTimeSeries() != null)
                ptsc.addNumericTimeSeries(pointStat.getNumericTimeSeries().plainCopy());
            else if (pointStat.getDiscreteTimeSeries() != null)
                ptsc.addDiscreteTimeSeries(pointStat.getDiscreteTimeSeries().plainCopy());

            if (ptsc.hasData()) {
                if (inlinePrefix != null)
                    model.put("chartName", inlinePrefix + pointStat.getChartName());
                pointStat.setImageData(ImageChartUtils.getChartData(ptsc, POINT_IMAGE_WIDTH, POINT_IMAGE_HEIGHT,
                        reportInstance.getReportStartTime(), reportInstance.getReportEndTime()));
            }
        }

        PointTimeSeriesCollection ptsc = handler.getPointTimeSeriesCollection();
        if (ptsc.hasData()) {
            if (inlinePrefix != null)
                model.put("chartName", inlinePrefix + IMAGE_CONTENT_ID);
            else {
                chartName = "r" + reportInstance.getId() + ".png";
                // The path comes from the servlet path definition in web.xml.
View Full Code Here

        return KEY;
    }

    @Override
    public ChangeTypeRT createRuntime() {
        return new AlternateBooleanChangeRT();
    }
View Full Code Here

    return alternateBooleanChange;
  }

  @Override
  public PointLocatorRT createRuntime() {
    ChangeTypeRT changeType = getChangeType().createRuntime();
    String startValue = getChangeType().getStartValue();
    DataValue startObject;
    if (dataTypeId == DataTypes.BINARY)
      startObject = BinaryValue.parseBinary(startValue);
    else if (dataTypeId == DataTypes.MULTISTATE) {
View Full Code Here

TOP

Related Classes of com.serotonin.m2m2.rt.dataImage.types.NumericValue

Copyright © 2018 www.massapicom. 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.