Skip to content

Commit

Permalink
update mechanical design simulations (#788)
Browse files Browse the repository at this point in the history
* update mechanical design simulations

* updated test

* simplify object structure of prosess design and cost

* update doc

* fix bug

* update
  • Loading branch information
EvenSol authored Jul 27, 2023
1 parent 4ed7da5 commit 2c851bd
Show file tree
Hide file tree
Showing 18 changed files with 376 additions and 137 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import java.util.Objects;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import neqsim.processSimulation.mechanicalDesign.SystemMechanicalDesign;
import neqsim.processSimulation.processEquipment.ProcessEquipmentInterface;
import neqsim.processSimulation.processSystem.ProcessSystem;

/**
* <p>
Expand All @@ -19,28 +19,31 @@ public class CostEstimateBaseClass implements java.io.Serializable {
private static final long serialVersionUID = 1000;
static Logger logger = LogManager.getLogger(CostEstimateBaseClass.class);

private ProcessSystem processSystem;
private SystemMechanicalDesign processdesign;
private double CAPEXperWeight = 1000.0; // KNOK/tones

/**
* <p>
* Constructor for CostEstimateBaseClass.
* </p>
*
* @param process a {@link neqsim.processSimulation.processSystem.ProcessSystem} object
* @param processdesign a {@link neqsim.processSimulation.mechanicalDesign.SystemMechanicalDesign}
* object
*/
public CostEstimateBaseClass(ProcessSystem process) {
this.processSystem = process;
public CostEstimateBaseClass(SystemMechanicalDesign processdesign) {
this.processdesign = processdesign;
}

/**
* <p>Constructor for CostEstimateBaseClass.</p>
* <p>
* Constructor for CostEstimateBaseClass.
* </p>
*
* @param process input process
* @param processdesign a {@link neqsim.processSimulation.mechanicalDesign.SystemMechanicalDesign}
* @param costFactor cost factor
*/
public CostEstimateBaseClass(ProcessSystem process, double costFactor) {
this(process);
public CostEstimateBaseClass(SystemMechanicalDesign processdesign, double costFactor) {
this(processdesign);
this.CAPEXperWeight = costFactor;
}

Expand All @@ -52,7 +55,7 @@ public CostEstimateBaseClass(ProcessSystem process, double costFactor) {
* @return a double
*/
public double getWeightBasedCAPEXEstimate() {
return this.processSystem.getSystemMechanicalDesign().getTotalWeight() * CAPEXperWeight;
return this.processdesign.getTotalWeight() * CAPEXperWeight;
}

/**
Expand All @@ -64,12 +67,14 @@ public double getWeightBasedCAPEXEstimate() {
*/
public double getCAPEXestimate() {
double cost = 0;
ArrayList<String> names = this.processSystem.getAllUnitNames();
ArrayList<String> names = processdesign.getProcess().getAllUnitNames();
for (int i = 0; i < names.size(); i++) {
try {
if (!((ProcessEquipmentInterface) this.processSystem.getUnit(names.get(i)) == null)) {
cost += ((ProcessEquipmentInterface) this.processSystem.getUnit(names.get(i)))
.getMechanicalDesign().getCostEstimate().getTotaltCost();
if (!((ProcessEquipmentInterface) this.processdesign.getProcess()
.getUnit(names.get(i)) == null)) {
cost +=
((ProcessEquipmentInterface) this.processdesign.getProcess().getUnit(names.get(i)))
.getMechanicalDesign().getCostEstimate().getTotaltCost();
}
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public SystemMechanicalDesign(ProcessSystem processSystem) {
this.processSystem = processSystem;
}

public ProcessSystem getProcess() {
return processSystem;
}

/**
* <p>
* setCompanySpecificDesignStandards.
Expand All @@ -45,7 +49,7 @@ public SystemMechanicalDesign(ProcessSystem processSystem) {
*/
public void setCompanySpecificDesignStandards(String name) {
for (int i = 0; i < this.processSystem.getUnitOperations().size(); i++) {
this.processSystem.getUnitOperations().get(i).getMechanicalDesign()
this.getProcess().getUnitOperations().get(i).getMechanicalDesign()
.setCompanySpecificDesignStandards(name);
}
}
Expand All @@ -60,6 +64,8 @@ public void runDesignCalculation() {
for (int i = 0; i < names.size(); i++) {
try {
if (!((ProcessEquipmentInterface) this.processSystem.getUnit(names.get(i)) == null)) {
((ProcessEquipmentInterface) this.processSystem.getUnit(names.get(i)))
.initMechanicalDesign();
((ProcessEquipmentInterface) this.processSystem.getUnit(names.get(i)))
.getMechanicalDesign().calcDesign();
totalPlotSpace += ((ProcessEquipmentInterface) this.processSystem.getUnit(names.get(i)))
Expand Down Expand Up @@ -133,6 +139,25 @@ public int getTotalNumberOfModules() {
return numberOfModules;
}

/**
* <p>
* getMechanicalWeight.
* </p>
*
* @param unit a {@link java.lang.String} object
* @return a double
*/
public double getMechanicalWeight(String unit) {
double weight = 0.0;
for (int i = 0; i < processSystem.getUnitOperations().size(); i++) {
processSystem.getUnitOperations().get(i).getMechanicalDesign().calcDesign();
System.out.println("Name " + processSystem.getUnitOperations().get(i).getName() + " weight "
+ processSystem.getUnitOperations().get(i).getMechanicalDesign().getWeightTotal());
weight += processSystem.getUnitOperations().get(i).getMechanicalDesign().getWeightTotal();
}
return weight;
}

/** {@inheritDoc} */
@Override
public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,11 @@ public void calcDesign() {

// ASME/ANSI Code B31.8
if (designStandardCode.equals("ANSI/ASME Standard B31.8")) {
wallThickness = ((AdiabaticPipe) getProcessEquipment()).getMechanicalDesign()
.getMaxOperationPressure() * innerDiameter
/ (2.0
* ((AdiabaticPipe) getProcessEquipment()).getMechanicalDesign()
.getMaterialPipeDesignStandard().getDesignFactor()
* ((AdiabaticPipe) getProcessEquipment()).getMechanicalDesign()
.getMaterialPipeDesignStandard().getEfactor()
* ((AdiabaticPipe) getProcessEquipment()).getMechanicalDesign()
.getMaterialPipeDesignStandard().getTemperatureDeratingFactor()
* ((AdiabaticPipe) getProcessEquipment()).getMechanicalDesign()
.getMaterialPipeDesignStandard().getMinimumYeildStrength());
wallThickness = getMaxOperationPressure() * innerDiameter
/ (2.0 * getMaterialPipeDesignStandard().getDesignFactor()
* getMaterialPipeDesignStandard().getEfactor()
* getMaterialPipeDesignStandard().getTemperatureDeratingFactor()
* getMaterialPipeDesignStandard().getMinimumYeildStrength());
} else if (designStandardCode.equals("ANSI/ASME Standard B31.3")) {
wallThickness = 0.0001; // to be implemented
// ((AdiabaticPipe)
Expand Down Expand Up @@ -128,9 +122,9 @@ public static void main(String args[]) {
operations.add(stream_1);
operations.add(pipe);

operations.getSystemMechanicalDesign().setCompanySpecificDesignStandards("Statoil");
operations.getSystemMechanicalDesign().runDesignCalculation();
operations.getSystemMechanicalDesign().setDesign();
// operations.getSystemMechanicalDesign().setCompanySpecificDesignStandards("Statoil");
// operations.getSystemMechanicalDesign().runDesignCalculation();
// operations.getSystemMechanicalDesign().setDesign();
operations.run();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public void calcDesign() {
valveCvMax = valve1.getThermoSystem().getVolume("m3/hr")
* Math.sqrt(valve1.getThermoSystem().getDensity("kg/m3") / 1000.0 / dP);
valveWeight = valveCvMax * 100.0;
setWeightTotal(valveWeight);
}

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ public MechanicalDesign getMechanicalDesign() {
return new MechanicalDesign(this);
}

/** {@inheritDoc} */
@Override
public void initMechanicalDesign() {}

/** {@inheritDoc} */
@Override
public String getSpecification() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ public interface ProcessEquipmentInterface extends SimulationInterface {
*/
public String[][] reportResults();

/**
* <p>
* Get a <code>initMechanicalDesign</code> for the equipment.
* </p>
**/
default void initMechanicalDesign() {

}

/**
* <p>
* Get a <code>mechanicalDesign</code> for the equipment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,8 @@ public void displayResult() {
* <p>
* component componentMassBalanceCheck.
* </p>
*
*
* @param componentName component name to heck mass balance for
* @return a boolean
*/
public boolean componentMassBalanceCheck(String componentName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public Manifold() {
* <p>
* Constructor for Splitter with name as input.
* </p>
*
* @param name name of manifold
*/
public Manifold(String name) {
super(name);
Expand Down Expand Up @@ -72,7 +74,8 @@ public StreamInterface getSplitStream(int i) {
* <p>
* getMixedStream.
* </p>
*
*
* @return a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface}
**/
public StreamInterface getMixedStream() {
return localmixer.getOutletStream();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public class Pipeline extends TwoPortEquipment implements PipeLineInterface {
double[] outerHeatTransferCoeffs = {1e-5, 1e-5}; // , 1e-5, 1e-5, 1e-5};
double[] wallHeatTransferCoeffs = {1e-5, 1e-5}; // , 1e-5, 1e-5, 1e-5};

PipelineMechanicalDesign pipelineMechanicalDesign = null;

/**
* <p>
* Constructor for Pipeline.
Expand Down Expand Up @@ -93,6 +95,12 @@ public Pipeline(String name, StreamInterface inStream) {
super(name, inStream);
}

@Override
public void initMechanicalDesign() {
pipelineMechanicalDesign = new PipelineMechanicalDesign(this);
}


/**
* {@inheritDoc}
*
Expand All @@ -101,7 +109,7 @@ public Pipeline(String name, StreamInterface inStream) {
*/
@Override
public PipelineMechanicalDesign getMechanicalDesign() {
return new PipelineMechanicalDesign(this);
return pipelineMechanicalDesign;
}

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public class Separator extends ProcessEquipmentBaseClass implements SeparatorInt
private double designLiquidLevelFraction = 0.8;
ArrayList<SeparatorSection> separatorSection = new ArrayList<SeparatorSection>();

SeparatorMechanicalDesign separatorMechanicalDesign;

/**
* Constructor for Separator.
*/
Expand Down Expand Up @@ -118,7 +120,12 @@ public Separator(String name, StreamInterface inletStream) {
*/
@Override
public SeparatorMechanicalDesign getMechanicalDesign() {
return new SeparatorMechanicalDesign(this);
return separatorMechanicalDesign;
}

@Override
public void initMechanicalDesign() {
separatorMechanicalDesign = new SeparatorMechanicalDesign(this);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package neqsim.processSimulation.processEquipment.valve;

import java.util.UUID;
import neqsim.processSimulation.mechanicalDesign.valve.ValveMechanicalDesign;
import neqsim.processSimulation.processEquipment.TwoPortEquipment;
import neqsim.processSimulation.processEquipment.stream.StreamInterface;
import neqsim.thermo.system.SystemInterface;
Expand Down Expand Up @@ -31,6 +32,7 @@ public class ThrottlingValve extends TwoPortEquipment implements ValveInterface
double molarFlow = 0.0;
private String pressureUnit = "bara";
private boolean acceptNegativeDP = true;
ValveMechanicalDesign valveMechanicalDesign;

/**
* <p>
Expand Down Expand Up @@ -430,4 +432,20 @@ public boolean isAcceptNegativeDP() {
public void setAcceptNegativeDP(boolean acceptNegativeDP) {
this.acceptNegativeDP = acceptNegativeDP;
}

@Override
public void initMechanicalDesign() {
valveMechanicalDesign = new ValveMechanicalDesign(this);
}


/**
* {@inheritDoc}
*
* @return a {@link neqsim.processSimulation.mechanicalDesign.valve.ValveMechanicalDesign} object
*/
@Override
public ValveMechanicalDesign getMechanicalDesign() {
return valveMechanicalDesign;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
import org.apache.logging.log4j.Logger;
import neqsim.processSimulation.SimulationBaseClass;
import neqsim.processSimulation.conditionMonitor.ConditionMonitor;
import neqsim.processSimulation.costEstimation.CostEstimateBaseClass;
import neqsim.processSimulation.measurementDevice.MeasurementDeviceInterface;
import neqsim.processSimulation.mechanicalDesign.SystemMechanicalDesign;
import neqsim.processSimulation.processEquipment.ProcessEquipmentBaseClass;
import neqsim.processSimulation.processEquipment.ProcessEquipmentInterface;
import neqsim.processSimulation.processEquipment.util.Recycle;
Expand Down Expand Up @@ -714,28 +712,6 @@ public void setName(String name) {
this.name = name;
}

/**
* <p>
* Get a SystemMechanicalDesign object from processSystem.
* </p>
*
* @return a new SystemMechanicalDesign object
*/
public SystemMechanicalDesign getSystemMechanicalDesign() {
return new SystemMechanicalDesign(this);
}

/**
* <p>
* Get a CostEstimateBaseClass object from processSystem.
* </p>
*
* @return a new CostEstimateBaseClass object
*/
public CostEstimateBaseClass getCostEstimator() {
return new CostEstimateBaseClass(this);
}

/**
* <p>
* getEntropyProduction.
Expand Down Expand Up @@ -840,25 +816,6 @@ public double getHeaterDuty(String unit) {
return heat;
}

/**
* <p>
* getMechanicalWeight.
* </p>
*
* @param unit a {@link java.lang.String} object
* @return a double
*/
public double getMechanicalWeight(String unit) {
double weight = 0.0;
for (int i = 0; i < unitOperations.size(); i++) {
unitOperations.get(i).getMechanicalDesign().calcDesign();
System.out.println("Name " + unitOperations.get(i).getName() + " weight "
+ unitOperations.get(i).getMechanicalDesign().getWeightTotal());
weight += unitOperations.get(i).getMechanicalDesign().getWeightTotal();
}
return weight;
}

/**
* <p>
* Getter for the field <code>surroundingTemperature</code>.
Expand Down
Loading

0 comments on commit 2c851bd

Please sign in to comment.