本文整理了Java中com.powsybl.iidm.network.Terminal.isConnected()
方法的一些代码示例,展示了Terminal.isConnected()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Terminal.isConnected()
方法的具体详情如下:
包路径:com.powsybl.iidm.network.Terminal
类名称:Terminal
方法名:isConnected
[英]Test if the terminal is connected.
[中]测试端子是否已连接。
代码示例来源:origin: com.powsybl/powsybl-iidm-api
private static double getTheta(LegBase<?> leg) {
return leg.getTerminal().isConnected() ? Math.toRadians(leg.getTerminal().getBusView().getBus().getAngle())
: Double.NaN;
}
代码示例来源:origin: itesla/ipst
@Override
public void dumpDtaFile(Path workingDir, String fileName, Network network, Map<String, Character> parallelIndexes, String eurostagVersion, Map<String, String> iidm2eurostagId, SimulationParameters simulationParameters) {
Objects.requireNonNull(workingDir);
Objects.requireNonNull(fileName);
Objects.requireNonNull(network);
Objects.requireNonNull(parallelIndexes);
Objects.requireNonNull(eurostagVersion);
Objects.requireNonNull(iidm2eurostagId);
LOGGER.info("exporting dynamic data for network: {}", network.getId());
//uses the first connected generator that is available in the iidm2eurostag map
Generator generator = network.getGeneratorStream()
.filter(gen -> (iidm2eurostagId.containsKey(gen.getId())) && (gen.getTerminal().isConnected()))
.findFirst()
.orElseThrow(() -> new RuntimeException("could not find a suitable generator in network: " + network + ", to be used in: " + fileName));
Bus bus = generator.getTerminal().getBusBreakerView().getConnectableBus();
if ((bus == null) || (!iidm2eurostagId.containsKey(bus.getId()))) {
bus = generator.getTerminal().getBusView().getConnectableBus();
if ((bus == null) || (!iidm2eurostagId.containsKey(bus.getId()))) {
throw new RuntimeException("suitable node not found");
}
}
DynamicDatabaseMockUtils mockUtils = new DynamicDatabaseMockUtils();
String mappedGenName = mockUtils.formatString8(iidm2eurostagId.get(generator.getId()));
String mappedNodeName = mockUtils.formatString8(iidm2eurostagId.get(bus.getId()));
LOGGER.info("generator: iidm {}, eurostag {}", generator.getId(), mappedGenName);
LOGGER.info("node: iidm {}, eurostag {}", bus.getId(), mappedNodeName);
mockUtils.copyDynamicDataFiles(MINIMAL_DTA_TEMPLATE, workingDir, fileName,
ImmutableMap.of("NODENAME", mappedNodeName, "MINIMALI", mappedGenName),
MOCK_REG_FILES_PREFIXES);
}
代码示例来源:origin: com.powsybl/powsybl-loadflow-results-completion
private void completeTerminalData(Terminal terminal, ThreeWindingsTransformer.Side side, TwtData twtData) {
if (terminal.isConnected() && terminal.getBusView().getBus().isInMainConnectedComponent()) {
if (Double.isNaN(terminal.getP())) {
LOGGER.debug("Twt {}, Side {}: setting p = {}", twtData.getId(), side, twtData.getComputedP(side));
terminal.setP(twtData.getComputedP(side));
}
if (Double.isNaN(terminal.getQ())) {
LOGGER.debug("Twt {}, Side {}: setting q = {}", twtData.getId(), side, twtData.getComputedQ(side));
terminal.setQ(twtData.getComputedQ(side));
}
}
}
代码示例来源:origin: com.powsybl/powsybl-loadflow-results-completion
private void completeTerminalData(Terminal terminal, Side side, BranchData branchData) {
if (terminal.isConnected() && terminal.getBusView().getBus().isInMainConnectedComponent()) {
if (Double.isNaN(terminal.getP())) {
LOGGER.debug("Branch {}, Side {}: setting p = {}", branchData.getId(), side, branchData.getComputedP(side));
terminal.setP(branchData.getComputedP(side));
}
if (Double.isNaN(terminal.getQ())) {
LOGGER.debug("Branch {}, Side {}: setting q = {}", branchData.getId(), side, branchData.getComputedQ(side));
terminal.setQ(branchData.getComputedQ(side));
}
}
}
代码示例来源:origin: com.powsybl/powsybl-iidm-reducer
private static double checkP(Terminal terminal) {
if (!terminal.isConnected()) {
return 0.0;
}
if (Double.isNaN(terminal.getP())) {
String connectableId = terminal.getConnectable().getId();
String voltageLevelId = terminal.getVoltageLevel().getId();
throw new PowsyblException("The active power of '" + connectableId + "' (" + voltageLevelId + ") is not set. Do you forget to compute the flows?");
}
return terminal.getP();
}
代码示例来源:origin: com.powsybl/powsybl-iidm-reducer
private static double checkQ(Terminal terminal) {
if (!terminal.isConnected()) {
return 0.0;
}
if (Double.isNaN(terminal.getQ())) {
String connectableId = terminal.getConnectable().getId();
String voltageLevelId = terminal.getVoltageLevel().getId();
throw new PowsyblException("The reactive power of '" + connectableId + "' (" + voltageLevelId + ") is not set. Do you forget to compute the flows?");
}
return terminal.getQ();
}
}
代码示例来源:origin: com.powsybl/powsybl-iidm-api
private static double getV(LegBase<?> leg) {
return leg.getTerminal().isConnected() ? leg.getTerminal().getBusView().getBus().getV() : Double.NaN;
}
代码示例来源:origin: com.powsybl/powsybl-action-util
@Override
public double scale(Network n, double asked) {
Objects.requireNonNull(n);
Generator g = n.getGenerator(id);
double done = 0;
if (g != null) {
Terminal t = g.getTerminal();
if (!t.isConnected()) {
connectGenerator(g);
}
done = Math.min(asked, g.getMaxP() - g.getTargetP());
double oldTargetP = g.getTargetP();
g.setTargetP(g.getTargetP() + done);
LOGGER.info("Change active power setpoint of {} from {} to {} (pmax={})",
g.getId(), oldTargetP, g.getTargetP(), g.getMaxP());
} else {
LOGGER.warn("Generator {} not found", id);
}
return done;
}
代码示例来源:origin: itesla/ipst
public LineRecord(Line line, double snref) {
super(line);
this.line = line;
boolean isSendingOpen = line.getTerminal1().isConnected() ? true : false;
boolean isReceivingOpen = line.getTerminal2().isConnected() ? true : false;
if (!isSendingOpen && isReceivingOpen) { //Opening Sending
super.setDEFAULT_BRANCH_TYPE(DEFAULT_OPEN_LINE_TYPE);
super.addParameter(this.iidmbranchParameters, EurostagFixedData.OPENR, false);
} else if (isSendingOpen && !isReceivingOpen) { //Opening receiving
super.setDEFAULT_BRANCH_TYPE(DEFAULT_OPEN_LINE_TYPE);
super.addParameter(this.iidmbranchParameters, EurostagFixedData.OPENR, true);
} else {
super.setDEFAULT_BRANCH_TYPE(DEFAULT_LINE_TYPE);
}
super.setDEFAULT_BRANCH_PREFIX(StaticData.PREF_LINE);
this.setParameters(snref);
}
代码示例来源:origin: com.powsybl/powsybl-iidm-api
Mockito.when(leg1Terminal.isConnected()).thenReturn(CONNECTED1);
Mockito.when(leg1Terminal.getP()).thenReturn(P1);
Mockito.when(leg1Terminal.getQ()).thenReturn(Q1);
Mockito.when(leg2Terminal.isConnected()).thenReturn(CONNECTED2);
Mockito.when(leg2Terminal.getP()).thenReturn(P2);
Mockito.when(leg2Terminal.getQ()).thenReturn(Q2);
Mockito.when(leg3Terminal.isConnected()).thenReturn(CONNECTED3);
Mockito.when(leg3Terminal.getP()).thenReturn(P3);
Mockito.when(leg3Terminal.getQ()).thenReturn(Q3);
代码示例来源:origin: itesla/ipst
private boolean removeSwitchandBus(VoltageLevel vl, Switch s, Bus toRemove, Bus toKeep) {
List<Terminal> terminals = getTerminals(toRemove);
if (terminals.size() <= 1) {
terminals.forEach(t -> {
boolean reconnect = false;
if (t.isConnected()) {
t.disconnect();
reconnect = true;
}
t.getBusBreakerView().setConnectableBus(toKeep.getId());
if (!s.isOpen() && reconnect) {
t.connect();
}
});
vl.getBusBreakerView().removeSwitch(s.getId());
vl.getBusBreakerView().removeBus(toRemove.getId());
return true;
}
return false;
}
代码示例来源:origin: com.powsybl/powsybl-iidm-reducer
private static void fillNodeOrBus(InjectionAdder adder, Terminal terminal) {
if (terminal.getVoltageLevel().getTopologyKind() == TopologyKind.NODE_BREAKER) {
adder.setNode(terminal.getNodeBreakerView().getNode());
} else {
if (terminal.isConnected()) {
adder.setBus(terminal.getBusBreakerView().getBus().getId());
}
adder.setConnectableBus(terminal.getBusBreakerView().getConnectableBus().getId());
}
}
代码示例来源:origin: itesla/ipst
LOGGER.trace("Removing step up transformer '{}' of generator '{}'", twt.getId(), lvGen.getId());
boolean connected = twt.getTerminal1().isConnected() && twt.getTerminal2().isConnected() && lvGen.getTerminal().isConnected();
代码示例来源:origin: com.powsybl/powsybl-loadflow-results-completion
if (terminal.isConnected()
&& Double.isNaN(terminal.getQ())
&& terminal.getBusView().getBus().isInMainConnectedComponent()) {
代码示例来源:origin: itesla/ipst
if (l.getTerminal().getVoltageLevel().getNominalV() <= 100 && l.getTerminal().isConnected()) { // connected HV load
if (l.getLoadType() != LoadType.AUXILIARY) {
dumpDataLoadAutomaton(l, eurostagSim, "A14_MT", dtaOutStream, iidm2eurostagId);
代码示例来源:origin: com.powsybl/powsybl-iidm-api
ratedU3 = twt.getLeg3().getRatedU();
connected1 = twt.getLeg1().getTerminal().isConnected();
connected2 = twt.getLeg2().getTerminal().isConnected();
connected3 = twt.getLeg3().getTerminal().isConnected();
mainComponent1 = isMainComponent(twt.getLeg1());
mainComponent2 = isMainComponent(twt.getLeg2());
内容来源于网络,如有侵权,请联系作者删除!