@Override public NetTracerRow[] getRootRows() { if (model == null) return new NetTracerVSourceRow[] {}; if (rows == null || modelDirty) { ArrayList<VoltageSource> ports = new ArrayList<VoltageSource>(PMFindVDomainTools.findVoltageSources(pmConfig)); ports.addAll(PMFindVDomainTools.findPowerSourcePins(pmConfig)); ArrayList<NetTracerRow> rows = new ArrayList<NetTracerRow>(); for (VoltageSource port : ports) { // TODO // if ( !((PowerSourceDB)port).isDerived() ) { // // search the source pin inside the power network // srcPin = DBNodeTools.getPortDBNode(model, true, port.getPinName()); // rows.add(new NetTracerVSourceRow(this, null, port)); // } } this.rows = rows.toArray(new NetTracerRow[rows.size()]); } return this.rows; }
public WritableList getObservedVsrcWritable() { if (observedVsrcWritable == null) { observedVsrcWritable = new WritableList(observedVsrc, VoltageSource.class); initPinListListener(); observedVsrcWritable.addAll(PMFindVDomainTools.findAllVoltageSources(pmConfig)); } return observedVsrcWritable; }
public Object execute(List<String> argList) throws TclShellException { JSAPResult argv = parse(argList); if (argv == null) { return false; } if (argv.getBoolean(SmOptionPM.LIST_ATTR_OPTION)) { for (PWR_SRC_ATTR e : PWR_SRC_ATTR.values()) System.out.println( " => " + e.arg + " :\n " + e.help + (e.allowed == null ? "" : " = " + StringUtilities.join(", ", e.allowed) + ")")); return true; } String modelID = argv.getString(SmOption.MODEL_OPTION); ModelDB model = (modelID != null) ? ToolsDesign.getModel(modelID) : UnwCore.getDBProject().model(); if (model == null) { Logger.error(ErrorList.DB3.errorName(), ErrorList.DB3.getMessage(modelID)); throw new TclShellException(""); } PMConfig cfg = PMResourceManager.instance.getPmconfig(model, null); String pwrsrcName = argv.getString(SmOptionPM.PWRSRC_OPTION); PowerSourceInstance powerSource = PMFindVDomainTools.findPowerSource(cfg, pwrsrcName); if (powerSource == null) { Logger.error( ErrorListPM.PM22.errorName(), ErrorListPM.PM22.getMessage(pwrsrcName + "in model " + model.getModelName())); throw new TclShellException(""); } if (!argv.contains(SmOption.NAME_VALUE_OPTION)) { Logger.error("TCL", "no attribute specified"); throw new TclShellException(""); } String[] tokens = argv.getStringArray(SmOption.NAME_VALUE_OPTION); if (tokens.length % 2 != 0) { Logger.error(ErrorListPM.PM_TCL1.errorName(), ErrorListPM.PM_TCL1.getMessage()); throw new TclShellException(""); } String attrName; String attrValue; boolean error = false; for (int i = 0; i < tokens.length; i += 2) { attrName = tokens[i]; attrValue = tokens[i + 1]; PWR_SRC_ATTR id = PWR_SRC_ATTR.findAttr(attrName); if (id == null) { Logger.error(ErrorListPM.PM_TCL3.errorName(), ErrorListPM.PM_TCL3.getMessage(attrName)); throw new TclShellException(""); } else { CONNECT_DIRECTIVE direct = null; switch (id) { case CONNECT_IVOLT: try { direct = CONNECT_DIRECTIVE.valueOf(attrValue); powerSource.setConnectInputVoltage(direct); } catch (Exception e) { error = true; } break; case CONNECT_CTRL: try { direct = CONNECT_DIRECTIVE.valueOf(attrValue); powerSource.setConnectControl(direct); } catch (Exception e) { error = true; } break; case NAME: if (FormatValidation.isAlphaNumeric(attrValue, false)) { powerSource.setName(attrValue); } else error = true; default: break; } if (error) { Logger.error( ErrorListPM.PM_TCL2.errorName(), ErrorListPM.PM_TCL2.getMessage(attrValue + " for attribute " + attrName)); throw new TclShellException(""); } } } return true; }