private void showTableGroupEditor(ParamGroup kind, int groupno = 0) { string Caption = (kind == ParamGroup.Trend) ? "Редактор групп трендов" : "Редактор групп таблиц"; frmTableGroupEditor form; Form found; if (FindAndShow(Caption, out found)) { form = found as frmTableGroupEditor; form.BringToFront(); if (form != null) { form.RestoreTreePos(String.Format("Группа {0}", groupno.ToString().PadLeft(3))); } } else { form = new frmTableGroupEditor(this, groupno, kind); childforms.Add(form); form.Text = Caption; form.MdiParent = this; form.Show(); } }
public KpTestLogic(int number) : base(number) { random = new Random(); InitArrays(10, 2); ParamGroup group; group = new ParamGroup("Group 1", 5); group.KPParams[0] = new Param(1, "Tag 1"); group.KPParams[1] = new Param(2, "Tag 2"); group.KPParams[2] = new Param(3, "Tag 3"); group.KPParams[3] = new Param(4, "Tag 4"); group.KPParams[4] = new Param(5, "Tag 5"); ParamGroups[0] = group; group = new ParamGroup("Group 2", 5); group.KPParams[0] = new Param(6, "Tag 6"); group.KPParams[1] = new Param(7, "Tag 7"); group.KPParams[2] = new Param(8, "Tag 8"); group.KPParams[3] = new Param(9, "Tag 9"); group.KPParams[4] = new Param(10, "Tag 10"); ParamGroups[1] = group; CopyParamsFromGroups(); }
public override ParamGroup ExcCmd() { ParamGroup param = cmdFlow.Dequeue(); SingleManager <SnakeManager> .Get().CreateCmd <RotateCmd>(this, param.GetParam(CmdType.Rotate))?.Exc(); SingleManager <SnakeManager> .Get().CreateCmd <MoveCmd>(this, param.GetParam(CmdType.Move))?.Exc(); return(param); }
public frmTableGroupEditor(Form panel, int groupno, ParamGroup kind) { InitializeComponent(); ParamGroupKind = kind; lastGroupNo = String.Format("Группа {0}", groupno.ToString().PadLeft(3)); int GroupsCount = (ParamGroupKind == ParamGroup.Trend) ? Properties.Settings.Default.GroupsCount : Properties.Settings.Default.TableGroupsCount; tstbGroupCount.Text = GroupsCount.ToString(); lvList.SetDoubleBuffered(true); lvEntity.SetDoubleBuffered(true); }
public void ExcCmd() { _listBlock[0].FillParam(_cacheParam); for (int i = 0; i < _listBlock.Count; i++) { ParamGroup param = _listBlock[i].ExcCmd(); if (i < _listBlock.Count - 1) { _listBlock[i + 1].FillParam(param); } } }
private void showGroupsEditor(ParamGroup kind, int groupno = 0) { switch (kind) { case ParamGroup.Trend: showDataEditor(String.Format("-g{0}", groupno)); break; case ParamGroup.Table: showDataEditor(String.Format("-q{0}", groupno)); break; } }
public ParamGroupVm(ParamGroup paramGroup, string parentKey) { ParamGroup = paramGroup; Path = Key.MakePath(parentKey); foreach (var pram in Params.GetChildParams(paramGroup)) { var res = Params.ForCSharp(pram); var vm = (pram.IsPF32) ? (IParamChildVm)(new F32ParamVm(Path, (Param.PF32)res.Item1)) : new IntParamVm(Path, (Param.PInt)res.Item1); _children.Add(vm); _paramChildVms.Add(vm); } foreach (var pg in Params.GetChildParamGroups(paramGroup)) { var gvm = new ParamGroupVm(pg, Path); _children.Add(gvm); _paramGroupVms.Add(gvm); } }
private void edit(object sender, DataGridViewCellEventArgs e) { IParamCollection i = p.Groups[currentEntry[0]]; if (i is ParamGroup) { ParamGroup pg = (ParamGroup)i; switch (pg.Values[pg.EntrySize * currentEntry[1] + e.RowIndex].Type) { case ParamType.str: pg.Values[pg.EntrySize * currentEntry[1] + e.RowIndex].Value = tbl.Rows[e.RowIndex][1]; break; case ParamType.s8: pg.Values[pg.EntrySize * currentEntry[1] + e.RowIndex].Value = Convert.ToByte(tbl.Rows[e.RowIndex][1]); break; case ParamType.u8: pg.Values[pg.EntrySize * currentEntry[1] + e.RowIndex].Value = Convert.ToByte(tbl.Rows[e.RowIndex][1]); break; case ParamType.s16: pg.Values[pg.EntrySize * currentEntry[1] + e.RowIndex].Value = Convert.ToInt16(tbl.Rows[e.RowIndex][1]); break; case ParamType.u16: pg.Values[pg.EntrySize * currentEntry[1] + e.RowIndex].Value = Convert.ToUInt16(tbl.Rows[e.RowIndex][1]); break; case ParamType.s32: pg.Values[pg.EntrySize * currentEntry[1] + e.RowIndex].Value = Convert.ToInt32(tbl.Rows[e.RowIndex][1]); break; case ParamType.u32: pg.Values[pg.EntrySize * currentEntry[1] + e.RowIndex].Value = Convert.ToUInt32(tbl.Rows[e.RowIndex][1]); break; case ParamType.f32: pg.Values[pg.EntrySize * currentEntry[1] + e.RowIndex].Value = Convert.ToSingle(tbl.Rows[e.RowIndex][1]); break; } //pg.Values[pg.EntrySize * currentEntry[1] + e.RowIndex].Value = tbl.Rows[e.RowIndex][1]; } else { switch (i.Values[e.RowIndex].Type) { case ParamType.str: i.Values[e.RowIndex].Value = tbl.Rows[e.RowIndex][1]; break; case ParamType.s8: i.Values[e.RowIndex].Value = Convert.ToByte(tbl.Rows[e.RowIndex][1]); break; case ParamType.u8: i.Values[e.RowIndex].Value = Convert.ToByte(tbl.Rows[e.RowIndex][1]); break; case ParamType.s16: i.Values[e.RowIndex].Value = Convert.ToInt16(tbl.Rows[e.RowIndex][1]); break; case ParamType.u16: i.Values[e.RowIndex].Value = Convert.ToUInt16(tbl.Rows[e.RowIndex][1]); break; case ParamType.s32: i.Values[e.RowIndex].Value = Convert.ToInt32(tbl.Rows[e.RowIndex][1]); break; case ParamType.u32: i.Values[e.RowIndex].Value = Convert.ToUInt32(tbl.Rows[e.RowIndex][1]); break; case ParamType.f32: i.Values[e.RowIndex].Value = Convert.ToSingle(tbl.Rows[e.RowIndex][1]); break; } //i.Values[e.RowIndex].Value = tbl.Rows[e.RowIndex][1]; } if (!notSaved) { Text += "*"; notSaved = true; } }
public override void FillParam(ParamGroup param) { cmdFlow.Enqueue(param); }
public abstract void FillParam(ParamGroup param);
public DataFilter <TModel> AddGroup(DataFilterGroup group) { ParamGroup.AddGroup(group); return(this); }
public DataFilter <TModel> AddParam(DataFilterParam param) { ParamGroup.AddParam(param); return(this); }
public IEnumerable <object> ProcessGroupMessages(string assetuid, DeviceConfigRequestBase requestBase, ParamGroup group) { //Get device type parameter names as collection. _loggingService.Info("Started processing group messages", "MetersMessageBuilder.ProcessGroupMessages"); var metersMessages = new List <object>(); foreach (var param in group.Parameters) { if (param.ParameterName == "HoursMeter") { var hourMtroffsetDataObj = GetHourMeterOffsetMessageEvent(requestBase); hourMtroffsetDataObj.AssetId = new Guid(assetuid); metersMessages.Add(hourMtroffsetDataObj); } if (param.ParameterName == "Odometer") { var odoMtroffsetDataObj = GetOdometerOffsetMessageEvent(requestBase); odoMtroffsetDataObj.AssetId = new Guid(assetuid); metersMessages.Add(odoMtroffsetDataObj); } } _loggingService.Info("Ended processing group messages", "MetersMessageBuilder.ProcessGroupMessages"); return(metersMessages); }
public override void FillParam(ParamGroup param) { group.SetParam(param); }
/// <summary> /// Add a param group to the Optimizer s param_groups. /// </summary> /// <param name="param_group"></param> /// <remarks>This can be useful when fine tuning a pre-trained network as frozen layers can be made trainable and added to the Optimizer as training progresses.</remarks> public virtual void add_param_group(ParamGroup param_group) { throw new NotImplementedException($"add_param_group"); }
/// <summary> /// Выполнить действия после добавления КП на линию связи /// </summary> public override void OnAddedToCommLine() { // загрузка шаблона устройства deviceModel = null; elemGroupCnt = 0; floatSignals = new HashSet <int>(); string fileName = KPReqParams.CmdLine.Trim(); if (fileName == "") { WriteToLog((Localization.UseRussian ? "Не задан шаблон устройства для " : "Template is undefined for the ") + Caption); } else { Dictionary <string, Modbus.DeviceModel> templates = GetTemplates(); if (templates.ContainsKey(fileName)) { // создание модели устройства на основе модели, загруженной ранее Modbus.DeviceModel template = templates[fileName]; if (template != null) { deviceModel = new Modbus.DeviceModel(); deviceModel.CopyFrom(template); elemGroupCnt = deviceModel.ElemGroups.Count; } } else { WriteToLog((Localization.UseRussian ? "Загрузка шаблона устройства из файла " : "Load device template from file ") + fileName); Modbus.DeviceModel template = new Modbus.DeviceModel(); string errMsg; if (template.LoadTemplate(ConfigDir + fileName, out errMsg)) { deviceModel = template; elemGroupCnt = deviceModel.ElemGroups.Count; templates.Add(fileName, template); } else { WriteToLog(errMsg); templates.Add(fileName, null); } } } // инициализация параметров КП на основе модели устройства if (elemGroupCnt > 0) { ParamGroup[] paramGroups = new ParamGroup[elemGroupCnt]; int paramInd = 0; int paramGroupInd = 0; foreach (Modbus.ElemGroup elemGroup in deviceModel.ElemGroups) { int elemCnt = elemGroup.Elems.Count; ParamGroup paramGroup = new ParamGroup(elemGroup.Name, elemCnt); paramGroups[paramGroupInd++] = paramGroup; elemGroup.StartParamInd = paramInd; for (int i = 0; i < elemCnt; i++) { int signal = ++paramInd; Modbus.Elem elem = elemGroup.Elems[i]; Param param = new Param(signal, elem.Name); paramGroup.KPParams[i] = param; if (elem.ElemType == Modbus.ElemTypes.Float) { floatSignals.Add(signal); } } } InitArrays(paramInd, elemGroupCnt); for (int i = 0; i < elemGroupCnt; i++) { ParamGroups[i] = paramGroups[i]; } CopyParamsFromGroups(); CanSendCmd = deviceModel.Cmds.Count > 0; } }