using System; using System.Text; using System.Linq; using System.Drawing; using System.Diagnostics; using System.Windows.Forms; using System.Threading; using System.Threading.Tasks; using System.Collections.Generic; using Tango.PMR.Hardware; using Tango.PMR.Printing; using Tango.PMR.Stubs; using Tango.Stubs.UI; HardwarePidControl FeederPidControl = new HardwarePidControl(); FeederPidControl.HardwarePidControlType = Tango.PMR.Hardware.HardwarePidControlType.MotorFeeder; FeederPidControl.OutputProportionalPowerLimit = 1.0; FeederPidControl.OutputProportionalBand = 5; FeederPidControl.IntegralTime = 5; FeederPidControl.DerivativeTime = 0; FeederPidControl.SensorCorrectionAdjustment = 0; FeederPidControl.SensorMinValue = 0; FeederPidControl.SensorMaxValue = 0; FeederPidControl.SetPointRampRateorSoftStartRamp = 0; FeederPidControl.SetPointControlOutputRate = 4; FeederPidControl.ControlOutputType = 0; FeederPidControl.SsrControlOutputType = 0; FeederPidControl.OutputOnOffHysteresisValue = 0; FeederPidControl.ProcessVariableSamplingRate = 1000; FeederPidControl.PvInputFilterFactorMode = 4; FeederPidControl.OutputProportionalCycleTime = 0; FeederPidControl.AcHeatersHalfCycleTime = 0; FeederPidControl.ProportionalGain = 11.0; HardwarePidControl PoolerPidControl = new HardwarePidControl(); PoolerPidControl.HardwarePidControlType = Tango.PMR.Hardware.HardwarePidControlType.MotorPooler; PoolerPidControl.OutputProportionalPowerLimit = 1.0; PoolerPidControl.OutputProportionalBand = 5; PoolerPidControl.IntegralTime = 5; PoolerPidControl.DerivativeTime = 0; PoolerPidControl.SensorCorrectionAdjustment = 0; PoolerPidControl.SensorMinValue = 0; PoolerPidControl.SensorMaxValue = 0; PoolerPidControl.SetPointRampRateorSoftStartRamp = 0; PoolerPidControl.SetPointControlOutputRate = 4; PoolerPidControl.ControlOutputType = 0; PoolerPidControl.SsrControlOutputType = 0; PoolerPidControl.OutputOnOffHysteresisValue = 0; PoolerPidControl.ProcessVariableSamplingRate = 1000; PoolerPidControl.PvInputFilterFactorMode = 4; PoolerPidControl.OutputProportionalCycleTime = 0; PoolerPidControl.AcHeatersHalfCycleTime = 0; PoolerPidControl.ProportionalGain = 11.0; HardwarePidControl WinderPidControl = new HardwarePidControl(); WinderPidControl.HardwarePidControlType = Tango.PMR.Hardware.HardwarePidControlType.MotorWinder; WinderPidControl.OutputProportionalPowerLimit = 1.0; WinderPidControl.OutputProportionalBand = 5; WinderPidControl.IntegralTime = 5; WinderPidControl.DerivativeTime = 0; WinderPidControl.SensorCorrectionAdjustment = 0; WinderPidControl.SensorMinValue = 0; WinderPidControl.SensorMaxValue = 0; WinderPidControl.SetPointRampRateorSoftStartRamp = 0; WinderPidControl.SetPointControlOutputRate = 4; WinderPidControl.ControlOutputType = 0; WinderPidControl.SsrControlOutputType = 0; WinderPidControl.OutputOnOffHysteresisValue = 0; WinderPidControl.ProcessVariableSamplingRate = 1000; WinderPidControl.PvInputFilterFactorMode = 4; WinderPidControl.OutputProportionalCycleTime = 0; WinderPidControl.AcHeatersHalfCycleTime = 0; WinderPidControl.ProportionalGain = 11.0; HardwareDancer FeederDancer = new HardwareDancer(); FeederDancer.HardwareDancerType = Tango.PMR.Hardware.HardwareDancerType.RightDancer; FeederDancer.Gradual = false; FeederDancer.K = 0; FeederDancer.X = 0; FeederDancer.PulsePerMmSpring = 0; FeederDancer.MaximalMovementMm = 20; FeederDancer.ZeroPoint = 14182; FeederDancer.ResolutionBits = 14; FeederDancer.ArmLength = 126; HardwareDancer PoolerDancer = new HardwareDancer(); PoolerDancer.HardwareDancerType = Tango.PMR.Hardware.HardwareDancerType.MiddleDancer; PoolerDancer.Gradual = false; PoolerDancer.K = 0; PoolerDancer.X = 0; PoolerDancer.PulsePerMmSpring = 0; PoolerDancer.MaximalMovementMm = 20; PoolerDancer.ZeroPoint = 13247; PoolerDancer.ResolutionBits = 14; PoolerDancer.ArmLength = 126; HardwareDancer WinderDancer = new HardwareDancer(); WinderDancer.HardwareDancerType = Tango.PMR.Hardware.HardwareDancerType.LeftDancer; WinderDancer.Gradual = false; WinderDancer.K = 0; WinderDancer.X = 0; WinderDancer.PulsePerMmSpring = 0; WinderDancer.MaximalMovementMm = 20; WinderDancer.ZeroPoint = 11193; WinderDancer.ResolutionBits = 14; WinderDancer.ArmLength = 126; HardwareMotor FeederMotor = new HardwareMotor(); FeederMotor.HardwareMotorType = Tango.PMR.Hardware.HardwareMotorType.MotoRdriving; FeederMotor.MinFrequency = 0; FeederMotor.MaxFrequency = 1000000; FeederMotor.SetMicroStep = 1; FeederMotor.MicroStep = 8; FeederMotor.MaxChangeSlope = 4095; FeederMotor.HighLengthMicroSecond = 0; FeederMotor.SpeedMaster = false; FeederMotor.PulsePerRound = 200; FeederMotor.PulleyRadius = 1.25; FeederMotor.ConfigWord = 0x1C80; FeederMotor.DirectionThreadWize = true; FeederMotor.KvalHold = 0x35; FeederMotor.KvalRun = 0x7f; FeederMotor.KvalAcc = 0x7f; FeederMotor.KvalDec = 0x7f; FeederMotor.OverCurrentThreshold = 7; FeederMotor.StallThreshold = 0x1F; FeederMotor.ThermalCompensationFactor = 0; FeederMotor.LowSpeedOptimization = false; FeederMotor.StSlp = 0x20; FeederMotor.IntSpd = 0x1A13; FeederMotor.FnSlpAcc = 0x50; FeederMotor.FnSlpDec = 0x50; HardwareMotor DryerMotor = new HardwareMotor(); DryerMotor.HardwareMotorType = Tango.PMR.Hardware.HardwareMotorType.MotoDryerDriving; DryerMotor.MinFrequency = 0; DryerMotor.MaxFrequency = 1000000; DryerMotor.SetMicroStep = 1; DryerMotor.MicroStep = 8; DryerMotor.MaxChangeSlope = 4095; DryerMotor.HighLengthMicroSecond = 0; DryerMotor.SpeedMaster = true; DryerMotor.PulsePerRound = 200; DryerMotor.PulleyRadius = 1.05; DryerMotor.ConfigWord = 0x1c80; DryerMotor.DirectionThreadWize = false; DryerMotor.KvalHold = 0x35; DryerMotor.KvalRun = 0x7f; DryerMotor.KvalAcc = 0x7f; DryerMotor.KvalDec = 0x7f; DryerMotor.OverCurrentThreshold = 7; DryerMotor.StallThreshold = 0x1F; DryerMotor.ThermalCompensationFactor = 0; DryerMotor.LowSpeedOptimization = false; DryerMotor.StSlp = 0x20; DryerMotor.IntSpd = 0x1A13; DryerMotor.FnSlpAcc = 0x50; DryerMotor.FnSlpDec = 0x50; HardwareMotor PoolerMotor = new HardwareMotor(); PoolerMotor.HardwareMotorType = Tango.PMR.Hardware.HardwareMotorType.MotoLdriving; PoolerMotor.MinFrequency = 0; PoolerMotor.MaxFrequency = 1000000; PoolerMotor.SetMicroStep = 1; PoolerMotor.MicroStep = 8; PoolerMotor.MaxChangeSlope = 10000; PoolerMotor.HighLengthMicroSecond = 0; PoolerMotor.SpeedMaster = false; PoolerMotor.PulsePerRound = 200; PoolerMotor.PulleyRadius = 1.25; PoolerMotor.ConfigWord = 0x1C80; PoolerMotor.DirectionThreadWize = true; PoolerMotor.KvalHold = 0x35; PoolerMotor.KvalRun = 0x7f; PoolerMotor.KvalAcc = 0x7f; PoolerMotor.KvalDec = 0x7f; PoolerMotor.OverCurrentThreshold = 7; PoolerMotor.StallThreshold = 0x1F; PoolerMotor.ThermalCompensationFactor = 0; PoolerMotor.LowSpeedOptimization = false; PoolerMotor.StSlp = 20; PoolerMotor.IntSpd = 0x1A13; PoolerMotor.FnSlpAcc = 0x50; PoolerMotor.FnSlpDec = 0x50; HardwareMotor WinderMotor = new HardwareMotor(); WinderMotor.HardwareMotorType = Tango.PMR.Hardware.HardwareMotorType.MotoWinder; WinderMotor.MinFrequency = 0; WinderMotor.MaxFrequency = 100000; WinderMotor.SetMicroStep = 1; WinderMotor.MicroStep = 16; WinderMotor.MaxChangeSlope = 0x7ff; WinderMotor.HighLengthMicroSecond = 0; WinderMotor.SpeedMaster = false; WinderMotor.PulsePerRound = 200; WinderMotor.PulleyRadius = 0.8; WinderMotor.ConfigWord = 0x1CA0; WinderMotor.DirectionThreadWize = false; WinderMotor.KvalHold = 0x08; WinderMotor.KvalRun = 0x20; WinderMotor.KvalAcc = 0x20; WinderMotor.KvalDec = 0x20; WinderMotor.OverCurrentThreshold = 0xF; WinderMotor.StallThreshold = 0x7F; WinderMotor.ThermalCompensationFactor = 0; WinderMotor.LowSpeedOptimization = false; WinderMotor.StSlp = 0x7; WinderMotor.IntSpd = 0x22C5; WinderMotor.FnSlpAcc = 0x15; WinderMotor.FnSlpDec = 0x15; HardwareMotor ScrewMotor = new HardwareMotor(); ScrewMotor.HardwareMotorType = Tango.PMR.Hardware.HardwareMotorType.MotoScrew; ScrewMotor.MinFrequency = 0; ScrewMotor.MaxFrequency = 100000; ScrewMotor.SetMicroStep = 1; ScrewMotor.MicroStep = 8; ScrewMotor.MaxChangeSlope = 0x7FF; ScrewMotor.HighLengthMicroSecond = 0; ScrewMotor.SpeedMaster = false; ScrewMotor.PulsePerRound = 200; ScrewMotor.PulleyRadius = 1.68; ScrewMotor.ConfigWord = 0x1CA0; ScrewMotor.DirectionThreadWize = true; ScrewMotor.KvalHold = 0x1; ScrewMotor.KvalRun = 0x20; ScrewMotor.KvalAcc = 0x20; ScrewMotor.KvalDec = 0x20; ScrewMotor.OverCurrentThreshold = 0xF; ScrewMotor.StallThreshold = 0x7F; ScrewMotor.ThermalCompensationFactor = 0; ScrewMotor.LowSpeedOptimization = false; ScrewMotor.StSlp = 0x7; ScrewMotor.IntSpd = 0x22C5; ScrewMotor.FnSlpAcc = 0x15; ScrewMotor.FnSlpDec = 0x15; HardwareMotor LeftRockerMotor = new HardwareMotor(); LeftRockerMotor.HardwareMotorType = Tango.PMR.Hardware.HardwareMotorType.MotoLloading; LeftRockerMotor.MinFrequency = 0; LeftRockerMotor.MaxFrequency = 1000000; LeftRockerMotor.SetMicroStep = 1; LeftRockerMotor.MicroStep = 4; LeftRockerMotor.MaxChangeSlope = 10000; LeftRockerMotor.HighLengthMicroSecond = 0; LeftRockerMotor.SpeedMaster = false; LeftRockerMotor.PulsePerRound = 200; LeftRockerMotor.PulleyRadius = 1.3; LeftRockerMotor.ConfigWord = 0xC80; LeftRockerMotor.DirectionThreadWize = false; LeftRockerMotor.KvalHold = 0x28; LeftRockerMotor.KvalRun = 0x5f; LeftRockerMotor.KvalAcc = 0x5f; LeftRockerMotor.KvalDec = 0x5f; LeftRockerMotor.OverCurrentThreshold = 7; LeftRockerMotor.StallThreshold = 0x1F; LeftRockerMotor.ThermalCompensationFactor = 0; LeftRockerMotor.LowSpeedOptimization = false; LeftRockerMotor.StSlp = 6; LeftRockerMotor.IntSpd = 0x44B8; LeftRockerMotor.FnSlpAcc = 0x14; LeftRockerMotor.FnSlpDec = 0x14; HardwareMotor RightRockerMotor = new HardwareMotor(); RightRockerMotor.HardwareMotorType = Tango.PMR.Hardware.HardwareMotorType.MotoRloading; RightRockerMotor.MinFrequency = 0; RightRockerMotor.MaxFrequency = 1000000; RightRockerMotor.SetMicroStep = 1; RightRockerMotor.MicroStep = 4; RightRockerMotor.MaxChangeSlope = 4095; RightRockerMotor.HighLengthMicroSecond = 0; RightRockerMotor.SpeedMaster = false; RightRockerMotor.PulsePerRound = 200; RightRockerMotor.PulleyRadius = 1.3; RightRockerMotor.ConfigWord = 0xC80; RightRockerMotor.DirectionThreadWize = true; RightRockerMotor.KvalHold = 0x28; RightRockerMotor.KvalRun = 0x5f; RightRockerMotor.KvalAcc = 0x5f; RightRockerMotor.KvalDec = 0x5f; RightRockerMotor.OverCurrentThreshold = 7; RightRockerMotor.StallThreshold = 0x1F; RightRockerMotor.ThermalCompensationFactor = 0; RightRockerMotor.LowSpeedOptimization = false; RightRockerMotor.StSlp = 6; RightRockerMotor.IntSpd = 0x44B8; RightRockerMotor.FnSlpAcc = 0x14; RightRockerMotor.FnSlpDec = 0x14; HardwareMotor Dispenser4Motor = new HardwareMotor(); Dispenser4Motor.HardwareMotorType = Tango.PMR.Hardware.HardwareMotorType.MotoDispenser7; /*Dispenser4Motor.MinFrequency = 0; Dispenser4Motor.MaxFrequency = 1000000; Dispenser4Motor.SetMicroStep = 1; Dispenser4Motor.MicroStep = 8; Dispenser4Motor.MaxChangeSlope = 0x7FF; Dispenser4Motor.HighLengthMicroSecond = 0; Dispenser4Motor.SpeedMaster = false; Dispenser4Motor.PulsePerRound = 200; Dispenser4Motor.PulleyRadius = 1.68; Dispenser4Motor.ConfigWord = 0x1CA0; Dispenser4Motor.DirectionThreadWize = true; Dispenser4Motor.KvalHold = 0x35; Dispenser4Motor.KvalRun = 0x7f; Dispenser4Motor.KvalAcc = 0x7f; Dispenser4Motor.KvalDec = 0x7f; Dispenser4Motor.OverCurrentThreshold = 0xF; Dispenser4Motor.StallThreshold = 0x7F; Dispenser4Motor.ThermalCompensationFactor = 0; Dispenser4Motor.LowSpeedOptimization = false; Dispenser4Motor.StSlp = 0x20; Dispenser4Motor.IntSpd = 0x1A13; Dispenser4Motor.FnSlpAcc = 0x50; Dispenser4Motor.FnSlpDec = 0x50; */ Dispenser4Motor.MinFrequency = 0; Dispenser4Motor.MaxFrequency = 1000000; Dispenser4Motor.SetMicroStep = 1; Dispenser4Motor.MicroStep = 1; Dispenser4Motor.MaxChangeSlope = 10000; Dispenser4Motor.HighLengthMicroSecond = 0; Dispenser4Motor.SpeedMaster = false; Dispenser4Motor.PulsePerRound = 200; Dispenser4Motor.PulleyRadius = 1.25; Dispenser4Motor.ConfigWord = 0x1C80; Dispenser4Motor.DirectionThreadWize = true; Dispenser4Motor.KvalHold = 0x35; Dispenser4Motor.KvalRun = 0x7f; Dispenser4Motor.KvalAcc = 0x7f; Dispenser4Motor.KvalDec = 0x7f; Dispenser4Motor.OverCurrentThreshold = 7; Dispenser4Motor.StallThreshold = 0x1F; Dispenser4Motor.ThermalCompensationFactor = 0; Dispenser4Motor.LowSpeedOptimization = false; Dispenser4Motor.StSlp = 0x20; Dispenser4Motor.IntSpd = 0x1A13; Dispenser4Motor.FnSlpAcc = 0x50; Dispenser4Motor.FnSlpDec = 0x50; HardwareDispenser hardwareDispenser = new HardwareDispenser(); hardwareDispenser.HardwareDispenserType = Tango.PMR.Hardware.HardwareDispenserType.StandardDispenser; hardwareDispenser.Index = 6; hardwareDispenser.NlPerPulse = 2.4; hardwareDispenser.Capacity = 500; JobDispenser jobDispenser = new JobDispenser(); jobDispenser.Index = 0; jobDispenser.Volume = 0; jobDispenser.DispenserStepDivision = Tango.PMR.Printing.DispenserStepDivision.Auto; jobDispenser.NanolitterPerSecond = 0; jobDispenser.NanoliterPerCentimeter = 0; jobDispenser.PulsePerSecond = 0; jobDispenser.DispenserLiquidType = Tango.PMR.Printing.DispenserLiquidType.Cyan; jobDispenser.LiquidMaxNanoliterPerCentimeter = 0; jobDispenser.NanoliterPerPulse = 0; HardwareWinder Winder = new HardwareWinder(); Winder.HardwareWinderType = Tango.PMR.Hardware.HardwareWinderType.InternalWinder; Winder.MillimeterPerRotation = 20; //hardwareConfiguration.Motors.Add(FeederMotor); //hardwareConfiguration.Motors.Add(WinderMotor); //hardwareConfiguration.Motors.Add(DryerMotor); //hardwareConfiguration.Motors.Add(PoolerMotor); //hardwareConfiguration.Motors.Add(ScrewMotor); //hardwareConfiguration.Motors.Add(LeftRockerMotor); //hardwareConfiguration.Motors.Add(RightRockerMotor); //hardwareConfiguration.PidControls.Add(FeederPidControl); //hardwareConfiguration.PidControls.Add(PoolerPidControl); //hardwareConfiguration.PidControls.Add(WinderPidControl); //hardwareConfiguration.Dancers.Add(FeederDancer); //hardwareConfiguration.Dancers.Add(PoolerDancer); //hardwareConfiguration.Dancers.Add(WinderDancer);