use of com.cas.circuit.util.R in project TeachingInSimulation by ScOrPiOzzy.
the class ElecCompCPU method sendSignal.
/**
* @param jackNm 信号发生的插孔名称
* @param startIndex 具体的针脚号
* @param endIndex 具体的针脚号
* @param sign 电压对象
*/
public void sendSignal(String jackNm, String startIndex, String endIndex, CommandSignal sign) {
synchronized (this) {
// 判断当前插口是否允许发送指令
Jack jack = getJackMap().get(jackNm);
if (jack.isStopSend()) {
log.warn("无法发送信号!![" + jackNm + "]");
return;
}
Terminal startTerminal = getStitch(jackNm, startIndex);
Terminal endTerminal = getStitch(jackNm, endIndex);
String env = EVN_NAME_PRE + jackNm;
R r = R.getR(env);
if (r == null) {
r = R.createSignal(env, startTerminal, endTerminal, 24);
r.shareVoltage();
}
SignalVolt sv = (SignalVolt) r.getVoltage();
sv.changeCommandSignal(sign);
r.shareVoltage();
}
}
use of com.cas.circuit.util.R in project TeachingInSimulation by ScOrPiOzzy.
the class ElecCompCPU method sendSignal.
/**
* @param jackNm 信号发生的插孔名称
* @param startIndex 具体的针脚号
* @param endIndex 具体的针脚号
* @param sign 电压对象
*/
public void sendSignal(String jackNm, int startIndex, int endIndex, CommandSignal sign) {
synchronized (this) {
// 判断当前插口是否允许发送指令
Jack jack = getJackMap().get(jackNm);
if (jack.isStopSend()) {
LOG.warn("无法发送信号[{}]!!", jackNm);
return;
}
Terminal startTerminal = getStitch(jackNm, startIndex);
Terminal endTerminal = getStitch(jackNm, endIndex);
String env = EVN_NAME_PRE + jackNm;
R r = R.getR(env);
if (r == null) {
r = R.createSignal(env, startTerminal, endTerminal, 24);
r.shareVoltage();
}
SignalVolt sv = (SignalVolt) r.getVoltage();
sv.changeCommandSignal(sign);
r.shareVoltage();
}
}
use of com.cas.circuit.util.R in project TeachingInSimulation by ScOrPiOzzy.
the class ElecCompCPU method elecCompEnd.
/**
* 关闭元器件指示灯<br>
* 关闭信号电<br>
*/
protected void elecCompEnd() {
LOG.info("shutdown {}{}", elecComp.getName(), elecComp.getProxy().getTagName());
// System.out.println(this.getClass().getCanonicalName() + ".elecCompEnd(start...)");
getElecComp().getLightIOList().forEach(l -> l.closeLight());
R r = null;
if (cb_evn_names != null) {
for (int i = 0; i < cb_evn_names.size(); i++) {
r = R.getR(cb_evn_names.get(i));
if (r != null) {
r.shutPowerDown();
}
}
}
if (jf_evn_names != null) {
for (int i = 0; i < jf_evn_names.size(); i++) {
r = R.getR(jf_evn_names.get(i));
if (r != null) {
r.shutPowerDown();
}
}
}
if (cop_evn_names != null) {
for (int i = 0; i < cop_evn_names.size(); i++) {
r = R.getR(cop_evn_names.get(i));
if (r != null) {
r.shutPowerDown();
}
}
}
if (jfr_evn_names != null) {
String env = null;
for (int i = 0; i < jfr_evn_names.size(); i++) {
for (int j = 0; j < jfrEnvEnds.length; j++) {
// env = jfr_evn_names.get(i) + jfrEnvEnds[j][0] + "_" + jfrEnvEnds[j][1];
env = MessageFormat.format("{0}{1}_{2}", jfr_evn_names.get(i), jfrEnvEnds[j][0], jfrEnvEnds[j][1]);
r = R.getR(env);
if (r != null) {
r.shutPowerDown();
}
}
}
}
LOG.info("shutdown done {}{}", elecComp.getName(), elecComp.getProxy().getTagName());
// System.out.println(this.getClass().getCanonicalName() + ".elecCompEnd(end...)");
}
use of com.cas.circuit.util.R in project TeachingInSimulation by ScOrPiOzzy.
the class Encoder method onTargetStop.
public void onTargetStop() {
// System.out.println("Encoder.onTargetStop()");
R.SERVICE.execute(() -> {
// 设置abz与0v接通
ResisRelation resis = _A.getResisRelationMap().remove(_0v);
_0v.getResisRelationMap().remove(_A);
if (resis != null) {
resis.setActivated(false);
}
resis = _B.getResisRelationMap().remove(_0v);
_0v.getResisRelationMap().remove(_B);
if (resis != null) {
resis.setActivated(false);
}
Set<String> envs = _0v.getResidualVolt().keySet();
R r = null;
for (String env : envs) {
r = R.getR(env);
r.getVoltage().putData("PulsePerMillis", null);
r.getVoltage().putData("PulseDir", null);
r.shareVoltage();
}
});
}
use of com.cas.circuit.util.R in project TeachingInSimulation by ScOrPiOzzy.
the class ServoDrive method rotateChange.
private void rotateChange() {
// 让电机停止转动
List<R> rs = R.get3Phase(controlVoltEnv);
if (rs != null) {
for (R r : rs) {
r.shutPowerDown();
}
}
if (!outputEnable) {
return;
}
//
// if (leftLimit || rightLimit || servoOff) {
// return;
// }
rs = R.create3Phase(controlVoltEnv, _U, _V, _W, new Terminal(), 380);
System.out.println("ServoDrive.rotateChange() cw " + receivedDir);
R.reversePhase(controlVoltEnv, receivedDir);
R.set3PhaseFrequency(controlVoltEnv, frequency);
for (R r : rs) {
// r.getVoltage().setFrequency(frequency);
// r.getVoltage().putData("pulseAmount", result.getData("pulseAmount"));
r.shareVoltage();
}
}
Aggregations