+ *
+ * In this method, only Bus and Branch objected are "moved" from the parent network to
+ * the SubNetwork. It should be override in the subclass if more objects need to be "moved".
+ *
+ * @param parentNet
+ */
+ public void buildSubNet(TNet parentNet, int subNetFlag) throws InterpssException {
+ //System.out.println("Build SubNetwork for " + this.getFlag());
+
+ this.subNet = createSubNetwork(subNetFlag);
+
+ for (TBus bus : parentNet.getBusList()) {
+ if (bus.getSubAreaFlag() == this.getFlag()) {
+ this.subNet.addBus(bus);
+ }
+ };
+
+ for ( TBranch branch : parentNet.getBranchList()) {
+ if (branch.getFromBus().getSubAreaFlag() == this.getFlag() &&
+ branch.getToBus().getSubAreaFlag() == this.getFlag()) {
+ this.subNet.addBranch(branch);
+ }
+ };
+ }
+
+ /**
+ * create the sub-network object
+ *
+ * @return the sub-network object
+ */
+ public abstract TNet createSubNetwork(int subNetFlag);
+
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append(super.toString() + "\n");
+ this.subNet.getBusList().forEach(bus -> {
+ buf.append("Bus: " + bus.getId() + "\n");
+ });
+ this.subNet.getBranchList().forEach(branch -> {
+ buf.append("Branch: " + branch.getId() + "\n");
+ });
+ return buf.toString();
+ }
+}
diff --git a/ipss.extendedPiecewiseAlgo/src/org/interpss/piecewise/subAreaNet/impl/BaseSubAreaNetProcessorImpl.java b/ipss.extendedPiecewiseAlgo/src/org/interpss/piecewise/subAreaNet/impl/BaseSubAreaNetProcessorImpl.java
new file mode 100644
index 000000000..564f91086
--- /dev/null
+++ b/ipss.extendedPiecewiseAlgo/src/org/interpss/piecewise/subAreaNet/impl/BaseSubAreaNetProcessorImpl.java
@@ -0,0 +1,474 @@
+ /*
+ * @(#)BaseSubAreaNetProcessorImpl.java
+ *
+ * Copyright (C) 2006-2016 www.interpss.org
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * @Author Mike Zhou
+ * @Version 1.0
+ * @Date 04/15/2016
+ *
+ * Revision History
+ * ================
+ *
+ */
+
+package org.interpss.piecewise.subAreaNet.impl;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+
+import org.interpss.piecewise.subAreaNet.SubAreaNetProcessor;
+import org.interpss.piecewise.subAreaNet.base.BaseCuttingBranch;
+import org.interpss.piecewise.subAreaNet.base.BaseSubArea;
+
+import com.interpss.common.exp.InterpssException;
+import com.interpss.common.util.IpssLogger;
+import com.interpss.core.net.Branch;
+import com.interpss.core.net.Bus;
+import com.interpss.core.net.Network;
+import com.interpss.core.net.BranchBusSide;
+
+/**
+ * Base Class for SubArea processing. It begins by defining a set of cutting branches.
+ * It finds SubAreas in the network and SubArea interface buses.
+ *
+ * @author Mike
+ *
+ */
+
+public abstract class BaseSubAreaNetProcessorImpl<
+ TBus extends Bus,
+ TBra extends Branch,
+ TSub extends BaseSubArea, ?, TState>,
+ TState> implements SubAreaNetProcessor