Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
EvenSol committed Dec 10, 2023
1 parent ab8484c commit 9016f5d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public CompressorMonitor(Compressor compressor) {
*/
public CompressorMonitor(String name, Compressor compressor) {
super(name, "rpm");
this.compressor = compressor;
}

/** {@inheritDoc} */
Expand All @@ -47,6 +48,10 @@ public void displayResult() {
/** {@inheritDoc} */
@Override
public double getMeasuredValue(String unit) {
return compressor.getSpeed();
if (unit.equals("distance to surge")) {
return compressor.getDistanceToSurge();
} else {
return compressor.getSpeed();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,12 @@ public boolean isSurge(double flow, double head) {
return getAntiSurge().isSurge();
}

public double getDistanceToSurge() {
return (getInletStream().getFlowRate("m3/hr")
- getCompressorChart().getSurgeCurve().getSurgeFlow(getPolytropicFluidHead()))
/ getCompressorChart().getSurgeCurve().getSurgeFlow(getPolytropicFluidHead());
}

/**
* <p>
* isStoneWall.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,6 @@ public interface CompressorInterface extends ProcessEquipmentInterface, TwoPortI
* @return a {@link neqsim.processSimulation.processEquipment.compressor.AntiSurge} object
*/
public AntiSurge getAntiSurge();

public double getDistanceToSurge();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import neqsim.processSimulation.SimulationInterface;
import neqsim.processSimulation.controllerDevice.ControllerDeviceBaseClass;
import neqsim.processSimulation.controllerDevice.ControllerDeviceInterface;
import neqsim.processSimulation.measurementDevice.CompressorMonitor;
import neqsim.processSimulation.measurementDevice.LevelTransmitter;
import neqsim.processSimulation.measurementDevice.PressureTransmitter;
import neqsim.processSimulation.measurementDevice.VolumeFlowTransmitter;
Expand Down Expand Up @@ -585,6 +586,8 @@ public void testAntiSurgeControl() {
compressor1.setCalculateSteadyState(false);
compressor1.setOutletPressure(100.0);

CompressorMonitor surgemonitor = new CompressorMonitor(compressor1);

Separator separator2 = new Separator("separator_2");
separator2.addStream(compressor1.getOutletStream());
separator2.setCalculateSteadyState(false);
Expand All @@ -595,12 +598,14 @@ public void testAntiSurgeControl() {
Stream gasfromsep2 = new Stream("gas from sep", separator2.getGasOutStream());

Splitter splitter = new Splitter("splitter1", gasfromsep2);
splitter.setSplitFactors(new double[] {1.0, 0.0});
splitter.setFlowRates(new double[] {-1, 1.0}, "kg/hr");

ThrottlingValve resycleValve =
new ThrottlingValve("anti surge valve", splitter.getSplitStream(1));
resycleValve.setPressure(47.0);



SetPoint pressureset =
new SetPoint("HP pump set", resycleValve, "pressure", separator1.getGasOutStream());

Expand All @@ -616,7 +621,6 @@ public void testAntiSurgeControl() {
PressureTransmitter separatorPressureTransmitter =
new PressureTransmitter(separator2.getGasOutStream());


ControllerDeviceInterface speedController = new ControllerDeviceBaseClass();
speedController.setReverseActing(true);
speedController.setTransmitter(separatorPressureTransmitter);
Expand All @@ -628,6 +632,7 @@ public void testAntiSurgeControl() {
p.add(valve1);
p.add(separator1);
p.add(compressor1);
p.add(surgemonitor);
p.add(separator2);
p.add(gasfromsep2);
p.add(splitter);
Expand Down Expand Up @@ -661,7 +666,7 @@ public void testAntiSurgeControl() {
System.out.println("speed " + compressor1.getSpeed());
p.setTimeStep(10.0);


valve2.setPercentValveOpening(5);
for (int i = 0; i < 100; i++) {
System.out.println("time " + i + " speed " + compressor1.getSpeed() + "feed flow "
+ stream1.getFlowRate("kg/hr") + " compressor flow rate "
Expand All @@ -670,7 +675,8 @@ public void testAntiSurgeControl() {
+ (compressor1.getOutletStream().getPressure()
- compressor1.getInletStream().getPressure())
+ " pres inn " + compressor1.getInletStream().getPressure() + " pres out "
+ compressor1.getOutletStream().getPressure());
+ compressor1.getOutletStream().getPressure() + " distancetosurge "
+ surgemonitor.getMeasuredValue("distance to surge"));
p.runTransient();
}

Expand Down

0 comments on commit 9016f5d

Please sign in to comment.