Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Smart/logical modeling

Status
Not open for further replies.

KatieTX

Civil/Environmental
Mar 14, 2006
34
Does anyone have any tips for keeping your work logical when you are troubleshooting a model? When I am doing this, I'll change something here, change something there, try this, try that. I've tried making lists of what I changed, saving a new version of the model if I make a really big/complicated change (sometimes ending up with many models with cryptic names), etc. While these are better than doing nothing, they are still not ideal. Any ideas?
 
Replies continue below

Recommended for you

I do a lot of modeling, especially looking into files written by someone else and usually see tons of confusing and unnecessary details. I HATE opening up new third party codes. Usually they are totally illogical ant's nests, so I for one appreciate your efforts.

RULE #1: Never model anything that isn't needed to answer the questions you need to answer.

RULE #2: Refer to Rule #1

Rule #3: Copy the model to a Backup Folder. Use and edit a working model in another folder.

Rule #4: Make 1 "change", or change 1 area at a time. Could be any size of change on a number of things, but for example, don't make changes at two pump stations at the same time.

Rule #5: Limit changes to what is convenient to describe at any given time in a text file and keep an updated textual discription of the model current, as you build and add new details. Take snapshots of any overall graphic view of the model your program can give you. In any case, keep an updated graphic model, perhaps using MS Paint, if you have to.

Rule #6: Establish a list of default equipment parameters, that you will use and keep a list of only the equipment that has parameters varying from the default description.

Rule #7: Keep as many parameters as possible in Table Form Valves: Mark Number, Kp, Type, Size, Cv
Pipe: Mark Number, Start Kp, End Kp, diam, wt, material

Rule #8 Develope a generic unitized curve function for Cv's for common valves you use dependent on size only. So you just enter the size and the program or an auxiliary model data file writing program automatically selects the proper Cv value. I use Excel's VBA to take data entered in table form and writes the text data files that my program uses. I have also done that for pumps. I have one function and I vary three parameters and multiply by that pump's shutoff head and get the curve description in data entry format. Then you just need to note those parameters on the updated graphic model.

Rule #9 Keep standard blocks of "assemblies" to use in future models or for "dropping in" at points you leave for later. Start simple with just two pieces of pipe, for example and get the model working. Then write the code for the first pump station and locate that at the beginning of segment 1. When the first pump station is working in the model, copy it to the break point. Do the same for block valve stations, pressure control valve stations, meter stations etc. I keep a large Excel workbook with the most common "stations" each on their own page, with a picture file of the schematic, a table of the equipment parameters and the VBA written textual code the program needs to model that station. When I write a new model, I just copy parts I need from the spreadsheet and paste the code into the new model file. BS1.PCV.PD Booster station #1.pressure control valve.PumpDischarge piping. BS2.PRV.PD, booster station 2.PressureRelief valve.PumpDischarge piping. SP.KRO.BV1 StoragePlant.KerosenePiping.BlockValve#1, SP.DIE.ESD1 StoragePlant.DieselPiping.EmergencyShutdownValve #1.

Rule #10, Develope a standard pipeline data exchange format to use at your company and get all modelers to use it. There was some work presented by PSIG group on that topic. There isn't so much exchange of that kind of information between companies, so it was never heavily adopted for that, but I adopted it anyway and it tends to keep my models in order. You might try something like their idea, or make your own standard format.

Make a convention to use in naming items, 10 in pipe at somewhere in the pipe located with a KP, such as P10K102-1, would be 10" diameter Pipe at mile or kilometer post 102, and that pipe is the first segment after that KP. If you need another different wall thickness in there, use -2. Lots of things you can do like that. You could use code to describe elements that your program uses as well, PR pressure relay, TT temperature transmitter, PT pressure transmitter, BS1 Booster Station (assembly#1). TP, Transient Capable (long dimension) Pipe Element, FP flow pipe (a flow element, no transient consideration needed as its just a pipe a few feet long, so only volume is important, etc.)

You can use the first page of an Excel workbook to index and cross reference cryptic names, and even go to a defined view of that item on another page where VBA writes the code you will use for that item.

It seems to be the general thing these days to model everything to the Nth degree and in many situations you just don't need all that weight to get most all the answers you will ever need out of the model. And to be sure you get the right answers, you really need to have a good picture of what the model is representing, so allow more time for documentation of that model as you write it. It will save you or the next guy a lot of grief if you ever have to resurrect it later.

Here's one of my old model files of a booster pump station and the text input file it represents. I can still immediately tell you by my code convention what is going on there, although it was 8 years ago that I wrote it. BS1.PA.PSV.A This is an actuator for the pressure relief valve on pump A at booster station #1. And the picture file.

Last Rule: Insert lots of comments in the code.
Most of this was written with the help of VBA.

/****** PUMP SUCTION RELIEF **********************
/* B+ BS1.PA.PSV.BK -BS1.PA -BS1.PA.PSV GATEO GATEC 0 3000 0.25
/* SEE SUCTION PRESS CONTROL ** S BS1.PA.SP.S
/* C BS1.PA.PSV.C BS1.PA.SP.S:OUT 800 50 0 0 0 3000
/* A BS1.PA.PSV.A C BS1.PA.PSV.C V BS1.PA.PSV X(V)2 0. 1. V240 0
/* V BS1.PA.PSV +BS1.PA.PSV.BK BS1.PA.PSV.NODE C(X)2 0.01 15
/* E BS1.PA.PSV.E BS1.PA.PSV.NODE TAKE 10 0

/*==========================================================
/* UNION PUMP - DB36 - 8x10x12.5 - 5 STAGES
/* CAPACITY 500 M3/HR
/* HEAD 1620 METERS (ACTUAL IS 1595)
/* POWER 2348 Kw @ 0.829 SPGR
/* EFFICIENCY 77%
/* NPSHR 29.0 METERS
/*------------- BS1 ENGINE AND PUMP CURVES ----------
INCLUDE PUMPS\UNION_DB36_BS1.INC /* BS1 PUMP CURVE
/*-------------------------------------------------
/* PUMPN -CNC +CNC SPEED DRIVERHP INERT EFF STARTTORQUE
P BS1.PA +BS1.H26 -BS1.H3 5400 5700 2 * 100
/* BEP.RPM BEP.HP BEP.H BEP.Q
- 5400 3689 5413 2069
/* CURVE NAME YMULT XMULT RPM
+UNIONDB36-5_HD_2160 1 1 2160
+UNIONDB36-5_PW_2160 1 1 2160
+UNIONDB36-5_HD_2700 1 1 2700
+UNIONDB36-5_PW_2700 1 1 2700
+UNIONDB36-5_HD_3240 1 1 3240
+UNIONDB36-5_PW_3240 1 1 3240
+UNIONDB36-5_HD_3780 1 1 3780
+UNIONDB36-5_PW_3780 1 1 3780
+UNIONDB36-5_HD_4320 1 1 4320
+UNIONDB36-5_PW_4320 1 1 4320
+UNIONDB36-5_HD_4860 1 1 4860
+UNIONDB36-5_PW_4860 1 1 4860
+UNIONDB36-5_HD_5400 1 1 5400
+UNIONDB36-5_PW_5400 1 1 5400
/* NO INTEG SUCT BLOCK
/* NO INTEG SUCT CHECK
/* NO INTEG DISCH BLOCK
/* NO INTEG DISCH CHECK
/* NO BYPASS CHECK

/* -------------- RPM CONTROL ----------------

/* **************** MAXIMUM RPM *******************
/* SENSOR ATTACH TYPE CURVE OUT1 OUT2 INP1 INP2
S BS1.PA.RPM.S BS1.PA RPM V(Z)2 0 6000 0 6000
/* PID INPUT SET KC TD TI BIAS NC
/* C BS1.PA.MAXRPM.C BS1.PA.RPM.S:OUT 5400 .025 0. 0.15 0 -1
C BS1.PA.MAXRPM.C BS1.PA.RPM.S:OUT 5500 0.05 0. 0. 0. -1

/* *********** MIN SUCTION PRESS CONTROL (75 PSIG MIN) ***
/* SENSOR ATTACH TYPE CURVE OUT1 OUT2 IN1 IN2
S BS1.PA.SP.S -BS1.H26 PRES V(Z)2 0 500 0 500
/* PID CONTROLLER INPUT DEVICE SET KC TD TI BIAS NC
C BS1.PA.SP.C BS1.PA.SP.S:OUT 75 .125 0 .15 0 1

/* ************ ENGINE STARTING **********************
/* STARTING CURVE PUMPSTART F(T)
/* D PUMPSTART F(T) 10
/* 0.0 0.25 0.2 0.20 0.36 0.36 0.54 0.54 0.90 1.00 /* RPM
/* 0.0 0.125 .25 0.5 1 2 2.50 3.50 4.50 5.00 /* TIME MIN
/* INPUT_REFERENCE CURVENAME | FUNC1 FUNC2 |t1 |t2 |[SC] |[ST]
/* | END PT VALUES |BEGIN TIME |END TIME |SCALE FACTOR |START TIME
/* | TO ADJ CURVE |TO ADJ CURVE |TO ADJ CURVE|IR TO SIM TIME |SHIFT OUTPUT F(SIMULATION TIME)
/* I BS1.PUMPSTART PUMPSTART 0. 0. 0. 0. 1.0 0
/* + TIMEDELAY RESET
/* 0 RESET
/* SENSOR ATTACH TYPE CURVE OUT1 OUT2 IN1 IN2
/* S BS1.START.S BS1.PUMPSTART IREF V(Z)2 0 1 0 1

/* ****** FEED TO LOW RELAY **********
/* NOTE! **** USE THIS RELAY WHEN USING A PUMP START CURVE
/* RELAYNAME TYPE INPUTTYPE&NAME INPUTTYPE&NAME OR FROM MAX SPEED
/* Y BS1.PA.YL LO S BS1.START.S C BS1.PA.SP.C C BS1.PA.MAXRPM.C C BS1.PA.DP.C

/* USE THIS RELAY WITHOUT PUMP START CURVE
Y BS1.PA.YL LO C BS1.PA.SP.C C BS1.PA.MAXRPM.C C BS1.PA.DP.C

/* MIN RPM 2000 *** 400 MIN RPM ENGINE = 2000 RPM / 5400 rpm max = 0.4 MIN PUMP SPEED
/* BUT PUT AT 0.05 TO EXAMINE START-UP CHARACTERISTICS
/* RELAYNAME TYPE INPUT TYPE&NAME INP CONSTANT MIN.RPM
Y BS1.PA.YH HI Y BS1.PA.YL V 0.05 /* 270 PUMP RPM

/* RAMP RELAY TO LIMIT RATE OF CHANGE OF INPUT SIGNAL
/* RELAYNAME TYPE INPUT&NAME MAX.ABS.ROC BIAS
Y BS1.YR R Y BS1.PA.YH 0.1 .0001

/* RELAYNAME INPUTTYPE&NAME PUMP&NAME CURVE INP OUTP RECIPt
A BS1.PA.A Y BS1.YR R BS1.PA X(V)2 0 1 V60 /*LINEAR RESPONSE

/* ------------- END RPM CONTROL ----------------------------

H BS1.H4 +BS1.PA.DBK -BS1.OUT.ESD 0.022 12.75 1.125
+ MOODY 0.016

/* PLOT LIMIT ISOLATION VALVE ON DISCHARGE SIDE ZV119
B+ BS1.OUT.ESD +BS1.H4 -BS1.OUT.H1 GATEO GATEC * 12028 .03

/* SCRAPER TRAP VALVE
B+ BS1.OUT.TRAP +BS1.OUT.H1 BS1.OUT GATEO GATEC * 12028 1.000



**********************
"Pumping accounts for 20% of the world’s energy used by electric motors and 25-50% of the total electrical energy usage in certain industrial facilities."-DOE statistic (Note: Make that 99% for pipeline companies)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor