using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using AR; using COMM; namespace vmsnet { public partial class FMain { public void _STEP_RUN_START(ESMStep step) { //각스텝의 시작시간값을 초기화 한다. PUB.sm.seq.ClearTime(); //재시작에 대한 코드 분리 bool IsResume = VAR.BOOL[EVarBool.RESUMEJOB]; if (IsResume == false) { PUB.log.Add($"[{step}] job start"); PUB.sm.RaiseInitControl(); //################################### //### 사용자 코드를 입력하세요(신규시작) //################################### if (_USER_START_CHECK() == false) { PUB.log.AddE($"[{step}] fail:_USER_START_CHECK()"); return; } else PUB.log.AddI($"*** [{step}] START ***"); } else { //################################### //### 사용자 코드를 입력하세요(작업재시작) //################################### if (_USER_RESUME_CHECK() == false) { PUB.log.AddE($"[{step}] fail:_USER_RESUME_CHECK()"); return; } else PUB.log.AddI($"*** [{step}] START ***"); } } public StepResult _STEP_RUN(ESMStep step, TimeSpan stepTime, TimeSpan seqTime) { //데이터를 요청하고 처리하는 코드 필요 RUN_GETDATA(); /* 데이터형식 : PUB.Values[mc, unit, ch-1] * 전해조A [CH2] : PUB.Values[0, 0, 2-1] : 3002 * [CH2] 실제값 : 3.002 */ //인디케이터 디스플레이 if (PUB.indicator.IsOpen) { var _ampdecpos = 3; PUB.KA1_SUM = 0f; foreach (var item in PUB.KA1_IndexList) { var buff = item.Split(new char[] { ',' }); int di1 = int.Parse(buff[0]); int di2 = int.Parse(buff[1]); int di3 = int.Parse(buff[2]); try { PUB.KA1_SUM += (float)(PUB.Values[di1, di2, di3 - 1] / (Math.Pow(10, _ampdecpos))); } catch { } } PUB.KA2_SUM = 0f; foreach (var item in PUB.KA2_IndexList) { var buff = item.Split(new char[] { ',' }); int di1 = int.Parse(buff[0]); int di2 = int.Parse(buff[1]); int di3 = int.Parse(buff[2]); try { PUB.KA2_SUM += (float)(PUB.Values[di1, di2, di3 - 1] / (Math.Pow(10, _ampdecpos))); } catch { } } // '100.00(실제값) × 100 = 10,000' 식처럼 100 배 만든다. var SUMKA = (PUB.KA1_SUM + PUB.KA2_SUM) * 100; // '10,000'을 전송한 후 Indicator 에서 왼쪽으로 소수점을 '2' 칸 이동시켜서 Display 하는 작업이 필요 PUB.indicator.SetKA((Int32)SUMKA); } return StepResult.Wait; } } }