using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace FryPot_DosingSystem.Control { /// <summary> /// plc变量 /// </summary> internal class GlobalVariable { /// <summary> /// 滚筒线1 /// </summary> public RollerLineOne rollerLineOne = new RollerLineOne(); /// <summary> /// 滚筒线2 /// </summary> public RollerLineTwo rollerLineTwo = new RollerLineTwo(); /// <summary> /// 滚筒线3 /// </summary> public RollerLineThree rollerLineThree = new RollerLineThree(); /// <summary> /// 炒锅1 /// </summary> public FryPotOne fryPotOne= new FryPotOne(); /// <summary> /// 炒锅2 /// </summary> public FryPotTwo fryPotTwo= new FryPotTwo(); /// <summary> /// 炒锅3 /// </summary> public FryPotThree fryPotThree= new FryPotThree(); /// <summary> /// 炒锅4 /// </summary> public FryPotFour fryPotFour= new FryPotFour(); /// <summary> /// 炒锅5 /// </summary> public FryPotFive fryPotFive= new FryPotFive(); /// <summary> /// 洗桶进桶滚筒运行信号 /// </summary> public ushort CleadBarrelEnterSingle { get; set; } /// <summary> /// 洗桶出桶滚筒运行信号 /// </summary> public ushort CleadBarrelExitSingle { get; set; } /// <summary> /// PLC初始化状态 /// </summary> public ushort PlcInite { get; set; } /// <summary> /// 清洗台清洗完成信号 /// </summary> public ushort CleanComplete { get; set; } #region 上位机内部逻辑条件 /// <summary> /// 退出线体1任务 /// </summary> public bool ExitLineOneTask { get; set; } /// <summary> /// 退出线体2任务 /// </summary> public bool ExitLineTwoTask { get; set; } /// <summary> /// 退出线体3任务 /// </summary> public bool ExitLineThreeTask { get; set; } /// <summary> /// 允许AGV去线体1装桶条件 /// </summary> public bool AllowAgvToLineLoadRoller { get; set; } = true; /// <summary> /// 允许AGV去线体2装桶条件 /// </summary> public bool AllowAgvToLineTwoLoadRoller { get; set; } = true; /// <summary> /// 允许AGV去线体3装桶条件 /// </summary> public bool AllowAgvToLineThreeLoadRoller { get; set; } = true; ///// <summary> ///// 配方唯一ID ///// </summary> //public string RecipeId { get; set; } /// <summary> /// 线体1对应的进桶出桶互锁 /// </summary> public bool InOrOutputLock { get; set; } /// <summary> /// 线体2对应的进桶出桶互锁 /// </summary> public bool LTwoInOrOutputLock { get; set; } /// <summary> /// 线体3对应的进桶出桶互锁 /// </summary> public bool LThreeInOrOutputLock { get; set; } ///// <summary> ///// 线体1任务执行锁 ///// </summary> //public bool LOneTaskLock { get; set; } ///// <summary> ///// 线体2任务执行锁 ///// </summary> //public bool LTwoTaskLock { get; set; } ///// <summary> ///// 线体3任务执行锁 ///// </summary> //public bool LThreeTaskLock { get; set; } /// <summary> /// 线体1当前正在制作的配方名称 /// </summary> public string LOneCurrentRecipeName { get; set; } = string.Empty; /// <summary> /// 线体2当前正在制作的配方名称 /// </summary> public string LTwoCurrentRecipeName { get; set; } = string.Empty; /// <summary> /// 线体3当前正在制作的配方名称 /// </summary> public string LThreeCurrentRecipeName { get; set; } = string.Empty; #endregion #region 线体1流程互锁变量 public bool LoadRoller { get; set; } public bool AgvToFryPot { get; set; } public bool PotOneInputMaterialArrive { get; set; } public bool PotOneOutputRollerArrive { get; set; } public bool AgvArrivePot { get; set; } #endregion #region 线体2流程互锁变量 public bool LTwoLoadRoller { get; set; } public bool LTwoAgvToFryPot { get; set; } public bool LTwoPotInputMaterialArrive { get; set; } public bool LTwoPotOutputRollerArrive { get; set; } public bool LTwoAgvArrivePot { get; set; } #endregion #region 线体3流程互锁变量 public bool LThreeLoadRoller { get; set; } public bool LThreeAgvToFryPot { get; set; } public bool LThreePotInputMaterialArrive { get; set; } public bool LThreePotOutputRollerArrive { get; set; } public bool LThreeAgvArrivePot { get; set; } #endregion #region AGV视图显示变量 public int LOneMaterialNum { get; set; } = 0; public int LOneFryPotSerial { get; set; } = 1; public int LOneCurrentCookingStep { get; set; } = 0; public bool agvArriveUpLoad { get; set; } public bool agvArriveUnLoad { get; set; } public bool agvFryPotEmptyRollerArrive { get; set; } public bool EmptyRollerUnLoadcCom { get; set; }//AGV空桶4号线体下料完成 public bool agvLineOneLoadCom { get; set; }//线体1上料完成 public int LTwoMaterialNum { get; set; } = 0; public int LTwoFryPotSerial { get; set; } = 2; public int LTwoCurrentCookingStep { get; set; } = 0; public bool agvArriveLTwoUpLoad { get; set; } public bool LTwoagvArriveUnLoad { get; set; } public bool LTwoagvFryPotEmptyRollerArrive { get; set; } public bool agvLineTwoLoadCom { get; set; }//线体2上料完成 public int LThreeMaterialNum { get; set; } = 0; public int LThreeFryPotSerial { get; set; } = 3; public int LThreeCurrentCookingStep { get; set; } = 0; public bool agvArriveLThreeUpLoad { get; set; } public bool LThreeagvArriveUnLoad { get; set; } public bool LThreeagvFryPotEmptyRollerArrive { get; set; } public bool agvLineThreeLoadCom { get; set; }//线体1上料完成 public int LFourRollerNum { get; set; } = 0;//4号线体空桶数量 //新增空桶清洗系列变量 public bool agvArriveLineFour { get; set; }//agv到达线体4下料位置从清洗台或炒锅 public bool agvArriveCleanUnLoad { get; set; }//agv到达清洗台下料位置 public bool agvArriveCleanLoad { get; set; }//agv到达清洗台上料位置 public bool agvArriveLineOneLoadEmptyRoller { get; set; }//agv到达线体1空桶上料位置 public bool agvArriveLineTwoLoadEmptyRoller { get; set; }//agv到达线体2空桶上料位置 public bool agvArriveLineThreeLoadEmptyRoller { get; set; }//agv到达线体3空桶上料位置 public bool agvArriveLineOneLoadCom { get; set; } //agv线体1空桶上料完成 public bool agvArriveLineTwoLoadCom { get; set; } //agv线体2空桶上料完成 public bool agvArriveLineThreeLoadCom { get; set; }//agv线体3空桶上料完成 //空桶清洗流程锁 #endregion } /// <summary> /// 滚筒线1相关变量 /// </summary> public class RollerLineOne { /// <summary> /// 工位号1 /// </summary> public ushort StationOne { get; set; } /// <summary> /// 工位号2 /// </summary> public ushort StationTwo { get; set; } /// <summary> /// 工位号3 /// </summary> public ushort StationThree { get; set; } /// <summary> /// 工位号4 /// </summary> public ushort StationFour { get; set; } /// <summary> /// 工位号5 /// </summary> public ushort StationFive { get; set; } /// <summary> /// 工位号6 /// </summary> public ushort StationSix { get; set; } /// <summary> /// 工位号7 /// </summary> public ushort StationSeven { get; set; } /// <summary> /// 工位号8 /// </summary> public ushort StationEight { get; set; } /// <summary> /// 输送出料滚筒运行信号 /// </summary> public ushort OutMaterialingSingle { get; set; } /// <summary> /// 输送出料滚筒运行故障信号 /// </summary> public ushort OutMaterialingTroubleSingle { get; set; } /// <summary> /// 当前线体配方完成信号 /// </summary> public ushort RecipeCompleteSingle { get; set; } /// <summary> /// 线体1上空桶确认信号 /// </summary> public ushort EmptyRollerConfirmSingle { get; set; } /// <summary> /// 线体1上单个空桶编号 /// </summary> public ushort EmptyRollerNum { get; set; } /// <summary> /// 上一个桶是否是空桶 /// </summary> public bool IsEpmtyBefore { get; set; } //空桶上料结束后,配方料桶AGV才能去1号线装桶 public bool CanRun { get; set; } = true; //配方料桶上料结束后,线体空桶AGV才能1号线装桶 /// <summary> /// 线体1上所有空桶的编号集合 /// </summary> public List<ushort> EmptyRollerNums { get; set; } = new List<ushort>(); } /// <summary> /// 滚筒线2相关变量 /// </summary> public class RollerLineTwo { /// <summary> /// 工位号1 /// </summary> public ushort StationOne { get; set; } /// <summary> /// 工位号2 /// </summary> public ushort StationTwo { get; set; } /// <summary> /// 工位号3 /// </summary> public ushort StationThree { get; set; } /// <summary> /// 工位号4 /// </summary> public ushort StationFour { get; set; } /// <summary> /// 工位号5 /// </summary> public ushort StationFive { get; set; } /// <summary> /// 工位号6 /// </summary> public ushort StationSix { get; set; } /// <summary> /// 工位号7 /// </summary> public ushort StationSeven { get; set; } /// <summary> /// 工位号8 /// </summary> public ushort StationEight { get; set; } /// <summary> /// 输送出料滚筒运行信号 /// </summary> public ushort OutMaterialingSingle { get; set; } /// <summary> /// 输送出料滚筒运行故障信号 /// </summary> public ushort OutMaterialingTroubleSingle { get; set; } /// <summary> /// 当前线体配方完成信号 /// </summary> public ushort RecipeCompleteSingle { get; set; } /// <summary> /// 线体1上空桶确认信号 /// </summary> public ushort EmptyRollerConfirmSingle { get; set; } /// <summary> /// 线体1上单个空桶编号 /// </summary> public ushort EmptyRollerNum { get; set; } /// <summary> /// 上一个同时否是空桶 /// </summary> public bool IsEpmtyBefore { get; set; } public bool CanRun { get; set; } = true; //配方料桶上料结束后,线体空桶AGV才能1号线装桶 /// <summary> /// 线体2上所有空桶的编号集合 /// </summary> public List<ushort> EmptyRollerNums { get; set; } = new List<ushort>(); } /// <summary> /// 滚筒线3相关变量 /// </summary> public class RollerLineThree { /// <summary> /// 工位号1 /// </summary> public ushort StationOne { get; set; } /// <summary> /// 工位号2 /// </summary> public ushort StationTwo { get; set; } /// <summary> /// 工位号3 /// </summary> public ushort StationThree { get; set; } /// <summary> /// 工位号4 /// </summary> public ushort StationFour { get; set; } /// <summary> /// 工位号5 /// </summary> public ushort StationFive { get; set; } /// <summary> /// 工位号6 /// </summary> public ushort StationSix { get; set; } /// <summary> /// 工位号7 /// </summary> public ushort StationSeven { get; set; } /// <summary> /// 工位号8 /// </summary> public ushort StationEight { get; set; } /// <summary> /// 输送出料滚筒运行信号 /// </summary> public ushort OutMaterialingSingle { get; set; } /// <summary> /// 输送出料滚筒运行故障信号 /// </summary> public ushort OutMaterialingTroubleSingle { get; set; } /// <summary> /// 当前线体配方完成信号 /// </summary> public ushort RecipeCompleteSingle { get; set; } /// <summary> /// 线体1上空桶确认信号 /// </summary> public ushort EmptyRollerConfirmSingle { get; set; } /// <summary> /// 线体1上单个空桶编号 /// </summary> public ushort EmptyRollerNum { get; set; } /// <summary> /// 上一个同时否是空桶 /// </summary> public bool IsEpmtyBefore { get; set; } public bool CanRun { get; set; } = true;//配方料桶上料结束后,线体空桶AGV才能1号线装桶 /// <summary> /// 线体3上所有空桶的编号集合 /// </summary> public List<ushort> EmptyRollerNums { get; set; } = new List<ushort>(); } /// <summary> /// 滚筒线4相关变量 /// </summary> public class RollerLineFour { /// <summary> /// 工位号1 /// </summary> public ushort StationOne { get; set; } /// <summary> /// 工位号2 /// </summary> public ushort StationTwo { get; set; } /// <summary> /// 工位号3 /// </summary> public ushort StationThree { get; set; } /// <summary> /// 工位号4 /// </summary> public ushort StationFour { get; set; } /// <summary> /// 工位号5 /// </summary> public ushort StationFive { get; set; } /// <summary> /// 工位号6 /// </summary> public ushort StationSix { get; set; } /// <summary> /// 工位号7 /// </summary> public ushort StationSeven { get; set; } /// <summary> /// 工位号8 /// </summary> public ushort StationEight { get; set; } /// <summary> /// 输送出料滚筒运行信号 /// </summary> public ushort OutMaterialingSingle { get; set; } /// <summary> /// 输送出料滚筒运行故障信号 /// </summary> public ushort OutMaterialingTroubleSingle { get; set; } /// <summary> /// 当前线体配方完成信号 /// </summary> public ushort RecipeCompleteSingle { get; set; } } /// <summary> /// 炒锅1相关变量 /// </summary> public class FryPotOne { /// <summary> /// 进料滚筒运行信号 /// </summary> public ushort InputMaterialRollerRunningSingle { get; set; } /// <summary> /// 进料到位信号 /// </summary> public ushort InputMaterialArrivedSingle { get; set; } /// <summary> /// 空桶到位信号 /// </summary> public ushort EmptyBarrelArrivedSingle { get; set; } /// <summary> /// 空桶滚筒运行信号 /// </summary> public ushort EmptyBarrelRollerRunningSingle { get; set; } /// <summary> /// 滚筒故障信号 /// </summary> public ushort RollerTroubleSingle { get; set; } /// <summary> /// 用油量确认信号 /// </summary> public ushort OilConfirm { get; set; } /// <summary> /// 当前配方用油量 /// </summary> public double OilCapacity { get; set; } } /// <summary> /// 炒锅2相关变量 /// </summary> public class FryPotTwo { /// <summary> /// 进料滚筒运行信号 /// </summary> public ushort InputMaterialRollerRunningSingle { get; set; } /// <summary> /// 进料到位信号 /// </summary> public ushort InputMaterialArrivedSingle { get; set; } /// <summary> /// 空桶到位信号 /// </summary> public ushort EmptyBarrelArrivedSingle { get; set; } /// <summary> /// 空桶滚筒运行信号 /// </summary> public ushort EmptyBarrelRollerRunningSingle { get; set; } /// <summary> /// 滚筒故障信号 /// </summary> public ushort RollerTroubleSingle { get; set; } /// <summary> /// 用油量确认信号 /// </summary> public ushort OilConfirm { get; set; } /// <summary> /// 当前配方用油量 /// </summary> public double OilCapacity { get; set; } } /// <summary> /// 炒锅3相关变量 /// </summary> public class FryPotThree { /// <summary> /// 进料滚筒运行信号 /// </summary> public ushort InputMaterialRollerRunningSingle { get; set; } /// <summary> /// 进料到位信号 /// </summary> public ushort InputMaterialArrivedSingle { get; set; } /// <summary> /// 空桶到位信号 /// </summary> public ushort EmptyBarrelArrivedSingle { get; set; } /// <summary> /// 空桶滚筒运行信号 /// </summary> public ushort EmptyBarrelRollerRunningSingle { get; set; } /// <summary> /// 滚筒故障信号 /// </summary> public ushort RollerTroubleSingle { get; set; } /// <summary> /// 用油量确认信号 /// </summary> public ushort OilConfirm { get; set; } /// <summary> /// 当前配方用油量 /// </summary> public double OilCapacity { get; set; } } /// <summary> /// 炒锅4相关变量 /// </summary> public class FryPotFour { /// <summary> /// 进料滚筒运行信号 /// </summary> public ushort InputMaterialRollerRunningSingle { get; set; } /// <summary> /// 进料到位信号 /// </summary> public ushort InputMaterialArrivedSingle { get; set; } /// <summary> /// 空桶到位信号 /// </summary> public ushort EmptyBarrelArrivedSingle { get; set; } /// <summary> /// 空桶滚筒运行信号 /// </summary> public ushort EmptyBarrelRollerRunningSingle { get; set; } /// <summary> /// 滚筒故障信号 /// </summary> public ushort RollerTroubleSingle { get; set; } /// <summary> /// 用油量确认信号 /// </summary> public ushort OilConfirm { get; set; } /// <summary> /// 当前配方用油量 /// </summary> public double OilCapacity { get; set; } } /// <summary> /// 炒锅5相关变量 /// </summary> public class FryPotFive { /// <summary> /// 进料滚筒运行信号 /// </summary> public ushort InputMaterialRollerRunningSingle { get; set; } /// <summary> /// 进料到位信号 /// </summary> public ushort InputMaterialArrivedSingle { get; set; } /// <summary> /// 空桶到位信号 /// </summary> public ushort EmptyBarrelArrivedSingle { get; set; } /// <summary> /// 空桶滚筒运行信号 /// </summary> public ushort EmptyBarrelRollerRunningSingle { get; set; } /// <summary> /// 滚筒故障信号 /// </summary> public ushort RollerTroubleSingle { get; set; } /// <summary> /// 用油量确认信号 /// </summary> public ushort OilConfirm { get; set; } /// <summary> /// 当前配方用油量 /// </summary> public double OilCapacity { get; set; } } }