use of com.cas.circuit.vo.Terminal in project TeachingInSimulation by ScOrPiOzzy.
the class LinkTargetHandler method select.
public void select() {
MultimeterState_MF47 multimeterState = stateManager.getState(MultimeterState_MF47.class);
if (multimeterState.isEnabled() && target instanceof Terminal) {
multimeterState.putPenToTerminal((Terminal) target, target.getModel());
return;
}
if (!handler.checkConnect(target)) {
return;
}
LinkerMsg reqMsg = handler.offlineConnect(target);
// 如果当前为多人联机模式则向服务器发送连线请求
if (!handler.isAlone()) {
reqMsg.setType(LinkerMsg.ADD_LINKER);
ClientMgr.send(reqMsg);
}
if (!(target instanceof Terminal)) {
return;
}
// 螺丝拧上拧下
Node parent = (Node) target.getModel();
// findCylinder(parent);
final Spatial luosi = parent.getChild("screw");
if (luosi == null) {
throw new RuntimeException("螺丝的模型结构有问题, 没有指出螺杆节点");
}
if (luosi.getNumControls() > 0) {
AbstractControl control = (AbstractControl) luosi.getControl(0);
control.setEnabled(true);
}
}
use of com.cas.circuit.vo.Terminal in project TeachingInSimulation by ScOrPiOzzy.
the class CircuitState method detachFromCircuit.
public boolean detachFromCircuit(ElecCompDef elecCompDef) {
// 0、判断元器件连接头是否接线
for (Terminal terminal : elecCompDef.getTerminalList()) {
if (terminal.getWires().size() > 0) {
return false;
}
}
for (Jack jack : elecCompDef.getJackList()) {
if (jack.getCable() != null) {
return false;
}
}
if (ElecComp.COMBINE_BUTTOM == elecCompDef.getElecComp().getCombine()) {
if (!StringUtils.isEmpty(combineMap.get(elecCompDef.getProxy().getUuid()))) {
return false;
}
}
// 1、移除元器件模型
detachElecComp(elecCompDef);
// 2、从元器件列表中移除
compList.remove(elecCompDef);
return true;
}
use of com.cas.circuit.vo.Terminal 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.vo.Terminal 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();
}
}
use of com.cas.circuit.vo.Terminal in project TeachingInSimulation by ScOrPiOzzy.
the class R method collectResisIsopotentialTerminal.
/**
* DING找出从此端子开始联系到的所有端子,包括有电阻的(电压测量法)
* @param ref
* @param isopotential
* @param r
*/
private void collectResisIsopotentialTerminal(Terminal ref, IP isopotential) {
if (!isopotential.hasTerminal(ref)) {
isopotential.addTerminal(ref);
}
// 遍历所有和ref关联的导线
List<Terminal> wireAnotherTerms = new ArrayList<Terminal>();
// List<ILinker> toRemove = new ArrayList<ILinker>();
for (Wire wire : ref.getWires()) {
if (!wire.isBothBinded()) {
// toRemove.add(linker);
continue;
}
if (isopotential.getPassedWires().contains(wire) || wire.isBrokenBreak()) {
continue;
}
isopotential.getPassedWires().add(wire);
Terminal anotherTerm = wire.getAnother(ref);
wireAnotherTerms.add(anotherTerm);
collectResisIsopotentialTerminal(anotherTerm, isopotential);
}
// FIXME 删除只接了一个连接头的导线????
// wires.removeAll(toRemove);
// 获取线缆中与ref关联的连接头
Terminal contacted = ref.getContacted();
if (contacted != null && !isopotential.getPassedContacted().contains(contacted)) {
isopotential.getPassedContacted().add(contacted);
collectResisIsopotentialTerminal(contacted, isopotential);
}
// 遍历和ref有电阻关系的电阻
Map<Terminal, ResisRelation> resisRelationMap = ref.getResisRelationMap();
// System.out.println(str + resisRelationMap);
Iterator<Entry<Terminal, ResisRelation>> iter = resisRelationMap.entrySet().iterator();
Terminal key_Terminal = null;
// ResisRelation resisRelation = null;
while (iter.hasNext()) {
Map.Entry<Terminal, ResisRelation> entry = iter.next();
key_Terminal = entry.getKey();
if (!isopotential.getPassedResis().contains(key_Terminal)) {
isopotential.getPassedResis().add(key_Terminal);
// 阻值为零,则以ref对应的连接头递归处理 或 此电阻被短接了
collectResisIsopotentialTerminal(key_Terminal, isopotential);
}
}
}
Aggregations