Search in sources :

Example 11 with MesureResult

use of com.cas.circuit.util.MesureResult in project TeachingInSimulation by ScOrPiOzzy.

the class ServoDrive method onReceivedLocal.

@Override
protected void onReceivedLocal(Terminal terminal) {
    // 伺服放大器工作的条件
    if (terminal == _L1C || terminal == _L2C) {
        power();
    // 输出电压的条件
    } else if (terminal == _L1 || terminal == _L2 || terminal == _L3) {
        output();
    // 控制电机转速的条件
    } else if (terminal == _OPC1 || terminal == _PULS2) {
        speedControl();
    // 控制电机转向的条件
    } else if (terminal == _OPC2 || terminal == _SIGN2) {
        dirControl();
    // 左限位
    } else if (terminal == _POT) {
        MesureResult result = R.matchRequiredVolt(Voltage.IS_DC, _COM, _POT, 24, 2);
        // 有24表示没有限位
        leftLimit = result == null;
    // 右限位
    } else if (terminal == _NOT) {
        MesureResult result = R.matchRequiredVolt(Voltage.IS_DC, _COM, _NOT, 24, 2);
        // 有24表示没有限位
        rightLimit = result == null;
    // 伺服开
    } else if (terminal == _SERV_ON) {
        MesureResult result = R.matchRequiredVolt(Voltage.IS_DC, _COM, _SERV_ON, 24, 2);
        // 有24表示伺服打开
        servoOff = result == null;
    }
// if (terminal == _POT || terminal == _NOT || terminal == _SERV_ON) {
// if (leftLimit || rightLimit || servoOff) {
// _ALM.getResisRelationMap().put(_ALM_, resis);
// _ALM_.getResisRelationMap().put(_ALM, resis);
// resis.setActivated(true);
// } else {// 有信号
// _ALM.getResisRelationMap().remove(_ALM_);
// _ALM_.getResisRelationMap().remove(_ALM);
// resis.setActivated(false);
// }
// 
// Set<String> envs = _ALM_.getResidualVolt().keySet();
// R r = null;
// for (String env : envs) {
// r = R.getR(env);
// r.shareVoltage();
// }
// }
}
Also used : MesureResult(com.cas.circuit.util.MesureResult)

Example 12 with MesureResult

use of com.cas.circuit.util.MesureResult in project TeachingInSimulation by ScOrPiOzzy.

the class ServoDrive method power.

private void power() {
    MesureResult result = R.matchRequiredVolt(Voltage.IS_AC, _L1C, _L2C, 380, 10);
    boolean tmp = result != null;
    if (tmp && !workable) {
        workable = true;
        LOG.info("伺服放大器开始工作");
        R r = R.getR(encoderEnv);
        if (r == null) {
            r = R.create(encoderEnv, Voltage.IS_DC, _E_24V, _E_0V, 24);
        }
        r.shareVoltage();
    } else if (!tmp && workable) {
        LOG.info("伺服放大器停止工作");
        workable = false;
        List<R> rs = R.get3Phase(controlVoltEnv);
        if (rs != null) {
            for (R r : rs) {
                r.shutPowerDown();
            }
        }
        R r = R.getR(encoderEnv);
        if (r != null) {
            r.shutPowerDown();
        }
    }
}
Also used : MesureResult(com.cas.circuit.util.MesureResult) R(com.cas.circuit.util.R) List(java.util.List)

Example 13 with MesureResult

use of com.cas.circuit.util.MesureResult in project TeachingInSimulation by ScOrPiOzzy.

the class DiffuseSensorLogic method onReceivedLocal.

@Override
protected void onReceivedLocal(Terminal terminal) {
    MesureResult result = R.matchRequiredVolt(Voltage.IS_DC, terminal1, terminal2, 24, 2f);
    boolean tmp = result != null;
    if (!enabled && tmp) {
        enabled = true;
        System.err.println("DiffuseSensorLogic 开始工作啦。。。。");
    } else if (enabled && !tmp) {
        enabled = false;
        System.err.println("DiffuseSensorLogic 没法工作。。。。");
    }
}
Also used : MesureResult(com.cas.circuit.util.MesureResult)

Example 14 with MesureResult

use of com.cas.circuit.util.MesureResult in project TeachingInSimulation by ScOrPiOzzy.

the class InductanceLogic method onReceivedLocal.

@Override
protected void onReceivedLocal(Terminal terminal) {
    super.onReceivedLocal(terminal);
    MesureResult result = R.matchRequiredVolt(Voltage.IS_DC, terminal1, terminal2, 24, 2f);
    boolean tmp = result != null;
    if (!enabled && tmp) {
        enabled = true;
        System.err.println("InductanceLogic 开始工作啦。。。。");
    } else if (enabled && !tmp) {
        enabled = false;
        System.err.println("InductanceLogic 没法工作。。。。");
    }
}
Also used : MesureResult(com.cas.circuit.util.MesureResult)

Example 15 with MesureResult

use of com.cas.circuit.util.MesureResult in project TeachingInSimulation by ScOrPiOzzy.

the class FR_D720SInverter method onReceivedLocal.

@Override
protected void onReceivedLocal(Terminal terminal) {
    super.onReceivedLocal(terminal);
    if (_l == terminal || _n == terminal) {
        // 分别测量uvw三者之间的电压情况
        MesureResult result = R.matchRequiredVolt(Voltage.IS_AC, _l, _n, 220, 10);
        // 判断三者之间是否存在电势差
        boolean tmp = Util.notEmpty(result);
        List<R> controlVoltPower = R.get3Phase(controlVoltEnv);
        if (tmp && !workable) {
            workable = true;
            if (controlVoltPower == null) {
                controlVoltPower = R.create3Phase(controlVoltEnv, _u, _v, _w, new Terminal(), 380);
            }
            R.set3PhaseFrequency(controlVoltEnv, 50);
            R.reversePhase(controlVoltEnv, dir != Dir.CW);
            for (R r : controlVoltPower) {
                r.shareVoltage();
            }
        } else if (!tmp && workable) {
            if (controlVoltPower != null) {
                for (R r : controlVoltPower) {
                    r.shutPowerDown();
                }
            }
            workable = false;
        }
    } else if (_rda == terminal || _rdb == terminal) {
        // 处理PLC侧发来的数据
        MesureResult result = R.matchRequiredVolt(Voltage.IS_DC, _rda, _rdb, 5, 1);
        if (result != null) {
            Map<String, String> data = R.getR(result.getEvn()).getVoltage().getData();
            assist.decode(data);
        }
        if (voltNeedChange) {
        }
    } else {
    }
}
Also used : MesureResult(com.cas.circuit.util.MesureResult) R(com.cas.circuit.util.R) Terminal(com.cas.circuit.vo.Terminal) Map(java.util.Map)

Aggregations

MesureResult (com.cas.circuit.util.MesureResult)18 R (com.cas.circuit.util.R)6 Jack (com.cas.circuit.vo.Jack)2 Terminal (com.cas.circuit.vo.Terminal)2 MotionEvent (com.jme3.cinematic.events.MotionEvent)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 ConnectivityException (javafish.clients.opc.exception.ConnectivityException)1 Variant (javafish.clients.opc.variant.Variant)1