use of com.cas.circuit.vo.ResisRelation in project TeachingInSimulation by ScOrPiOzzy.
the class Encoder method onTargetStart.
public void onTargetStart() {
// System.out.println("Encoder.onTargetStart()");
R.SERVICE.execute(() -> {
// 设置abz与0v接通
ResisRelation resis = new ResisRelation(_0v, _A, 0f, true);
_A.getResisRelationMap().put(_0v, resis);
_0v.getResisRelationMap().put(_A, resis);
resis.setActivated(true);
resis = new ResisRelation(_0v, _B, 0f, true);
_B.getResisRelationMap().put(_0v, resis);
_0v.getResisRelationMap().put(_B, resis);
resis.setActivated(true);
Set<String> envs = _0v.getResidualVolt().keySet();
R r = null;
for (String env : envs) {
r = R.getR(env);
r.getVoltage().putData("PulsePerMillis", String.valueOf(degPerMillis / degPerPulse));
r.getVoltage().putData("PulseDir", String.valueOf(dir));
r.shareVoltage();
}
});
}
use of com.cas.circuit.vo.ResisRelation in project TeachingInSimulation by ScOrPiOzzy.
the class R method findAllIsopotential.
public static void findAllIsopotential(Terminal start, R r, boolean stopWhileTermElectricity) {
if (start.hasIsopotential(r.voltage.getEnv())) {
return;
}
if (stopWhileTermElectricity && start.getIsopotential().keySet().size() != 0) {
return;
}
// if (start == endTerminal) {
// System.out.println(str + "R.findAllIsopotential()");
// // return;
// }
IP isop = new IP(r.voltage);
r.isopoList.add(isop);
r.allIsopoList.add(isop);
// 1.收集与start连接头在同一电势位上的所有连接头
// 2.收集与start连接头在同一电势位上的所有是电阻一端的连接头
collectIsopotentialTerminal(start, isop, r);
List<ResisRelation> resisRelations = isop.getResisRelationList();
// }
for (ResisRelation resisRelation : resisRelations) {
findAllIsopotential(resisRelation.getTerm1(), r, false);
findAllIsopotential(resisRelation.getTerm2(), r, false);
}
}
use of com.cas.circuit.vo.ResisRelation in project TeachingInSimulation by ScOrPiOzzy.
the class R method collectIsopotentialTerminal.
public static void collectIsopotentialTerminal(Terminal ref, IP isopotential, R r) {
// }
if (!isopotential.hasTerminal(ref)) {
isopotential.addTerminal(ref);
}
// 遍历所有和ref关联的导线
List<Terminal> wireAnotherTerms = new ArrayList<Terminal>();
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);
if (anotherTerm != null) {
// System.out.println(str + "R.collectIsopotentialTerminal ()" + wire);
wireAnotherTerms.add(anotherTerm);
collectIsopotentialTerminal(anotherTerm, isopotential, r);
}
}
// FIXME 删除只接了一个连接头的导线????
// wires.removeAll(toRemove);
// 获取线缆中与ref关联的连接头
Terminal contacted = ref.getContacted();
if (contacted != null && !isopotential.getPassedContacted().contains(contacted)) {
isopotential.getPassedContacted().add(contacted);
collectIsopotentialTerminal(contacted, isopotential, r);
}
// 遍历和ref有电阻关系的电阻
Map<Terminal, ResisRelation> resisRelationMap = ref.getResisRelationMap();
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();
resisRelation = entry.getValue();
if (!isopotential.getPassedResis().contains(key_Terminal)) {
isopotential.getPassedResis().add(key_Terminal);
if (resisRelation.getValue() == 0 || wireAnotherTerms.contains(key_Terminal)) {
// 阻值为零,则以ref对应的连接头递归处理 或 此电阻被短接了
collectIsopotentialTerminal(key_Terminal, isopotential, r);
} else {
isopotential.getResisRelationList().add(resisRelation);
if (r != null) {
// 遇到连接头是电阻的一端的,先创建出一个复合电阻对象
if (r.resisRelationWithCR.get(resisRelation) != null) {
CR cr = r.resisRelationWithCR.get(resisRelation);
isopotential.getCRList().add(cr);
cr.setIospo2(isopotential);
} else {
CR cr = new CR(r);
// 设置这个复合电阻的所指代的真实电阻
cr.addResisRelation(resisRelation);
isopotential.getCRList().add(cr);
cr.setIospo1(isopotential);
r.resisRelationWithCR.put(resisRelation, cr);
}
}
}
}
}
}
use of com.cas.circuit.vo.ResisRelation in project TeachingInSimulation by ScOrPiOzzy.
the class R method findAllResisIsopotential.
/**
* DING找出从此端子开始联系到的所有端子,包括有电阻的(电压测量法)
* @param start
* @param r
* @param stopWhileTermElectricity
*/
private void findAllResisIsopotential(Terminal start, boolean stopWhileTermElectricity) {
if (start.hasIsopotential(voltage.getEnv())) {
return;
}
if (stopWhileTermElectricity && start.getIsopotential().keySet().size() != 0) {
System.err.println("有电了, stop");
return;
}
IP isop = new IP(voltage);
isopoList.add(isop);
allIsopoList.add(isop);
// 1.收集与start连接头在同一电势位上的所有连接头
// 2.收集与start连接头在同一电势位上的所有是电阻一端的连接头
collectResisIsopotentialTerminal(start, isop);
List<ResisRelation> resisRelations = isop.getResisRelationList();
for (ResisRelation resisRelation : resisRelations) {
findAllResisIsopotential(resisRelation.getTerm1(), false);
findAllResisIsopotential(resisRelation.getTerm2(), false);
}
}
use of com.cas.circuit.vo.ResisRelation in project TeachingInSimulation by ScOrPiOzzy.
the class ServoDrive method initialize.
@Override
public void initialize(Node elecCompMdl) {
super.initialize(elecCompMdl);
rate = MathUtil.parseFloat(elecComp.getProperty("rate"), rate);
controlVoltEnv = "ServoControlVoltage" + hashCode();
encoderEnv = "ServoEncoderVoltage" + hashCode();
_L1C = elecComp.getDef().getTerminal("L1C");
_L2C = elecComp.getDef().getTerminal("L2C");
//
_L1 = elecComp.getDef().getTerminal("L1");
_L2 = elecComp.getDef().getTerminal("L2");
_L3 = elecComp.getDef().getTerminal("L3");
//
_U = elecComp.getDef().getTerminal("U");
_V = elecComp.getDef().getTerminal("V");
_W = elecComp.getDef().getTerminal("W");
Jack x4 = elecComp.getDef().getJackMap().get("X4");
_OPC1 = x4.getStitch().get("1");
_PULS2 = x4.getStitch().get("2");
_OPC2 = x4.getStitch().get("3");
_SIGN2 = x4.getStitch().get("4");
//
_POT = x4.getStitch().get("5");
_NOT = x4.getStitch().get("6");
_SERV_ON = x4.getStitch().get("10");
_COM = x4.getStitch().get("9");
_ALM = x4.getStitch().get("7");
_ALM_ = x4.getStitch().get("11");
resis = new ResisRelation(_ALM, _ALM_, 0f, true);
Jack x6 = elecComp.getDef().getJackMap().get("X6");
_E_24V = x6.getStitch().get("1");
_E_0V = x6.getStitch().get("2");
_E_A_ = x6.getStitch().get("3");
_E_B_ = x6.getStitch().get("4");
_E_Z_ = x6.getStitch().get("5");
}
Aggregations