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;
}
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);
}
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");
}
}
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);
}
}
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);
}
}
Aggregations