use of com.cas.circuit.util.R 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();
}
}
}
use of com.cas.circuit.util.R in project TeachingInSimulation by ScOrPiOzzy.
the class FX3UPLCLogicAssist method dealWithYSignal.
private void dealWithYSignal(String singalAddress, Variant value, Map<String, String> data) {
// Y信号:当某Y信号点有信号时将该端子与对应的COM端子导通
// System.out.println("PLCLogic.update()");
// 获取信号所对应的连接头id
String signal = singalAddress.substring(singalAddress.lastIndexOf('.') + 1);
String termId = Signal.untiFormatSignal(signal);
int index = Integer.parseInt(termId.substring(1));
// 找到信号所对应的COM端连接头ID
int a = index / 10;
int b = index % 10 >= 4 ? 1 : 0;
// int group = 2 * a + b; // COM0 开始
// COM1 开始
int group = 2 * a + b + 1;
if (group > 5) {
// FX3u-48M, 20 - 27 都与COM5连接
group = 5;
}
// System.out.println("Y" + index + " group=" + group);
Terminal term = logic.getElecComp().getDef().getTerminal(termId);
Terminal docom = logic.getElecComp().getDef().getTerminal("COM" + group);
if (term == null) {
throw new RuntimeException("信号:" + singalAddress + "所对应的连接头" + termId + "没有找到");
}
if (docom == null) {
throw new RuntimeException("连接头:" + termId + "所对应的COM" + group + "端没有找到");
}
ResisRelation resis = resisRelations.get(term);
if (resis == null) {
resisRelations.put(term, resis = new ResisRelation(term, docom, 0f, true));
}
if (value.getBoolean()) {
// 没有信号
term.getResisRelationMap().put(docom, resis);
docom.getResisRelationMap().put(term, resis);
resis.setActivated(true);
} else {
// 有信号
term.getResisRelationMap().remove(docom);
docom.getResisRelationMap().remove(term);
resis.setActivated(false);
}
Set<String> envs = docom.getResidualVolt().keySet();
R r = null;
for (String env : envs) {
r = R.getR(env);
r.getVoltage().setData(data);
r.shareVoltage();
}
}
use of com.cas.circuit.util.R 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 {
}
}
use of com.cas.circuit.util.R in project TeachingInSimulation by ScOrPiOzzy.
the class FX3UPLCLogic method s_rs485.
public void s_rs485(Map<String, String> data) {
R r = R.getR("RS-485_PLC");
if (r == null) {
r = R.create("RS-485_PLC", Voltage.IS_DC, sda, sdb, 5);
}
r.getVoltage().setData(data);
r.shareVoltage();
}
Aggregations