public void setValue(FloatData value) { Value.Value = MaxValue.Value; }
public void SubtractValuetoObj(FloatData data) { ValueObj.Value -= data.Value; }
public void UpdateTextWithFloatData(FloatData data) { textToReplace.text = data.value.ToString(); }
public void UpdateValue(FloatData data) { var newData = data as FloatData; if (newData != null) value += newData.value; }
public void UpdateImage(FloatData data) { img.fillAmount = data.value; }
public void UpdateImageComponent(FloatData dataObj) { imageComponent.fillAmount = dataObj.value; }
public void AddDeltaTime(FloatData modifier) { AddDeltaTime(modifier.value); }
public void AddValueToObj(FloatData data) { ValueObj.Value += data.Value; }
public void SubtractValue(FloatData data) { data.Value -= Data.Value; }
private List <PValue> GetFloatArchivedValues(int tagid, DateTime begin, DateTime end) { List <PValue> pvalues = new List <PValue>(); //判断tagid范围是否正常 if (tagid <= 0) { return(pvalues); //tagid必须大于0,否则返回空pvalues } //获取历史数据原始值 //golden数据库获取浮点型历史原始数据的接口是GetFloatArchivedValues(id, count, begin, end)。(读插值是GetFloatInterpoValues()) //count是一个输入/输出参数。该接口根据输入的count申请相应大小的内存,输出的count为实际查询到的历史数据数量。 //count大小没有限制,但是单个程序可以寻址的内存大小有限制. //——如果1秒一个实时数据,一天实时数据为86400条,读出的List<PValue>占用内存15M左右。 //一般设置count大小为1000000,即一百万条记录,如果按照1秒一个实时数据,大概存放10天左右的数据,占用内存为150M数量级 //在概化计算中,如果直接取用原始实时数据,计算周期不应超过1天。 const int maxCount = 1000000; int count = this._iHistorian.GetNumberArchivedValuesCount(tagid, begin, end); //实际情况,应该根据返回的数量做出不同的处理 // Entity <FloatData> list = new Entity <FloatData>(); if (count == 0) { return(pvalues); //如果count为0,直接返回空pvalues。外部程序可以根据pvalues.count是否为0来处理 } if (count <= maxCount && count > 0) //如果记录数量小于100000,且不为0,则直接读取 { try { list = this._iHistorian.GetFloatArchivedValues(tagid, count, begin, end); //读取历史数据 } catch (RTDBException ex) { //将golden的异常PgimDataException记录在_exception中,并以PgimDataException的名称继续抛出异常 this._exception = ex.ToString(); throw new Exception(ex.ToString()); //将pgim的异常继续向外传递。 } //golden数据库读取历史数据,返回数据集的是从起始时间后最近一个数据开始 //实际需要的是从起始时间前最近一个数据开始,只要返回的第一个数据时间戳不等于begin,就应该向前补充一个数据 //获取历史数据的起始时间begin为8:00:00,会自动找到该时间前的最近一个数据,比如7:59:50,将该数据做为返回数据集的第一个数据,并将时间修正为8:00:00 if (list.Data[0].Time > begin) { FloatData firstdata = new FloatData(); try { firstdata = this._iHistorian.GetFloatSingleValue(tagid, begin, HistorianMode.PREVIOUS);//获取起始时刻前最近的一个数据 } catch (RTDBException ex) { //将golden的异常PgimDataException记录在_exception中,并以PgimDataException的名称继续抛出异常 this._exception = ex.ToString(); throw new Exception(ex.ToString()); //将pgim的异常继续向外传递。 } //这里也存在两种可能,一种是begin时间点之前确实再没有其他数据,该时间点后的数据已经是数据库存储的第一个数据;另一种是可以找到begin时间点前的数据 if (firstdata != null) { //一般情况下,都能在begin时间点前,找到一个数据点,用该数据点的值替代begin时刻的值 firstdata.Time = begin; list.Data.Insert(0, firstdata); list.Count += 1; } else { //特殊情况下,仅当当前时刻已经位于数据库存储数据的最前端,begin时刻点前再无其他时刻的值。 //该情况下,用已经取得的第一个点的值,作为begin时刻的值 firstdata = new FloatData(); firstdata.Id = tagid; firstdata.Value = list.Data[0].Value; firstdata.Time = begin; firstdata.Error = 0; firstdata.Qualitie = Quality.GOOD; firstdata.Ms = 0; list.Data.Insert(0, firstdata); list.Count += 1; } } //golden数据库读取历史数据,返回数据集的是到截止时间前最后一个数据为止。 //根据需要,在后面补充一个空数据,仅记录截止时间end,用于计算截止时间前最后一个数据的timespan if (list.Data[list.Count - 1].Time < end) { FloatData lastdata = new FloatData(); lastdata.Time = end; list.Data.Add(lastdata); list.Count += 1; } //list是一个起始时间从begin开始,截止时间为end的点集合. //其头部begin时间点,有可能恰好对应一个原始值,有可能用前一时刻的值补足的值。 //其尾部end时间点,有可能恰好对应一个原始值,有可能是用end时刻补足的一个值。 //GetFloatSingleValue如过返回0个值,则直接退出 //GetFloatSingleValue如果仅返回一个值,则要么会在begin补值,要么会在end补值。要么会在两边都补。 //GetFloatSingleValue如果仅返回两个值,有可能恰好在两边。这样两边都不需要补值 //因此list一定是一个至少包含两个元素的列表集合。(GetFloatSingleValue返回0个值的情况,已经直接处理了) //将结果转换为pvalue pvalues = FloatDatatoPValueHist(list); } else if (count > maxCount) //如果记录数量大于100000,怎么处理 { //按晋晖说的应该分批读取,但实际上,对于概化计算,还要送到计算引擎,没有办法分批,因此必须记录log,并略过 //另外的处理方法就是做好规划控制每次读取的时间间隔 //在概化计算引擎中,采用第二种方式来控制最大数量 } return(pvalues); }
public void collect(SpeechResult result) { Token token = result.getResult().getBestToken(); float[] componentScore, featureVector, posteriors, tmean; int[] len; float dnom, wtMeanVar, wtDcountVar, wtDcountVarMean, mean; int mId, cluster; int numStreams, gauPerState; if (token == null) { throw new Exception("Best token not found!"); } do { FloatData feature = (FloatData)token.getData(); ISearchState ss = token.getSearchState(); if (!(ss is IHMMSearchState && ss.isEmitting())) { token = token.getPredecessor(); continue; } componentScore = token.calculateComponentScore(feature); featureVector = FloatData.toFloatData(feature).getValues(); mId = (int)((IHMMSearchState)token.getSearchState()).getHMMState() .getMixtureId(); if (loader is Sphinx3Loader && ((Sphinx3Loader)loader).hasTiedMixtures()) { // use CI phone ID for tied mixture model mId = ((Sphinx3Loader)loader).getSenone2Ci()[mId]; } len = loader.getVectorLength(); numStreams = loader.getNumStreams(); gauPerState = loader.getNumGaussiansPerState(); posteriors = this.computePosterios(componentScore, numStreams); int featVectorStartIdx = 0; for (int i = 0; i < numStreams; i++) { for (int j = 0; j < gauPerState; j++) { cluster = means.getClassIndex(mId * numStreams * gauPerState + i * gauPerState + j); dnom = posteriors[i * gauPerState + j]; if (dnom > 0f) { tmean = loader.getMeansPool().get( mId * numStreams * gauPerState + i * gauPerState + j); for (int k = 0; k < len[i]; k++) { mean = posteriors[i * gauPerState + j] * featureVector[k + featVectorStartIdx]; wtMeanVar = mean * loader.getVariancePool().get( mId * numStreams * gauPerState + i * gauPerState + j)[k]; wtDcountVar = dnom * loader.getVariancePool().get( mId * numStreams * gauPerState + i * gauPerState + j)[k]; for (int p = 0; p < len[i]; p++) { wtDcountVarMean = wtDcountVar * tmean[p]; for (int q = p; q < len[i]; q++) { regLs[cluster][i][k][p][q] += wtDcountVarMean * tmean[q]; } regLs[cluster][i][k][p][len[i]] += wtDcountVarMean; regRs[cluster][i][k][p] += wtMeanVar * tmean[p]; } regLs[cluster][i][k][len[i]][len[i]] += wtDcountVar; regRs[cluster][i][k][len[i]] += wtMeanVar; } } } featVectorStartIdx += len[i]; } token = token.getPredecessor(); } while (token != null); }
public override void Work() { fromNameId = NameIdObj as FloatData; workEvent.Invoke(); }
public void UnApply(FloatData data) { int value = Convert.ToInt32(Mathf.Floor(data.val)); this.val -= value; }
public void ChangeTargetValue(FloatData targetData) { targetData.value += DeltaValue.value; }
public void UpdateImage(FloatData data) //not naming it health because you can use this for any type of bar to update data { img.fillAmount = data.value; }
public void AddValue(FloatData data) { data.Value += Data.Value; }
private void dumpData(Data data) { if (data == null) { [email protected]("Data: null"); } else if (data is Signal) { if (this.outputSignals) { [email protected](new StringBuilder().append("Signal: ").append(data).toString()); } } else if (data is DoubleData) { DoubleData doubleData = (DoubleData)data; double[] values = doubleData.getValues(); [email protected](new StringBuilder().append("Frame ").append(values.Length).toString()); double[] array = values; int num = array.Length; for (int i = 0; i < num; i++) { double num2 = array[i]; [email protected](new StringBuilder().append(' ').append(this.formatter.format(num2)).toString()); } [email protected](); } else if (data is SpeechClassifiedData) { SpeechClassifiedData speechClassifiedData = (SpeechClassifiedData)data; double[] values = speechClassifiedData.getValues(); [email protected]("Frame "); if (speechClassifiedData.isSpeech()) { [email protected]('*'); } else { [email protected](' '); } [email protected](new StringBuilder().append(" ").append(values.Length).toString()); double[] array = values; int num = array.Length; for (int i = 0; i < num; i++) { double num2 = array[i]; [email protected](new StringBuilder().append(' ').append(this.formatter.format(num2)).toString()); } [email protected](); } else if (data is FloatData) { FloatData floatData = (FloatData)data; float[] values2 = floatData.getValues(); [email protected](new StringBuilder().append("Frame ").append(values2.Length).toString()); float[] array2 = values2; int num = array2.Length; for (int i = 0; i < num; i++) { float num3 = array2[i]; [email protected](new StringBuilder().append(' ').append(this.formatter.format((double)num3)).toString()); } [email protected](); } }
public void SubtractValue(FloatData obj) { Data.Value -= obj.Value; }
public void AddToValue(FloatData data) { AddToValue(data.value); }
public void AddValue(FloatData obj) { Data.Value += obj.Value; }
public void PartValue(FloatData data) { data.Value /= Data.Value; }
public void DisplayValue(FloatData data) { img.fillAmount = data.value; }
public void SetValue(FloatData data) { var newData = data as FloatData; if (newData != null) value = newData.value; }
public void OnDivideValue(FloatData outsideData) { outsideData.Value /= Data.Value; }
// ------------------------------------------------------------------------- public void ActionCompareToTarget(FloatData value) { ActionCompareToTarget(value.GetCurrentValue()); }
public void Apply(FloatData data) { this.val += data.val; }
public void OnPowerUp(FloatData outsideData) { outsideData.Value += Data.Value; }
public void UnApply(FloatData data) { this.val -= data.val; }
private void OnTriggerEnter(Collider other) { ProjectileSpeed = ProjectileUpgrade; projectile.AddForce(0, 0, ProjectileSpeed.Value); }
private void OnEnable() { moveSpeed = normalSpeed; controller = GetComponent <CharacterController>(); StartCoroutine(Move()); }