using CCDCount.MODEL.ConfigModel;
using CCDCount.MODEL.PlcModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CCDCount.DLL
{
public static class FormulationClass
{
///
/// 初始化配方数据
///
///
///
///
public static FormulationConfigClass InitFormulation(CameraConfig cameraConfig, ShuLiConfigClass shuLiConfig, PlcParaModelClass plcParaModel)
{
var result = new FormulationConfigClass()
{
Channel = shuLiConfig.Channel,
ExposureTimeValue = cameraConfig.ExposureTimeValue,
AcquistionLineRateValue = cameraConfig.AcquistionLineRateValue,
DeviceName = cameraConfig.DeviceName,
FormulationName = string.Empty,
//IdentifyStartX = shuLiConfig.IdentifyStartX,
//IdentifyStopX = shuLiConfig.IdentifyStopX,
//IsIdentifyRoiOpen = shuLiConfig.IsIdentifyRoiOpen,
MaxArea = shuLiConfig.MaxArea,
MinArea = shuLiConfig.MinArea,
NoiseFilter_Threshold = shuLiConfig.NoiseFilter_Threshold,
PandingCode = shuLiConfig.PandingCode,
RegionThreshold = shuLiConfig.RegionThreshold,
MAX_GAP = shuLiConfig.MAX_GAP,
MAX_Object_LENGTH = shuLiConfig.MAX_Object_LENGTH,
MIN_Object_LENGTH = shuLiConfig.MIN_Object_LENGTH,
};
if(plcParaModel != null)
{
result.SpeedModeRunningSpeed = plcParaModel.SpeedModeRunningSpeed;
result.JogSpeed = plcParaModel.JogSpeed;
result.BottValueSet = plcParaModel.BottValueSet;
result.TransferValveOpeningSpeed = plcParaModel.TransferValveOpeningSpeed;
result.TransferValveOpeningTime = plcParaModel.TransferValveOpeningTime;
result.BottingDecelerationValue = plcParaModel.BottingDecelerationValue;
result.CacheDecelerationValue = plcParaModel.CacheDecelerationValue;
result.CacheCountDelayTiming = plcParaModel.CacheCountDelayTiming;
result.CacheShutdownValue = plcParaModel.CacheShutdownValue;
result.BottingMaterialCylinderVibrationTableHighSpeedValue = plcParaModel.BottingMaterialCylinderVibrationTableHighSpeedValue;
result.BottingFilterVibrationTableHighSpeedValue = plcParaModel.BottingFilterVibrationTableHighSpeedValue;
result.BottingCountVibrationTableHighSpeedValue = plcParaModel.BottingCountVibrationTableHighSpeedValue;
result.BottingMaterialCylinderVibrationTableDecelerationSpeedValue = plcParaModel.BottingMaterialCylinderVibrationTableDecelerationSpeedValue;
result.BottingFilterVibrationTableDecelerationSpeedValue = plcParaModel.BottingFilterVibrationTableDecelerationSpeedValue;
result.BottingCountVibrationTableDecelerationSpeedValue = plcParaModel.BottingCountVibrationTableDecelerationSpeedValue;
result.CacheMaterialCylinderVibrationTableHighSpeedValue = plcParaModel.CacheMaterialCylinderVibrationTableHighSpeedValue;
result.CacheFilterVibrationTableHighSpeedValue = plcParaModel.CacheFilterVibrationTableHighSpeedValue;
result.CacheCountVibrationTableHighSpeedValue = plcParaModel.CacheCountVibrationTableHighSpeedValue;
result.CacheMaterialCylinderVibrationTableDecelerationSpeedValue = plcParaModel.CacheMaterialCylinderVibrationTableDecelerationSpeedValue;
result.CacheFilterVibrationTableDecelerationSpeedValue = plcParaModel.CacheFilterVibrationTableDecelerationSpeedValue;
result.CacheCountVibrationTableDecelerationSpeedValue = plcParaModel.CacheCountVibrationTableDecelerationSpeedValue;
result.GateOpeningDelay = plcParaModel.GateOpeningDelay;
result.ReturnToZeroOffsetValue = plcParaModel.ReturnToZeroOffsetValue;
result.ReturnToZeroOffsetSpeed = plcParaModel.ReturnToZeroOffsetSpeed;
result.TransferValveClosingSpeed = plcParaModel.TransferValveClosingSpeed;
result.TransferValveOpenPosition = plcParaModel.TransferValveOpenPosition;
result.TransferValveClosePosition = plcParaModel.TransferValveClosePosition;
result.AirValveOpeningDelay = plcParaModel.AirValveOpeningDelay;
result.BottlingShutdownValue = plcParaModel.BottlingShutdownValue;
result.BottlingShutdownTime = plcParaModel.BottlingShutdownTime;
result.BottleFeedingWheelRunningSpeed = plcParaModel.BottleFeedingWheelRunningSpeed;
result.BottleFeedingWheelJogRunningSpeed = plcParaModel.BottleFeedingWheelJogRunningSpeed;
result.BottleFeedingWheelReturnToZeroOffsetValue = plcParaModel.BottleFeedingWheelReturnToZeroOffsetValue;
result.BottleFeedingWheelReturnToZeroSpeed = plcParaModel.BottleFeedingWheelReturnToZeroSpeed;
result.BottleFeedingWheelPositionLength = plcParaModel.BottleFeedingWheelPositionLength;
result.BottleFeedingWheelPauseTime = plcParaModel.BottleFeedingWheelPauseTime;
result.DelayBlanking = plcParaModel.DelayBlanking;
}
else
{
result = null;
}
return result;
}
///
/// 更新配方数据
///
///
///
///
public static void UpdateFormulation(ref FormulationConfigClass formulationConfig,CameraConfig cameraConfig, ShuLiConfigClass shuLiConfig)
{
formulationConfig.Channel = shuLiConfig.Channel;
formulationConfig.ExposureTimeValue = cameraConfig.ExposureTimeValue;
formulationConfig.AcquistionLineRateValue = cameraConfig.AcquistionLineRateValue;
formulationConfig.DeviceName = cameraConfig.DeviceName;
//formulationConfig.IdentifyStartX = shuLiConfig.IdentifyStartX;
//formulationConfig.IdentifyStopX = shuLiConfig.IdentifyStopX;
//formulationConfig.IsIdentifyRoiOpen = shuLiConfig.IsIdentifyRoiOpen;
formulationConfig.MaxArea = shuLiConfig.MaxArea;
formulationConfig.MinArea = shuLiConfig.MinArea;
formulationConfig.NoiseFilter_Threshold = shuLiConfig.NoiseFilter_Threshold;
formulationConfig.PandingCode = shuLiConfig.PandingCode;
formulationConfig.RegionThreshold = shuLiConfig.RegionThreshold;
formulationConfig.MAX_GAP = shuLiConfig.MAX_GAP;
formulationConfig.MAX_Object_LENGTH = shuLiConfig.MAX_Object_LENGTH;
formulationConfig.MIN_Object_LENGTH = shuLiConfig.MIN_Object_LENGTH;
}
}
}