Files
vms2016_kadisp/cVMS.NET_CS/RunCode/Step/_STEP_RUN.cs

106 lines
3.2 KiB
C#

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();
//인디케이터 디스플레이
if (PUB.indicator.IsOpen)
{
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
{
var _ampdecpos = 3;
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
{
var _ampdecpos = 3;
PUB.KA2_SUM += (float)(PUB.Values[di1, di2, di3 - 1] / (Math.Pow(10, _ampdecpos)));
}
catch
{
}
}
var SUMKA = PUB.KA1_SUM + PUB.KA2_SUM;
PUB.indicator.SetKA((Int32)SUMKA);
}
return StepResult.Wait;
}
}
}