public void UpdateValues(Motor mDC, Motor mPAP) { try { // mDC.CPosition = (int)DMC1425.commandValue("PR?"); // EHe 014.10.08, PA? <> PR? !!! mDC.CSpeed = (int)DMC1425.commandValue("SP?"); mDC.CAcceleration = (int)DMC1425.commandValue("AC?"); mDC.CDeceleration = (int)DMC1425.commandValue("DC?"); mDC.KP = (float)DMC1425.commandValue("KP?"); mDC.KD = (float)DMC1425.commandValue("KD?"); mDC.KI = (float)DMC1425.commandValue("KI?"); // mPAP.CPosition = (int)DMC1425.commandValue("PR,?"); // EHe 014.10.08, PA? <> PR? !!! mPAP.CSpeed = (int)DMC1425.commandValue("SP,?"); // mPAP.CSpeed = (int)DMC1425.commandValue("SPB=?"); mPAP.CAcceleration = (int)DMC1425.commandValue("AC,?"); mPAP.CDeceleration = (int)DMC1425.commandValue("DC,?"); Object r = DMC1425.record("QR"); mDC.IsMov = Convert.ToBoolean(DMC1425.sourceValue(r, "_BGA")); mDC.Position = (int)DMC1425.sourceValue(r, "_TPA"); mDC.Speed = (int)DMC1425.sourceValue(r, "_TVA"); mDC.PosErr = (int)DMC1425.sourceValue(r, "_TEA"); mDC.UCommand = DMC1425.sourceValue(r, "_TTA"); mDC.powEnable = Convert.ToBoolean(DMC1425.sourceValue(r, "@OUT[03]")); mDC.MotorState = !Convert.ToBoolean(DMC1425.sourceValue(r, "_MOA")) && mDC.powEnable; mPAP.IsMov = Convert.ToBoolean(DMC1425.sourceValue(r, "_BGB")); mPAP.Position = (int)DMC1425.sourceValue(r, "_TDB"); mPAP.powEnable = !Convert.ToBoolean(DMC1425.sourceValue(r, "@OUT[01]")); bool frage = !Convert.ToBoolean(DMC1425.sourceValue(r, "_MOB")); mPAP.MotorState = frage && mPAP.powEnable; //mPAP.MotorState = !Convert.ToBoolean(DMC1425.sourceValue(r, "_MOB")) && mPAP.powEnable; // mPAP.MotorState = /* !Convert.ToBoolean(DMC1425.sourceValue(r, "_MOB")) && */ mPAP.powEnable; // EHe 014.10.08 } catch (Exception) { throw; } }
public async void MotorOn() { string m = (MotorType == tMotorType.DC) ? "A" : "B"; string c = (MotorType == tMotorType.DC) ? "SB3" : "CB1"; DMC1425.commandValue("SH" + m); // Both motors ! Reset erreur moteur DC // EHe 014.10.08 string r = DMC1425.command(c); // Enable Power await Task.Delay(msgDelay); int op = (int)DMC1425.commandValue("OP?"); if ((((op & 4) == 0) && (MotorType == tMotorType.DC)) || (((op & 1) != 0) && (MotorType == tMotorType.PAP))) { MessageBox.Show("Commutateur de puissance du moteur " + ((MotorType == tMotorType.DC) ? "DC" : "PAP") + " forcé sur DISABLE"); } else { await Task.Delay(msgDelay); } }