Search in sources :

Example 1 with Jack

use of com.cas.circuit.vo.Jack in project TeachingInSimulation by ScOrPiOzzy.

the class ElecCompCPU method getStitch.

/**
 * @param jackNm 信号发生的插孔名称
 * @param index 具体的针脚号
 */
public Terminal getStitch(String jackName, int index) {
    Jack jack = getJackMap().get(jackName);
    if (jack == null) {
        String errMsg = MessageFormat.format("没有找到名称为: {0}的插孔", jackName);
        LOG.warn(errMsg);
        throw new RuntimeException(errMsg);
    }
    Terminal stitch = jack.getStitch(index);
    if (stitch == null) {
        String errMsg = MessageFormat.format("插孔{0}中没有找到第{1}跟针脚", jackName, index);
        LOG.warn(errMsg);
        throw new RuntimeException(errMsg);
    }
    return stitch;
}
Also used : Jack(com.cas.circuit.vo.Jack) Terminal(com.cas.circuit.vo.Terminal)

Example 2 with Jack

use of com.cas.circuit.vo.Jack in project TeachingInSimulation by ScOrPiOzzy.

the class Inverter method initialize.

@Override
public void initialize() {
    super.initialize();
    assist = new InvertorAssist(this);
    controlVoltEnv = "Invertor_" + hashCode() + "_ControlVoltage";
    _r = elecComp.getTerminal("R");
    _s = elecComp.getTerminal("S");
    _t = elecComp.getTerminal("T");
    _u = elecComp.getTerminal("U");
    _v = elecComp.getTerminal("V");
    _w = elecComp.getTerminal("W");
    Jack jack_pu = elecComp.getJackMap().get("PU");
    _rda = jack_pu.getStitch(3);
    _rdb = jack_pu.getStitch(4);
    _sda = jack_pu.getStitch(1);
    _sdb = jack_pu.getStitch(2);
}
Also used : Jack(com.cas.circuit.vo.Jack)

Example 3 with Jack

use of com.cas.circuit.vo.Jack in project TeachingInSimulation by ScOrPiOzzy.

the class FiberSensorLogic method initialize.

@Override
public void initialize(Node elecCompMdl) {
    super.initialize(elecCompMdl);
    Jack jack = elecComp.getDef().getJackMap().get(elecComp.getDef().getPO().getModel());
    terminal1 = jack.getStitch().get("1");
    terminal2 = jack.getStitch().get("2");
    if (terminal1 == null) {
        throw new RuntimeException(elecComp + "中没能找到连接头 1");
    }
    if (terminal2 == null) {
        throw new RuntimeException(elecComp + "中没能找到连接头 2");
    }
}
Also used : Jack(com.cas.circuit.vo.Jack)

Example 4 with Jack

use of com.cas.circuit.vo.Jack in project TeachingInSimulation by ScOrPiOzzy.

the class ValveLogic method onButtonAction.

@Override
public void onButtonAction(ControlIO button, boolean press) {
    // 判断Jack是否满足电压
    String jackName = button.getProperties().get("jackName");
    Jack jack = def.getJackMap().get(jackName);
    MesureResult result = R.matchRequiredVolt(Voltage.IS_DC, jack.getStitch().get("1"), jack.getStitch().get("2"), 24, 2);
    // 如果电磁阀上没有满足条件的电压,则允许切换
    if (result != null) {
        return;
    }
    String switchFrom = button.getProperties().get("switchFrom");
    String switchTo = button.getProperties().get("switchTo");
    if (press) {
        changeBlockState(switchFrom, switchTo);
    } else {
        changeBlockState(switchTo, switchFrom);
    }
}
Also used : MesureResult(com.cas.circuit.util.MesureResult) Jack(com.cas.circuit.vo.Jack)

Example 5 with Jack

use of com.cas.circuit.vo.Jack in project TeachingInSimulation by ScOrPiOzzy.

the class ValveLogicEx method singleValve.

private void singleValve(ControlIO button, boolean press) {
    // 判断Jack是否满足电压
    String jackName = button.getProperties().get("jackName");
    Jack jack = def.getJackMap().get(jackName);
    MesureResult result = R.matchRequiredVolt(Voltage.IS_DC, jack.getStitch().get("1"), jack.getStitch().get("2"), 24, 2);
    // 如果电磁阀上没有满足条件的电压,则允许切换
    if (result != null) {
        return;
    }
    String switchFrom = button.getProperties().get("switchFrom");
    String switchTo = button.getProperties().get("switchTo");
    if (press) {
        changeBlockState(switchFrom, switchTo);
    } else {
        changeBlockState(switchTo, switchFrom);
    }
}
Also used : MesureResult(com.cas.circuit.util.MesureResult) Jack(com.cas.circuit.vo.Jack)

Aggregations

Jack (com.cas.circuit.vo.Jack)27 Terminal (com.cas.circuit.vo.Terminal)11 GasPort (com.cas.gas.vo.GasPort)5 Cable (com.cas.circuit.vo.Cable)4 Wire (com.cas.circuit.vo.Wire)4 Spatial (com.jme3.scene.Spatial)4 ElecCompDef (com.cas.circuit.vo.ElecCompDef)3 Pipe (com.cas.gas.vo.Pipe)3 ArrayList (java.util.ArrayList)3 MesureResult (com.cas.circuit.util.MesureResult)2 R (com.cas.circuit.util.R)2 ResisRelation (com.cas.circuit.vo.ResisRelation)2 Node (com.jme3.scene.Node)2 SignalVolt (com.cas.circuit.SignalVolt)1 TransducersAdapter (com.cas.circuit.event.TransducersAdapter)1 TransducersHandler (com.cas.circuit.event.TransducersHandler)1 LinkerMsg (com.cas.circuit.msg.LinkerMsg)1 ControlIO (com.cas.circuit.vo.ControlIO)1 ElecComp (com.cas.circuit.vo.ElecComp)1 Format (com.cas.circuit.vo.Format)1