Welcome to TiddlyWiki created by Jeremy Ruston, Copyright © 2007 UnaMesa Association
Index of all tiddlers
{{{<<tiddlerList tags:"-Plugin -plugin -systemConfig" group:"tiddler.title.substr(0,1)" groupTemplate:'!%group\n'>>}}}
<<tiddlerList tags:-Config group:"tiddler.title.substr(0,1)" groupTemplate:'!%group\n'>>
Accurate interface level measurement is vital for efficient separation of three or more phases inside a gravity separator employed offshore around the world, both on platforms and FPSOs. Though devices such as displacers and differential pressure transmitters are often specified and installed, their effectiveness is often in doubt1. This is particularly true where foam and stable emulsions are frequently encountered
inside the separators. Clearly, if an interface level instrument can accurately indicate the thickness of such emulsions and foams, it would greatly help optimise the separation process by prompting appropriate actions such as an alteration to the production rate or more probably varying the dosage of chemicals additives, e.g. demuslifiers and de-foamants.
Another interesting application of intelligent well technology is the monitoring and control in separate wells. It is possible to use DTS for monitoring production from a multi-layered reservoir and the use this information to provide fedback on the sweep efficiency provided by the water injection from an intelligent well. Using this method of monitoring and control one field study has shown that more than 20% of the reserves can be protected through optimal voidage control.
* Graphical Interface
* Data Management
* Data Graphing
* Analysis
* Rod-pumping
The realized benefits of distributed, flexible and user-friendly software and IT systems:
risk reduction by early warning
* higher production by timely workovers
* reduced paper work
* reduced manual processes
* eliminating data redundancy
* more accurate and reliable data
CO2 corrosion relies on temperature, pressure, content of CO2, water pH, components of water, type of deposit, and the flowing condition. CO2 content is the most important factor.
The CO2 corrosion product is FeCO3 which is off-white and relatively hard. Of course, FeCO3 vigorously evolves CO2 gas when exposed to acid.
General corrosion and pitting internally in piping and presssure vessels is generally related to the aciditu of the water phase being separated on the metal surface. ''The acidity of the water is a function of the partial pressures of H2S and CO2.'' Other factors such as content of organic acids, the buffer capacity of dissolved salts as well as temperature and pressure is of importance.
# Cost
# Corrosion control
# System compatibility
# Inhibitor adsorption
# Process compatibility
Choke reduction may also reduce sand and/or water production, thus reducing erosion/corrosion problems.
/***
|Name:|CloseOnCancelPlugin|
|Description:|Closes the tiddler if you click new tiddler then cancel. Default behaviour is to leave it open|
|Version:|3.0.1 ($Rev: 3861 $)|
|Date:|$Date: 2008-03-08 10:53:09 +1000 (Sat, 08 Mar 2008) $|
|Source:|http://mptw.tiddlyspot.com/#CloseOnCancelPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
***/
//{{{
merge(config.commands.cancelTiddler,{
handler_mptw_orig_closeUnsaved: config.commands.cancelTiddler.handler,
handler: function(event,src,title) {
this.handler_mptw_orig_closeUnsaved(event,src,title);
if (!store.tiddlerExists(title) && !store.isShadowTiddler(title))
story.closeTiddler(title,true);
return false;
}
});
//}}}
Name: MptwGreen
Background: #fff
Foreground: #000
PrimaryPale: #9b9
PrimaryLight: #385
PrimaryMid: #031
PrimaryDark: #020
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
p55, c1:
This checklist can be used as a general precaution:
[img[SPE024079ConceptualSteamDistributionSystem.png]]
Life cycle cost ([[LCC]]) analysis is conducted to identify the most economic material selection through proper consideration of both CAPEX and OPEX. LCC analysis often weighs three material options: carbon steel, carbon steel with inhibition, and corrosion resistant alloys anticipated to be resistant to the environment.
In the common wellbore configuration, convection heat transfer takes place between the injected fluid and the tubing, conduction heat transfer occurs in the tubing, and conduction, convection and radiation all occur in the annular region. Finally, heat is conducted through the casing, cement and into the formation. The properties of the fluid injected and injection rates govern convective heat transfer while tubing, casing and cement properties govern the conduction. Free convection takes place in the annular region, in the absence of a forced convective flow. Radiation across the annulus is governed by the view factor, emissivity, absorptivity and temperature of the annular surfaces.
PageTemplate
|>|>|SiteTitle - SiteSubtitle|
|MainMenu|DefaultTiddlers<br><br><br><br>ViewTemplate<br><br>EditTemplate|SideBarOptions|
|~|~|OptionsPanel|
|~|~|AdvancedOptions|
|~|~|<<tiddler Configuration.SideBarTabs>>|
''StyleSheet:'' StyleSheetColors - StyleSheetLayout - StyleSheetPrint
SiteUrl
GettingStarted
[[Configuration]]
[[Tag Cloud]]
<<tiddler NewPaper>>
http://jreyesag@reyesaguayo.com/public_html/smartguy/images/tw-papers/
#@images/
#file:///F:/Documents/My%20Documents/@images/
#file:///F:/Documents/My%20Documents/@images/public/
<html>
<span macro='tiddler NewPaper'></span>
<span macro ='tiddler RefreshTiddler with: "Refresh" "refresh this page"'></span></html>
| ''Title:''|<html><input type="text" name="docTitle" size="80" /></html>|
| ''Document ID:''|<html><input type="text" name="docID" size="80" /></html>|
| ''Author:''|<html><input type="text" name="docAuthor" size="80" /></html>|
| ''Coauthors:''|<html><textarea name="docCoAuthors" rows="2" cols="60"></textarea></html>|
| ''Organization:''|<html><input type="text" name="docOrg" size="80" /></html>|
| ''Document Type:''|<html><select name="docType" size="4"><option value="SPE">SPE</option><option value="Livelink">Livelink</option><option value="OTC">OTC</option><option value="Book">Book</option><option value="Other">Other</option></select></html>|
| ''Date:''|<html><input type="text" size="25" name="docDateTxt" /></html>|
| ''Published in:''|<html><input type="text" name="docPublished" size="80" /></html>|
|vertical-align:top; ''Link:''|<html><textarea rows="2" cols="60" name="docLink"></textarea></html>|
<script>
var tiddlerName = config.macros.formTiddler.getContainingTiddlerName(place);
var tid = store.getTiddler(tiddlerName);
var t = store.getTiddler(tiddlerName);
var tag = DataTiddler.getData(tiddlerName, "docType");
var doc_Link = DataTiddler.getData(tiddlerName,"docLink")
var docType = DataTiddler.getData(tiddlerName, "docType");
var docu = "";
var chars3 = tiddlerName.substring(0,3)
var newTitle = ""
var tiddlerElem=document.getElementById(story.tiddlerName); // current tiddler element
//document.write("<b>"+tiddlerName+"</b><br>");
//document.write(t.tags+"<br>")
//document.write(tag+"<br>")
if (doc_Link == undefined)
{doc_Link = ""}
else
{doc_Link = "Open document from this "+"[[Link|"+DataTiddler.getData(tiddlerName,"docLink")+"]]"}
if (docType == "Book") {
docu = "Book";
if (chars3 != "ISB") {
newTitle = "ISBN " + tiddlerName //t.text
store.saveTiddler(newTitle,newTitle,t.text,config.options.txtUserName,new Date(),t.tags, t.fields, true);
story.refreshTiddler(newTitle,null,true);
}
}
if (docType == "SPE")
{docu = "Paper"};
if (docType == "Livelink")
{docu = "File"};
if (!t || !t.tags) {
address = "";
return; }
if (t.tags.find(tag)==null) // if new tag is not in tag list
if (tag.length > 0)
{t.tags.push(tag)
address = "" }
//document.write(t.tags+"<br>");
//document.write(tag.length);
var address = "<html><b>Citation: </b></html>"
address += DataTiddler.getData(tiddlerName, "docAuthor") + ': "'
address += DataTiddler.getData(tiddlerName, "docTitle") + '", '
address += " " + docu + " " + DataTiddler.getData(tiddlerName, "docID") + ", "
address += 'published in "' + DataTiddler.getData(tiddlerName, "docPublished") + '", '
address += DataTiddler.getData(tiddlerName, "docDateTxt") + ".<br>"
//address += doc_Link
wikify(doc_Link+"\n\n",place);
out = address;
//return out + newTiddlerName + "@" + chars3 +tiddlerElem;
return out
</script>
/***
|Name|CopyTiddlerPlugin|
|Source|http://www.TiddlyTools.com/#CopyTiddlerPlugin|
|Version|3.0.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <<br>>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|Quickly create a copy of any existing tiddler|
!!!!!Usage
<<<
View a tiddler and select the "copy" toolbar item. A new tiddler editor is opened with a title of "Copy of TiddlerName" containing copies of the text/tags from the original tiddler. Note: If select the "copy" toolbar item while //editing// a tiddler, the current values of the text/tags that are displayed in the existing tiddler editor are used (including any unsaved changes you may have made to those values).
<<<
!!!!!Installation
<<<
import (or copy/paste) the following tiddlers into your document:
''CopyTiddlerPlugin'' (tagged with <<tag systemConfig>>)
* When using the default (shadow) EditTemplate, the plugin automatically updates the template to include the ''copyTiddler'' toolbar command.
* If you have created a custom EditTemplate tiddler, you will need to manually add the ''copyTiddler'' toolbar command to your existing template toolbar definition.
* If you add ''copyTiddler'' to the ViewTemplate toolbar definition, the ''copy'' toolbar command will also appear when viewing a tiddler.
{{{
<!-- add 'copyTiddler' command to existing toolbar definition -->
<div class='toolbar' macro='toolbar ... copyTiddler ... '>
}}}
<<<
!!!!!Revisions
<<<
''2007.06.28 [3.0.0]'' complete re-write to handle custom fields and alternative view/edit templates
''2007.05.17 [2.1.2]'' use store.getTiddlerText() to retrieve tiddler content, so that SHADOW tiddlers can be copied correctly when in VIEW mode
''2007.04.01 [2.1.1]'' in copyTiddler.handler(), fix check for editor fields by ensuring that found field actually has edit=="text" attribute
''2007.02.05 [2.1.0]'' in copyTiddler.handler(), if editor fields (textfield and/or tagsfield) can't be found (i.e., tiddler is in VIEW mode, not EDIT mode), then get text/tags values from stored tiddler instead of active editor fields. Allows use of COPY toolbar directly from VIEW mode (based on a request from LaurentCharles)
''2006.12.12 [2.0.0]'' completely rewritten so plugin just creates a new tiddler EDITOR with a copy of the current tiddler EDITOR contents, instead of creating the new tiddler in the STORE by copying the current tiddler values from the STORE.
''2005.xx.xx [1.0.0]'' original version by Tim Morgan
<<<
!!!!!Credits
>This feature was originally developed by Tim Morgan. Current version developed by EricShulman from [[ELS Design Studios|http://www.elsdesign.com]]
!!!!!Code
***/
//{{{
version.extensions.copyTiddler= {major: 3, minor: 0, revision: 0, date: new Date(2007,6,28)};
// automatically tweak shadow EditTemplate to add "copyTiddler" toolbar command (following "cancelTiddler")
config.shadowTiddlers.EditTemplate=config.shadowTiddlers.EditTemplate.replace(/cancelTiddler/,"cancelTiddler copyTiddler");
config.commands.copyTiddler = {
text: 'copy',
hideReadOnly: true,
tooltip: 'Make a copy of this tiddler',
prefix: "Copy of ",
handler: function(event,src,title) {
var tiddlerElem=document.getElementById(story.idPrefix+title); // current tiddler element
var template=tiddlerElem.getAttribute("template") // current tiddler template
var newTitle = this.prefix+title; // add "copy of" to create new tiddler title
if (!story.isDirty(title)) { // if existing tiddler is being VIEWED (not EDITED)
// duplicate existing stored tiddler (and clear "changecount")
var tid=store.getTiddler(title);
store.saveTiddler(newTitle,newTitle,tid.text,config.options.txtUserName,new Date(),tid.tags, tid.fields, true);
// display new tiddler using same view template as current tiddler
story.displayTiddler(story.findContainingTiddler(src),newTitle,template);
} else {
// display new tiddler editor using same editor template as current tiddler
story.displayTiddler(story.findContainingTiddler(src),newTitle,template);
// get fields from current tiddler editor
var fields=config.commands.copyTiddler.gatherFields(tiddlerElem);
// set fields in new editor
var newTiddlerElem = document.getElementById(story.idPrefix+newTitle);
for (var f=0; f<fields.length; f++) {
if (fields[f].name=="title") fields[f].value=newTitle; // rename title in new tiddler
var fieldElem=config.commands.copyTiddler.findField(newTiddlerElem,fields[f].name);
if (fieldElem) {
if (fieldElem.getAttribute("type")=="checkbox")
fieldElem.checked=fields[f].value;
else
fieldElem.value=fields[f].value;
}
}
}
story.focusTiddler(newTitle,"title");
return false;
},
findField: function(tiddlerElem,field) {
var inputs=tiddlerElem.getElementsByTagName("input");
for (var i=0; i<inputs.length; i++) {
if (inputs[i].getAttribute("type")=="checkbox" && inputs[i].field == field) return inputs[i];
if (inputs[i].getAttribute("type")=="text" && inputs[i].getAttribute("edit") == field) return inputs[i];
}
var tas=tiddlerElem.getElementsByTagName("textarea");
for (var i=0; i<tas.length; i++) if (tas[i].getAttribute("edit") == field) return tas[i];
var sels=tiddlerElem.getElementsByTagName("select");
for (var i=0; i<sels.length; i++) if (sels[i].getAttribute("edit") == field) return sels[i];
return null;
},
gatherFields: function(tiddlerElem) { // get field names and values from current tiddler editor
var fields=[];
// get checkboxes and edit fields
var inputs=tiddlerElem.getElementsByTagName("input");
for (var i=0; i<inputs.length; i++) {
if (inputs[i].getAttribute("type")=="checkbox")
if (inputs[i].field) fields.push({name:inputs[i].field,value:inputs[i].checked});
if (inputs[i].getAttribute("type")=="text")
if (inputs[i].getAttribute("edit")) fields.push({name:inputs[i].getAttribute("edit"),value:inputs[i].value});
}
// get textareas (multi-line edit fields)
var tas=tiddlerElem.getElementsByTagName("textarea");
for (var i=0; i<tas.length; i++)
if (tas[i].getAttribute("edit")) fields.push({name:tas[i].getAttribute("edit"),value:tas[i].value});
// get selection lists (droplist or listbox)
var sels=tiddlerElem.getElementsByTagName("select");
for (var i=0; i<sels.length; i++)
if (sels[i].getAttribute("edit")) fields.push({name:sels[i].getAttribute("edit"),value:sels[i].value});
return fields;
}
};
//}}}
<html><p> </p><p><table width="374" cellspacing="1" cellpadding="1" border="0"><tbody><tr><td width="150" valign="top" bordercolor="#ffffcc"><strong>Materials:</strong></td><td width="150" valign="top" bordercolor="#ffffcc"><p>H2S resistant</p><p>13% Cr steel</p><p>Stainless Steel</p><p>Ni alloys</p></td></tr><tr><td width="150" valign="top" bordercolor="#ffffcc"><strong>Operation:</strong></td><td width="150" valign="top" bordercolor="#ffffcc"><p>Separation</p><p>Dehydration</p><p>Temperature control</p><p>Pressure Control</p></td></tr><tr><td width="150" valign="top" bordercolor="#ffffcc"><strong>Inhibition:</strong></td><td width="150" valign="top" bordercolor="#ffffcc"><p>Oxygen scavenger</p><p>Bactericide</p><p>pH control</p><p>Film forming</p></td></tr><tr><td width="150" valign="top" bordercolor="#ffffcc"><strong>Coating:</strong></td><td width="150" valign="top" bordercolor="#ffffcc">in-situ coating</td></tr></tbody></table></p></html>
... conducted either on a routine basis or as opportunity permits.
* Corrosion coupons are pulled at 3-day, 60-day and 90-day intervals.
* Water and suspended solids are routinely analyzed.
* Water samples are collected from drains at the bottom of the knockout vessels.
* Iron and manganese counts are determined, and chloride and inhibitor residuals are peridiocally measured, in order to determine the corrosivity of the water collected.
* weight-loss coupons
* electric resistance probes
* polarization probes
The corrosion coupons are made of the actual steels to be used in the field. They are flush-mounted in an insulating corrosion-resistant holder along the perimeter of the equipment to minimize edge effect and are place in eviromentally identical positions.
The presence of carbon dioxide (CO2), hydrogen sulphide (H2S) and free water can cause severe corrosion problems in oil and gas pipelines. Internal corrosion in wells and pipelines is influenced by:
* temperature,
* CO2 and H2S content,
* water chemistry,
* flow velocity,
* oil or water wetting, and
* composition and surface condition of the steel.
A small change in one of these parameters can change the corrosion rate considerably, due to changes in the properties of the thin layer of corrosion products that accumulates on the steel surface.
When corrosion products are not deposited on the steel surface, very high corrosion rates of several millimetres per year can occur. The corrosion rate can be reduced substantially under conditions where iron carbonate (FeCO3) can precipitate on the steel surface and form a dense and protective corrosion product film. This occurs more easily at high temperature or high pH in the water phase. When H2S is present in addition to CO2, iron sulphide (FeS) films are formed rather than FeCO3, and protective films can be formed at lower temperature, since FeS precipitates much easier than FeCO3.
''Localised corrosion'' with very high corrosion rates can occur when the corrosion product film does not give sufficient protection, and this is the most feared type of corrosion attack in oil and gas pipelines.
Corrosion due to carbon dioxide takes place when an
electrolyte such as water is present. Most mixed production
flowlines have liquid water at some place in the system. When
water is present, corrosion due to carbon dioxide will increase
with temperature to a point where precipitation of a corrosion
product layer occurs. ''The formation of a corrosion product
layer that reduces corrosion rates is influenced by temperature,
brine composition, wall shear stress, and flow regime.'' The
greater the partial pressure of carbon dioxide in the system, the
more acidic the water in the system becomes causing it to be
more corrosive.
As a general rule, brine corrosivity increases with density, with ZnBr2 being the most corrosive of the normally used brines. All brines have the potential for oxygen-type corrosion, hence air entrainment must be avoided. Sulfite scavengers are sometimes unusable because of secondary reactions with brines additives. Prejob testing of inhibitors should be required to ensure effectiveness, to avoid chemical and thermal reactions, and to prohibit formation damage.
Some of the tests used for corrosion inhibitor compatibility are the following:
# Solubility in methanol, brine and condensate
# Fluids compatibility
# Inhibitor shelf life
Corrosion inhibitor compatibility with system facilities includes tests on the following:
# Viscosity of the corrosion inhibitor
# Capillary injection stability
# Materials compatibility
# [[tubing selection|Corrosion: tubing selection]]
# corrosion treatment method
# completion design
Effectiveness of a corrosion control program has to be assesed by corrosion monitoring. Optimization of chemical treatment is impossible without a reliable monitoring data.
Corrosion monitoring devices are installed the the folowing points, where water tends to collect. These will be areas experiencing the highest corrosion rates in the system:
# the liquid drains from the high presure and low pressure compressor suction drums.
# The oulet lines from each bank of the fin-fan coolers
# The outlet of the chiller
# The water outlet line from the high presure compressior discharge drum.
... in CO2 (sweet) corrosion, corrosion rates tipically increase with temperature until approximately 150 to 200F, where stable [[siderite]] scales may form and corrosion rates usually drop.
Similarly, in H2S (sour) corrosion, scales protectiveness, and thus corrosion rate, can vary with the type of scale expected (mackinawite, pyrrhotite, pyrite, or even siderite at very low H2S concentrations) and the relative concentrations of acid gas (CO2 and H2S).
Corrosion rates increases after the bubble point pressure because after this point, gas containing CO2/H2S starts liberating from the crude oil, then dissolving in the water forming carbonic acid. Also, as the fluid flows upstream of the tubing. the fluid velocity increases, affecting the corrosion rates. Once the fluid flow pressure is below the bubble point pressure. multi-phase flow developes; therefore flow velocity and pressure drop increases affecting the corrosion rates. For fluid flow pressures above the bubble point pressure, gas is in solution. and there is single phase flow present; therefore, corrosion rates should be expected to be very low. The correlations have to be adjusted for this condition.
<html><p>... a minimum of two reactions occur simultaneously. The major reactions are:</p><p>Fe -> Fe<sup>++</sup> + 2e<sup>-</sup> (oxidation)</p><p>2H<sup>+</sup> + 2 e<sup>-</sup> -> H<sub>2</sub> (reduction)</p></html>
... corrosion mitigation considerations require the selection process (of proper tubing) to take into account [[tubing ID|Tubing ID importance on corrosion]], [[metallurgy|Metallurgy importance in corrosion]] and [[Thread type|Thread type importance in corrosion]].
Our integrated team began the task of developing our surveillance plan with the objectives of:
* Understanding reservoir behavior
* Protecting base production by minimizing the decline rate
* Identifying opportuinities for well work in the form of new drills and recompletions
* Production optimization, and
* Improve reservoir management strategy
* Base Map
* Histogram: univariate statistics
* Cross-Plot
* Matrix Plot
* Cloud Plot
* Mosaic
* Surface Plot
* Variograms
/***
|''Name:''|DataTiddlerPlugin|
|''Version:''|1.0.6 (2006-08-26)|
|''Source:''|http://tiddlywiki.abego-software.de/#DataTiddlerPlugin|
|''Author:''|UdoBorkowski (ub [at] abego-software [dot] de)|
|''Licence:''|[[BSD open source license]]|
|''TiddlyWiki:''|1.2.38+, 2.0|
|''Browser:''|Firefox 1.0.4+; InternetExplorer 6.0|
!Description
Enhance your tiddlers with structured data (such as strings, booleans, numbers, or even arrays and compound objects) that can be easily accessed and modified through named fields (in JavaScript code).
Such tiddler data can be used in various applications. E.g. you may create tables that collect data from various tiddlers.
''//Example: "Table with all December Expenses"//''
{{{
<<forEachTiddler
where
'tiddler.tags.contains("expense") && tiddler.data("month") == "Dec"'
write
'"|[["+tiddler.title+"]]|"+tiddler.data("descr")+"| "+tiddler.data("amount")+"|\n"'
>>
}}}
//(This assumes that expenses are stored in tiddlers tagged with "expense".)//
<<forEachTiddler
where
'tiddler.tags.contains("expense") && tiddler.data("month") == "Dec"'
write
'"|[["+tiddler.title+"]]|"+tiddler.data("descr")+"| "+tiddler.data("amount")+"|\n"'
>>
For other examples see DataTiddlerExamples.
''Access and Modify Tiddler Data''
You can "attach" data to every tiddler by assigning a JavaScript value (such as a string, boolean, number, or even arrays and compound objects) to named fields.
These values can be accessed and modified through the following Tiddler methods:
|!Method|!Example|!Description|
|{{{data(field)}}}|{{{t.data("age")}}}|Returns the value of the given data field of the tiddler. When no such field is defined or its value is undefined {{{undefined}}} is returned.|
|{{{data(field,defaultValue)}}}|{{{t.data("isVIP",false)}}}|Returns the value of the given data field of the tiddler. When no such field is defined or its value is undefined the defaultValue is returned.|
|{{{data()}}}|{{{t.data()}}}|Returns the data object of the tiddler, with a property for every field. The properties of the returned data object may only be read and not be modified. To modify the data use DataTiddler.setData(...) or the corresponding Tiddler method.|
|{{{setData(field,value)}}}|{{{t.setData("age",42)}}}|Sets the value of the given data field of the tiddler to the value. When the value is {{{undefined}}} the field is removed.|
|{{{setData(field,value,defaultValue)}}}|{{{t.setData("isVIP",flag,false)}}}|Sets the value of the given data field of the tiddler to the value. When the value is equal to the defaultValue no value is set (and the field is removed).|
Alternatively you may use the following functions to access and modify the data. In this case the tiddler argument is either a tiddler or the name of a tiddler.
|!Method|!Description|
|{{{DataTiddler.getData(tiddler,field)}}}|Returns the value of the given data field of the tiddler. When no such field is defined or its value is undefined {{{undefined}}} is returned.|
|{{{DataTiddler.getData(tiddler,field,defaultValue)}}}|Returns the value of the given data field of the tiddler. When no such field is defined or its value is undefined the defaultValue is returned.|
|{{{DataTiddler.getDataObject(tiddler)}}}|Returns the data object of the tiddler, with a property for every field. The properties of the returned data object may only be read and not be modified. To modify the data use DataTiddler.setData(...) or the corresponding Tiddler method.|
|{{{DataTiddler.setData(tiddler,field,value)}}}|Sets the value of the given data field of the tiddler to the value. When the value is {{{undefined}}} the field is removed.|
|{{{DataTiddler.setData(tiddler,field,value,defaultValue)}}}|Sets the value of the given data field of the tiddler to the value. When the value is equal to the defaultValue no value is set (and the field is removed).|
//(For details on the various functions see the detailed comments in the source code.)//
''Data Representation in a Tiddler''
The data of a tiddler is stored as plain text in the tiddler's content/text, inside a "data" section that is framed by a {{{<data>...</data>}}} block. Inside the data section the information is stored in the [[JSON format|http://www.crockford.com/JSON/index.html]].
//''Data Section Example:''//
{{{
<data>{"isVIP":true,"user":"John Brown","age":34}</data>
}}}
The data section is not displayed when viewing the tiddler (see also "The showData Macro").
Beside the data section a tiddler may have all kind of other content.
Typically you will not access the data section text directly but use the methods given above. Nevertheless you may retrieve the text of the data section's content through the {{{DataTiddler.getDataText(tiddler)}}} function.
''Saving Changes''
The "setData" methods respect the "ForceMinorUpdate" and "AutoSave" configuration values. I.e. when "ForceMinorUpdate" is true changing a value using setData will not affect the "modifier" and "modified" attributes. With "AutoSave" set to true every setData will directly save the changes after a setData.
''Notifications''
No notifications are sent when a tiddler's data value is changed through the "setData" methods.
''Escape Data Section''
In case that you want to use the text {{{<data>}}} or {{{</data>}}} in a tiddler text you must prefix the text with a tilde ('~'). Otherwise it may be wrongly considered as the data section. The tiddler text {{{~<data>}}} is displayed as {{{<data>}}}.
''The showData Macro''
By default the data of a tiddler (that is stored in the {{{<data>...</data>}}} section of the tiddler) is not displayed. If you want to display this data you may used the {{{<<showData ...>>}}} macro:
''Syntax:''
|>|{{{<<}}}''showData '' [''JSON''] [//tiddlerName//] {{{>>}}}|
|''JSON''|By default the data is rendered as a table with a "Name" and "Value" column. When defining ''JSON'' the data is rendered in JSON format|
|//tiddlerName//|Defines the tiddler holding the data to be displayed. When no tiddler is given the tiddler containing the showData macro is used. When the tiddler name contains spaces you must quote the name (or use the {{{[[...]]}}} syntax.)|
|>|~~Syntax formatting: Keywords in ''bold'', optional parts in [...]. 'or' means that exactly one of the two alternatives must exist.~~|
!Revision history
* v1.0.6 (2006-08-26)
** Removed misleading comment
* v1.0.5 (2006-02-27) (Internal Release Only)
** Internal
*** Make "JSLint" conform
* v1.0.4 (2006-02-05)
** Bugfix: showData fails in TiddlyWiki 2.0
* v1.0.3 (2006-01-06)
** Support TiddlyWiki 2.0
* v1.0.2 (2005-12-22)
** Enhancements:
*** Handle texts "<data>" or "</data>" more robust when used in a tiddler text or as a field value.
*** Improved (JSON) error messages.
** Bugs fixed:
*** References are not updated when using the DataTiddler.
*** Changes to compound objects are not always saved.
*** "~</data>" is not rendered correctly (expected "</data>")
* v1.0.1 (2005-12-13)
** Features:
*** The showData macro supports an optional "tiddlername" argument to specify the tiddler containing the data to be displayed
** Bugs fixed:
*** A script immediately following a data section is deleted when the data is changed. (Thanks to GeoffS for reporting.)
* v1.0.0 (2005-12-12)
** initial version
!Code
***/
//{{{
//============================================================================
//============================================================================
// DataTiddlerPlugin
//============================================================================
//============================================================================
// Ensure that the DataTiddler Plugin is only installed once.
//
if (!version.extensions.DataTiddlerPlugin) {
version.extensions.DataTiddlerPlugin = {
major: 1, minor: 0, revision: 6,
date: new Date(2006, 7, 26),
type: 'plugin',
source: "http://tiddlywiki.abego-software.de/#DataTiddlerPlugin"
};
// For backward compatibility with v1.2.x
//
if (!window.story) window.story=window;
if (!TiddlyWiki.prototype.getTiddler) {
TiddlyWiki.prototype.getTiddler = function(title) {
var t = this.tiddlers[title];
return (t !== undefined && t instanceof Tiddler) ? t : null;
};
}
//============================================================================
// DataTiddler Class
//============================================================================
// ---------------------------------------------------------------------------
// Configurations and constants
// ---------------------------------------------------------------------------
function DataTiddler() {
}
DataTiddler = {
// Function to stringify a JavaScript value, producing the text for the data section content.
// (Must match the implementation of DataTiddler.parse.)
//
stringify : null,
// Function to parse the text for the data section content, producing a JavaScript value.
// (Must match the implementation of DataTiddler.stringify.)
//
parse : null
};
// Ensure access for IE
window.DataTiddler = DataTiddler;
// ---------------------------------------------------------------------------
// Data Accessor and Mutator
// ---------------------------------------------------------------------------
// Returns the value of the given data field of the tiddler.
// When no such field is defined or its value is undefined
// the defaultValue is returned.
//
// @param tiddler either a tiddler name or a tiddler
//
DataTiddler.getData = function(tiddler, field, defaultValue) {
var t = (typeof tiddler == "string") ? store.getTiddler(tiddler) : tiddler;
if (!(t instanceof Tiddler)) {
throw "Tiddler expected. Got "+tiddler;
}
return DataTiddler.getTiddlerDataValue(t, field, defaultValue);
};
// Sets the value of the given data field of the tiddler to
// the value. When the value is equal to the defaultValue
// no value is set (and the field is removed)
//
// Changing data of a tiddler will not trigger notifications.
//
// @param tiddler either a tiddler name or a tiddler
//
DataTiddler.setData = function(tiddler, field, value, defaultValue) {
var t = (typeof tiddler == "string") ? store.getTiddler(tiddler) : tiddler;
if (!(t instanceof Tiddler)) {
throw "Tiddler expected. Got "+tiddler+ "("+t+")";
}
DataTiddler.setTiddlerDataValue(t, field, value, defaultValue);
};
// Returns the data object of the tiddler, with a property for every field.
//
// The properties of the returned data object may only be read and
// not be modified. To modify the data use DataTiddler.setData(...)
// or the corresponding Tiddler method.
//
// If no data section is defined a new (empty) object is returned.
//
// @param tiddler either a tiddler name or a Tiddler
//
DataTiddler.getDataObject = function(tiddler) {
var t = (typeof tiddler == "string") ? store.getTiddler(tiddler) : tiddler;
if (!(t instanceof Tiddler)) {
throw "Tiddler expected. Got "+tiddler;
}
return DataTiddler.getTiddlerDataObject(t);
};
// Returns the text of the content of the data section of the tiddler.
//
// When no data section is defined for the tiddler null is returned
//
// @param tiddler either a tiddler name or a Tiddler
// @return [may be null]
//
DataTiddler.getDataText = function(tiddler) {
var t = (typeof tiddler == "string") ? store.getTiddler(tiddler) : tiddler;
if (!(t instanceof Tiddler)) {
throw "Tiddler expected. Got "+tiddler;
}
return DataTiddler.readDataSectionText(t);
};
// ---------------------------------------------------------------------------
// Internal helper methods (must not be used by code from outside this plugin)
// ---------------------------------------------------------------------------
// Internal.
//
// The original JSONError is not very user friendly,
// especially it does not define a toString() method
// Therefore we extend it here.
//
DataTiddler.extendJSONError = function(ex) {
if (ex.name == 'JSONError') {
ex.toString = function() {
return ex.name + ": "+ex.message+" ("+ex.text+")";
};
}
return ex;
};
// Internal.
//
// @param t a Tiddler
//
DataTiddler.getTiddlerDataObject = function(t) {
if (t.dataObject === undefined) {
var data = DataTiddler.readData(t);
t.dataObject = (data) ? data : {};
}
return t.dataObject;
};
// Internal.
//
// @param tiddler a Tiddler
//
DataTiddler.getTiddlerDataValue = function(tiddler, field, defaultValue) {
var value = DataTiddler.getTiddlerDataObject(tiddler)[field];
return (value === undefined) ? defaultValue : value;
};
// Internal.
//
// @param tiddler a Tiddler
//
DataTiddler.setTiddlerDataValue = function(tiddler, field, value, defaultValue) {
var data = DataTiddler.getTiddlerDataObject(tiddler);
var oldValue = data[field];
if (value == defaultValue) {
if (oldValue !== undefined) {
delete data[field];
DataTiddler.save(tiddler);
}
return;
}
data[field] = value;
DataTiddler.save(tiddler);
};
// Internal.
//
// Reads the data section from the tiddler's content and returns its text
// (as a String).
//
// Returns null when no data is defined.
//
// @param tiddler a Tiddler
// @return [may be null]
//
DataTiddler.readDataSectionText = function(tiddler) {
var matches = DataTiddler.getDataTiddlerMatches(tiddler);
if (matches === null || !matches[2]) {
return null;
}
return matches[2];
};
// Internal.
//
// Reads the data section from the tiddler's content and returns it
// (as an internalized object).
//
// Returns null when no data is defined.
//
// @param tiddler a Tiddler
// @return [may be null]
//
DataTiddler.readData = function(tiddler) {
var text = DataTiddler.readDataSectionText(tiddler);
try {
return text ? DataTiddler.parse(text) : null;
} catch(ex) {
throw DataTiddler.extendJSONError(ex);
}
};
// Internal.
//
// Returns the serialized text of the data of the given tiddler, as it
// should be stored in the data section.
//
// @param tiddler a Tiddler
//
DataTiddler.getDataTextOfTiddler = function(tiddler) {
var data = DataTiddler.getTiddlerDataObject(tiddler);
return DataTiddler.stringify(data);
};
// Internal.
//
DataTiddler.indexOfNonEscapedText = function(s, subString, startIndex) {
var index = s.indexOf(subString, startIndex);
while ((index > 0) && (s[index-1] == '~')) {
index = s.indexOf(subString, index+1);
}
return index;
};
// Internal.
//
DataTiddler.getDataSectionInfo = function(text) {
// Special care must be taken to handle "<data>" and "</data>" texts inside
// a data section.
// Also take care not to use an escaped <data> (i.e. "~<data>") as the start
// of a data section. (Same for </data>)
// NOTE: we are explicitly searching for a data section that contains a JSON
// string, i.e. framed with braces. This way we are little bit more robust in
// case the tiddler contains unescaped texts "<data>" or "</data>". This must
// be changed when using a different stringifier.
var startTagText = "<data>{";
var endTagText = "}</data>";
var startPos = 0;
// Find the first not escaped "<data>".
var startDataTagIndex = DataTiddler.indexOfNonEscapedText(text, startTagText, 0);
if (startDataTagIndex < 0) {
return null;
}
// Find the *last* not escaped "</data>".
var endDataTagIndex = text.indexOf(endTagText, startDataTagIndex);
if (endDataTagIndex < 0) {
return null;
}
var nextEndDataTagIndex;
while ((nextEndDataTagIndex = text.indexOf(endTagText, endDataTagIndex+1)) >= 0) {
endDataTagIndex = nextEndDataTagIndex;
}
return {
prefixEnd: startDataTagIndex,
dataStart: startDataTagIndex+(startTagText.length)-1,
dataEnd: endDataTagIndex,
suffixStart: endDataTagIndex+(endTagText.length)
};
};
// Internal.
//
// Returns the "matches" of a content of a DataTiddler on the
// "data" regular expression. Return null when no data is defined
// in the tiddler content.
//
// Group 1: text before data section (prefix)
// Group 2: content of data section
// Group 3: text behind data section (suffix)
//
// @param tiddler a Tiddler
// @return [may be null] null when the tiddler contains no data section, otherwise see above.
//
DataTiddler.getDataTiddlerMatches = function(tiddler) {
var text = tiddler.text;
var info = DataTiddler.getDataSectionInfo(text);
if (!info) {
return null;
}
var prefix = text.substr(0,info.prefixEnd);
var data = text.substr(info.dataStart, info.dataEnd-info.dataStart+1);
var suffix = text.substr(info.suffixStart);
return [text, prefix, data, suffix];
};
// Internal.
//
// Saves the data in a <data> block of the given tiddler (as a minor change).
//
// The "chkAutoSave" and "chkForceMinorUpdate" options are respected.
// I.e. the TiddlyWiki *file* is only saved when AutoSave is on.
//
// Notifications are not send.
//
// This method should only be called when the data really has changed.
//
// @param tiddler
// the tiddler to be saved.
//
DataTiddler.save = function(tiddler) {
var matches = DataTiddler.getDataTiddlerMatches(tiddler);
var prefix;
var suffix;
if (matches === null) {
prefix = tiddler.text;
suffix = "";
} else {
prefix = matches[1];
suffix = matches[3];
}
var dataText = DataTiddler.getDataTextOfTiddler(tiddler);
var newText =
(dataText !== null)
? prefix + "<data>" + dataText + "</data>" + suffix
: prefix + suffix;
if (newText != tiddler.text) {
// make the change in the tiddlers text
// ... see DataTiddler.MyTiddlerChangedFunction
tiddler.isDataTiddlerChange = true;
// ... do the action change
tiddler.set(
tiddler.title,
newText,
config.options.txtUserName,
config.options.chkForceMinorUpdate? undefined : new Date(),
tiddler.tags);
// ... see DataTiddler.MyTiddlerChangedFunction
delete tiddler.isDataTiddlerChange;
// Mark the store as dirty.
store.dirty = true;
// AutoSave if option is selected
if(config.options.chkAutoSave) {
saveChanges();
}
}
};
// Internal.
//
DataTiddler.MyTiddlerChangedFunction = function() {
// Remove the data object from the tiddler when the tiddler is changed
// by code other than DataTiddler code.
//
// This is necessary since the data object is just a "cached version"
// of the data defined in the data section of the tiddler and the
// "external" change may have changed the content of the data section.
// Thus we are not sure if the data object reflects the data section
// contents.
//
// By deleting the data object we ensure that the data object is
// reconstructed the next time it is needed, with the data defined by
// the data section in the tiddler's text.
// To indicate that a change is a "DataTiddler change" a temporary
// property "isDataTiddlerChange" is added to the tiddler.
if (this.dataObject && !this.isDataTiddlerChange) {
delete this.dataObject;
}
// call the original code.
DataTiddler.originalTiddlerChangedFunction.apply(this, arguments);
};
//============================================================================
// Formatters
//============================================================================
// This formatter ensures that "~<data>" is rendered as "<data>". This is used to
// escape the "<data>" of a data section, just in case someone really wants to use
// "<data>" as a text in a tiddler and not start a data section.
//
// Same for </data>.
//
config.formatters.push( {
name: "data-escape",
match: "~<\\/?data>",
handler: function(w) {
w.outputText(w.output,w.matchStart + 1,w.nextMatch);
}
} );
// This formatter ensures that <data>...</data> sections are not rendered.
//
config.formatters.push( {
name: "data",
match: "<data>",
handler: function(w) {
var info = DataTiddler.getDataSectionInfo(w.source);
if (info && info.prefixEnd == w.matchStart) {
w.nextMatch = info.suffixStart;
} else {
w.outputText(w.output,w.matchStart,w.nextMatch);
}
}
} );
//============================================================================
// Tiddler Class Extension
//============================================================================
// "Hijack" the changed method ---------------------------------------------------
DataTiddler.originalTiddlerChangedFunction = Tiddler.prototype.changed;
Tiddler.prototype.changed = DataTiddler.MyTiddlerChangedFunction;
// Define accessor methods -------------------------------------------------------
// Returns the value of the given data field of the tiddler. When no such field
// is defined or its value is undefined the defaultValue is returned.
//
// When field is undefined (or null) the data object is returned. (See
// DataTiddler.getDataObject.)
//
// @param field [may be null, undefined]
// @param defaultValue [may be null, undefined]
// @return [may be null, undefined]
//
Tiddler.prototype.data = function(field, defaultValue) {
return (field)
? DataTiddler.getTiddlerDataValue(this, field, defaultValue)
: DataTiddler.getTiddlerDataObject(this);
};
// Sets the value of the given data field of the tiddler to the value. When the
// value is equal to the defaultValue no value is set (and the field is removed).
//
// @param value [may be null, undefined]
// @param defaultValue [may be null, undefined]
//
Tiddler.prototype.setData = function(field, value, defaultValue) {
DataTiddler.setTiddlerDataValue(this, field, value, defaultValue);
};
//============================================================================
// showData Macro
//============================================================================
config.macros.showData = {
// Standard Properties
label: "showData",
prompt: "Display the values stored in the data section of the tiddler"
};
config.macros.showData.handler = function(place,macroName,params) {
// --- Parsing ------------------------------------------
var i = 0; // index running over the params
// Parse the optional "JSON"
var showInJSONFormat = false;
if ((i < params.length) && params[i] == "JSON") {
i++;
showInJSONFormat = true;
}
var tiddlerName = story.findContainingTiddler(place).id.substr(7);
if (i < params.length) {
tiddlerName = params[i];
i++;
}
// --- Processing ------------------------------------------
try {
if (showInJSONFormat) {
this.renderDataInJSONFormat(place, tiddlerName);
} else {
this.renderDataAsTable(place, tiddlerName);
}
} catch (e) {
this.createErrorElement(place, e);
}
};
config.macros.showData.renderDataInJSONFormat = function(place,tiddlerName) {
var text = DataTiddler.getDataText(tiddlerName);
if (text) {
createTiddlyElement(place,"pre",null,null,text);
}
};
config.macros.showData.renderDataAsTable = function(place,tiddlerName) {
var text = "|!Name|!Value|\n";
var data = DataTiddler.getDataObject(tiddlerName);
if (data) {
for (var i in data) {
var value = data[i];
text += "|"+i+"|"+DataTiddler.stringify(value)+"|\n";
}
}
wikify(text, place);
};
// Internal.
//
// Creates an element that holds an error message
//
config.macros.showData.createErrorElement = function(place, exception) {
var message = (exception.description) ? exception.description : exception.toString();
return createTiddlyElement(place,"span",null,"showDataError","<<showData ...>>: "+message);
};
// ---------------------------------------------------------------------------
// Stylesheet Extensions (may be overridden by local StyleSheet)
// ---------------------------------------------------------------------------
//
setStylesheet(
".showDataError{color: #ffffff;background-color: #880000;}",
"showData");
} // of "install only once"
// Used Globals (for JSLint) ==============
// ... TiddlyWiki Core
/*global createTiddlyElement, saveChanges, store, story, wikify */
// ... DataTiddler
/*global DataTiddler */
// ... JSON
/*global JSON */
/***
!JSON Code, used to serialize the data
***/
/*
Copyright (c) 2005 JSON.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The Software shall be used for Good, not Evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/*
The global object JSON contains two methods.
JSON.stringify(value) takes a JavaScript value and produces a JSON text.
The value must not be cyclical.
JSON.parse(text) takes a JSON text and produces a JavaScript value. It will
throw a 'JSONError' exception if there is an error.
*/
var JSON = {
copyright: '(c)2005 JSON.org',
license: 'http://www.crockford.com/JSON/license.html',
/*
Stringify a JavaScript value, producing a JSON text.
*/
stringify: function (v) {
var a = [];
/*
Emit a string.
*/
function e(s) {
a[a.length] = s;
}
/*
Convert a value.
*/
function g(x) {
var c, i, l, v;
switch (typeof x) {
case 'object':
if (x) {
if (x instanceof Array) {
e('[');
l = a.length;
for (i = 0; i < x.length; i += 1) {
v = x[i];
if (typeof v != 'undefined' &&
typeof v != 'function') {
if (l < a.length) {
e(',');
}
g(v);
}
}
e(']');
return;
} else if (typeof x.toString != 'undefined') {
e('{');
l = a.length;
for (i in x) {
v = x[i];
if (x.hasOwnProperty(i) &&
typeof v != 'undefined' &&
typeof v != 'function') {
if (l < a.length) {
e(',');
}
g(i);
e(':');
g(v);
}
}
return e('}');
}
}
e('null');
return;
case 'number':
e(isFinite(x) ? +x : 'null');
return;
case 'string':
l = x.length;
e('"');
for (i = 0; i < l; i += 1) {
c = x.charAt(i);
if (c >= ' ') {
if (c == '\\' || c == '"') {
e('\\');
}
e(c);
} else {
switch (c) {
case '\b':
e('\\b');
break;
case '\f':
e('\\f');
break;
case '\n':
e('\\n');
break;
case '\r':
e('\\r');
break;
case '\t':
e('\\t');
break;
default:
c = c.charCodeAt();
e('\\u00' + Math.floor(c / 16).toString(16) +
(c % 16).toString(16));
}
}
}
e('"');
return;
case 'boolean':
e(String(x));
return;
default:
e('null');
return;
}
}
g(v);
return a.join('');
},
/*
Parse a JSON text, producing a JavaScript value.
*/
parse: function (text) {
var p = /^\s*(([,:{}\[\]])|"(\\.|[^\x00-\x1f"\\])*"|-?\d+(\.\d*)?([eE][+-]?\d+)?|true|false|null)\s*/,
token,
operator;
function error(m, t) {
throw {
name: 'JSONError',
message: m,
text: t || operator || token
};
}
function next(b) {
if (b && b != operator) {
error("Expected '" + b + "'");
}
if (text) {
var t = p.exec(text);
if (t) {
if (t[2]) {
token = null;
operator = t[2];
} else {
operator = null;
try {
token = eval(t[1]);
} catch (e) {
error("Bad token", t[1]);
}
}
text = text.substring(t[0].length);
} else {
error("Unrecognized token", text);
}
} else {
token = operator = undefined;
}
}
function val() {
var k, o;
switch (operator) {
case '{':
next('{');
o = {};
if (operator != '}') {
for (;;) {
if (operator || typeof token != 'string') {
error("Missing key");
}
k = token;
next();
next(':');
o[k] = val();
if (operator != ',') {
break;
}
next(',');
}
}
next('}');
return o;
case '[':
next('[');
o = [];
if (operator != ']') {
for (;;) {
o.push(val());
if (operator != ',') {
break;
}
next(',');
}
}
next(']');
return o;
default:
if (operator !== null) {
error("Missing value");
}
k = token;
next();
return k;
}
}
next();
return val();
}
};
/***
!Setup the data serialization
***/
DataTiddler.format = "JSON";
DataTiddler.stringify = JSON.stringify;
DataTiddler.parse = JSON.parse;
//}}}
p3,c2:
The deposition process is not only a function of the thermodynamic and chemical properties of the fluid but also of the hydrodynamics, geometry and surface characteristics of the system.
During the first year of production, precipitation of corrosion products from the pipeline started to create problems in the onshore glycol regeneration units. The dissolved iron from the pipeline caused formation of scales on the surfaces in the heat exchangers and boilers, and particles that settled in low-flow areas such as tanks, drums and slug catchers. The estimated amount of corrosion products was 20t the first year of operation. This was not regarded as a corrosion problem in the pipelines, but as a process problem in the onshore processing plant. In order to reduce the amount of dissolved corrosion products in the pipeline and avoid a costly rebuilding of the gas processing plant, the operator, Statoil, decided to reduce the corrosivity in the pipelines further by applying the pH stabilisation technique.
The pH at the outlet of the pipelines prior to pH stabilisation was close to 6. Based on results from laboratory testing and calculations at the IFE, it was decided to increase the pH in the pipeline to 7.4. This was achieved by injecting a sodium hydroxide (NaOH) solution into the lean MEG tank. The concentration of dissolved iron, which has the potential to form scale in the process equipment, was reduced from approximately 100 parts per million (ppm) to less than 5ppm after six weeks, as shown in Figure 3. This corresponds to a corrosion rate far below 0.1mm/year. Very little precipitation takes place in the process system today, and the system has been operated with success since the treatment was carried out in 1997.
To combat emulsion and foam formation and hence increase the separation efficiency, chemical additives such as demulsifiers and anti-foamant are frequently used. These chemicals are often injected into the production fluids prior to entering the primary three phase separator. Chemical additives can be very effective in reducing the amount of emulsion and foam inside the separator. The drawback is that a lot of these chemicals, in particular the demuslifiers, are toxic in nature; as they can partition into the produced water, some of them will be inevitably discharged into the marine environment. Also, if the chemical is overdosed, instead of promoting the separation, it can actually stabilise the emulsion. As a result, the use of such chemicals need to be both optimised and minimised.
Chrome-22 and Chrome 13 appear to be sensitive to high concentrations of calcium chloride and/or trace amount of oxygen
Willhite studied casing temperatures assuming steady heat transfer in the wellbore, unsteady radial heat transfer in the formation, and overall coefficient of heat transfer to be dependent on temperature. Emphasis was given to formulation of the overall heat transfer coefficients for different well completions. For long term injection the mathematical model was in good agreement with field tests, giving casing temperatures of approximately 480°F after one week of injection for a standard wellbore configuration and injection temperatures of 650 °F. A ''lower emissivity'' and ''insulation'' of tubing string reduced casing temperatures to ''350 °F'' and ''150 °F'' respectively.
Radiation accounts for approximately 90% of the total heat transferred through the wellbore.
An effective monitoring program is often the most important aspect of a program since it can warn the operator of unfavorable conditions before serious damage can occur. The program for these wells consisted of:
* coupons
* iron counts
* [[hydrogen probes]]
* ultrasonic testing
This type of equipment is a metal string mounted in the process stream. As the string is corroding, the cross sectional area decreases and the resistance increases. This increase can be related to the corrosion rate. The advantage of the method is that it may note be retrieved for measuring the corrosion rate. For systems giving electrical conducting corrosion products (iron sulphides), the method can give misleading results.
{{borderlessL{
|>|vertical-align:top;''General methods: ''|Review of design and operation|
|>|~|Visual inspection|
|>|vertical-align:top;''Materials: ''|Ultrasonic|
|>|~|Radiography|
|>|~|Metallographic|
|>|~|Examination of sample|
|>|vertical-align:top;''Corrosivity: ''|Analytical|
|>|~|Coupons|
|>|~|Electrochemical|
|>|~|Probes|
}}}
Reduced emissivities in the wellbore have been discussed and analytically shown to reduce casing temperatures and heat loss from the wellbore by both Willhite and Hoist and Flock. '''The addition of a second casing, presented by Hoist and Flock, is physically the same as adding a radiation shield''', but no detailed study has been made of the effect of all pertinent variables on well casing temperatures.
In this study, the effect of a radiation shield which is in the wellbore annulus and concentric with the tubing string, is first determined in presence of free convection in the annular regions. '''Conduction of heat occurs through the tubing, radiation shield, casing, cement, and formation. The tubing and casing offer little resistance to heat flow in comparison to the cement and formation resistance'''. Across the annular regions heat conducted to the gas is carried away by gas motion near the heated surface caused by the buoyant forces on the less dense gas near the warmer surfaces. The flow pattern for free convection is shown in Figure 1. Radiant interchange between tubing and radiation shield and casing are dependent surfaces have of each other, the emitting and and radiation shield, on the view the absorbing characteristics of the surfaces, and the difference between the fourth power of the surface temperatures.
Emulsion problem was being execerbated by scale and fines (sand) production. Therefore, a lot of efforts were dedicated to identification of scaled up piping bottlenecks, their removal (descaling) and putting together a scaling management plan for the future.
As field data are are collected over time, the computer-aided engine self-learns the reservoir dynamics and continually produces smart actions for control hardware in the field by performing dynamic optimization that satisfies short and long term project objectives and constraints.
Corrosion modeling estimated the general corrosion rate to be 0.89 mm/yr (35 mpy). This high corrosion rate would consume a typical 3 mm (120 [[mil]]s) corrosion allowance in less than 4 years. In addition, the high H2S concentration in the flowline made it likely that pitting corrosion would propagate at a higher rate than general corrosion ... the integrated team concluded that corrosion inhibituion would be required should carbon steel be selected for this application. A comprenhensive ab test program was conducted to ensure that corrosion inhibition would be able to mitigate both weight loss and [[pitting corrosion]] at an economic dosage rate.
* The model loops until pressure convergence is achieved.
* Predic uninhibited corrosion rate
* vertical well
* natural flowing or gas lifted wells
* Models that must be looped before the bottomhole pressure convergen is achieved:
** Temperature/Pressure Profile
** Phase Behavior Profile
** Flow Dynamics Profile
** Corrosion Rate Profile
In addition to the film elastricity, other factors that may affect foam stability are:
* surface shear viscosity
* bulk vicosity of the foaming liquid
* presence of particulate matter
Several factors influence both uninhibited corrosion rates in the system and the type of corrosion inhibition package used to mitigate the corrosion at each point in the production tubing:
1) Temperature of production fluids
2) Pressure of the system
3) Partial pressure of carbon dioxide
4) Amount of water
5) Liquid velocity
6) Amount of liquid hydrocarbon
7) Composition of liquid hydrocarbon
8) Velocity of hydrocarbon
9) Flow regime
10) Wall shear stress
Recent failures of high-strength corrosion-resistant alloys (CRAs) have been reported by the industry for high temperature application involving low-density calcium chl;oride packer fluids.
One failure was reported for S13Cr-95 ksi in an 11.0 ppg CaCl2 brine inhibited with ammonium bisulfite, ..., in a well with a BHT of about 300 degF. Failure analysis concluded that the presence of oxygen, CO2 and H2SD in the CaCl2 brine was the most likely cause for cracking. [...] Comparative testing demonstrated that cracking did not occur when CaBr2 or NaBr brine environments were used.
Failure of 22Cr - 130 Ksi in 11.0 ppg CaCl2 inhibited with ammonium bisulfite and sodium thiocyanete (NaSCN) at about 370 degF was reported and the cause of the failre was environmentally assited cracking.
Four of the five failures reported herein were observed for chrome metal in CaCl2 brine containing more than about 32% CaCl2 at temperatures aboove 300 degF.
Notably, the [[SFOS]] was succesful in controlling cracking factors, at least for the duration of the test. In non-acidic environments, sodium NaBr and CaBr2 were shown to be very effective in controlling cracking of the chrome materials studied.
[img[SPE-029666FieldDataInputReservoirSurveillance.png]]
[img[SPE083974FieldOperationHierarchy.png]]
[img[SPE090244FlowAssuranceCombinedDesignSurveillanceWorkflow.png]]
[img[SPE-090244FlowAssuranceDesignData.png]]
[img[SPE090244FlowAssuranceDesignWorkFlow.png]]
[img[SPE-090244FlowAssuranceSurveillanceData.png]]
p1,c2:
... including:
* precipitation and deposition of
** common organic solids (waxes and asphaltenes)
** hydrates
** inorganic scales
** less common solids: diamondoids
* Rheological problems like:
** high viscosity
** gelling
** adverse flow conditions leading to slugging
* crude oil chemistry and solids precipitation can also lead to:
** stable emulsion
** and foams
* Corrosion and erosion issues (not addressed in this paper).
If the thermal properties of the oil, completion and formation are known, it is possible to calculate the flow contribution from each reservoir using the temperature curve alone.
Foam Formation and Stability. Based upon experience,
foamers are dosed at 1000 to 4000 ppm based upon total
produced liquids in most cases. The lifetime of a foam is
controlled by a three-stage process consisting of
* lamella formation,
* thinning of the film, and
* rupturing of the film.
The lifetime of a foam has been experimentally determined to be
controlled by the rate limiting step of film thinning12.
Foams are colloidal systems containing a gas as the dispersed phase. The continuous phase may be either liquid or solid. Both solid and liquid foams posses the fundamental characteristic common to all irreversible colloids -a very large interfacial area. A liquid foam may be defined as a two-phase system consisting of a three-dimensional network of liquid lamellae (films) that keep the enclosed gas subdivided.
p1,c1:
Foamy-oil flow is a non-Darcy form of two-phase flow of gas and oil encountered in many Canadian and Venezuelan heavy-oil reservoirs during production under solution gas drive. Unlike normal two-phase flow, which requires a fluid phase to become continuous before it can flow, it involves flow of dispersed gas bubbles.
The term “foamy oil” originated from observations of stable foams in samples collected at the wellhead from many Canadian and Venezuelan heavy-oil wells that produce under solution-gas drive. The oil produced from these wells was in the form of thick oil-continuous foam.
Although there is still debate on the suitability of the phrase “foamy-oil flow” to describe the anomalous flow of the oil/gas mixtures in cold production of heavy oil, the expression has become a part of petroleum engineering terminology. To some, the term “foamy-oil flow” suggests two-phase flow in the form of oil-continuous foam, and they find it to be a misnomer because the actual microstructure may not resemble foam. To others, including this author, it only denotes the flow of a gas-in-oil dispersion,
which is what appears to be involved. However, the full meaning of the term is still evolving, and for now
it can be treated as a catchall phrase for representing the contribution of nonequilibrium processes in solution-gas drive in heavy-oil systems.
/***
|''Name:''|ForEachTiddlerPlugin|
|''Version:''|1.0.8 (2007-04-12)|
|''Source:''|http://tiddlywiki.abego-software.de/#ForEachTiddlerPlugin|
|''Author:''|UdoBorkowski (ub [at] abego-software [dot] de)|
|''Licence:''|[[BSD open source license (abego Software)|http://www.abego-software.de/legal/apl-v10.html]]|
|''Copyright:''|© 2005-2007 [[abego Software|http://www.abego-software.de]]|
|''TiddlyWiki:''|1.2.38+, 2.0|
|''Browser:''|Firefox 1.0.4+; Firefox 1.5; InternetExplorer 6.0|
!Description
Create customizable lists, tables etc. for your selections of tiddlers. Specify the tiddlers to include and their order through a powerful language.
''Syntax:''
|>|{{{<<}}}''forEachTiddler'' [''in'' //tiddlyWikiPath//] [''where'' //whereCondition//] [''sortBy'' //sortExpression// [''ascending'' //or// ''descending'']] [''script'' //scriptText//] [//action// [//actionParameters//]]{{{>>}}}|
|//tiddlyWikiPath//|The filepath to the TiddlyWiki the macro should work on. When missing the current TiddlyWiki is used.|
|//whereCondition//|(quoted) JavaScript boolean expression. May refer to the build-in variables {{{tiddler}}} and {{{context}}}.|
|//sortExpression//|(quoted) JavaScript expression returning "comparable" objects (using '{{{<}}}','{{{>}}}','{{{==}}}'. May refer to the build-in variables {{{tiddler}}} and {{{context}}}.|
|//scriptText//|(quoted) JavaScript text. Typically defines JavaScript functions that are called by the various JavaScript expressions (whereClause, sortClause, action arguments,...)|
|//action//|The action that should be performed on every selected tiddler, in the given order. By default the actions [[addToList|AddToListAction]] and [[write|WriteAction]] are supported. When no action is specified [[addToList|AddToListAction]] is used.|
|//actionParameters//|(action specific) parameters the action may refer while processing the tiddlers (see action descriptions for details). <<tiddler [[JavaScript in actionParameters]]>>|
|>|~~Syntax formatting: Keywords in ''bold'', optional parts in [...]. 'or' means that exactly one of the two alternatives must exist.~~|
See details see [[ForEachTiddlerMacro]] and [[ForEachTiddlerExamples]].
!Revision history
* v1.0.8 (2007-04-12)
** Adapted to latest TiddlyWiki 2.2 Beta importTiddlyWiki API (introduced with changeset 2004). TiddlyWiki 2.2 Beta builds prior to changeset 2004 are no longer supported (but TiddlyWiki 2.1 and earlier, of cause)
* v1.0.7 (2007-03-28)
** Also support "pre" formatted TiddlyWikis (introduced with TW 2.2) (when using "in" clause to work on external tiddlers)
* v1.0.6 (2006-09-16)
** Context provides "viewerTiddler", i.e. the tiddler used to view the macro. Most times this is equal to the "inTiddler", but when using the "tiddler" macro both may be different.
** Support "begin", "end" and "none" expressions in "write" action
* v1.0.5 (2006-02-05)
** Pass tiddler containing the macro with wikify, context object also holds reference to tiddler containing the macro ("inTiddler"). Thanks to SimonBaird.
** Support Firefox 1.5.0.1
** Internal
*** Make "JSLint" conform
*** "Only install once"
* v1.0.4 (2006-01-06)
** Support TiddlyWiki 2.0
* v1.0.3 (2005-12-22)
** Features:
*** Write output to a file supports multi-byte environments (Thanks to Bram Chen)
*** Provide API to access the forEachTiddler functionality directly through JavaScript (see getTiddlers and performMacro)
** Enhancements:
*** Improved error messages on InternetExplorer.
* v1.0.2 (2005-12-10)
** Features:
*** context object also holds reference to store (TiddlyWiki)
** Fixed Bugs:
*** ForEachTiddler 1.0.1 has broken support on win32 Opera 8.51 (Thanks to BrunoSabin for reporting)
* v1.0.1 (2005-12-08)
** Features:
*** Access tiddlers stored in separated TiddlyWikis through the "in" option. I.e. you are no longer limited to only work on the "current TiddlyWiki".
*** Write output to an external file using the "toFile" option of the "write" action. With this option you may write your customized tiddler exports.
*** Use the "script" section to define "helper" JavaScript functions etc. to be used in the various JavaScript expressions (whereClause, sortClause, action arguments,...).
*** Access and store context information for the current forEachTiddler invocation (through the build-in "context" object) .
*** Improved script evaluation (for where/sort clause and write scripts).
* v1.0.0 (2005-11-20)
** initial version
!Code
***/
//{{{
//============================================================================
//============================================================================
// ForEachTiddlerPlugin
//============================================================================
//============================================================================
// Only install once
if (!version.extensions.ForEachTiddlerPlugin) {
if (!window.abego) window.abego = {};
version.extensions.ForEachTiddlerPlugin = {
major: 1, minor: 0, revision: 8,
date: new Date(2007,3,12),
source: "http://tiddlywiki.abego-software.de/#ForEachTiddlerPlugin",
licence: "[[BSD open source license (abego Software)|http://www.abego-software.de/legal/apl-v10.html]]",
copyright: "Copyright (c) abego Software GmbH, 2005-2007 (www.abego-software.de)"
};
// For backward compatibility with TW 1.2.x
//
if (!TiddlyWiki.prototype.forEachTiddler) {
TiddlyWiki.prototype.forEachTiddler = function(callback) {
for(var t in this.tiddlers) {
callback.call(this,t,this.tiddlers[t]);
}
};
}
//============================================================================
// forEachTiddler Macro
//============================================================================
version.extensions.forEachTiddler = {
major: 1, minor: 0, revision: 8, date: new Date(2007,3,12), provider: "http://tiddlywiki.abego-software.de"};
// ---------------------------------------------------------------------------
// Configurations and constants
// ---------------------------------------------------------------------------
config.macros.forEachTiddler = {
// Standard Properties
label: "forEachTiddler",
prompt: "Perform actions on a (sorted) selection of tiddlers",
// actions
actions: {
addToList: {},
write: {}
}
};
// ---------------------------------------------------------------------------
// The forEachTiddler Macro Handler
// ---------------------------------------------------------------------------
config.macros.forEachTiddler.getContainingTiddler = function(e) {
while(e && !hasClass(e,"tiddler"))
e = e.parentNode;
var title = e ? e.getAttribute("tiddler") : null;
return title ? store.getTiddler(title) : null;
};
config.macros.forEachTiddler.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
// config.macros.forEachTiddler.traceMacroCall(place,macroName,params,wikifier,paramString,tiddler);
if (!tiddler) tiddler = config.macros.forEachTiddler.getContainingTiddler(place);
// --- Parsing ------------------------------------------
var i = 0; // index running over the params
// Parse the "in" clause
var tiddlyWikiPath = undefined;
if ((i < params.length) && params[i] == "in") {
i++;
if (i >= params.length) {
this.handleError(place, "TiddlyWiki path expected behind 'in'.");
return;
}
tiddlyWikiPath = this.paramEncode((i < params.length) ? params[i] : "");
i++;
}
// Parse the where clause
var whereClause ="true";
if ((i < params.length) && params[i] == "where") {
i++;
whereClause = this.paramEncode((i < params.length) ? params[i] : "");
i++;
}
// Parse the sort stuff
var sortClause = null;
var sortAscending = true;
if ((i < params.length) && params[i] == "sortBy") {
i++;
if (i >= params.length) {
this.handleError(place, "sortClause missing behind 'sortBy'.");
return;
}
sortClause = this.paramEncode(params[i]);
i++;
if ((i < params.length) && (params[i] == "ascending" || params[i] == "descending")) {
sortAscending = params[i] == "ascending";
i++;
}
}
// Parse the script
var scriptText = null;
if ((i < params.length) && params[i] == "script") {
i++;
scriptText = this.paramEncode((i < params.length) ? params[i] : "");
i++;
}
// Parse the action.
// When we are already at the end use the default action
var actionName = "addToList";
if (i < params.length) {
if (!config.macros.forEachTiddler.actions[params[i]]) {
this.handleError(place, "Unknown action '"+params[i]+"'.");
return;
} else {
actionName = params[i];
i++;
}
}
// Get the action parameter
// (the parsing is done inside the individual action implementation.)
var actionParameter = params.slice(i);
// --- Processing ------------------------------------------
try {
this.performMacro({
place: place,
inTiddler: tiddler,
whereClause: whereClause,
sortClause: sortClause,
sortAscending: sortAscending,
actionName: actionName,
actionParameter: actionParameter,
scriptText: scriptText,
tiddlyWikiPath: tiddlyWikiPath});
} catch (e) {
this.handleError(place, e);
}
};
// Returns an object with properties "tiddlers" and "context".
// tiddlers holds the (sorted) tiddlers selected by the parameter,
// context the context of the execution of the macro.
//
// The action is not yet performed.
//
// @parameter see performMacro
//
config.macros.forEachTiddler.getTiddlersAndContext = function(parameter) {
var context = config.macros.forEachTiddler.createContext(parameter.place, parameter.whereClause, parameter.sortClause, parameter.sortAscending, parameter.actionName, parameter.actionParameter, parameter.scriptText, parameter.tiddlyWikiPath, parameter.inTiddler);
var tiddlyWiki = parameter.tiddlyWikiPath ? this.loadTiddlyWiki(parameter.tiddlyWikiPath) : store;
context["tiddlyWiki"] = tiddlyWiki;
// Get the tiddlers, as defined by the whereClause
var tiddlers = this.findTiddlers(parameter.whereClause, context, tiddlyWiki);
context["tiddlers"] = tiddlers;
// Sort the tiddlers, when sorting is required.
if (parameter.sortClause) {
this.sortTiddlers(tiddlers, parameter.sortClause, parameter.sortAscending, context);
}
return {tiddlers: tiddlers, context: context};
};
// Returns the (sorted) tiddlers selected by the parameter.
//
// The action is not yet performed.
//
// @parameter see performMacro
//
config.macros.forEachTiddler.getTiddlers = function(parameter) {
return this.getTiddlersAndContext(parameter).tiddlers;
};
// Performs the macros with the given parameter.
//
// @param parameter holds the parameter of the macro as separate properties.
// The following properties are supported:
//
// place
// whereClause
// sortClause
// sortAscending
// actionName
// actionParameter
// scriptText
// tiddlyWikiPath
//
// All properties are optional.
// For most actions the place property must be defined.
//
config.macros.forEachTiddler.performMacro = function(parameter) {
var tiddlersAndContext = this.getTiddlersAndContext(parameter);
// Perform the action
var actionName = parameter.actionName ? parameter.actionName : "addToList";
var action = config.macros.forEachTiddler.actions[actionName];
if (!action) {
this.handleError(parameter.place, "Unknown action '"+actionName+"'.");
return;
}
var actionHandler = action.handler;
actionHandler(parameter.place, tiddlersAndContext.tiddlers, parameter.actionParameter, tiddlersAndContext.context);
};
// ---------------------------------------------------------------------------
// The actions
// ---------------------------------------------------------------------------
// Internal.
//
// --- The addToList Action -----------------------------------------------
//
config.macros.forEachTiddler.actions.addToList.handler = function(place, tiddlers, parameter, context) {
// Parse the parameter
var p = 0;
// Check for extra parameters
if (parameter.length > p) {
config.macros.forEachTiddler.createExtraParameterErrorElement(place, "addToList", parameter, p);
return;
}
// Perform the action.
var list = document.createElement("ul");
place.appendChild(list);
for (var i = 0; i < tiddlers.length; i++) {
var tiddler = tiddlers[i];
var listItem = document.createElement("li");
list.appendChild(listItem);
createTiddlyLink(listItem, tiddler.title, true);
}
};
abego.parseNamedParameter = function(name, parameter, i) {
var beginExpression = null;
if ((i < parameter.length) && parameter[i] == name) {
i++;
if (i >= parameter.length) {
throw "Missing text behind '%0'".format([name]);
}
return config.macros.forEachTiddler.paramEncode(parameter[i]);
}
return null;
}
// Internal.
//
// --- The write Action ---------------------------------------------------
//
config.macros.forEachTiddler.actions.write.handler = function(place, tiddlers, parameter, context) {
// Parse the parameter
var p = 0;
if (p >= parameter.length) {
this.handleError(place, "Missing expression behind 'write'.");
return;
}
var textExpression = config.macros.forEachTiddler.paramEncode(parameter[p]);
p++;
// Parse the "begin" option
var beginExpression = abego.parseNamedParameter("begin", parameter, p);
if (beginExpression !== null)
p += 2;
var endExpression = abego.parseNamedParameter("end", parameter, p);
if (endExpression !== null)
p += 2;
var noneExpression = abego.parseNamedParameter("none", parameter, p);
if (noneExpression !== null)
p += 2;
// Parse the "toFile" option
var filename = null;
var lineSeparator = undefined;
if ((p < parameter.length) && parameter[p] == "toFile") {
p++;
if (p >= parameter.length) {
this.handleError(place, "Filename expected behind 'toFile' of 'write' action.");
return;
}
filename = config.macros.forEachTiddler.getLocalPath(config.macros.forEachTiddler.paramEncode(parameter[p]));
p++;
if ((p < parameter.length) && parameter[p] == "withLineSeparator") {
p++;
if (p >= parameter.length) {
this.handleError(place, "Line separator text expected behind 'withLineSeparator' of 'write' action.");
return;
}
lineSeparator = config.macros.forEachTiddler.paramEncode(parameter[p]);
p++;
}
}
// Check for extra parameters
if (parameter.length > p) {
config.macros.forEachTiddler.createExtraParameterErrorElement(place, "write", parameter, p);
return;
}
// Perform the action.
var func = config.macros.forEachTiddler.getEvalTiddlerFunction(textExpression, context);
var count = tiddlers.length;
var text = "";
if (count > 0 && beginExpression)
text += config.macros.forEachTiddler.getEvalTiddlerFunction(beginExpression, context)(undefined, context, count, undefined);
for (var i = 0; i < count; i++) {
var tiddler = tiddlers[i];
text += func(tiddler, context, count, i);
}
if (count > 0 && endExpression)
text += config.macros.forEachTiddler.getEvalTiddlerFunction(endExpression, context)(undefined, context, count, undefined);
if (count == 0 && noneExpression)
text += config.macros.forEachTiddler.getEvalTiddlerFunction(noneExpression, context)(undefined, context, count, undefined);
if (filename) {
if (lineSeparator !== undefined) {
lineSeparator = lineSeparator.replace(/\\n/mg, "\n").replace(/\\r/mg, "\r");
text = text.replace(/\n/mg,lineSeparator);
}
saveFile(filename, convertUnicodeToUTF8(text));
} else {
var wrapper = createTiddlyElement(place, "span");
wikify(text, wrapper, null/* highlightRegExp */, context.inTiddler);
}
};
// ---------------------------------------------------------------------------
// Helpers
// ---------------------------------------------------------------------------
// Internal.
//
config.macros.forEachTiddler.createContext = function(placeParam, whereClauseParam, sortClauseParam, sortAscendingParam, actionNameParam, actionParameterParam, scriptText, tiddlyWikiPathParam, inTiddlerParam) {
return {
place : placeParam,
whereClause : whereClauseParam,
sortClause : sortClauseParam,
sortAscending : sortAscendingParam,
script : scriptText,
actionName : actionNameParam,
actionParameter : actionParameterParam,
tiddlyWikiPath : tiddlyWikiPathParam,
inTiddler : inTiddlerParam, // the tiddler containing the <<forEachTiddler ...>> macro call.
viewerTiddler : config.macros.forEachTiddler.getContainingTiddler(placeParam) // the tiddler showing the forEachTiddler result
};
};
// Internal.
//
// Returns a TiddlyWiki with the tiddlers loaded from the TiddlyWiki of
// the given path.
//
config.macros.forEachTiddler.loadTiddlyWiki = function(path, idPrefix) {
if (!idPrefix) {
idPrefix = "store";
}
var lenPrefix = idPrefix.length;
// Read the content of the given file
var content = loadFile(this.getLocalPath(path));
if(content === null) {
throw "TiddlyWiki '"+path+"' not found.";
}
var tiddlyWiki = new TiddlyWiki();
// Starting with TW 2.2 there is a helper function to import the tiddlers
if (tiddlyWiki.importTiddlyWiki) {
if (!tiddlyWiki.importTiddlyWiki(content))
throw "File '"+path+"' is not a TiddlyWiki.";
tiddlyWiki.dirty = false;
return tiddlyWiki;
}
// The legacy code, for TW < 2.2
// Locate the storeArea div's
var posOpeningDiv = content.indexOf(startSaveArea);
var posClosingDiv = content.lastIndexOf(endSaveArea);
if((posOpeningDiv == -1) || (posClosingDiv == -1)) {
throw "File '"+path+"' is not a TiddlyWiki.";
}
var storageText = content.substr(posOpeningDiv + startSaveArea.length, posClosingDiv);
// Create a "div" element that contains the storage text
var myStorageDiv = document.createElement("div");
myStorageDiv.innerHTML = storageText;
myStorageDiv.normalize();
// Create all tiddlers in a new TiddlyWiki
// (following code is modified copy of TiddlyWiki.prototype.loadFromDiv)
var store = myStorageDiv.childNodes;
for(var t = 0; t < store.length; t++) {
var e = store[t];
var title = null;
if(e.getAttribute)
title = e.getAttribute("tiddler");
if(!title && e.id && e.id.substr(0,lenPrefix) == idPrefix)
title = e.id.substr(lenPrefix);
if(title && title !== "") {
var tiddler = tiddlyWiki.createTiddler(title);
tiddler.loadFromDiv(e,title);
}
}
tiddlyWiki.dirty = false;
return tiddlyWiki;
};
// Internal.
//
// Returns a function that has a function body returning the given javaScriptExpression.
// The function has the parameters:
//
// (tiddler, context, count, index)
//
config.macros.forEachTiddler.getEvalTiddlerFunction = function (javaScriptExpression, context) {
var script = context["script"];
var functionText = "var theFunction = function(tiddler, context, count, index) { return "+javaScriptExpression+"}";
var fullText = (script ? script+";" : "")+functionText+";theFunction;";
return eval(fullText);
};
// Internal.
//
config.macros.forEachTiddler.findTiddlers = function(whereClause, context, tiddlyWiki) {
var result = [];
var func = config.macros.forEachTiddler.getEvalTiddlerFunction(whereClause, context);
tiddlyWiki.forEachTiddler(function(title,tiddler) {
if (func(tiddler, context, undefined, undefined)) {
result.push(tiddler);
}
});
return result;
};
// Internal.
//
config.macros.forEachTiddler.createExtraParameterErrorElement = function(place, actionName, parameter, firstUnusedIndex) {
var message = "Extra parameter behind '"+actionName+"':";
for (var i = firstUnusedIndex; i < parameter.length; i++) {
message += " "+parameter[i];
}
this.handleError(place, message);
};
// Internal.
//
config.macros.forEachTiddler.sortAscending = function(tiddlerA, tiddlerB) {
var result =
(tiddlerA.forEachTiddlerSortValue == tiddlerB.forEachTiddlerSortValue)
? 0
: (tiddlerA.forEachTiddlerSortValue < tiddlerB.forEachTiddlerSortValue)
? -1
: +1;
return result;
};
// Internal.
//
config.macros.forEachTiddler.sortDescending = function(tiddlerA, tiddlerB) {
var result =
(tiddlerA.forEachTiddlerSortValue == tiddlerB.forEachTiddlerSortValue)
? 0
: (tiddlerA.forEachTiddlerSortValue < tiddlerB.forEachTiddlerSortValue)
? +1
: -1;
return result;
};
// Internal.
//
config.macros.forEachTiddler.sortTiddlers = function(tiddlers, sortClause, ascending, context) {
// To avoid evaluating the sortClause whenever two items are compared
// we pre-calculate the sortValue for every item in the array and store it in a
// temporary property ("forEachTiddlerSortValue") of the tiddlers.
var func = config.macros.forEachTiddler.getEvalTiddlerFunction(sortClause, context);
var count = tiddlers.length;
var i;
for (i = 0; i < count; i++) {
var tiddler = tiddlers[i];
tiddler.forEachTiddlerSortValue = func(tiddler,context, undefined, undefined);
}
// Do the sorting
tiddlers.sort(ascending ? this.sortAscending : this.sortDescending);
// Delete the temporary property that holds the sortValue.
for (i = 0; i < tiddlers.length; i++) {
delete tiddlers[i].forEachTiddlerSortValue;
}
};
// Internal.
//
config.macros.forEachTiddler.trace = function(message) {
displayMessage(message);
};
// Internal.
//
config.macros.forEachTiddler.traceMacroCall = function(place,macroName,params) {
var message ="<<"+macroName;
for (var i = 0; i < params.length; i++) {
message += " "+params[i];
}
message += ">>";
displayMessage(message);
};
// Internal.
//
// Creates an element that holds an error message
//
config.macros.forEachTiddler.createErrorElement = function(place, exception) {
var message = (exception.description) ? exception.description : exception.toString();
return createTiddlyElement(place,"span",null,"forEachTiddlerError","<<forEachTiddler ...>>: "+message);
};
// Internal.
//
// @param place [may be null]
//
config.macros.forEachTiddler.handleError = function(place, exception) {
if (place) {
this.createErrorElement(place, exception);
} else {
throw exception;
}
};
// Internal.
//
// Encodes the given string.
//
// Replaces
// "$))" to ">>"
// "$)" to ">"
//
config.macros.forEachTiddler.paramEncode = function(s) {
var reGTGT = new RegExp("\\$\\)\\)","mg");
var reGT = new RegExp("\\$\\)","mg");
return s.replace(reGTGT, ">>").replace(reGT, ">");
};
// Internal.
//
// Returns the given original path (that is a file path, starting with "file:")
// as a path to a local file, in the systems native file format.
//
// Location information in the originalPath (i.e. the "#" and stuff following)
// is stripped.
//
config.macros.forEachTiddler.getLocalPath = function(originalPath) {
// Remove any location part of the URL
var hashPos = originalPath.indexOf("#");
if(hashPos != -1)
originalPath = originalPath.substr(0,hashPos);
// Convert to a native file format assuming
// "file:///x:/path/path/path..." - pc local file --> "x:\path\path\path..."
// "file://///server/share/path/path/path..." - FireFox pc network file --> "\\server\share\path\path\path..."
// "file:///path/path/path..." - mac/unix local file --> "/path/path/path..."
// "file://server/share/path/path/path..." - pc network file --> "\\server\share\path\path\path..."
var localPath;
if(originalPath.charAt(9) == ":") // pc local file
localPath = unescape(originalPath.substr(8)).replace(new RegExp("/","g"),"\\");
else if(originalPath.indexOf("file://///") === 0) // FireFox pc network file
localPath = "\\\\" + unescape(originalPath.substr(10)).replace(new RegExp("/","g"),"\\");
else if(originalPath.indexOf("file:///") === 0) // mac/unix local file
localPath = unescape(originalPath.substr(7));
else if(originalPath.indexOf("file:/") === 0) // mac/unix local file
localPath = unescape(originalPath.substr(5));
else // pc network file
localPath = "\\\\" + unescape(originalPath.substr(7)).replace(new RegExp("/","g"),"\\");
return localPath;
};
// ---------------------------------------------------------------------------
// Stylesheet Extensions (may be overridden by local StyleSheet)
// ---------------------------------------------------------------------------
//
setStylesheet(
".forEachTiddlerError{color: #ffffff;background-color: #880000;}",
"forEachTiddler");
//============================================================================
// End of forEachTiddler Macro
//============================================================================
//============================================================================
// String.startsWith Function
//============================================================================
//
// Returns true if the string starts with the given prefix, false otherwise.
//
version.extensions["String.startsWith"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};
//
String.prototype.startsWith = function(prefix) {
var n = prefix.length;
return (this.length >= n) && (this.slice(0, n) == prefix);
};
//============================================================================
// String.endsWith Function
//============================================================================
//
// Returns true if the string ends with the given suffix, false otherwise.
//
version.extensions["String.endsWith"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};
//
String.prototype.endsWith = function(suffix) {
var n = suffix.length;
return (this.length >= n) && (this.right(n) == suffix);
};
//============================================================================
// String.contains Function
//============================================================================
//
// Returns true when the string contains the given substring, false otherwise.
//
version.extensions["String.contains"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};
//
String.prototype.contains = function(substring) {
return this.indexOf(substring) >= 0;
};
//============================================================================
// Array.indexOf Function
//============================================================================
//
// Returns the index of the first occurance of the given item in the array or
// -1 when no such item exists.
//
// @param item [may be null]
//
version.extensions["Array.indexOf"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};
//
Array.prototype.indexOf = function(item) {
for (var i = 0; i < this.length; i++) {
if (this[i] == item) {
return i;
}
}
return -1;
};
//============================================================================
// Array.contains Function
//============================================================================
//
// Returns true when the array contains the given item, otherwise false.
//
// @param item [may be null]
//
version.extensions["Array.contains"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};
//
Array.prototype.contains = function(item) {
return (this.indexOf(item) >= 0);
};
//============================================================================
// Array.containsAny Function
//============================================================================
//
// Returns true when the array contains at least one of the elements
// of the item. Otherwise (or when items contains no elements) false is returned.
//
version.extensions["Array.containsAny"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};
//
Array.prototype.containsAny = function(items) {
for(var i = 0; i < items.length; i++) {
if (this.contains(items[i])) {
return true;
}
}
return false;
};
//============================================================================
// Array.containsAll Function
//============================================================================
//
// Returns true when the array contains all the items, otherwise false.
//
// When items is null false is returned (even if the array contains a null).
//
// @param items [may be null]
//
version.extensions["Array.containsAll"] = {major: 1, minor: 0, revision: 0, date: new Date(2005,11,20), provider: "http://tiddlywiki.abego-software.de"};
//
Array.prototype.containsAll = function(items) {
for(var i = 0; i < items.length; i++) {
if (!this.contains(items[i])) {
return false;
}
}
return true;
};
} // of "install only once"
// Used Globals (for JSLint) ==============
// ... DOM
/*global document */
// ... TiddlyWiki Core
/*global convertUnicodeToUTF8, createTiddlyElement, createTiddlyLink,
displayMessage, endSaveArea, hasClass, loadFile, saveFile,
startSaveArea, store, wikify */
//}}}
/***
!Licence and Copyright
Copyright (c) abego Software ~GmbH, 2005 ([[www.abego-software.de|http://www.abego-software.de]])
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
Neither the name of abego Software nor the names of its contributors may be
used to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
***/
.borderlessL, .borderlessL table, .borderlessL td, .borderlessL tr, .borderlessL th, .borderlessL tbody { border:0 !important; margin:0 !important; padding:0 !important; td.vertical-align:top !important;margin-left: 0 !important; margin-right: auto !important; padding:7px !important;}
/***
<<checkForDataTiddlerPlugin>>
|''Name:''|FormTiddlerPlugin|
|''Version:''|1.0.5 (2006-02-24)|
|''Source:''|http://tiddlywiki.abego-software.de/#FormTiddlerPlugin|
|''Author:''|UdoBorkowski (ub [at] abego-software [dot] de)|
|''Licence:''|[[BSD open source license]]|
|''Macros:''|formTiddler, checkForDataTiddlerPlugin, newTiddlerWithForm|
|''Requires:''|DataTiddlerPlugin|
|''TiddlyWiki:''|1.2.38+, 2.0|
|''Browser:''|Firefox 1.0.4+; InternetExplorer 6.0|
!Description
Use form-based tiddlers to enter your tiddler data using text fields, listboxes, checkboxes etc. (All standard HTML Form input elements supported).
''Syntax:''
|>|{{{<<}}}''formTiddler'' //tiddlerName//{{{>>}}}|
|//tiddlerName//|The name of the FormTemplate tiddler to be used to edit the data of the tiddler containing the macro.|
|>|{{{<<}}}''newTiddlerWithForm'' //formTemplateName// //buttonLabel// [//titleExpression// [''askUser'']] {{{>>}}}|
|//formTemplateName//|The name of the tiddler that defines the form the new tiddler should use.|
|//buttonLabel//|The label of the button|
|//titleExpression//|A (quoted) JavaScript String expression that defines the title (/name) of the new tiddler.|
|''askUser''|Typically the user is not asked for the title when a title is specified (and not yet used). When ''askUser'' is given the user will be asked in any case. This may be used when the calculated title is just a suggestion that must be confirmed by the user|
|>|~~Syntax formatting: Keywords in ''bold'', optional parts in [...]. 'or' means that exactly one of the two alternatives must exist.~~|
For details and how to use the macros see the [[introduction|FormTiddler Introduction]] and the [[examples|FormTiddler Examples]].
!Revision history
* v1.0.5 (2006-02-24)
** Removed "debugger;" instruction
* v1.0.4 (2006-02-07)
** Bug: On IE no data is written to data section when field values changed (thanks to KenGirard for reporting)
* v1.0.3 (2006-02-05)
** Bug: {{{"No form template specified in <<formTiddler>>"}}} when using formTiddler macro on InternetExplorer (thanks to KenGirard for reporting)
* v1.0.2 (2006-01-06)
** Support TiddlyWiki 2.0
* v1.0.1 (2005-12-22)
** Features:
*** Support InternetExplorer
*** Added newTiddlerWithForm Macro
* v1.0.0 (2005-12-14)
** initial version
!Code
***/
//{{{
//============================================================================
//============================================================================
// FormTiddlerPlugin
//============================================================================
//============================================================================
version.extensions.FormTiddlerPlugin = {
major: 1, minor: 0, revision: 5,
date: new Date(2006, 2, 24),
type: 'plugin',
source: "http://tiddlywiki.abego-software.de/#FormTiddlerPlugin"
};
// For backward compatibility with v1.2.x
//
if (!window.story) window.story=window;
if (!TiddlyWiki.prototype.getTiddler) TiddlyWiki.prototype.getTiddler = function(title) { return t = this.tiddlers[title]; return (t != undefined && t instanceof Tiddler) ? t : null; }
//============================================================================
// formTiddler Macro
//============================================================================
// -------------------------------------------------------------------------------
// Configurations and constants
// -------------------------------------------------------------------------------
config.macros.formTiddler = {
// Standard Properties
label: "formTiddler",
version: {major: 1, minor: 0, revision: 4, date: new Date(2006, 2, 7)},
prompt: "Edit tiddler data using forms",
// Define the "setters" that set the values of INPUT elements of a given type
// (must match the corresponding "getter")
setter: {
button: function(e, value) {/*contains no data */ },
checkbox: function(e, value) {e.checked = value;},
file: function(e, value) {try {e.value = value;} catch(e) {/* ignore, possibly security error*/}},
hidden: function(e, value) {e.value = value;},
password: function(e, value) {e.value = value;},
radio: function(e, value) {e.checked = (e.value == value);},
reset: function(e, value) {/*contains no data */ },
"select-one": function(e, value) {config.macros.formTiddler.setSelectOneValue(e,value);},
"select-multiple": function(e, value) {config.macros.formTiddler.setSelectMultipleValue(e,value);},
submit: function(e, value) {/*contains no data */},
text: function(e, value) {e.value = value;},
textarea: function(e, value) {e.value = value;}
},
// Define the "getters" that return the value of INPUT elements of a given type
// Return undefined to not store any data.
getter: {
button: function(e, value) {return undefined;},
checkbox: function(e, value) {return e.checked;},
file: function(e, value) {return e.value;},
hidden: function(e, value) {return e.value;},
password: function(e, value) {return e.value;},
radio: function(e, value) {return e.checked ? e.value : undefined;},
reset: function(e, value) {return undefined;},
"select-one": function(e, value) {return config.macros.formTiddler.getSelectOneValue(e);},
"select-multiple": function(e, value) {return config.macros.formTiddler.getSelectMultipleValue(e);},
submit: function(e, value) {return undefined;},
text: function(e, value) {return e.value;},
textarea: function(e, value) {return e.value;}
}
};
// -------------------------------------------------------------------------------
// The formTiddler Macro Handler
// -------------------------------------------------------------------------------
config.macros.formTiddler.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
if (!config.macros.formTiddler.checkForExtensions(place, macroName)) {
return;
}
// --- Parsing ------------------------------------------
var i = 0; // index running over the params
// get the name of the form template tiddler
var formTemplateName = undefined;
if (i < params.length) {
formTemplateName = params[i];
i++;
}
if (!formTemplateName) {
config.macros.formTiddler.createErrorElement(place, "No form template specified in <<" + macroName + ">>.");
return;
}
// --- Processing ------------------------------------------
// Get the form template text.
// (This contains the INPUT elements for the form.)
var formTemplateTiddler = store.getTiddler(formTemplateName);
if (!formTemplateTiddler) {
config.macros.formTiddler.createErrorElement(place, "Form template '" + formTemplateName + "' not found.");
return;
}
var templateText = formTemplateTiddler.text;
if(!templateText) {
// Shortcut: when template text is empty we do nothing.
return;
}
// Get the name of the tiddler containing this "formTiddler" macro
// (i.e. the tiddler, that will be edited and that contains the data)
var tiddlerName = config.macros.formTiddler.getContainingTiddlerName(place);
// Append a "form" element.
var formName = "form"+formTemplateName+"__"+tiddlerName;
var e = document.createElement("form");
e.setAttribute("name", formName);
place.appendChild(e);
// "Embed" the elements defined by the templateText (i.e. the INPUT elements)
// into the "form" element we just created
wikify(templateText, e);
// Initialize the INPUT elements.
config.macros.formTiddler.initValuesAndHandlersInFormElements(formName, DataTiddler.getDataObject(tiddlerName));
}
// -------------------------------------------------------------------------------
// Form Data Access
// -------------------------------------------------------------------------------
// Internal.
//
// Initialize the INPUT elements of the form with the values of their "matching"
// data fields in the tiddler. Also setup the onChange handler to ensure that
// changes in the INPUT elements are stored in the tiddler's data.
//
config.macros.formTiddler.initValuesAndHandlersInFormElements = function(formName, data) {
// config.macros.formTiddler.trace("initValuesAndHandlersInFormElements(formName="+formName+", data="+data+")");
// find the form
var form = config.macros.formTiddler.findForm(formName);
if (!form) {
return;
}
try {
var elems = form.elements;
for (var i = 0; i < elems.length; i++) {
var c = elems[i];
var setter = config.macros.formTiddler.setter[c.type];
if (setter) {
var value = data[c.name];
if (value != null) {
setter(c, value);
}
c.onchange = onFormTiddlerChange;
} else {
config.macros.formTiddler.displayFormTiddlerError("No setter defined for INPUT element of type '"+c.type+"'. (Element '"+c.name+"' in form '"+formName+"')");
}
}
} catch(e) {
config.macros.formTiddler.displayFormTiddlerError("Error when updating elements with new formData. "+e);
}
}
// Internal.
//
// @return [may be null]
//
config.macros.formTiddler.findForm = function(formName) {
// We must manually iterate through the document's forms, since
// IE does not support the "document[formName]" approach
var forms = window.document.forms;
for (var i = 0; i < forms.length; i++) {
var form = forms[i];
if (form.name == formName) {
return form;
}
}
return null;
}
// Internal.
//
config.macros.formTiddler.setSelectOneValue = function(element,value) {
var n = element.options.length;
for (var i = 0; i < n; i++) {
element.options[i].selected = element.options[i].value == value;
}
}
// Internal.
//
config.macros.formTiddler.setSelectMultipleValue = function(element,value) {
var values = {};
for (var i = 0; i < value.length; i++) {
values[value[i]] = true;
}
var n = element.length;
for (var i = 0; i < n; i++) {
element.options[i].selected = !(!values[element.options[i].value]);
}
}
// Internal.
//
config.macros.formTiddler.getSelectOneValue = function(element) {
var i = element.selectedIndex;
return (i >= 0) ? element.options[i].value : null;
}
// Internal.
//
config.macros.formTiddler.getSelectMultipleValue = function(element) {
var values = [];
var n = element.length;
for (var i = 0; i < n; i++) {
if (element.options[i].selected) {
values.push(element.options[i].value);
}
}
return values;
}
// -------------------------------------------------------------------------------
// Helpers
// -------------------------------------------------------------------------------
// Internal.
//
config.macros.formTiddler.checkForExtensions = function(place,macroName) {
if (!version.extensions.DataTiddlerPlugin) {
config.macros.formTiddler.createErrorElement(place, "<<" + macroName + ">> requires the DataTiddlerPlugin. (You can get it from http://tiddlywiki.abego-software.de/#DataTiddlerPlugin)");
return false;
}
return true;
}
// Internal.
//
// Displays a trace message in the "TiddlyWiki" message pane.
// (used for debugging)
//
config.macros.formTiddler.trace = function(s) {
displayMessage("Trace: "+s);
}
// Internal.
//
// Display some error message in the "TiddlyWiki" message pane.
//
config.macros.formTiddler.displayFormTiddlerError = function(s) {
alert("FormTiddlerPlugin Error: "+s);
}
// Internal.
//
// Creates an element that holds an error message
//
config.macros.formTiddler.createErrorElement = function(place, message) {
return createTiddlyElement(place,"span",null,"formTiddlerError",message);
}
// Internal.
//
// Returns the name of the tiddler containing the given element.
//
config.macros.formTiddler.getContainingTiddlerName = function(element) {
return story.findContainingTiddler(element).id.substr(7);
}
// -------------------------------------------------------------------------------
// Event Handlers
// -------------------------------------------------------------------------------
// This function must be called by the INPUT elements whenever their
// data changes. Typically this is done through an "onChange" handler.
//
function onFormTiddlerChange (e) {
// config.macros.formTiddler.trace("onFormTiddlerChange "+e);
if (!e) var e = window.event;
var target = resolveTarget(e);
var tiddlerName = config.macros.formTiddler.getContainingTiddlerName(target);
var getter = config.macros.formTiddler.getter[target.type];
if (getter) {
var value = getter(target);
DataTiddler.setData(tiddlerName, target.name, value);
} else {
config.macros.formTiddler.displayFormTiddlerError("No getter defined for INPUT element of type '"+target.type+"'. (Element '"+target.name+"' used in tiddler '"+tiddlerName+"')");
}
}
// ensure that the function can be used in HTML event handler
window.onFormTiddlerChange = onFormTiddlerChange;
// -------------------------------------------------------------------------------
// Stylesheet Extensions (may be overridden by local StyleSheet)
// -------------------------------------------------------------------------------
setStylesheet(
".formTiddlerError{color: #ffffff;background-color: #880000;}",
"formTiddler");
//============================================================================
// checkForDataTiddlerPlugin Macro
//============================================================================
config.macros.checkForDataTiddlerPlugin = {
// Standard Properties
label: "checkForDataTiddlerPlugin",
version: {major: 1, minor: 0, revision: 0, date: new Date(2005, 12, 14)},
prompt: "Check if the DataTiddlerPlugin exists"
}
config.macros.checkForDataTiddlerPlugin.handler = function(place,macroName,params) {
config.macros.formTiddler.checkForExtensions(place, config.macros.formTiddler.label);
}
//============================================================================
// newTiddlerWithForm Macro
//============================================================================
config.macros.newTiddlerWithForm = {
// Standard Properties
label: "newTiddlerWithForm",
version: {major: 1, minor: 0, revision: 1, date: new Date(2006, 1, 6)},
prompt: "Creates a new Tiddler with a <<formTiddler ...>> macro"
}
config.macros.newTiddlerWithForm.handler = function(place,macroName,params) {
// --- Parsing ------------------------------------------
var i = 0; // index running over the params
// get the name of the form template tiddler
var formTemplateName = undefined;
if (i < params.length) {
formTemplateName = params[i];
i++;
}
if (!formTemplateName) {
config.macros.formTiddler.createErrorElement(place, "No form template specified in <<" + macroName + ">>.");
return;
}
// get the button label
var buttonLabel = undefined;
if (i < params.length) {
buttonLabel = params[i];
i++;
}
if (!buttonLabel) {
config.macros.formTiddler.createErrorElement(place, "No button label specified in <<" + macroName + ">>.");
return;
}
// get the (optional) tiddlerName script and "askUser"
var tiddlerNameScript = undefined;
var askUser = false;
if (i < params.length) {
tiddlerNameScript = params[i];
i++;
if (i < params.length && params[i] == "askUser") {
askUser = true;
i++;
}
}
// --- Processing ------------------------------------------
if(!readOnly) {
var onClick = function() {
var tiddlerName;
if (tiddlerNameScript) {
try {
tiddlerName = eval(tiddlerNameScript);
} catch (ex) {
}
}
if (!tiddlerName || askUser) {
tiddlerName = prompt("Please specify a tiddler name.", askUser ? tiddlerName : "");
}
while (tiddlerName && store.getTiddler(tiddlerName)) {
tiddlerName = prompt("A tiddler named '"+tiddlerName+"' already exists.\n\n"+"Please specify a tiddler name.", tiddlerName);
}
// tiddlerName is either null (user canceled) or a name that is not yet in the store.
if (tiddlerName) {
var body = "<<formTiddler [["+formTemplateName+"]]>>";
var tags = [];
store.saveTiddler(tiddlerName,tiddlerName,body,config.options.txtUserName,new Date(),tags);
story.displayTiddler(null,tiddlerName,1);
}
}
createTiddlyButton(place,buttonLabel,buttonLabel,onClick);
}
}
//}}}
/***
!Licence and Copyright
Copyright (c) abego Software ~GmbH, 2005 ([[www.abego-software.de|http://www.abego-software.de]])
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
Neither the name of abego Software nor the names of its contributors may be
used to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
***/
Holst and Flock included frictional losses and kinetic energy effects. They concluded that the effect of frictional loss on heat loss was relatively minor. In addition, the heat loss from the tubing was reduced for relatively large values of formation thermal conductivity with the addition of a second concentric tubing string.
A Gamma Ray transmission technique was used to determine liquid levels and density profiles and also to establish the presence of foam in vessels and pipework.
Scale Detection Efforts & Thorough Descaling Campaign. Gamma ray scanning technique was used in order to identfy some scaled up spots which could not be observed visually during shutdowns. Fig 10 & 11 show schematics of some gamma ray inspection points. However, there were some limitations of this gamma ray tool (Fig.12). It does not work near bends and a minimum straight & uniform run of 0.5 ft is required for a meaningful measurement. Also it needs a minimum 12 inches clearance around the point of inspection.
To get started with this blank TiddlyWiki, you'll need to modify the following tiddlers:
* SiteTitle & SiteSubtitle: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
* MainMenu: The menu (usually on the left)
* DefaultTiddlers: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened
You'll also need to enter your username for signing your edits: <<option txtUserName>>
See also [[MPTW]].
[img[CasingTemperatureYield.png]]
For H2S containing environments, carbon steel materials are selected for sour service as per ISO Standard 15156.
The corrosion reaction between steel and hydrogen sulphide generates hydrogen in the atomic state which may easily diffuse into the steel. The presence of hydrogen in steel may create different defect such as:
* Sulphide Stress Cracking ([[SSCC]])
* Hydrogen Blistering ([[HB]]), which can lead to
* Stepwise Cracking ([[SWC]])
[[Hydrogen Blistering and Stepwise Cracking]] are related phenomena connected to diffusion of hydrogen into the steel.
/***
|Name:|HideWhenPlugin|
|Description:|Allows conditional inclusion/exclusion in templates|
|Version:|3.1 ($Rev: 3919 $)|
|Date:|$Date: 2008-03-13 02:03:12 +1000 (Thu, 13 Mar 2008) $|
|Source:|http://mptw.tiddlyspot.com/#HideWhenPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
For use in ViewTemplate and EditTemplate. Example usage:
{{{<div macro="showWhenTagged Task">[[TaskToolbar]]</div>}}}
{{{<div macro="showWhen tiddler.modifier == 'BartSimpson'"><img src="bart.gif"/></div>}}}
***/
//{{{
window.hideWhenLastTest = false;
window.removeElementWhen = function(test,place) {
window.hideWhenLastTest = test;
if (test) {
removeChildren(place);
place.parentNode.removeChild(place);
}
};
merge(config.macros,{
hideWhen: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( eval(paramString), place);
}},
showWhen: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( !eval(paramString), place);
}},
hideWhenTagged: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( tiddler.tags.containsAll(params), place);
}},
showWhenTagged: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( !tiddler.tags.containsAll(params), place);
}},
hideWhenTaggedAny: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( tiddler.tags.containsAny(params), place);
}},
showWhenTaggedAny: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( !tiddler.tags.containsAny(params), place);
}},
hideWhenTaggedAll: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( tiddler.tags.containsAll(params), place);
}},
showWhenTaggedAll: { handler: function (place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( !tiddler.tags.containsAll(params), place);
}},
hideWhenExists: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( store.tiddlerExists(params[0]) || store.isShadowTiddler(params[0]), place);
}},
showWhenExists: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( !(store.tiddlerExists(params[0]) || store.isShadowTiddler(params[0])), place);
}},
hideWhenTitleIs: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( tiddler.title == params[0], place);
}},
showWhenTitleIs: { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( tiddler.title != params[0], place);
}},
'else': { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
removeElementWhen( !window.hideWhenLastTest, place);
}}
});
//}}}
|UploadUserName:||
|UploadStoreUrl:|http://thesmartfield.com/tw/papers/store.php|
|UploadDir:|.|
|UploadFilename:|index.html|
|UploadBackupDir:|backup|
!Usefull url for your site
*http://thesmartfield.com/tw/papers/backup : List of backup files
*http://thesmartfield.com/tw/papers/download.php : to download thisTiddlyWiki
*http://thesmartfield.com/tw/papers/index.xml : your RSSFeed
*http://thesmartfield.com/tw/papers/news.php : to display your RSSFeed
!Access and change data
*http://thesmartfield.com/tw/papers/#Site : Site properties
*http://thesmartfield.com/tw/papers/#User : User properties
!More Information on TiddlyHome
*http://thesmartfield.com/tw/papers/ for your hosting service
*http://thesmartfield.com/tw/papers/ for BidiX's TiddlyHome Package
Hydrogen Blistering and Stepwise Cracking are related phenomena connected to diffusion of hydrogen into the steel. In connection with elongated non-metallic inclusions in the steel, hydrogen gas (H2) is formed and due to high gas pressure will cause cracking in the steel. The cracks may be connected in a ''stepwise'' manner to pass through the pipe.
The resistance of hydropgen blistering is governed by the cleanliness of the steel.
The strength level of the steel is not considered to be an important parameter. This means that to limit the hardness of HRC 22 will not reduce the susceptibility to hydrogen blistering.
Hydrogen is a product of the corrosion reaction and can be measured by a hydrogen probe or hydrogen patch mounted in the plant. Atomic hydrogen diffuses through metals and it can be combined to molecular hydrogen in a separate chamber. The pressure increase can be an indication of the corroion rate.
Although the principle is, experience indicates that this tyoe if equipment is not without problems. Many operators have little confidence in the hydrogen probes for hydrocarbon production.
http://thesmartfield.com/images/tw-papers/
/***
|Name|ImagePathPlugin|
|Source|http://www.TiddlyTools.com/#ImagePathPlugin|
|Version|0.7.1|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <<br>>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin,formatter|
|Requires||
|Overrides|'image' formatter|
|Description|Tell TiddlyWiki where to look for image files. Permits multiple 'fallback' locations|
|Status|ALPHA - initial development/testing only - may be unstable - do not distribute|
!!!!!Usage
<<<
This plugin adds "resolvePath()" fallback processing to the {{{[img[...]]}}} formatter's handler, so that local image file references can be successfully resolved, even if the files cannot be located on the local filesystem.
The plugin tries alternative file "paths" that are listed, one per line, in an optional tiddler, [[ImagePathList]]. Each path in the list is combined with the image filename, which is then checked for existence, until the file is located. If no alternative is found, or [[ImagePathList]] is not present, then a 'last-ditch' fallback is attempted using the remote system and path specified in [[SiteUrl]] (if present).
If no fallback attempt is successful (i.e., because no [[ImagePathList]] OR [[SiteUrl]] tiddlers have been defined), the plugin simply passes the original image file value along for default handling by the browser without any "path resolution" being applied.(i.e, the current TW core behavior occurs).
| ''Important note: This plugin may cause one or more security alert messages to appear, because it uses browser-specific functions that can require security permission in order to access the local filesystem to check for the existence of a given image file. If you block local access, the 'last-ditch' fallback using the remote [[SiteUrl]] (if present) will be attempted.'' |
Note: the image formatter code contained here also includes support for AttachFilePlugin extensions (if installed). AttachFilePlugin includes its own fallback mechanism for handling embedded vs. local file vs. remote URL references to the attached binary file. Both methods may be used: ImagePathPlugin provides fallback for images contained in tiddler content, while AttachFilePlugin works well for access to non-image binary files (or images used in CSS as backgrounds, textures, etc.)
<<<
!!!!!Examples
<<<
coming soon...
<<<
!!!!!Revision History
<<<
''2007.04.13 [0.7.1]'' in testFile(), convert any file:// references to local native format before checking for existence.
''2007.03.26 [0.7.0]'' for IE, use onError handling to trigger call to resolvePath() so it will only be invoked if the original path/file is not found by the browser-native lookup. This avoids an unneeded call to fileExists() and the accompanying ActiveX security alert message box (as well as being slightly more efficient...)
''2007.03.25 [0.6.0]'' code cleanup (moved global functions into config.formatterHelpers) plus documentation re-write
''2007.03.24 [0.5.0]'' initial implementation - ALPHA - do not distribute
<<<
!!!!!Code
***/
//{{{
version.extensions.imagePath = {major: 0, minor: 7, revision: 1, date: new Date(2007,4,13)};
//}}}
//{{{
// name of path definition tiddler
if (config.options.txtPathTiddler==undefined) config.options.txtPathTiddler="ImagePathList";
//}}}
//{{{
// low-level wrapper for platform-specific tests for local file existence
// returns true/false without visible error display
// Uses Components for FF and ActiveX FSO object for MSIE
// NOTE: this can cause a security warning on some browsers
config.formatterHelpers.fileExists=function(theFile) {
var found=false;
// DEBUG: alert('testing fileExists('+theFile+')...');
if(window.Components) {
try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); }
catch(e) { return false; } // security access denied
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
try { file.initWithPath(theFile); }
catch(e) { return false; } // invalid directory
found = file.exists();
}
else { // use ActiveX FSO object for MSIE
var fso = new ActiveXObject("Scripting.FileSystemObject");
found = fso.FileExists(theFile)
}
// DEBUG: alert(theFile+" "+(found?"exists":"not found"));
return found;
}
//}}}
//{{{
// higher-level logic for checking local file existence.
// with secondary check for finding relative file references
// and automatic OK of http-based references without checking local filesystem
config.formatterHelpers.testFile=function(theFile) {
if (document.location.protocol!="file:") return true; // viewing remote document, can't test local filesystem... assume OK
if (theFile.substr(0,5)=="http:") return true; // remote HTTP reference... assume OK
if (theFile.substr(0,5)=="file:") theFile=getLocalPath(theFile); // convert local FILE reference to native format
if (this.fileExists(theFile)) return true; // file exists locally... OK to use!
// file might have been relative, add path from current document and try again
var docPath=document.location.href;
var slashpos=docPath.lastIndexOf("/"); if (slashpos==-1) slashpos=docPath.lastIndexOf("\\");
if (slashpos!=-1 && slashpos!=docPath.length-1) docPath=docPath.substr(0,slashpos+1); // trim off filename
if (this.fileExists(getLocalPath(docPath+theFile)))
return true; // ah ha!... file exists relative to current document... OK to use!
return false; // file not found on local system
}
//}}}
//{{{
// given a path/file string, check for existence and
// try alternatives (if any) defined in a tiddler
// with last-ditch using system/path from SiteUrl (if any)
config.formatterHelpers.resolvePath=function(theFile,testoriginal) {
if (testoriginal && this.testFile(theFile)) return theFile; // FOUND FILE - use specified path/file without modification
// get the filename portion only
var slashpos=theFile.lastIndexOf("/"); if (slashpos==-1) slashpos=theFile.lastIndexOf("\\");
var theName=(slashpos==-1)?theFile:theFile.substr(slashpos+1);
// get list of fallbacks (if any)
var pathText=store.getTiddlerText(config.options.txtPathTiddler);
if (pathText && pathText.length) {
var paths=pathText.split("\n");
for (p=0; p<paths.length; p++) // combine path+filename until one works...
if (this.testFile(paths[p]+theName))
return paths[p]+theName; // FOUND FILE - use alternative path+filename
}
// try "last ditch" fallback using SiteURL - assumes that original path/file was relative to document location
var siteURL=store.getTiddlerText("SiteUrl");
if (!siteURL||!siteURL.length) return theFile; // NO FALLBACK - use original path/file and hope for the best
// trim filename (if any) from site URL
var slashpos=siteURL.lastIndexOf("/"); if (slashpos==-1) slashpos=siteURL.lastIndexOf("\\");
if (slashpos!=-1 && slashpos!=siteURL.length-1) siteURL=siteURL.substr(0,slashpos+1);
return siteURL+theFile; // LAST DITCH: use system/path from SiteUrl combined with original file/path
}
//}}}
//{{{
// replace standard handler for image formatter
// adds call to resolvePath() to handle fallback processing
// includes support for AttachFilePlugin as well
config.formatters[config.formatters.findByField("name","image")].handler=function(w) {
if (!this.lookaheadRegExp) // fixup for TW2.0.x
this.lookaheadRegExp = new RegExp(this.lookahead,"mg");
this.lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source)
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
// Simple bracketted link
var e = w.output;
if(lookaheadMatch[5]) {
var link = lookaheadMatch[5];
if (!config.formatterHelpers.isExternalLink) // fixup for TW2.0.x
var external=!store.tiddlerExists(link)&&!store.isShadowTiddler(link);
else
var external=config.formatterHelpers.isExternalLink(link);
if (external) {
if (config.macros.attach && config.macros.attach.isAttachment(link)) { // ELS - attachments
e = createExternalLink(w.output,link);
e.href=config.macros.attach.getAttachment(link);
e.title = config.macros.attach.linkTooltip + link;
} else
e = createExternalLink(w.output,link);
} else
e = createTiddlyLink(w.output,link,false,null,w.isStatic);
addClass(e,"imageLink");
}
var img = createTiddlyElement(e,"img");
if(lookaheadMatch[1])
img.align = "left";
else if(lookaheadMatch[2])
img.align = "right";
if(lookaheadMatch[3])
img.title = lookaheadMatch[3];
if (config.macros.attach!=undefined && config.macros.attach.isAttachment(lookaheadMatch[4])) // ELS - attachments
img.src=config.macros.attach.getAttachment(lookaheadMatch[4]);
else {
if (config.browser.isIE || config.browser.isSafari) { // ELS - path processing
// IE and Safari use browser's onError handling to check the original file...
// avoids extra security alert messages due to use of Components/ActiveX for filesystem access
img.onerror=(function(){this.src=config.formatterHelpers.resolvePath(this.src,false);return false;});
img.src=lookaheadMatch[4]; // ELS - path processing
} else {
// if NOT IE or Safari, always check the original path/file before rendering
img.src=config.formatterHelpers.resolvePath(lookaheadMatch[4],true);
}
}
w.nextMatch = this.lookaheadRegExp.lastIndex;
}
}
//}}}
On Friday, February 13, 2009 7:38:53 AM, AlfonsoReyes imported 1 tiddler from
[[F:\Documents\Databases\papers.html|F:\Documents\Databases\papers.html]]:
<<<
#[[InlineJavascriptPlugin]] - added
<<<
----
On Friday, February 13, 2009 7:34:28 AM, AlfonsoReyes imported 1 tiddler from
[[F:\Documents\Databases\papers.html|F:\Documents\Databases\papers.html]]:
<<<
#[[NewDocumentPlugin]] - added
<<<
----
On Friday, February 13, 2009 7:24:39 AM, AlfonsoReyes imported 23 tiddlers from
[[http://areyes11feb.tiddlyspot.com|http://areyes11feb.tiddlyspot.com]]:
<<<
#[[Ultrasonic method for corrosion]] - added
#[[Understand the meaning of the measurement and incorporating it into the surveillance models]] - added
#[[Understanding the chemistry and physics of corrosion]] - added
#[[Use of chemicals that act as foaming agents and corrosion inhibitors ]] - added
#[[Value loop in reservoir management]] - added
#[[Value of data]] - added
#[[Versatile packer fluids]] - added
#[[Wax, flow assurance screening]] - added
#[[Weight-loss coupons]] - added
#[[Well Risk Management]] - added
#[[Well cannot be considered intelligent]] - added
#[[What is a self-learning system]] - added
#[[What to do to control corrosion?]] - added
#[[corrosion field conditions]] - added
#[[flow regimes]] - added
#[[hydrogen probes]] - added
#[[magnetostrictive device]] - added
#[[nucleonic device]] - added
#[[pH of water phase in corrosion]] - added
#[[pH stabilization technique]] - added
#[[telemetry]] - added
#[[test 2 paper]] - added
#[[types of corrosion]] - added
<<<
----
On Friday, February 13, 2009 7:21:14 AM, AlfonsoReyes imported 97 tiddlers from
[[F:\Documents\Databases\papers.html|F:\Documents\Databases\papers.html]]:
<<<
#[[SFOS]] - added
#[[SPE]] - added
#[[SPE-001732]] - added
#[[SPE-003259]] - added
#[[SPE-005879]] - added
#[[SPE-009035]] - added
#[[SPE-009363]] - added
#[[SPE-010030]] - added
#[[SPE-010319]] - added
#[[SPE-010449]] - added
#[[SPE-011107]] - added
#[[SPE-011185]] - added
#[[SPE-012317: Production Technology Experience in Michigan Waterfloods]] - added
#[[SPE-023471: Waterflood surveillance Techniques - A Reservoir Management Approach]] - added
#[[SPE-024079: Steam Distribution Surveillance and Analysis]] - added
#[[SPE-029666 - Data Integration and synergy improve Reservoir Surveillance at South Belridge Tulare Field]] - added
#[[SPE-035218: ALWORKS - An Artificial Lift Surveillance Tool]] - added
#[[SPE-036127]] - added
#[[SPE-036582]] - added
#[[SPE-050587]] - added
#[[SPE-050758]] - added
#[[SPE-062878]] - added
#[[SPE-062950]] - added
#[[SPE-066651]] - added
#[[SPE-067325]] - added
#[[SPE-071532]] - added
#[[SPE-071674]] - added
#[[SPE-077941]] - added
#[[SPE-078273]] - added
#[[SPE-078277]] - added
#[[SPE-078293]] - added
#[[SPE-079031]] - added
#[[SPE-081107]] - added
#[[SPE-083974: Automated Reservoir Surveillance through Data Mining Software]] - added
#[[SPE-084064]] - added
#[[SPE-084220]] - added
#[[SPE-084323]] - added
#[[SPE-087309]] - added
#[[SPE-088792: A Novel Approach to Reservoir Surveillance Planning]] - added
#[[SPE-090188]] - added
#[[SPE-090213: Real Time Optimization - Classification and Assessment]] - added
#[[SPE-090244]] - added
#[[SPE-090244 - Flow Assurance and Subsea Productivity, Closing the Loop with Connectivity and Measurements]] - added
#[[SPE-094543: Developments in the visualisation of well tubular condition]] - added
#[[SPE-095004]] - added
#[[SPE-099358]] - added
#[[SPE-099994]] - added
#[[SPE-100112]] - added
#[[SPE-100191]] - added
#[[SPE-100386]] - added
#[[SPE-100710]] - added
#[[SPE-103222: Rate Allocation Using Permanent Downhole Pressures]] - added
#[[SPE-107279: Surveillance Planning - The Key to Managing a Mature Gas Reservoir]] - added
#[[SPE-111430]] - added
#[[SPE-12809]] - added
#[[SPE-56917: Primary Separation and New Generation of Interface Level Measurement Systems]] - added
#[[SPE-60199]] - added
#[[SPE-60222]] - added
#[[SPE-68885]] - added
#[[SPE-75177]] - added
#[[SPE-87459]] - added
#[[SSCC]] - added
#[[SWC]] - added
#[[Scale Prediction]] - added
#[[Scale definition]] - added
#[[Scale forming mechanisms]] - added
#[[Scale particles and fine sands helped stabilize emulsion]] - added
#[[Scaling management plan]] - added
#[[Search reducing heat flow in the casing annulus]] - added
#[[Selection of corrosion inhibitors]] - added
#[[Self-learning and self-adaptive scheme]] - added
#[[Self-learning reservoir management]] - added
#[[SetDefaultTiddlers]] - added
#[[Seven deadly data sins]] - added
#[[SiteSubtitle]] - added
#[[SiteTitle]] - added
#[[Smart technologies results]] - added
#[[Spider Diagram of Technology Status]] - added
#[[Steam injection causes casing failure]] - added
#[[Strategic Data Management]] - added
#[[Structure of Foam]] - added
#[[Sulphide Stress Corrosion Cracking]] - added
#[[Surveillance]] - added
#[[Surveillance - A look ahead]] - added
#[[Surveillance tecniques helped out on Production Technology problems]] - added
#[[Surveillance tecnniques used in waterflood]] - added
#[[TIG]] - added
#[[Table 1 - Waterflood Surveillance System]] - added
#[[Technologies for monitoring interface level]] - added
#[[The oil industry and smart wells]] - added
#[[Thickness measuring tools]] - added
#[[Thread type importance in corrosion]] - added
#[[Traditional Flow assurance]] - added
#[[Tubing ID importance on corrosion]] - added
#[[Tubing Pickle]] - added
#[[Tubing and Wellhead Flowline Inspection and Descaling]] - added
#[[Typical foaming ability in surfactants]] - added
<<<
----
On Thursday, February 12, 2009 7:18:35 PM, AlfonsoReyes imported 42 tiddlers from
[[F:\Documents\Databases\papers.html|F:\Documents\Databases\papers.html]]:
<<<
#[[MPC]] - added
#[[Magnetic Thickness Tool]] - added
#[[Main Topics, SPE-029666]] - added
#[[Main topics - SPE-090244]] - added
#[[Main topics, SPE-090213]] - added
#[[MainMenu]] - added
#[[Mass en Energy Balances]] - added
#[[Mathematically extrapolate the lab corrosion results to the field]] - added
#[[Metallurgy importance in corrosion]] - added
#[[Models used for bottomhole pressure convergence]] - added
#[[NDT]] - added
#[[Natural Convection]] - added
#[[New Ref Doc Paper]] - added
#[[New generation of Interface Level Measurement]] - added
#[[NewPaper]] - added
#[[Non-Destructive Testing]] - added
#[[Nyborg_lr.pdf]] - added
#[[OTC-016285: Evaluating a concept of using DTS and Strain sensor for continuous monitoring of casing and completion mechanical deformation in intelligent wells]] - added
#[[OTC-017999: When Intelligent Wells are truly intelligent. reliable and cost effective]] - added
#[[Oil field as a dynamic system]] - added
#[[Oilfield Scales]] - added
#[[Open Applications]] - added
#[[Optimization and control framework]] - added
#[[Pickling process contact time]] - added
#[[Polarization resistance in corrosion measurement]] - added
#[[Polytope]] - added
#[[Problems caused by scaling]] - added
#[[Pseudoscale]] - added
#[[RTO]] - added
#[[RTO, technology categories]] - added
#[[Radiography method for corrosion]] - added
#[[Ramey studies on wellbore heat transfer]] - added
#[[Reduction of heat loss]] - added
#[[RefDocTemplate2]] - added
#[[Relevance of information]] - added
#[[Reservoir Management - definition]] - added
#[[Reservoir Management Approach]] - added
#[[Reservoir Management objectives]] - added
#[[Reservoir Surveillance Data Management]] - added
#[[Reservoir characterization and inverse modeling technique]] - added
#[[Reservoir management decomposed]] - added
#[[Reservoir productivity and tubing performance feasible solutions]] - added
<<<
----
On Thursday, February 12, 2009 7:10:57 PM, AlfonsoReyes imported 87 tiddlers from
[[F:\Documents\Databases\papers.html|F:\Documents\Databases\papers.html]]:
<<<
#[[A-Z]] - added
#[[Abbreviations]] - added
#[[Accurate level measurement]] - added
#[[Added SmartWell papers references to this wiki]] - added
#[[Allocation Factors]] - added
#[[Application of intelligent well technology]] - added
#[[Artificial Lift Surveillance]] - added
#[[Asset level optimization]] - added
#[[CO2 corrosion]] - added
#[[Causes of corrosion]] - added
#[[Challenges in Scale Removal]] - added
#[[Choke reduction in corrosion]] - added
#[[Completion Fluid Checklist]] - added
#[[Conceptual Steam Distribution System]] - added
#[[Conduct life-cycle cost analysis]] - added
#[[Conduction, convection and radiation in the wellbore]] - added
#[[Configuration]] - added
#[[Corrosion Control Measures]] - added
#[[Corrosion Monitoring Activities]] - added
#[[Corrosion Monitoring Devices]] - added
#[[Corrosion coupons]] - added
#[[Corrosion deposition and indirect protection]] - added
#[[Corrosion due to carbon dioxide (CO2)]] - added
#[[Corrosion in completion fluids]] - added
#[[Corrosion inhibitor compatibility and tests]] - added
#[[Corrosion mechanisms]] - added
#[[Corrosion mitigation and critical areas]] - added
#[[Corrosion monitoring points]] - added
#[[Corrosion rates]] - added
#[[Corrosion rates and pressure]] - added
#[[Corrosion reactions on iron surface]] - added
#[[Corrosion: tubing selection]] - added
#[[Creating the Surveillance Plan]] - added
#[[Data Displays]] - added
#[[Deposition process not only function of thermodynamic and chemical properties of fluid ]] - added
#[[Dissolved iron problems]] - added
#[[Drawback demulsifiers and anti-foamants]] - added
#[[Effect of CaCl2 brines on chrome materials]] - added
#[[Effect of emissivity and insulation on casing temperature]] - added
#[[Effect of radiation as a wellbore shield]] - added
#[[Effective corrosion monitoring program]] - added
#[[Electrical Resistance Probes for corrosion measurement]] - added
#[[Elements of internal corrosion monitoring]] - added
#[[Emissivity in the wellbore]] - added
#[[Emulsion problem execerbated by scale]] - added
#[[Engine that self-learns the reservoir dynamics]] - added
#[[Example of corrosion modeling]] - added
#[[Expert system used in corrosion prediction]] - added
#[[Factors foam stability]] - added
#[[Factors influencing corrosion rates]] - added
#[[Failures by corrosion of corrosion resistant alloys]] - added
#[[Failures on chrome materials]] - added
#[[Field Data Input for Reservoir Surveillance]] - added
#[[Field Operation Hierarchy]] - added
#[[Flow Assurance Combined Design Surveillance Workflow]] - added
#[[Flow Assurance Design Data flow chart]] - added
#[[Flow Assurance Design Workflow]] - added
#[[Flow Assurance Surveillance Data flow chart]] - added
#[[Flow assurance covers a broad range of problems]] - added
#[[Flow contribution calculation]] - added
#[[Foam Formation and Stability]] - added
#[[Foam, background an theory]] - added
#[[Foamy-oil flow introduction]] - added
#[[Foamy-oil flow, meaning of the term]] - added
#[[Frictional losses and kinetic energy effects]] - added
#[[Gamma Ray transmission technique]] - added
#[[Gamma ray scanning technique in scale detection]] - added
#[[Graph temperature and casing yield]] - added
#[[H2S and ISO standard]] - added
#[[H2S corrosion]] - added
#[[HB]] - added
#[[Hydrogen Blistering and Stepwise Cracking]] - added
#[[Hydrogen Probes for corrosion measurement]] - added
#[[ImagePathList]] - added
#[[Increase in corrosion rate as the reservoir is depleted]] - added
#[[Industry demands from smart wells]] - added
#[[Inhibitor interaction with supercritical gas phase]] - added
#[[Integrated approach to predicting corrosion]] - added
#[[Intelligence realization]] - added
#[[Ionic effects of brines in foam]] - added
#[[Iron counts]] - added
#[[Joule Thomson effect used downhole]] - added
#[[Key reservoir knowledge]] - added
#[[Laboratory data and modeling]] - added
#[[Level and Interface Level Measurement Techniques]] - added
#[[Linear Polarization]] - added
#[[Lowering casing temperature with radiation shield]] - added
<<<
----
On Thursday, February 12, 2009 7:06:22 PM, AlfonsoReyes imported 5 tiddlers from
[[F:\Documents\Databases\papers.html|F:\Documents\Databases\papers.html]]:
<<<
#[[CopyTiddlerPlugin]] - added
#[[DataTiddlerPlugin]] - added
#[[ForEachTiddlerPlugin]] - added
#[[FormTiddlerPlugin]] - added
#[[ImagePathPlugin]] - added
<<<
p1,c1:
Two major factors contributing to the continued viability of a well are the mitigation of corrosion and
continued production as the reservoir is depleted and bottom hole pressure declines. The two factors are closely related; as production decreases due to lower pressures, a gas well may load with water and produce in intermittent slug flow. The result is a dramatic decrease in well productivity. A significant
increase in the corrosion rate may also be observed.
Going forward, industry demands have not changed significantly. First, intelligent well need to be truly intelligent, with increased requirement for dynamic information to enable the downhole control and reservoir management processes. This is particularly important for subsea wells where data flow is lower than dry-tree wells.
As conditions change through the system, the corrosion inhibitor must remain mobile and transportable, regardless of the presence of water of condensation. At supercritical pressures, the corrosion inhibitor’s interaction with the dense gas phase should be evaluated. The results in this study reveal that the supercritical gas phase behaves much like an aliphatic hydrocarbon. This has the effect of increasing the apparent oil/water ratio at any point in the system where such high pressures exist.
/***
|Name|InlineJavascriptPlugin|
|Source|http://www.TiddlyTools.com/#InlineJavascriptPlugin|
|Version|1.6.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <<br>>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|Insert Javascript executable code directly into your tiddler content.|
''Call directly into TW core utility routines, define new functions, calculate values, add dynamically-generated TiddlyWiki-formatted output'' into tiddler content, or perform any other programmatic actions each time the tiddler is rendered.
!!!!!Usage
<<<
When installed, this plugin adds new wiki syntax for surrounding tiddler content with {{{<script>}}} and {{{</script>}}} markers, so that it can be treated as embedded javascript and executed each time the tiddler is rendered.
''Deferred execution from an 'onClick' link''
By including a {{{label="..."}}} parameter in the initial {{{<script>}}} marker, the plugin will create a link to an 'onclick' script that will only be executed when that specific link is clicked, rather than running the script each time the tiddler is rendered. You may also include a {{{title="..."}}} parameter to specify the 'tooltip' text that will appear whenever the mouse is moved over the onClick link text
''External script source files:''
You can also load javascript from an external source URL, by including a src="..." parameter in the initial {{{<script>}}} marker (e.g., {{{<script src="demo.js"></script>}}}). This is particularly useful when incorporating third-party javascript libraries for use in custom extensions and plugins. The 'foreign' javascript code remains isolated in a separate file that can be easily replaced whenever an updated library file becomes available.
''Display script source in tiddler output''
By including the keyword parameter "show", in the initial {{{<script>}}} marker, the plugin will include the script source code in the output that it displays in the tiddler.
''Defining javascript functions and libraries:''
Although the external javascript file is loaded while the tiddler content is being rendered, any functions it defines will not be available for use until //after// the rendering has been completed. Thus, you cannot load a library and //immediately// use it's functions within the same tiddler. However, once that tiddler has been loaded, the library functions can be freely used in any tiddler (even the one in which it was initially loaded).
To ensure that your javascript functions are always available when needed, you should load the libraries from a tiddler that will be rendered as soon as your TiddlyWiki document is opened. For example, you could put your {{{<script src="..."></script>}}} syntax into a tiddler called LoadScripts, and then add {{{<<tiddler LoadScripts>>}}} in your MainMenu tiddler.
Since the MainMenu is always rendered immediately upon opening your document, the library will always be loaded before any other tiddlers that rely upon the functions it defines. Loading an external javascript library does not produce any direct output in the tiddler, so these definitions should have no impact on the appearance of your MainMenu.
''Creating dynamic tiddler content''
An important difference between this implementation of embedded scripting and conventional embedded javascript techniques for web pages is the method used to produce output that is dynamically inserted into the document:
* In a typical web document, you use the document.write() function to output text sequences (often containing HTML tags) that are then rendered when the entire document is first loaded into the browser window.
* However, in a ~TiddlyWiki document, tiddlers (and other DOM elements) are created, deleted, and rendered "on-the-fly", so writing directly to the global 'document' object does not produce the results you want (i.e., replacing the embedded script within the tiddler content), and completely replaces the entire ~TiddlyWiki document in your browser window.
* To allow these scripts to work unmodified, the plugin automatically converts all occurences of document.write() so that the output is inserted into the tiddler content instead of replacing the entire ~TiddlyWiki document.
If your script does not use document.write() to create dynamically embedded content within a tiddler, your javascript can, as an alternative, explicitly return a text value that the plugin can then pass through the wikify() rendering engine to insert into the tiddler display. For example, using {{{return "thistext"}}} will produce the same output as {{{document.write("thistext")}}}.
//Note: your script code is automatically 'wrapped' inside a function, {{{_out()}}}, so that any return value you provide can be correctly handled by the plugin and inserted into the tiddler. To avoid unpredictable results (and possibly fatal execution errors), this function should never be redefined or called from ''within'' your script code.//
''Accessing the ~TiddlyWiki DOM''
The plugin provides one pre-defined variable, 'place', that is passed in to your javascript code so that it can have direct access to the containing DOM element into which the tiddler output is currently being rendered.
Access to this DOM element allows you to create scripts that can:
* vary their actions based upon the specific location in which they are embedded
* access 'tiddler-relative' information (use findContainingTiddler(place))
* perform direct DOM manipulations (when returning wikified text is not enough)
<<<
!!!!!Examples
<<<
an "alert" message box:
><script show>
alert('InlineJavascriptPlugin: this is a demonstration message');
</script>
dynamic output:
><script show>
return (new Date()).toString();
</script>
wikified dynamic output:
><script show>
return "link to current user: [["+config.options.txtUserName+"]]";
</script>
dynamic output using 'place' to get size information for current tiddler:
><script show>
if (!window.story) window.story=window;
var title=story.findContainingTiddler(place).id.substr(7);
return title+" is using "+store.getTiddlerText(title).length+" bytes";
</script>
creating an 'onclick' button/link that runs a script:
><script label="click here" title="clicking this link will show an 'alert' box" show>
if (!window.story) window.story=window;
alert("Hello World!\nlinktext='"+place.firstChild.data+"'\ntiddler='"+story.findContainingTiddler(place).id.substr(7)+"'");
</script>
loading a script from a source url:
>http://www.TiddlyTools.com/demo.js contains:
>>{{{function demo() { alert('this output is from demo(), defined in demo.js') } }}}
>>{{{alert('InlineJavascriptPlugin: demo.js has been loaded'); }}}
><script src="demo.js" show>
return "loading demo.js..."
</script>
><script label="click to execute demo() function" show>
demo()
</script>
<<<
!!!!!Installation
<<<
import (or copy/paste) the following tiddlers into your document:
''InlineJavascriptPlugin'' (tagged with <<tag systemConfig>>)
<<<
!!!!!Revision History
<<<
''2007.02.19 [1.6.0]'' added support for title="..." to specify mouseover tooltip when using an onclick (label="...") script
''2006.10.16 [1.5.2]'' add newline before closing '}' in 'function out_' wrapper. Fixes error caused when last line of script is a comment.
''2006.06.01 [1.5.1]'' when calling wikify() on script return value, pass hightlightRegExp and tiddler params so macros that rely on these values can render properly
''2006.04.19 [1.5.0]'' added 'show' parameter to force display of javascript source code in tiddler output
''2006.01.05 [1.4.0]'' added support 'onclick' scripts. When label="..." param is present, a button/link is created using the indicated label text, and the script is only executed when the button/link is clicked. 'place' value is set to match the clicked button/link element.
''2005.12.13 [1.3.1]'' when catching eval error in IE, e.description contains the error text, instead of e.toString(). Fixed error reporting so IE shows the correct response text. Based on a suggestion by UdoBorkowski
''2005.11.09 [1.3.0]'' for 'inline' scripts (i.e., not scripts loaded with src="..."), automatically replace calls to 'document.write()' with 'place.innerHTML+=' so script output is directed into tiddler content. Based on a suggestion by BradleyMeck
''2005.11.08 [1.2.0]'' handle loading of javascript from an external URL via src="..." syntax
''2005.11.08 [1.1.0]'' pass 'place' param into scripts to provide direct DOM access
''2005.11.08 [1.0.0]'' initial release
<<<
!!!!!Credits
<<<
This feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]]
<<<
!!!!!Code
***/
//{{{
version.extensions.inlineJavascript= {major: 1, minor: 6, revision: 0, date: new Date(2007,2,19)};
config.formatters.push( {
name: "inlineJavascript",
match: "\\<script",
lookahead: "\\<script(?: src=\\\"((?:.|\\n)*?)\\\")?(?: label=\\\"((?:.|\\n)*?)\\\")?(?: title=\\\"((?:.|\\n)*?)\\\")?( show)?\\>((?:.|\\n)*?)\\</script\\>",
handler: function(w) {
var lookaheadRegExp = new RegExp(this.lookahead,"mg");
lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = lookaheadRegExp.exec(w.source)
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
if (lookaheadMatch[1]) { // load a script library
// make script tag, set src, add to body to execute, then remove for cleanup
var script = document.createElement("script"); script.src = lookaheadMatch[1];
document.body.appendChild(script); document.body.removeChild(script);
}
if (lookaheadMatch[5]) { // there is script code
if (lookaheadMatch[4]) // show inline script code in tiddler output
wikify("{{{\n"+lookaheadMatch[0]+"\n}}}\n",w.output);
if (lookaheadMatch[2]) { // create a link to an 'onclick' script
// add a link, define click handler, save code in link (pass 'place'), set link attributes
var link=createTiddlyElement(w.output,"a",null,"tiddlyLinkExisting",lookaheadMatch[2]);
link.onclick=function(){try{return(eval(this.code))}catch(e){alert(e.description?e.description:e.toString())}}
link.code="function _out(place){"+lookaheadMatch[5]+"\n};_out(this);"
link.setAttribute("title",lookaheadMatch[3]?lookaheadMatch[3]:"");
link.setAttribute("href","javascript:;");
link.style.cursor="pointer";
}
else { // run inline script code
var code="function _out(place){"+lookaheadMatch[5]+"\n};_out(w.output);"
code=code.replace(/document.write\(/gi,'place.innerHTML+=(');
try { var out = eval(code); } catch(e) { out = e.description?e.description:e.toString(); }
if (out && out.length) wikify(out,w.output,w.highlightRegExp,w.tiddler);
}
}
w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
}
}
} )
//}}}
/***
|Name:|InstantTimestampPlugin|
|Description:|A handy way to insert timestamps in your tiddler content|
|Version:|1.0.10 ($Rev: 3646 $)|
|Date:|$Date: 2008-02-27 02:34:38 +1000 (Wed, 27 Feb 2008) $|
|Source:|http://mptw.tiddlyspot.com/#InstantTimestampPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!Usage
If you enter {ts} in your tiddler content (without the spaces) it will be replaced with a timestamp when you save the tiddler. Full list of formats:
* {ts} or {t} -> timestamp
* {ds} or {d} -> datestamp
* !ts or !t at start of line -> !!timestamp
* !ds or !d at start of line -> !!datestamp
(I added the extra ! since that's how I like it. Remove it from translations below if required)
!!Notes
* Change the timeFormat and dateFormat below to suit your preference.
* See also http://mptw2.tiddlyspot.com/#AutoCorrectPlugin
* You could invent other translations and add them to the translations array below.
***/
//{{{
config.InstantTimestamp = {
// adjust to suit
timeFormat: 'DD/0MM/YY 0hh:0mm',
dateFormat: 'DD/0MM/YY',
translations: [
[/^!ts?$/img, "'!!{{ts{'+now.formatString(config.InstantTimestamp.timeFormat)+'}}}'"],
[/^!ds?$/img, "'!!{{ds{'+now.formatString(config.InstantTimestamp.dateFormat)+'}}}'"],
// thanks Adapted Cat
[/\{ts?\}(?!\}\})/ig,"'{{ts{'+now.formatString(config.InstantTimestamp.timeFormat)+'}}}'"],
[/\{ds?\}(?!\}\})/ig,"'{{ds{'+now.formatString(config.InstantTimestamp.dateFormat)+'}}}'"]
],
excludeTags: [
"noAutoCorrect",
"noTimestamp",
"html",
"CSS",
"css",
"systemConfig",
"systemConfigDisabled",
"zsystemConfig",
"Plugins",
"Plugin",
"plugins",
"plugin",
"javascript",
"code",
"systemTheme",
"systemPalette"
],
excludeTiddlers: [
"StyleSheet",
"StyleSheetLayout",
"StyleSheetColors",
"StyleSheetPrint"
// more?
]
};
TiddlyWiki.prototype.saveTiddler_mptw_instanttimestamp = TiddlyWiki.prototype.saveTiddler;
TiddlyWiki.prototype.saveTiddler = function(title,newTitle,newBody,modifier,modified,tags,fields,clearChangeCount,created) {
tags = tags ? tags : []; // just in case tags is null
tags = (typeof(tags) == "string") ? tags.readBracketedList() : tags;
var conf = config.InstantTimestamp;
if ( !tags.containsAny(conf.excludeTags) && !conf.excludeTiddlers.contains(newTitle) ) {
var now = new Date();
var trans = conf.translations;
for (var i=0;i<trans.length;i++) {
newBody = newBody.replace(trans[i][0], eval(trans[i][1]));
}
}
// TODO: use apply() instead of naming all args?
return this.saveTiddler_mptw_instanttimestamp(title,newTitle,newBody,modifier,modified,tags,fields,clearChangeCount,created);
}
// you can override these in StyleSheet
setStylesheet(".ts,.ds { font-style:italic; }","instantTimestampStyles");
//}}}
The Integrated approach to predicting corrosion has five primary elements:
# Establish environmental conditions ...
# Model the local environmental conditions and [[types of corrosion]] expected to occur ...
# Conduct corrosion tests under identified [[field conditions|corrosion field conditions]] ...
# [[Extrapolate the lab corrosion results to the field]]
# [[Conduct life-cycle cost analysis]]
/***
|''Name:''|IntelliTaggerPlugin|
|''Version:''|1.0.2 (2007-07-25)|
|''Type:''|plugin|
|''Source:''|http://tiddlywiki.abego-software.de/#IntelliTaggerPlugin|
|''Author:''|Udo Borkowski (ub [at] abego-software [dot] de)|
|''Documentation:''|[[IntelliTaggerPlugin Documentation]]|
|''~SourceCode:''|[[IntelliTaggerPlugin SourceCode]]|
|''Licence:''|[[BSD open source license (abego Software)]]|
|''~CoreVersion:''|2.0.8|
|''Browser:''|Firefox 1.5.0.2 or better|
***/
/***
!Version History
* 1.0.2 (2007-07-25):
** Feature: "Return" key may be used to accept first tag suggestion (beside "Alt-1")
** Bugfix: Keyboard shortcuts (Alt+3 etc.) shifted
* 1.0.1 (2007-05-18): Improvement: Speedup when using TiddlyWikis with many tags
* 1.0.0 (2006-04-26): Initial release
***/
// /%
if(!version.extensions.IntelliTaggerPlugin){if(!window.abego){window.abego={};}if(!abego.internal){abego.internal={};}abego.alertAndThrow=function(s){alert(s);throw s;};if(version.major<2){abego.alertAndThrow("Use TiddlyWiki 2.0.8 or better to run the IntelliTagger Plugin.");}version.extensions.IntelliTaggerPlugin={major:1,minor:0,revision:2,date:new Date(2007,6,25),type:"plugin",source:"http://tiddlywiki.abego-software.de/#IntelliTaggerPlugin",documentation:"[[IntelliTaggerPlugin Documentation]]",sourcecode:"[[IntelliTaggerPlugin SourceCode]]",author:"Udo Borkowski (ub [at] abego-software [dot] de)",licence:"[[BSD open source license (abego Software)]]",tiddlywiki:"Version 2.0.8 or better",browser:"Firefox 1.5.0.2 or better"};abego.createEllipsis=function(_2){var e=createTiddlyElement(_2,"span");e.innerHTML="…";};abego.isPopupOpen=function(_4){return _4&&_4.parentNode==document.body;};abego.openAsPopup=function(_5){if(_5.parentNode!=document.body){document.body.appendChild(_5);}};abego.closePopup=function(_6){if(abego.isPopupOpen(_6)){document.body.removeChild(_6);}};abego.getWindowRect=function(){return {left:findScrollX(),top:findScrollY(),height:findWindowHeight(),width:findWindowWidth()};};abego.moveElement=function(_7,_8,_9){_7.style.left=_8+"px";_7.style.top=_9+"px";};abego.centerOnWindow=function(_a){if(_a.style.position!="absolute"){throw "abego.centerOnWindow: element must have absolute position";}var _b=abego.getWindowRect();abego.moveElement(_a,_b.left+(_b.width-_a.offsetWidth)/2,_b.top+(_b.height-_a.offsetHeight)/2);};abego.isDescendantOrSelf=function(_c,e){while(e){if(_c==e){return true;}e=e.parentNode;}return false;};abego.toSet=function(_e){var _f={};for(var i=0;i<_e.length;i++){_f[_e[i]]=true;}return _f;};abego.filterStrings=function(_11,_12,_13){var _14=[];for(var i=0;i<_11.length&&(_13===undefined||_14.length<_13);i++){var s=_11[i];if(s.match(_12)){_14.push(s);}}return _14;};abego.arraysAreEqual=function(a,b){if(!a){return !b;}if(!b){return false;}var n=a.length;if(n!=b.length){return false;}for(var i=0;i<n;i++){if(a[i]!=b[i]){return false;}}return true;};abego.moveBelowAndClip=function(_1b,_1c){if(!_1c){return;}var _1d=findPosX(_1c);var _1e=findPosY(_1c);var _1f=_1c.offsetHeight;var _20=_1d;var _21=_1e+_1f;var _22=findWindowWidth();if(_22<_1b.offsetWidth){_1b.style.width=(_22-100)+"px";}var _23=_1b.offsetWidth;if(_20+_23>_22){_20=_22-_23-30;}if(_20<0){_20=0;}_1b.style.left=_20+"px";_1b.style.top=_21+"px";_1b.style.display="block";};abego.compareStrings=function(a,b){return (a==b)?0:(a<b)?-1:1;};abego.sortIgnoreCase=function(arr){var _27=[];var n=arr.length;for(var i=0;i<n;i++){var s=arr[i];_27.push([s.toString().toLowerCase(),s]);}_27.sort(function(a,b){return (a[0]==b[0])?0:(a[0]<b[0])?-1:1;});for(i=0;i<n;i++){arr[i]=_27[i][1];}};abego.getTiddlerField=function(_2d,_2e,_2f){var _30=document.getElementById(_2d.idPrefix+_2e);var e=null;if(_30!=null){var _32=_30.getElementsByTagName("*");for(var t=0;t<_32.length;t++){var c=_32[t];if(c.tagName.toLowerCase()=="input"||c.tagName.toLowerCase()=="textarea"){if(!e){e=c;}if(c.getAttribute("edit")==_2f){e=c;}}}}return e;};abego.setRange=function(_35,_36,end){if(_35.setSelectionRange){_35.setSelectionRange(_36,end);var max=0+_35.scrollHeight;var len=_35.textLength;var top=max*_36/len,bot=max*end/len;_35.scrollTop=Math.min(top,(bot+top-_35.clientHeight)/2);}else{if(_35.createTextRange!=undefined){var _3b=_35.createTextRange();_3b.collapse();_3b.moveEnd("character",end);_3b.moveStart("character",_36);_3b.select();}else{_35.select();}}};abego.internal.TagManager=function(){var _3c=null;var _3d=function(){if(_3c){return;}_3c={};store.forEachTiddler(function(_3e,_3f){for(var i=0;i<_3f.tags.length;i++){var tag=_3f.tags[i];var _42=_3c[tag];if(!_42){_42=_3c[tag]={count:0,tiddlers:{}};}_42.tiddlers[_3f.title]=true;_42.count+=1;}});};var _43=TiddlyWiki.prototype.saveTiddler;TiddlyWiki.prototype.saveTiddler=function(_44,_45,_46,_47,_48,_49){var _4a=this.fetchTiddler(_44);var _4b=_4a?_4a.tags:[];var _4c=(typeof _49=="string")?_49.readBracketedList():_49;_43.apply(this,arguments);if(!abego.arraysAreEqual(_4b,_4c)){abego.internal.getTagManager().reset();}};var _4d=TiddlyWiki.prototype.removeTiddler;TiddlyWiki.prototype.removeTiddler=function(_4e){var _4f=this.fetchTiddler(_4e);var _50=_4f&&_4f.tags.length>0;_4d.apply(this,arguments);if(_50){abego.internal.getTagManager().reset();}};this.reset=function(){_3c=null;};this.getTiddlersWithTag=function(tag){_3d();var _52=_3c[tag];return _52?_52.tiddlers:null;};this.getAllTags=function(_53){_3d();var _54=[];for(var i in _3c){_54.push(i);}for(i=0;_53&&i<_53.length;i++){_54.pushUnique(_53[i],true);}abego.sortIgnoreCase(_54);return _54;};this.getTagInfos=function(){_3d();var _56=[];for(var _57 in _3c){_56.push([_57,_3c[_57]]);}return _56;};var _58=function(a,b){var a1=a[1];var b1=b[1];var d=b[1].count-a[1].count;return d!=0?d:abego.compareStrings(a[0].toLowerCase(),b[0].toLowerCase());};this.getSortedTagInfos=function(){_3d();var _5e=this.getTagInfos();_5e.sort(_58);return _5e;};this.getPartnerRankedTags=function(_5f){var _60={};for(var i=0;i<_5f.length;i++){var _62=this.getTiddlersWithTag(_5f[i]);for(var _63 in _62){var _64=store.getTiddler(_63);if(!(_64 instanceof Tiddler)){continue;}for(var j=0;j<_64.tags.length;j++){var tag=_64.tags[j];var c=_60[tag];_60[tag]=c?c+1:1;}}}var _68=abego.toSet(_5f);var _69=[];for(var n in _60){if(!_68[n]){_69.push(n);}}_69.sort(function(a,b){var d=_60[b]-_60[a];return d!=0?d:abego.compareStrings(a.toLowerCase(),b.toLowerCase());});return _69;};};abego.internal.getTagManager=function(){if(!abego.internal.gTagManager){abego.internal.gTagManager=new abego.internal.TagManager();}return abego.internal.gTagManager;};(function(){var _6e=2;var _6f=1;var _70=30;var _71;var _72;var _73;var _74;var _75;var _76;if(!abego.IntelliTagger){abego.IntelliTagger={};}var _77=function(){return _72;};var _78=function(tag){return _75[tag];};var _7a=function(s){var i=s.lastIndexOf(" ");return (i>=0)?s.substr(0,i):"";};var _7d=function(_7e){var s=_7e.value;var len=s.length;return (len>0&&s[len-1]!=" ");};var _81=function(_82){var s=_82.value;var len=s.length;if(len>0&&s[len-1]!=" "){_82.value+=" ";}};var _85=function(tag,_87,_88){if(_7d(_87)){_87.value=_7a(_87.value);}story.setTiddlerTag(_88.title,tag,0);_81(_87);abego.IntelliTagger.assistTagging(_87,_88);};var _89=function(n){if(_76&&_76.length>n){return _76[n];}return (_74&&_74.length>n)?_74[n]:null;};var _8b=function(n,_8d,_8e){var _8f=_89(n);if(_8f){_85(_8f,_8d,_8e);}};var _90=function(_91){var pos=_91.value.lastIndexOf(" ");var _93=(pos>=0)?_91.value.substr(++pos,_91.value.length):_91.value;return new RegExp(_93.escapeRegExp(),"i");};var _94=function(_95,_96){var _97=0;for(var i=0;i<_95.length;i++){if(_96[_95[i]]){_97++;}}return _97;};var _99=function(_9a,_9b,_9c){var _9d=1;var c=_9a[_9b];for(var i=_9b+1;i<_9a.length;i++){if(_9a[i][1].count==c){if(_9a[i][0].match(_9c)){_9d++;}}else{break;}}return _9d;};var _a0=function(_a1,_a2){var _a3=abego.internal.getTagManager().getSortedTagInfos();var _a4=[];var _a5=0;for(var i=0;i<_a3.length;i++){var c=_a3[i][1].count;if(c!=_a5){if(_a2&&(_a4.length+_99(_a3,i,_a1)>_a2)){break;}_a5=c;}if(c==1){break;}var s=_a3[i][0];if(s.match(_a1)){_a4.push(s);}}return _a4;};var _a9=function(_aa,_ab){return abego.filterStrings(abego.internal.getTagManager().getAllTags(_ab),_aa);};var _ac=function(){if(!_71){return;}var _ad=store.getTiddlerText("IntelliTaggerMainTemplate");if(!_ad){_ad="<b>Tiddler IntelliTaggerMainTemplate not found</b>";}_71.innerHTML=_ad;applyHtmlMacros(_71,null);refreshElements(_71,null);};var _ae=function(e){if(!e){var e=window.event;}var tag=this.getAttribute("tag");if(_73){_73.call(this,tag,e);}return false;};var _b2=function(_b3){createTiddlyElement(_b3,"span",null,"tagSeparator"," | ");};var _b4=function(_b5,_b6,_b7,_b8,_b9){if(!_b6){return;}var _ba=_b8?abego.toSet(_b8):{};var n=_b6.length;var c=0;for(var i=0;i<n;i++){var tag=_b6[i];if(_ba[tag]){continue;}if(c>0){_b2(_b5);}if(_b9&&c>=_b9){abego.createEllipsis(_b5);break;}c++;var _bf="";var _c0=_b5;if(_b7<10){_c0=createTiddlyElement(_b5,"span",null,"numberedSuggestion");_b7++;var key=_b7<10?""+(_b7):"0";createTiddlyElement(_c0,"span",null,"suggestionNumber",key+") ");var _c2=_b7==1?"Return or ":"";_bf=" (Shortcut: %1Alt-%0)".format([key,_c2]);}var _c3=config.views.wikified.tag.tooltip.format([tag]);var _c4=(_78(tag)?"Remove tag '%0'%1":"Add tag '%0'%1").format([tag,_bf]);var _c5="%0; Shift-Click: %1".format([_c4,_c3]);var btn=createTiddlyButton(_c0,tag,_c5,_ae,_78(tag)?"currentTag":null);btn.setAttribute("tag",tag);}};var _c7=function(){if(_71){window.scrollTo(0,ensureVisible(_71));}if(_77()){window.scrollTo(0,ensureVisible(_77()));}};var _c8=function(e){if(!e){var e=window.event;}if(!_71){return;}var _cb=resolveTarget(e);if(_cb==_77()){return;}if(abego.isDescendantOrSelf(_71,_cb)){return;}abego.IntelliTagger.close();};addEvent(document,"click",_c8);var _cc=Story.prototype.gatherSaveFields;Story.prototype.gatherSaveFields=function(e,_ce){_cc.apply(this,arguments);var _cf=_ce.tags;if(_cf){_ce.tags=_cf.trim();}};var _d0=function(_d1){story.focusTiddler(_d1,"tags");var _d2=abego.getTiddlerField(story,_d1,"tags");if(_d2){var len=_d2.value.length;abego.setRange(_d2,len,len);window.scrollTo(0,ensureVisible(_d2));}};var _d4=config.macros.edit.handler;config.macros.edit.handler=function(_d5,_d6,_d7,_d8,_d9,_da){_d4.apply(this,arguments);var _db=_d7[0];if((_da instanceof Tiddler)&&_db=="tags"){var _dc=_d5.lastChild;_dc.onfocus=function(e){abego.IntelliTagger.assistTagging(_dc,_da);setTimeout(function(){_d0(_da.title);},100);};_dc.onkeyup=function(e){if(!e){var e=window.event;}if(e.altKey&&!e.ctrlKey&&!e.metaKey&&(e.keyCode>=48&&e.keyCode<=57)){_8b(e.keyCode==48?9:e.keyCode-49,_dc,_da);}else{if(e.ctrlKey&&e.keyCode==32){_8b(0,_dc,_da);}}if(!e.ctrlKey&&(e.keyCode==13||e.keyCode==10)){_8b(0,_dc,_da);}setTimeout(function(){abego.IntelliTagger.assistTagging(_dc,_da);},100);return false;};_81(_dc);}};var _e0=function(e){if(!e){var e=window.event;}var _e3=resolveTarget(e);var _e4=_e3.getAttribute("tiddler");if(_e4){story.displayTiddler(_e3,_e4,"IntelliTaggerEditTagsTemplate",false);_d0(_e4);}return false;};var _e5=config.macros.tags.handler;config.macros.tags.handler=function(_e6,_e7,_e8,_e9,_ea,_eb){_e5.apply(this,arguments);abego.IntelliTagger.createEditTagsButton(_eb,createTiddlyElement(_e6.lastChild,"li"));};var _ec=function(){if(_71&&_72&&!abego.isDescendantOrSelf(document,_72)){abego.IntelliTagger.close();}};setInterval(_ec,100);abego.IntelliTagger.displayTagSuggestions=function(_ed,_ee,_ef,_f0,_f1){_74=_ed;_75=abego.toSet(_ee);_76=_ef;_72=_f0;_73=_f1;if(!_71){_71=createTiddlyElement(document.body,"div",null,"intelliTaggerSuggestions");_71.style.position="absolute";}_ac();abego.openAsPopup(_71);if(_77()){var w=_77().offsetWidth;if(_71.offsetWidth<w){_71.style.width=(w-2*(_6e+_6f))+"px";}abego.moveBelowAndClip(_71,_77());}else{abego.centerOnWindow(_71);}_c7();};abego.IntelliTagger.assistTagging=function(_f3,_f4){var _f5=_90(_f3);var s=_f3.value;if(_7d(_f3)){s=_7a(s);}var _f7=s.readBracketedList();var _f8=_f7.length>0?abego.filterStrings(abego.internal.getTagManager().getPartnerRankedTags(_f7),_f5,_70):_a0(_f5,_70);abego.IntelliTagger.displayTagSuggestions(_a9(_f5,_f7),_f7,_f8,_f3,function(tag,e){if(e.shiftKey){onClickTag.call(this,e);}else{_85(tag,_f3,_f4);}});};abego.IntelliTagger.close=function(){abego.closePopup(_71);_71=null;return false;};abego.IntelliTagger.createEditTagsButton=function(_fb,_fc,_fd,_fe,_ff,id,_101){if(!_fd){_fd="[edit]";}if(!_fe){_fe="Edit the tags";}if(!_ff){_ff="editTags";}var _102=createTiddlyButton(_fc,_fd,_fe,_e0,_ff,id,_101);_102.setAttribute("tiddler",(_fb instanceof Tiddler)?_fb.title:String(_fb));return _102;};abego.IntelliTagger.getSuggestionTagsMaxCount=function(){return 100;};config.macros.intelliTagger={label:"intelliTagger",handler:function(_103,_104,_105,_106,_107,_108){var _109=_107.parseParams("list",null,true);var _10a=_109[0]["action"];for(var i=0;_10a&&i<_10a.length;i++){var _10c=_10a[i];var _10d=config.macros.intelliTagger.subhandlers[_10c];if(!_10d){abego.alertAndThrow("Unsupported action '%0'".format([_10c]));}_10d(_103,_104,_105,_106,_107,_108);}},subhandlers:{showTags:function(_10e,_10f,_110,_111,_112,_113){_b4(_10e,_74,_76?_76.length:0,_76,abego.IntelliTagger.getSuggestionTagsMaxCount());},showFavorites:function(_114,_115,_116,_117,_118,_119){_b4(_114,_76,0);},closeButton:function(_11a,_11b,_11c,_11d,_11e,_11f){var _120=createTiddlyButton(_11a,"close","Close the suggestions",abego.IntelliTagger.close);},version:function(_121){var t="IntelliTagger %0.%1.%2".format([version.extensions.IntelliTaggerPlugin.major,version.extensions.IntelliTaggerPlugin.minor,version.extensions.IntelliTaggerPlugin.revision]);var e=createTiddlyElement(_121,"a");e.setAttribute("href","http://tiddlywiki.abego-software.de/#IntelliTaggerPlugin");e.innerHTML="<font color=\"black\" face=\"Arial, Helvetica, sans-serif\">"+t+"<font>";},copyright:function(_124){var e=createTiddlyElement(_124,"a");e.setAttribute("href","http://tiddlywiki.abego-software.de");e.innerHTML="<font color=\"black\" face=\"Arial, Helvetica, sans-serif\">© 2006-2007 <b><font color=\"red\">abego</font></b> Software<font>";}}};})();config.shadowTiddlers["IntelliTaggerStyleSheet"]="/***\n"+"!~IntelliTagger Stylesheet\n"+"***/\n"+"/*{{{*/\n"+".intelliTaggerSuggestions {\n"+"\tposition: absolute;\n"+"\twidth: 600px;\n"+"\n"+"\tpadding: 2px;\n"+"\tlist-style: none;\n"+"\tmargin: 0;\n"+"\n"+"\tbackground: #eeeeee;\n"+"\tborder: 1px solid DarkGray;\n"+"}\n"+"\n"+".intelliTaggerSuggestions .currentTag {\n"+"\tfont-weight: bold;\n"+"}\n"+"\n"+".intelliTaggerSuggestions .suggestionNumber {\n"+"\tcolor: #808080;\n"+"}\n"+"\n"+".intelliTaggerSuggestions .numberedSuggestion{\n"+"\twhite-space: nowrap;\n"+"}\n"+"\n"+".intelliTaggerSuggestions .intelliTaggerFooter {\n"+"\tmargin-top: 4px;\n"+"\tborder-top-width: thin;\n"+"\tborder-top-style: solid;\n"+"\tborder-top-color: #999999;\n"+"}\n"+".intelliTaggerSuggestions .favorites {\n"+"\tborder-bottom-width: thin;\n"+"\tborder-bottom-style: solid;\n"+"\tborder-bottom-color: #999999;\n"+"\tpadding-bottom: 2px;\n"+"}\n"+"\n"+".intelliTaggerSuggestions .normalTags {\n"+"\tpadding-top: 2px;\n"+"}\n"+"\n"+".intelliTaggerSuggestions .intelliTaggerFooter .button {\n"+"\tfont-size: 10px;\n"+"\n"+"\tpadding-left: 0.3em;\n"+"\tpadding-right: 0.3em;\n"+"}\n"+"\n"+"/*}}}*/\n";config.shadowTiddlers["IntelliTaggerMainTemplate"]="<!--\n"+"{{{\n"+"-->\n"+"<div class=\"favorites\" macro=\"intelliTagger action: showFavorites\"></div>\n"+"<div class=\"normalTags\" macro=\"intelliTagger action: showTags\"></div>\n"+"<!-- The Footer (with the Navigation) ============================================ -->\n"+"<table class=\"intelliTaggerFooter\" border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tbody>\n"+" <tr>\n"+"\t<td align=\"left\">\n"+"\t\t<span macro=\"intelliTagger action: closeButton\"></span>\n"+"\t</td>\n"+"\t<td align=\"right\">\n"+"\t\t<span macro=\"intelliTagger action: version\"></span>, <span macro=\"intelliTagger action: copyright \"></span>\n"+"\t</td>\n"+" </tr>\n"+"</tbody></table>\n"+"<!--\n"+"}}}\n"+"-->\n";config.shadowTiddlers["IntelliTaggerEditTagsTemplate"]="<!--\n"+"{{{\n"+"-->\n"+"<div class='toolbar' macro='toolbar +saveTiddler -cancelTiddler'></div>\n"+"<div class='title' macro='view title'></div>\n"+"<div class='tagged' macro='tags'></div>\n"+"<div class='viewer' macro='view text wikified'></div>\n"+"<div class='toolbar' macro='toolbar +saveTiddler -cancelTiddler'></div>\n"+"<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser'></span></div>\n"+"<!--\n"+"}}}\n"+"-->\n";config.shadowTiddlers["BSD open source license (abego Software)"]="See [[Licence|http://tiddlywiki.abego-software.de/#%5B%5BBSD%20open%20source%20license%5D%5D]].";config.shadowTiddlers["IntelliTaggerPlugin Documentation"]="[[Documentation on abego Software website|http://tiddlywiki.abego-software.de/doc/IntelliTagger.pdf]].";config.shadowTiddlers["IntelliTaggerPlugin SourceCode"]="[[Plugin source code on abego Software website|http://tiddlywiki.abego-software.de/archive/IntelliTaggerPlugin/Plugin-IntelliTagger-src.1.0.2.js]]\n";(function(){var _126=restart;restart=function(){setStylesheet(store.getTiddlerText("IntelliTaggerStyleSheet"),"IntelliTaggerStyleSheet");_126.apply(this,arguments);};})();}
// %/
Temperature data alone does not provide intelligence -inversion of measurements using interpretation modeling is essential to realize intelligence.
Ionic Effects. As previously discussed, the ionic strength of a brine influences the stability of a foam. Three model brine, deionized water, 10,000 ppm TDS, and 100,000 TDS were analyzed for foam height and half-life. In practice, actual oilfield brines have to be analyzed to determine that no unique
complexes with a particular salt (especially divalent and trivalent ions) and a particular chemical occur. However, there is no general ionic effect on the performance of chemical foamers.
... theoretically indicate the amount of iron put in solution by corrosion at any given time, but iron counts are undependable due to natuaraly-occurring iron in some formation waters and iron sulfide formation in the presence of hydrogen sulfide.
A temperature profile around a gas lift mandrel is shown in Fig 9. The Joule Thomson cooling effect during valve opening allows the user to easily identify the operating valve, as well as understanding if the valve is remaining open or it is cycling.
To improve project economics, the operator has to search for key reservoir knowledge and adaptation of new technologies. Unfortunately, knowledge of the reservoir is gained only through experience and field production.
p2,c1:
The laboratory data is then used in a series of engineering software tool to model various scenarios for the production system.
/***
|Name:|LessBackupsPlugin|
|Description:|Intelligently limit the number of backup files you create|
|Version:|3.0.1 ($Rev: 2320 $)|
|Date:|$Date: 2007-06-18 22:37:46 +1000 (Mon, 18 Jun 2007) $|
|Source:|http://mptw.tiddlyspot.com/#LessBackupsPlugin|
|Author:|Simon Baird|
|Email:|simon.baird@gmail.com|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!Description
You end up with just backup one per year, per month, per weekday, per hour, minute, and second. So total number won't exceed about 200 or so. Can be reduced by commenting out the seconds/minutes/hours line from modes array
!!Notes
Works in IE and Firefox only. Algorithm by Daniel Baird. IE specific code by by Saq Imtiaz.
***/
//{{{
var MINS = 60 * 1000;
var HOURS = 60 * MINS;
var DAYS = 24 * HOURS;
if (!config.lessBackups) {
config.lessBackups = {
// comment out the ones you don't want or set config.lessBackups.modes in your 'tweaks' plugin
modes: [
["YYYY", 365*DAYS], // one per year for ever
["MMM", 31*DAYS], // one per month
["ddd", 7*DAYS], // one per weekday
//["d0DD", 1*DAYS], // one per day of month
["h0hh", 24*HOURS], // one per hour
["m0mm", 1*HOURS], // one per minute
["s0ss", 1*MINS], // one per second
["latest",0] // always keep last version. (leave this).
]
};
}
window.getSpecialBackupPath = function(backupPath) {
var now = new Date();
var modes = config.lessBackups.modes;
for (var i=0;i<modes.length;i++) {
// the filename we will try
var specialBackupPath = backupPath.replace(/(\.)([0-9]+\.[0-9]+)(\.html)$/,
'$1'+now.formatString(modes[i][0]).toLowerCase()+'$3')
// open the file
try {
if (config.browser.isIE) {
var fsobject = new ActiveXObject("Scripting.FileSystemObject")
var fileExists = fsobject.FileExists(specialBackupPath);
if (fileExists) {
var fileObject = fsobject.GetFile(specialBackupPath);
var modDate = new Date(fileObject.DateLastModified).valueOf();
}
}
else {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(specialBackupPath);
var fileExists = file.exists();
if (fileExists) {
var modDate = file.lastModifiedTime;
}
}
}
catch(e) {
// give up
return backupPath;
}
// expiry is used to tell if it's an 'old' one. Eg, if the month is June and there is a
// June file on disk that's more than an month old then it must be stale so overwrite
// note that "latest" should be always written because the expiration period is zero (see above)
var expiry = new Date(modDate + modes[i][1]);
if (!fileExists || now > expiry)
return specialBackupPath;
}
}
// hijack the core function
window.getBackupPath_mptw_orig = window.getBackupPath;
window.getBackupPath = function(localPath) {
return getSpecialBackupPath(getBackupPath_mptw_orig(localPath));
}
//}}}
There are a variety of techniques that may be used for constructing a level detection device. Some of these are listed below:
* capacitance
* displace
* floater
* hydrostatic
* level glassses
* [[magnetostrictive|magnetostrictive device]]
* nucleonic
* resistive
* thermal
* ultrasonic
* visual
* vibrating element
Stern and Geary coined the term "linear polarization" to describe the linear relationship they found to exist between potential and applied anodic or cathodic current densities at low values of applied current (near the freely corroding potential).
Commercial available linear polarization systems measure the amount of current which must be applied to produce a smal milivolt shift in potential of the test electrode and internal circuitry converts that current values to a corrosion rate on a meter scale.
Readings obtained in this manner are not indicative of the downhole corrosion rate by any means, but they do present an indication of the resistance of corrosion inhibitor films on the electrodes.
A low coorosion rate reading is indicative of a large inhibitor film resistance on the electrodes. In turn, a high corrosion rate reading is indicative of a poor inhibitor film.
/***
|''Name:''|LoadRemoteFileThroughProxy (previous LoadRemoteFileHijack)|
|''Description:''|When the TiddlyWiki file is located on the web (view over http) the content of [[SiteProxy]] tiddler is added in front of the file url. If [[SiteProxy]] does not exist "/proxy/" is added. |
|''Version:''|1.1.0|
|''Date:''|mar 17, 2007|
|''Source:''|http://tiddlywiki.bidix.info/#LoadRemoteFileHijack|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''License:''|[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D ]]|
|''~CoreVersion:''|2.2.0|
***/
//{{{
version.extensions.LoadRemoteFileThroughProxy = {
major: 1, minor: 1, revision: 0,
date: new Date("mar 17, 2007"),
source: "http://tiddlywiki.bidix.info/#LoadRemoteFileThroughProxy"};
if (!window.bidix) window.bidix = {}; // bidix namespace
if (!bidix.core) bidix.core = {};
bidix.core.loadRemoteFile = loadRemoteFile;
loadRemoteFile = function(url,callback,params)
{
if ((document.location.toString().substr(0,4) == "http") && (url.substr(0,4) == "http")){
url = store.getTiddlerText("SiteProxy", "/proxy/") + url;
}
return bidix.core.loadRemoteFile(url,callback,params);
}
//}}}
Results indicate that the radiation shield gives 20 to 40% reduction in casing temperatures after 14 days of injection.
Model Predicitive Control.
It is a technique in which the error between the predictive plant response and the set point is minimized online over a receding horizon and subject to constratints. It has been used for many years in the petrochemical and food industries.
MPTW is a distribution or edition of TiddlyWiki that includes a standard TiddlyWiki core packaged with some plugins designed to improve usability and provide a better way to organise your information. For more information see http://mptw.tiddlyspot.com/.
It has an array of twelve miniature sensors, each normally sampled 100 times per foot. This tool is based on remote field eddy currents, reflects the profile of the casing rather than detecting the edges of defects; significantly this includes areas of gradual thinning.
* Computer based surveillance
* Data Acquisition Systems
* Central Database
* Tools for Analysis
* Communication system
* Business drivers for data manegement
* Multidisciplinary teams
* work breakdown structure
* coordination workshops
* focused on problems associated with waxes, asphaltenes, hydrates and scale.
* flow assurance work process
* sampling, analysis, modeling, surveillance
* three cornerstones in adopting new technology:
** technology
** people
** process
* Real Time Optimization (RTO) systems
* value metrics
* RTO case histories
* economic value added by RTO
* lessons learned
* benchmarking RTO projects
* Calculation of general corrosion rates based on weight loss is straighforward. The weight loss corrosion may be then be linearly extrapolated over time.
* However, pitting prediction is more complicated since the rate of pit growth changes with time. Large amounts of data must be acquired and carefully analyzed, using proprietary algorithms, to ensure statiscal validity and accuracy in data interpretation. The analytic procedure includes identifying and sizing several of the deepest pits over the entire surface of several coupons per test.
... a few guidelines are suggested that should prove beneficial in extending the service life of the selected production string:
# Select tubing that has a homogeneous hardness throughout.
# Select tubing that has a low sulfur content.
# In wells with H2S, use low-alloy carbon steels that have a maximum Rockwell-C hardness of 22 or nonferrous alloys that have a maximum Rc of 35 (Ni-Cr, Ni-Cr-Mo, Ni-CrMo-Co).
# Avoid stainless steel in reducing environments or where chlorides, sand and H2S are present.
# Select tubing that has beeen properly stress-relieved of residual stress from upsetting threading and straightening operations.
|!Factor|!Temp./Press.|!Phase Behavior|!Flow Dynamics|!Corrosion Rate|
|Input| historic temperatures, pressures, ID, water rate, GOR, etc. | Flow rates, gas composition, temperature & pressure | liquid & gas superficial velocities | Five parameters in production tubing |
|Calculations| Pressure drop | Phase equilibrium | Equations by Fernandes and Sylvester | |
|Uses| Artificial neural network | Peng-Robinson Eq. of State | Ishii & Mishima flow map | Number Cruncher Statiscal System (NCSS) |
|Database| 726 wells | - | - | Data from non-annular gas condensate wells |
|Output| Temperature profile @ depth | Bubble point @ bottomhole | Flow regime vs. depth | Empirical correlation for corrosion rate |
Name: MptwBlack
Background: #000
Foreground: #fff
PrimaryPale: #333
PrimaryLight: #555
PrimaryMid: #888
PrimaryDark: #aaa
SecondaryPale: #111
SecondaryLight: #222
SecondaryMid: #555
SecondaryDark: #888
TertiaryPale: #222
TertiaryLight: #666
TertiaryMid: #888
TertiaryDark: #aaa
Error: #300
This is in progress. Help appreciated.
Name: MptwBlue
Background: #fff
Foreground: #000
PrimaryPale: #cdf
PrimaryLight: #57c
PrimaryMid: #114
PrimaryDark: #012
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
/***
|Name:|MptwConfigPlugin|
|Description:|Miscellaneous tweaks used by MPTW|
|Version:|1.0 ($Rev: 3646 $)|
|Date:|$Date: 2008-02-27 02:34:38 +1000 (Wed, 27 Feb 2008) $|
|Source:|http://mptw.tiddlyspot.com/#MptwConfigPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#MptwConfigPlugin|
!!Note: instead of editing this you should put overrides in MptwUserConfigPlugin
***/
//{{{
var originalReadOnly = readOnly;
var originalShowBackstage = showBackstage;
config.options.chkHttpReadOnly = false; // means web visitors can experiment with your site by clicking edit
readOnly = false; // needed because the above doesn't work any more post 2.1 (??)
showBackstage = true; // show backstage for same reason
config.options.chkInsertTabs = true; // tab inserts a tab when editing a tiddler
config.views.wikified.defaultText = ""; // don't need message when a tiddler doesn't exist
config.views.editor.defaultText = ""; // don't need message when creating a new tiddler
config.options.chkSaveBackups = true; // do save backups
config.options.txtBackupFolder = 'twbackup'; // put backups in a backups folder
config.options.chkAutoSave = (window.location.protocol == "file:"); // do autosave if we're in local file
config.mptwVersion = "2.5.2";
config.macros.mptwVersion={handler:function(place){wikify(config.mptwVersion,place);}};
if (config.options.txtTheme == '')
config.options.txtTheme = 'MptwTheme';
// add to default GettingStarted
config.shadowTiddlers.GettingStarted += "\n\nSee also [[MPTW]].";
// add select theme and palette controls in default OptionsPanel
config.shadowTiddlers.OptionsPanel = config.shadowTiddlers.OptionsPanel.replace(/(\n\-\-\-\-\nAlso see AdvancedOptions)/, "{{select{<<selectTheme>>\n<<selectPalette>>}}}$1");
// these are used by ViewTemplate
config.mptwDateFormat = 'DD/MM/YY';
config.mptwJournalFormat = 'Journal DD/MM/YY';
//}}}
Name: MptwGreen
Background: #fff
Foreground: #000
PrimaryPale: #9b9
PrimaryLight: #385
PrimaryMid: #031
PrimaryDark: #020
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
Name: MptwRed
Background: #fff
Foreground: #000
PrimaryPale: #eaa
PrimaryLight: #c55
PrimaryMid: #711
PrimaryDark: #500
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
|Name|MptwRounded|
|Description|Mptw Theme with some rounded corners (Firefox only)|
|ViewTemplate|MptwTheme##ViewTemplate|
|EditTemplate|MptwTheme##EditTemplate|
|PageTemplate|MptwTheme##PageTemplate|
|StyleSheet|##StyleSheet|
!StyleSheet
/*{{{*/
[[MptwTheme##StyleSheet]]
.tiddler,
.sliderPanel,
.button,
.tiddlyLink,
.tabContents
{ -moz-border-radius: 1em; }
.tab {
-moz-border-radius-topleft: 0.5em;
-moz-border-radius-topright: 0.5em;
}
#topMenu {
-moz-border-radius-bottomleft: 2em;
-moz-border-radius-bottomright: 2em;
}
/*}}}*/
Name: MptwSmoke
Background: #fff
Foreground: #000
PrimaryPale: #aaa
PrimaryLight: #777
PrimaryMid: #111
PrimaryDark: #000
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
|Name|MptwStandard|
|Description|Mptw Theme with the default TiddlyWiki PageLayout and Styles|
|ViewTemplate|MptwTheme##ViewTemplate|
|EditTemplate|MptwTheme##EditTemplate|
Name: MptwTeal
Background: #fff
Foreground: #000
PrimaryPale: #B5D1DF
PrimaryLight: #618FA9
PrimaryMid: #1a3844
PrimaryDark: #000
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #f8f8f8
TertiaryLight: #bbb
TertiaryMid: #999
TertiaryDark: #888
Error: #f88
|Name|MptwTheme|
|Description|Mptw Theme including custom PageLayout|
|PageTemplate|##PageTemplate|
|ViewTemplate|##ViewTemplate|
|EditTemplate|##EditTemplate|
|StyleSheet|##StyleSheet|
http://mptw.tiddlyspot.com/#MptwTheme ($Rev: 1829 $)
!PageTemplate
<!--{{{-->
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<!-- horizontal MainMenu -->
<div id='topMenu' refresh='content' tiddler='MainMenu'></div>
<!-- original MainMenu menu -->
<!-- <div id='mainMenu' refresh='content' tiddler='MainMenu'></div> -->
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
!ViewTemplate
<!--{{{-->
[[MptwTheme##ViewTemplateToolbar]]
<br><br></br>
<div class="tagglyTagged" macro="tags"></div>
<div class='titleContainer'>
<span class='title' macro='view title'></span>
<span macro="miniTag"></span>
</div>
<div class='subtitle'>
(updated <span macro='view modified date {{config.mptwDateFormat?config.mptwDateFormat:"MM/0DD/YY"}}'></span>
by <span macro='view modifier link'></span>)
<!--
(<span macro='message views.wikified.createdPrompt'></span>
<span macro='view created date {{config.mptwDateFormat?config.mptwDateFormat:"MM/0DD/YY"}}'></span>)
-->
</div>
<div macro="showWhen tiddler.tags.containsAny(['css','html','pre','systemConfig']) && !tiddler.text.match('{{'+'{')">
<div class='viewer'><pre macro='view text'></pre></div>
</div>
<div macro="else">
<div class='viewer' macro='view text wikified'></div>
</div>
<div class="tagglyTagging" macro="tagglyTagging"></div>
<!--}}}-->
!ViewTemplateToolbar
<!--{{{-->
<div class='toolbar'>
<span macro="showWhenTagged systemConfig">
<span macro="toggleTag systemConfigDisable . '[[disable|systemConfigDisable]]'"></span>
</span>
<span macro="showWhenTagged systemTheme"><span macro="applyTheme"></span></span>
<span macro="showWhenTagged systemPalette"><span macro="applyPalette"></span></span>
<span macro="showWhen tiddler.tags.contains('css') || tiddler.title == 'StyleSheet'"><span macro="refreshAll"></span></span>
<span style="padding:1em;"></span>
<span macro='toolbar closeTiddler closeOthers copyTiddler +editTiddler deleteTiddler > fields syncing permalink references jump'></span> <span macro='newHere label:"new here"'></span>
<span macro='newJournalHere {{config.mptwJournalFormat?config.mptwJournalFormat:"MM/0DD/YY"}}'></span>
</div>
<!--}}}-->
!EditTemplate
<!--{{{-->
<div class="toolbar" macro="toolbar +saveTiddler saveCloseTiddler copyTiddler closeOthers -cancelTiddler cancelCloseTiddler deleteTiddler"></div>
<div class="title" macro="view title"></div>
<div class="editLabel">Title</div><div class="editor" macro="edit title"></div>
<div macro='annotations'></div>
<div class="editLabel">Content</div><div class="editor" macro="edit text"></div>
<div class="editLabel">Tags</div><div class="editor" macro="edit tags"></div>
<div class="editorFooter"><span macro="message views.editor.tagPrompt"></span><span macro="tagChooser"></span></div>
<!--}}}-->
!StyleSheet
/*{{{*/
/* a contrasting background so I can see where one tiddler ends and the other begins */
body {
background: [[ColorPalette::TertiaryLight]];
}
/* sexy colours and font for the header */
.headerForeground {
color: [[ColorPalette::PrimaryPale]];
}
.headerShadow, .headerShadow a {
color: [[ColorPalette::PrimaryMid]];
}
/* separate the top menu parts */
.headerForeground, .headerShadow {
padding: 1em 1em 0;
}
.headerForeground, .headerShadow {
font-family: 'Trebuchet MS' sans-serif;
font-weight:bold;
}
.headerForeground .siteSubtitle {
color: [[ColorPalette::PrimaryLight]];
}
.headerShadow .siteSubtitle {
color: [[ColorPalette::PrimaryMid]];
}
/* make shadow go and down right instead of up and left */
.headerShadow {
left: 1px;
top: 1px;
}
/* prefer monospace for editing */
.editor textarea, .editor input {
font-family: 'Consolas' monospace;
background-color:[[ColorPalette::TertiaryPale]];
}
/* sexy tiddler titles */
.title {
font-size: 250%;
color: [[ColorPalette::PrimaryLight]];
font-family: 'Trebuchet MS' sans-serif;
}
/* more subtle tiddler subtitle */
.subtitle {
padding:0px;
margin:0px;
padding-left:1em;
font-size: 90%;
color: [[ColorPalette::TertiaryMid]];
}
.subtitle .tiddlyLink {
color: [[ColorPalette::TertiaryMid]];
}
/* a little bit of extra whitespace */
.viewer {
padding-bottom:3px;
}
/* don't want any background color for headings */
h1,h2,h3,h4,h5,h6 {
background-color: transparent;
color: [[ColorPalette::Foreground]];
}
/* give tiddlers 3d style border and explicit background */
.tiddler {
background: [[ColorPalette::Background]];
border-right: 2px [[ColorPalette::TertiaryMid]] solid;
border-bottom: 2px [[ColorPalette::TertiaryMid]] solid;
margin-bottom: 1em;
padding:1em 2em 2em 1.5em;
}
/* make options slider look nicer */
#sidebarOptions .sliderPanel {
border:solid 1px [[ColorPalette::PrimaryLight]];
}
/* the borders look wrong with the body background */
#sidebar .button {
border-style: none;
}
/* this means you can put line breaks in SidebarOptions for readability */
#sidebarOptions br {
display:none;
}
/* undo the above in OptionsPanel */
#sidebarOptions .sliderPanel br {
display:inline;
}
/* horizontal main menu stuff */
#displayArea {
margin: 1em 15.7em 0em 1em; /* use the freed up space */
}
#topMenu br {
display: none;
}
#topMenu {
background: [[ColorPalette::PrimaryMid]];
color:[[ColorPalette::PrimaryPale]];
}
#topMenu {
padding:2px;
}
#topMenu .button, #topMenu .tiddlyLink, #topMenu a {
margin-left: 0.5em;
margin-right: 0.5em;
padding-left: 3px;
padding-right: 3px;
color: [[ColorPalette::PrimaryPale]];
font-size: 115%;
}
#topMenu .button:hover, #topMenu .tiddlyLink:hover {
background: [[ColorPalette::PrimaryDark]];
}
/* make 2.2 act like 2.1 with the invisible buttons */
.toolbar {
visibility:hidden;
}
.selected .toolbar {
visibility:visible;
}
/* experimental. this is a little borked in IE7 with the button
* borders but worth it I think for the extra screen realestate */
.toolbar { float:right; }
/* fix for TaggerPlugin. from sb56637. improved by FND */
.popup li .tagger a {
display:inline;
}
/* makes theme selector look a little better */
#sidebarOptions .sliderPanel .select .button {
padding:0.5em;
display:block;
}
#sidebarOptions .sliderPanel .select br {
display:none;
}
/* make it print a little cleaner */
@media print {
#topMenu {
display: none ! important;
}
/* not sure if we need all the importants */
.tiddler {
border-style: none ! important;
margin:0px ! important;
padding:0px ! important;
padding-bottom:2em ! important;
}
.tagglyTagging .button, .tagglyTagging .hidebutton {
display: none ! important;
}
.headerShadow {
visibility: hidden ! important;
}
.tagglyTagged .quickopentag, .tagged .quickopentag {
border-style: none ! important;
}
.quickopentag a.button, .miniTag {
display: none ! important;
}
}
/* get user styles specified in StyleSheet */
[[StyleSheet]]
/*}}}*/
|Name|MptwTrim|
|Description|Mptw Theme with a reduced header to increase useful space|
|ViewTemplate|MptwTheme##ViewTemplate|
|EditTemplate|MptwTheme##EditTemplate|
|StyleSheet|MptwTheme##StyleSheet|
|PageTemplate|##PageTemplate|
!PageTemplate
<!--{{{-->
<!-- horizontal MainMenu -->
<div id='topMenu' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<span refresh='content' tiddler='SiteTitle' style="padding-left:1em;font-weight:bold;"></span>:
<span refresh='content' tiddler='MainMenu'></span>
</div>
<div id='sidebar'>
<div id='sidebarOptions'>
<div refresh='content' tiddler='SideBarOptions'></div>
<div style="margin-left:0.1em;"
macro='slider chkTabSliderPanel SideBarTabs {{"tabs \u00bb"}} "Show Timeline, All, Tags, etc"'></div>
</div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
For upgrading. See [[ImportTiddlers]].
URL: http://mptw.tiddlyspot.com/upgrade.html
/***
|Description:|A place to put your config tweaks so they aren't overwritten when you upgrade MPTW|
See http://www.tiddlywiki.org/wiki/Configuration_Options for other options you can set. In some cases where there are clashes with other plugins it might help to rename this to zzMptwUserConfigPlugin so it gets executed last.
***/
//{{{
// example: set your preferred date format
//config.mptwDateFormat = 'MM/0DD/YY';
//config.mptwJournalFormat = 'Journal MM/0DD/YY';
// example: set the theme you want to start with
config.options.txtTheme = 'MptwRoundTheme';
// example: switch off autosave, switch on backups and set a backup folder
//config.options.chkSaveBackups = true;
//config.options.chkAutoSave = false;
//config.options.txtBackupFolder = 'backups';
// uncomment to disable 'new means new' functionality for the new journal macro
//config.newMeansNewForJournalsToo = false;
//}}}
[[Non-Destructive Testing]]
Natural convection is fluid motion caused by the variation of oil density with temperature. The amount of fluid motion is inversely proportional to the viscosity. As viscosity increases, fluid motion decreases. This is accompanied by a decrease in the heat-carrying ability of the oil or, correspondingly, an increase in its insulating properties.
<<newTiddler title:"New Reference Document" label:"new Paper" text:{{"<<formTiddler RefDocTemplate2\>\>"}} tag:"ReferenceDocument Paper">>
The new generation of interface level devices may use the same techniques as mentioned above. However, they are able to provide information not only on the interface level but also on the thickness of emulsion and foam inside a three phase separator. Some of these devices are called “Profile Gauges” as they generate a (signal) profile of a particular property for the various phases inside the separator. From the profile, one is able to determine the interface levels and work out the thickness of the phases including the emulsions and foams. The profile can be based on dielectric constant or capacitance, density, or thermal transport ability. As a result, there is a great opportunity to make the three phase separation far more efficient than can be achieved with conventional interface level approach at the present. A number of such devices have been developed. The techniques used include
* capacitance
* ultrasonic
* measuring the variation of heat transport
* [[nucleonic|nucleonic device]]
/***
|Name|NewDocumentPlugin|
|Source|http://www.TiddlyTools.com/#NewDocumentPlugin|
|Version|1.7.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <<br>>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|Quickly create new TiddlyWiki documents from your existing document, with just one click|
Use the {{{<<newDocument>>}}} macro to place a "new document" link into your sidebar/mainmenu/any tiddler (wherever you like). Select this command to automatically create a "new.html" document containing a specific set of tagged tiddlers. Optional parameters let you specify an alternate path/filename for the new file, or different tags to match. You can also indicate "ask" for either parameter, which will trigger a prompt for input when the command is selected.
!!!!!Usage
<<<
{{{<<newDocument label:text prompt:text filename tag tag tag...>>}}}
{{{<<newDocument label:text prompt:text filename all>>}}}
{{{<<newDocument label:text prompt:text filename snap ID>>}}}
{{{<<newDocument label:text prompt:text filename snap here>>}}}
{{{<<newDocument label:text prompt:text nofile print ID>>}}}
{{{<<newDocument label:text prompt:text nofile print here>>}}}
where:
* ''label:text'' defines //optional// alternative link text (replaces default "new document" display)
* ''prompt:text'' defines //optional// alternative tooltip text for 'mouseover' prompting (replaces default hard-coded tooltip text)
* ''filename'' is any local path-and-filename. If no parameters are provided, the default is to create the file "new.html" in the current directory. If a filename is provided without a path (i.e., there is no "/" in the input), then the current directory is also assumed. Otherwise, this parameter is expected to contain the complete path and filename needed to write the file to your local hard disk. If ''ask'' is used in place of the filename parameter then, when the command link is selected, a message box will be automatically displayed so you can select/enter the path and filename.
* ''tag tag tag...'' is a list of one or more space-separated tags (use quotes or {{{[[]]}}} around tags that contain spaces). The new document will include all tiddlers that match at least one of the tags in the list. The default is to include tiddlers tagged with <<tag includeNew>>. The special value ''all'' may be used to match every tiddler (even those without tags). If ''ask'' is used in place of the tags then, when the command link is selected, a message box will be automatically displayed so you can enter the desired tags at that time.
* When you use the keyword ''snap'' in place of the tags, you can generate a file containing the //rendered// CSS-and-HTML that is currently being displayed in browser. By default, the snapshop uses the 'contentWrapper' DOM element ID to automatically include all the TiddlyWiki elements, such as the sidebars and header, in addition to the center 'story' column containing the tiddler content.
* When you use the keyword ''print'' in place of the tags, a snapshot is generated, but the contents are not written to a file. Instead, they are displayed in a separate browser tab/window, and the print dialog for that tab/window is automatically invoked.
* You can limit the snapshot to capture only a portion of the rendered TiddlyWiki elements by specifiying an optional alternate DOM element ID, such as "displayArea" (the entire center 'story' column) or even just a single tiddler (e.g., "tidderMyTiddlerTitle", assuming that "MyTiddlerTitle" is currently displayed). Only the portions of the document that are contained //within// the specified DOM element will be transcribed to the resulting snapshot file. If ''ask'' is used in place of a DOM element ID, you will be prompted to enter the ID (default is "contentWrapper") when the snapshot is being taken. This allows you to easily enter the ID of any currently displayed tiddler to make quick snapshots of specific tiddlers. If ''here'' is used in place of a DOM element ID, the current tiddler id is used.
Note: as of version 1.4.0 of this plugin, support for selecting tiddlers by using tag *expressions* has been replaced with simpler, more efficient "containsAny()" logic. To create new ~TiddlyWiki documents that contain only those tiddlers selected with advanced AND/OR/NOT Boolean expressions, you can use the filtering features provided by the ExportTiddlersPlugin (see www.TiddlyTools.com/#ExportTiddlersPlugin).
<<<
!!!!!Examples:
<<<
{{{<<newDocument>>}}}
equivalent to {{{<<newDocument new.htm includeNew systemTiddlers>>}}}
creates default "new.html" containing tiddlers tagged with either<<tag includeNew>>or<<tag systemTiddlers>>
try it: <<newDocument>>
{{{<<newDocument empty.html systemTiddlers>>}}}
creates "empty.html" containing only tiddlers tagged with<<tag systemTiddlers>>
//(reproduces old-style (pre 2.0.2) empty file)//
try it: <<newDocument empty.html systemTiddlers>>
{{{<<newDocument "label:create Import/Export starter" ask importexport>>}}}
save importexport tiddlers to a new file, prompts for path/file
try it: <<newDocument "label:create Import/Export starter" ask importexport>>
{{{<<newDocument ask ask>>}}}
prompts for path/file, prompts for tags to match
try it: <<newDocument ask ask>>
{{{<<newDocument ask all>>}}}
save all current TiddlyWiki contents to a new file, prompts for path/file
try it: <<newDocument ask all>>
{{{<<newDocument ask snap>>}}}
generates snapshot of currently displayed document, prompts for path/file
try it: <<newDocument ask snap>>
{{{<<newDocument ask snap here>>}}}
generates snapshot of this tiddler ONLY, prompts for path/file
try it: <<newDocument ask snap here>>
{{{<<newDocument ask print here>>}}}
prints a snapshot of this tiddler ONLY
try it: <<newDocument nofile print here>>
<<<
!!!!!Installation
<<<
Import (or copy/paste) the following tiddlers into your document:
''NewDocumentPlugin'' (tagged with <<tag systemConfig>>)
<<<
!!!!!Revision History
<<<
''2007.03.30 [1.7.0]'' added support for "print" param as alternative for "snap". When "print" is used, the filename is ignored and ouput is directed to another browser tab/window, where the print dialog is then automatically triggered.
''2007.03.30 [1.6.1]'' added support for "here" keyword for current tiddler elementID and "prompt:text" param for specifying tooltip text
''2007.02.12 [1.6.0]'' in onClickNewDocument(), reset HTML source 'markup'
''2006.10.23 [1.5.1]'' in onClickNewDocument(), get saved parameter value for snapID instead of using default "contentWrapper" (oops!)
''2006.10.18 [1.5.0]'' new optional param for 'snap'... specify alternative DOM element ID (default is still "contentWrapper"). Based on a suggestion from Xavier Verges.
''2006.08.03 [1.4.3]'' in promptForFilename(), for IE (WinXP only), added handling for UserAccounts.CommonDialog
''2006.07.29 [1.4.2]'' in onClickNewDocument(), okmsg display is now linked to newly created file
''2006.07.24 [1.4.1]'' in promptForFilename(), check for nsIFilePicker.returnCancel to allow nsIFilePicker.returnOK **OR** nsIFilePicker.returnReplace to be processed.
''2006.05.23 [1.4.0]'' due to very poor performance, support for tag *expressions* has been removed, in favor of a simpler "containsAny()" scan for tags.
''2006.04.09 [1.3.6]'' in onClickNewDocument, added call to convertUnicodeToUTF8() to better handle international characters.
''2006.03.15 [1.3.5]'' added nsIFilePicker() handler for selecting filename in moz-based browsers. IE and other non-moz browsers still use simple prompt() dialog
''2006.03.15 [1.3.0]'' added "label:text" param for custom link text. added special "all" filter parameter for "save as..." handling (writes all tiddlers to output file)
''2006.03.09 [1.2.0]'' added special "snap" filter parameter to generate and write "snapshot" files containing static HTML+CSS for currently rendered document.
''2006.02.24 [1.1.2]'' Fix incompatiblity with TW 2.0.5 by removing custom definition of getLocalPath() (which is now part of TW core)
''2006.02.03 [1.1.1]'' concatentate 'extra' params so that tag expressions don't have to be quoted. moved all text to 'formatted' string definitions for easier translation.
''2006.02.03 [1.1.0]'' added support for tag EXPRESSIONS. plus improved documentation and code cleanup
''2006.02.03 [1.0.0]'' Created.
<<<
!!!!!Credits
<<<
This feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]]
<<<
!!!!!Code
***/
//{{{
version.extensions.newDocument = {major: 1, minor: 7, revision: 0, date: new Date(2007,3,30)};
config.macros.newDocument = {
newlabel: "new document",
newprompt: "Create a new TiddlyWiki 'starter' document",
newdefault: "new.html",
allparam: "all",
saveaslabel: "save as...",
saveasprompt: "Save current TiddlyWiki to a different file",
printparam: "print",
snapparam: "snap",
snaplabel: "create a snapshot",
snapprompt: "Create a 'snapshot' of the current TiddlyWiki display",
snapdefault: "snapshot.html",
snapID: "contentWrapper",
snapIDprompt: "Please enter a DOM element ID for the desired content",
snapIDerrmsg: "Unrecognized document element ID: '%0'",
askparam: "ask",
hereparam: "here",
labelparam: "label:",
promptparam: "prompt:",
fileprompt: "Please enter a filename",
filter: "includeNew",
filterprompt: "Match one or more tags:\n(space-separated, use [[...]] around tags containing spaces)",
filtererrmsg: "Error in tag filter '%0'",
snapmsg: "Document snapshot written to %1",
okmsg: "%0 tiddlers written to %1",
failmsg: "An error occurred while creating %0"
};
config.macros.newDocument.handler = function(place,macroName,params) {
var path=getLocalPath(document.location.href);
var slashpos=path.lastIndexOf("/"); if (slashpos==-1) slashpos=path.lastIndexOf("\\");
if (slashpos!=-1) path = path.substr(0,slashpos+1); // remove filename from path, leave the trailing slash
if (params[0] && params[0].substr(0,config.macros.newDocument.labelparam.length)==config.macros.newDocument.labelparam)
var label=params.shift().substr(config.macros.newDocument.labelparam.length)
if (params[0] && params[0].substr(0,config.macros.newDocument.promptparam.length)==config.macros.newDocument.promptparam)
var prompt=params.shift().substr(config.macros.newDocument.promptparam.length)
var filename=params.shift(); if (!filename) filename=config.macros.newDocument.newdefault;
if (params[0]==config.macros.newDocument.snapparam || params[0]==config.macros.newDocument.printparam) {
var printmode=(params[0]==config.macros.newDocument.printparam);
params.shift();
if (!label) var label=config.macros.newDocument.snaplabel;
if (!prompt) var prompt=config.macros.newDocument.snapprompt;
var defaultfile=config.macros.newDocument.snapdefault;
var snapID=config.macros.newDocument.snapID;// default to "contentWrapper"
if (params[0]) var snapID=params.shift(); // alternate DOM element for snapshot
}
if (params[0]==config.macros.newDocument.allparam) {
if (!label) var label=config.macros.newDocument.saveaslabel;
if (!prompt) var prompt=config.macros.newDocument.saveasprompt;
var defaultfile=getLocalPath(document.location.href);
var slashpos=defaultfile.lastIndexOf("/"); if (slashpos==-1) slashpos=defaultfile.lastIndexOf("\\");
if (slashpos!=-1) defaultfile=defaultfile.substr(slashpos+1); // get filename only
}
if (!prompt) var prompt=config.macros.newDocument.newprompt;
if (!label) var label=config.macros.newDocument.newlabel;
if (!defaultfile) var defaultfile=config.macros.newDocument.newdefault;
var btn=createTiddlyButton(place,label,prompt,onClickNewDocument);
btn.path=path;
btn.file=filename;
btn.defaultfile=defaultfile;
btn.snapID=snapID; // NULL unless snapshot is being taken
btn.printmode=printmode;
btn.filter=params.length?params:[config.macros.newDocument.filter];
}
// IE needs explicit global scoping for functions called by browser events
window.onClickNewDocument=function(e)
{
if (!e) var e = window.event; var btn=resolveTarget(e);
// assemble document content, write file, report result
var okmsg=config.macros.newDocument.okmsg;
var failmsg=config.macros.newDocument.failmsg;
var count=0;
var out="";
if (btn.snapID) { // HTML+CSS snapshot
var snapID=btn.snapID;
if (btn.snapID==config.macros.newDocument.askparam)
snapID=prompt(config.macros.newDocument.snapIDprompt,config.macros.newDocument.snapID);
if (btn.snapID==config.macros.newDocument.hereparam)
{ var here=story.findContainingTiddler(btn); if (here) snapID=here.id; }
if (!document.getElementById(snapID)) { // if specified element does not exist
if (snapID) // ID=null if prompt was cancelled by user
displayMessage(config.macros.newDocument.snapIDerrmsg.format([snapID]));
e.cancelBubble = true; if (e.stopPropagation) e.stopPropagation(); return(false);
}
var styles=document.getElementsByTagName("style");
out+="<html>\n<head>\n<style>\n";
for(var i=0; i < styles.length; i++)
out +="/* stylesheet from tiddler:"+styles[i].getAttribute("id")+" */\n"+styles[i].innerHTML+"\n\n";
out+="</style>\n</head>\n<body>\n\n"+document.getElementById(snapID).innerHTML+"\n\n</body>\n</html>";
okmsg=config.macros.newDocument.snapmsg;
} else { // TW starter document
// get the TiddlyWiki core code source
var sourcefile=getLocalPath(document.location.href);
var source=loadFile(sourcefile);
if(source==null) { alert(config.messages.cantSaveError); return null; }
// reset existing HTML source markup
source=updateMarkupBlock(source,"PRE-HEAD");
source=updateMarkupBlock(source,"POST-HEAD");
source=updateMarkupBlock(source,"PRE-BODY");
source=updateMarkupBlock(source,"POST-BODY");
// find store area
var posOpeningDiv=source.indexOf(startSaveArea);
var posClosingDiv=source.lastIndexOf(endSaveArea);
if((posOpeningDiv==-1)||(posClosingDiv==-1)) { alert(config.messages.invalidFileError.format([sourcefile])); return; }
// get the matching tiddler divs
var match=btn.filter;
if (match[0]==config.macros.newDocument.askparam) { // ask user for tags
var newfilt=prompt(config.macros.newDocument.filterprompt,config.macros.newDocument.filter);
if (!newfilt) return; // cancelled by user
match=newfilt.readMacroParams();
}
var storeAreaDivs=[];
var tiddlers=store.getTiddlers('title');
for (var i=0; i<tiddlers.length; i++)
if (match[0]==config.macros.newDocument.allparam || (tiddlers[i].tags && tiddlers[i].tags.containsAny(match)) )
storeAreaDivs.push(tiddlers[i].saveToDiv());
out+=source.substr(0,posOpeningDiv+startSaveArea.length);
out+=convertUnicodeToUTF8(storeAreaDivs.join("\n"))+"\n\t\t";
out+=source.substr(posClosingDiv);
count=storeAreaDivs.length;
}
if (btn.printmode) {
var win=window.open("","_blank","");
win.document.open();
win.document.writeln(out);
win.document.close();
win.focus(); // bring to front
win.print(); // trigger print dialog
} else {
// get output path/filename
var filename=btn.file;
if (filename==config.macros.newDocument.askparam)
filename=promptForFilename(config.macros.newDocument.fileprompt,btn.path,btn.defaultfile);
if (!filename) return; // cancelled by user
// if specified file does not include a path, assemble fully qualified path and filename
var slashpos=filename.lastIndexOf("/"); if (slashpos==-1) slashpos=filename.lastIndexOf("\\");
if (slashpos==-1) filename=btn.path+filename;
var ok=saveFile(filename,out);
var msg=ok?okmsg.format([count,filename]):failmsg.format([filename]);
var link=ok?"file:///"+filename.replace(regexpBackSlash,'/'):""; // change local path to link text
clearMessage(); displayMessage(msg,link);
}
e.cancelBubble = true; if (e.stopPropagation) e.stopPropagation(); return(false);
}
//}}}
//{{{
function promptForFilename(msg,path,file)
{
if(window.Components) { // moz
try {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var nsIFilePicker = window.Components.interfaces.nsIFilePicker;
var picker = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker);
picker.init(window, msg, nsIFilePicker.modeSave);
var thispath = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
thispath.initWithPath(path);
picker.displayDirectory=thispath;
picker.defaultExtension='html';
picker.defaultString=file;
picker.appendFilters(nsIFilePicker.filterAll|nsIFilePicker.filterText|nsIFilePicker.filterHTML);
if (picker.show()!=nsIFilePicker.returnCancel) var result=picker.file.persistentDescriptor;
}
catch(e) { alert('error during local file access: '+e.toString()) }
}
else { // IE
try { // XP only
var s = new ActiveXObject('UserAccounts.CommonDialog');
s.Filter='All files|*.*|Text files|*.txt|HTML files|*.htm;*.html|';
s.FilterIndex=3; // default to HTML files;
s.InitialDir=path;
s.FileName=file;
if (s.showOpen()) var result=s.FileName;
}
catch(e) { var result=prompt(msg,path+file); } // fallback for non-XP IE
}
return result;
}
//}}}
/***
|Name:|NewHerePlugin|
|Description:|Creates the new here and new journal macros|
|Version:|3.0 ($Rev: 3861 $)|
|Date:|$Date: 2008-03-08 10:53:09 +1000 (Sat, 08 Mar 2008) $|
|Source:|http://mptw.tiddlyspot.com/#NewHerePlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License|http://mptw.tiddlyspot.com/#TheBSDLicense|
***/
//{{{
merge(config.macros, {
newHere: {
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
wikify("<<newTiddler "+paramString+" tag:[["+tiddler.title+"]]>>",place,null,tiddler);
}
},
newJournalHere: {
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
wikify("<<newJournal "+paramString+" tag:[["+tiddler.title+"]]>>",place,null,tiddler);
}
}
});
//}}}
/***
|Name:|NewMeansNewPlugin|
|Description:|If 'New Tiddler' already exists then create 'New Tiddler (1)' and so on|
|Version:|1.1.1 ($Rev: 2263 $)|
|Date:|$Date: 2007-06-13 04:22:32 +1000 (Wed, 13 Jun 2007) $|
|Source:|http://mptw.tiddlyspot.com/empty.html#NewMeansNewPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!Note: I think this should be in the core
***/
//{{{
// change this or set config.newMeansNewForJournalsToo it in MptwUuserConfigPlugin
if (config.newMeansNewForJournalsToo == undefined) config.newMeansNewForJournalsToo = true;
String.prototype.getNextFreeName = function() {
var numberRegExp = / \(([0-9]+)\)$/;
var match = numberRegExp.exec(this);
if (match) {
var num = parseInt(match[1]) + 1;
return this.replace(numberRegExp," ("+num+")");
}
else {
return this + " (1)";
}
}
config.macros.newTiddler.checkForUnsaved = function(newName) {
var r = false;
story.forEachTiddler(function(title,element) {
if (title == newName)
r = true;
});
return r;
}
config.macros.newTiddler.getName = function(newName) {
while (store.getTiddler(newName) || config.macros.newTiddler.checkForUnsaved(newName))
newName = newName.getNextFreeName();
return newName;
}
config.macros.newTiddler.onClickNewTiddler = function()
{
var title = this.getAttribute("newTitle");
if(this.getAttribute("isJournal") == "true") {
title = new Date().formatString(title.trim());
}
// ---- these three lines should be the only difference between this and the core onClickNewTiddler
if (config.newMeansNewForJournalsToo || this.getAttribute("isJournal") != "true")
title = config.macros.newTiddler.getName(title);
var params = this.getAttribute("params");
var tags = params ? params.split("|") : [];
var focus = this.getAttribute("newFocus");
var template = this.getAttribute("newTemplate");
var customFields = this.getAttribute("customFields");
if(!customFields && !store.isShadowTiddler(title))
customFields = String.encodeHashMap(config.defaultCustomFields);
story.displayTiddler(null,title,template,false,null,null);
var tiddlerElem = story.getTiddler(title);
if(customFields)
story.addCustomFields(tiddlerElem,customFields);
var text = this.getAttribute("newText");
if(typeof text == "string")
story.getTiddlerField(title,"text").value = text.format([title]);
for(var t=0;t<tags.length;t++)
story.setTiddlerTag(title,tags[t],+1);
story.focusTiddler(title,focus);
return false;
};
//}}}
/%
|Name|NewWell|
|Author|Alfonso Reyes|
|Type|script|
|Requires|InlineJavascriptPlugin|
|Overrides|None|
|Description|adds new Data Gathering item|
Usage: <<tiddler NewPaper>>
%/<script label="new Paper">
var tags = "[[Document]]";
var title = prompt("Please enter name for this item", "");
if( (title == null) || (title == "") ){
return;
}//if
store.saveTiddler(title, title, "<<formTiddler RefDocTemplate2>><data>{}</data>", config.options.txtUserName, new Date(), tags);
story.displayTiddler(null,title,DEFAULT_VIEW_TEMPLATE);
// add the tiddler title to the key field
DataTiddler.setData(title,"docTitle",title)
// refresh to reflect the added tiddler title to the key field
story.refreshTiddler(title,null,true);
</script>
[[NDT]] comprises a number of methods of which [[ultrasonic|Ultrasonic method for corrosion]], [[radiography|Radiography method for corrosion]] and different optical and mechanical devices are most important.
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Controlling Internal Corrosion in Oil and Gas Pipelines","docID":"Nyborg_lr.pdf","docAuthor":"Nyborg, Rolf","docDateTxt":"2005","docLink":"http://www.touchoilandgas.com/download.cfm?step=2&type=art&type_id=674","docType":"Other","docPublished":"Business Briefing - Exploration & Production -The Oil & Gas Review 2005 - Issue 2","docOrg":"Institute for Energy Technology (IFE), Norway"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"OTC-016285: Evaluating a concept of using DTS and Strain sensor for continuous monitoring of casing and completion mechanical deformation in intelligent wells","docID":"OTC-016285","docAuthor":"Li, Xu et al","docCoAuthors":"Parker, Tom\nFarhadiroushan, Mahmoud\nBlacklaw, David","docOrg":"BP, Sensornet, WoodGroup","docType":"OTC","docDateTxt":"May 2004","docPublished":"OTC 2004, Houston, texas"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"OTC-017999: When Intelligent Wells are truly intelligent, reliable and cost effective","docID":"OTC-017999","docAuthor":"Naldrett, G.","docOrg":"SPE","docType":"SPE","docDateTxt":"May 2006","docPublished":"OTC 2006, Houston, Texas","docCoAuthors":"Ross, D."}</data>
A system is a structure in which variables of different kinds interact and produce observable output signals by the action of external stimuli: manipulated inputs and distrubances. In this context, the petroleum system (Fig.2) is a dynamic structure of many observable outputs (fluid rates, concentrations, and pressures) that respond to the action of external stimuli (flow choke settings, injection rates, separator pressure, and artificial lift quantities), measureable (pipe flow constraints) and unmeasureable disturbance, and model uncertainties (reservoir heterogeneity and reservoir fluid distribution).
[img[ReservoirDynamicSystem.png]]
"... are inorganic crystaline deposits that form as a result of the precipitation of solids from brines present in the reservoir and production flow system."
... key features:
* uses a hierarchy of time scales to separate the levels over which decision making is performed, ...
* integrates field data for continuous learning of key reservoir features ...
* uses and adavanced feedback-control strategy ...
* its multiscale structure can naturally host optimization levels ...
/***
|''Name:''|PasswordOptionPlugin|
|''Description:''|Extends TiddlyWiki options with non encrypted password option.|
|''Version:''|1.0.2|
|''Date:''|Apr 19, 2007|
|''Source:''|http://tiddlywiki.bidix.info/#PasswordOptionPlugin|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''License:''|[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D ]]|
|''~CoreVersion:''|2.2.0 (Beta 5)|
***/
//{{{
version.extensions.PasswordOptionPlugin = {
major: 1, minor: 0, revision: 2,
date: new Date("Apr 19, 2007"),
source: 'http://tiddlywiki.bidix.info/#PasswordOptionPlugin',
author: 'BidiX (BidiX (at) bidix (dot) info',
license: '[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D]]',
coreVersion: '2.2.0 (Beta 5)'
};
config.macros.option.passwordCheckboxLabel = "Save this password on this computer";
config.macros.option.passwordInputType = "password"; // password | text
setStylesheet(".pasOptionInput {width: 11em;}\n","passwordInputTypeStyle");
merge(config.macros.option.types, {
'pas': {
elementType: "input",
valueField: "value",
eventName: "onkeyup",
className: "pasOptionInput",
typeValue: config.macros.option.passwordInputType,
create: function(place,type,opt,className,desc) {
// password field
config.macros.option.genericCreate(place,'pas',opt,className,desc);
// checkbox linked with this password "save this password on this computer"
config.macros.option.genericCreate(place,'chk','chk'+opt,className,desc);
// text savePasswordCheckboxLabel
place.appendChild(document.createTextNode(config.macros.option.passwordCheckboxLabel));
},
onChange: config.macros.option.genericOnChange
}
});
merge(config.optionHandlers['chk'], {
get: function(name) {
// is there an option linked with this chk ?
var opt = name.substr(3);
if (config.options[opt])
saveOptionCookie(opt);
return config.options[name] ? "true" : "false";
}
});
merge(config.optionHandlers, {
'pas': {
get: function(name) {
if (config.options["chk"+name]) {
return encodeCookie(config.options[name].toString());
} else {
return "";
}
},
set: function(name,value) {config.options[name] = decodeCookie(value);}
}
});
// need to reload options to load passwordOptions
loadOptionsCookie();
/*
if (!config.options['pasPassword'])
config.options['pasPassword'] = '';
merge(config.optionsDesc,{
pasPassword: "Test password"
});
*/
//}}}
The pickling process involves reaction of the HCl acid with various tubular contaminants inside the tubing. Therefore, it is important to provide enough contact time for the reaction to take place.
Contact time can be controlled through either the volume of the acid or through the pumping flowrate. Larger acid volumes and less flowrates provide better contact time.
This method is of much interest as it can respond instantaneously to change in corrosivity. The probes can only be installed in electrical conducting electrolytes, for instance in the water drains of the separators. The measured corrosion rate can be recorded continuously and automatically.
http://mathworld.wolfram.com/Polytope.html
A generalization of a polyhedron to more than three dimensions.
Polytope is a high school-level concept that would be first encountered in a geometry course covering high-dimensional solids.
/***
|Name:|PrettyDatesPlugin|
|Description:|Provides a new date format ('pppp') that displays times such as '2 days ago'|
|Version:|1.0 ($Rev: 3646 $)|
|Date:|$Date: 2008-02-27 02:34:38 +1000 (Wed, 27 Feb 2008) $|
|Source:|http://mptw.tiddlyspot.com/#PrettyDatesPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!Notes
* If you want to you can rename this plugin. :) Some suggestions: LastUpdatedPlugin, RelativeDatesPlugin, SmartDatesPlugin, SexyDatesPlugin.
* Inspired by http://ejohn.org/files/pretty.js
***/
//{{{
Date.prototype.prettyDate = function() {
var diff = (((new Date()).getTime() - this.getTime()) / 1000);
var day_diff = Math.floor(diff / 86400);
if (isNaN(day_diff)) return "";
else if (diff < 0) return "in the future";
else if (diff < 60) return "just now";
else if (diff < 120) return "1 minute ago";
else if (diff < 3600) return Math.floor(diff/60) + " minutes ago";
else if (diff < 7200) return "1 hour ago";
else if (diff < 86400) return Math.floor(diff/3600) + " hours ago";
else if (day_diff == 1) return "Yesterday";
else if (day_diff < 7) return day_diff + " days ago";
else if (day_diff < 14) return "a week ago";
else if (day_diff < 31) return Math.ceil(day_diff/7) + " weeks ago";
else if (day_diff < 62) return "a month ago";
else if (day_diff < 365) return "about " + Math.ceil(day_diff/31) + " months ago";
else if (day_diff < 730) return "a year ago";
else return Math.ceil(day_diff/365) + " years ago";
}
Date.prototype.formatString_orig_mptw = Date.prototype.formatString;
Date.prototype.formatString = function(template) {
return this.formatString_orig_mptw(template).replace(/pppp/,this.prettyDate());
}
// for MPTW. otherwise edit your ViewTemplate as required.
// config.mptwDateFormat = 'pppp (DD/MM/YY)';
config.mptwDateFormat = 'pppp';
//}}}
* wellhead flowlines and downhole tubing with flow restrictions
* well accesibility
* difficult access to wells
* well surveillance and maintenenance become more expensive
* essential surveillance cannot be performed due to unpredictable sacaling restrictions
* well remedial/enhancement work become more expensive and frustrating
* number idle wells start to rise
* people not able to cope with amount of challenges
* widespread malfunction on equipment and instruments
* production decline
* scale deposition in piping causes abnormal pressure drop and flow restrictions in various parts of the production system
* control valves get stuck
* automatic mode fails very quicky and system has to be operated in manual control
the deposit of a reaction product between two or more man-introduced chemicals.
/***
|Name:|QuickOpenTagPlugin|
|Description:|Changes tag links to make it easier to open tags as tiddlers|
|Version:|3.0.1 ($Rev: 3861 $)|
|Date:|$Date: 2008-03-08 10:53:09 +1000 (Sat, 08 Mar 2008) $|
|Source:|http://mptw.tiddlyspot.com/#QuickOpenTagPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
***/
//{{{
config.quickOpenTag = {
dropdownChar: (document.all ? "\u25bc" : "\u25be"), // the little one doesn't work in IE?
createTagButton: function(place,tag,excludeTiddler) {
// little hack so we can do this: <<tag PrettyTagName|RealTagName>>
var splitTag = tag.split("|");
var pretty = tag;
if (splitTag.length == 2) {
tag = splitTag[1];
pretty = splitTag[0];
}
var sp = createTiddlyElement(place,"span",null,"quickopentag");
createTiddlyText(createTiddlyLink(sp,tag,false),pretty);
var theTag = createTiddlyButton(sp,config.quickOpenTag.dropdownChar,
config.views.wikified.tag.tooltip.format([tag]),onClickTag);
theTag.setAttribute("tag",tag);
if (excludeTiddler)
theTag.setAttribute("tiddler",excludeTiddler);
return(theTag);
},
miniTagHandler: function(place,macroName,params,wikifier,paramString,tiddler) {
var tagged = store.getTaggedTiddlers(tiddler.title);
if (tagged.length > 0) {
var theTag = createTiddlyButton(place,config.quickOpenTag.dropdownChar,
config.views.wikified.tag.tooltip.format([tiddler.title]),onClickTag);
theTag.setAttribute("tag",tiddler.title);
theTag.className = "miniTag";
}
},
allTagsHandler: function(place,macroName,params) {
var tags = store.getTags(params[0]);
var filter = params[1]; // new feature
var ul = createTiddlyElement(place,"ul");
if(tags.length == 0)
createTiddlyElement(ul,"li",null,"listTitle",this.noTags);
for(var t=0; t<tags.length; t++) {
var title = tags[t][0];
if (!filter || (title.match(new RegExp('^'+filter)))) {
var info = getTiddlyLinkInfo(title);
var theListItem =createTiddlyElement(ul,"li");
var theLink = createTiddlyLink(theListItem,tags[t][0],true);
var theCount = " (" + tags[t][1] + ")";
theLink.appendChild(document.createTextNode(theCount));
var theDropDownBtn = createTiddlyButton(theListItem," " +
config.quickOpenTag.dropdownChar,this.tooltip.format([tags[t][0]]),onClickTag);
theDropDownBtn.setAttribute("tag",tags[t][0]);
}
}
},
// todo fix these up a bit
styles: [
"/*{{{*/",
"/* created by QuickOpenTagPlugin */",
".tagglyTagged .quickopentag, .tagged .quickopentag ",
" { margin-right:1.2em; border:1px solid #eee; padding:2px; padding-right:0px; padding-left:1px; }",
".quickopentag .tiddlyLink { padding:2px; padding-left:3px; }",
".quickopentag a.button { padding:1px; padding-left:2px; padding-right:2px;}",
"/* extra specificity to make it work right */",
"#displayArea .viewer .quickopentag a.button, ",
"#displayArea .viewer .quickopentag a.tiddyLink, ",
"#mainMenu .quickopentag a.tiddyLink, ",
"#mainMenu .quickopentag a.tiddyLink ",
" { border:0px solid black; }",
"#displayArea .viewer .quickopentag a.button, ",
"#mainMenu .quickopentag a.button ",
" { margin-left:0px; padding-left:2px; }",
"#displayArea .viewer .quickopentag a.tiddlyLink, ",
"#mainMenu .quickopentag a.tiddlyLink ",
" { margin-right:0px; padding-right:0px; padding-left:0px; margin-left:0px; }",
"a.miniTag {font-size:150%;} ",
"#mainMenu .quickopentag a.button ",
" /* looks better in right justified main menus */",
" { margin-left:0px; padding-left:2px; margin-right:0px; padding-right:0px; }",
"#topMenu .quickopentag { padding:0px; margin:0px; border:0px; }",
"#topMenu .quickopentag .tiddlyLink { padding-right:1px; margin-right:0px; }",
"#topMenu .quickopentag .button { padding-left:1px; margin-left:0px; border:0px; }",
"/*}}}*/",
""].join("\n"),
init: function() {
// we fully replace these builtins. can't hijack them easily
window.createTagButton = this.createTagButton;
config.macros.allTags.handler = this.allTagsHandler;
config.macros.miniTag = { handler: this.miniTagHandler };
config.shadowTiddlers["QuickOpenTagStyles"] = this.styles;
store.addNotification("QuickOpenTagStyles",refreshStyles);
}
}
config.quickOpenTag.init();
//}}}
# Measurement
# [[telemetry]]
# data handling and access
# analysis
# visualization
# automatic control
# integration and automation
... it is a comparatively slow method but may be very efficient in detailed mapping of local corrosion. A disadvantage is cetain limitation in system containg liquids and that internal access sometime is required.
Existing studies in wellbore heat transfer are primarily concerned with either, the temperature of the injected fluid or the determination of casing temperature. Ramey computed wellbore temperature profiles during injection of a single-phase fluid considering steady heat transfer in the wellbore and unsteady radial heat transfer in the formation. He further assumed frictional losses and kinetic energy effect of the injected fluid to be negligible, and the coefficient of heat transfer to be independent of temperature.
During fluid injection, reduction of the heat loss from the tubing through the wellbore is necessary to deliver as much thermal energy to the reservoir as possible. Reduction of the casing temperature is also of primary importance to reduce the possibility for casing failure due to stress induced by thermal expansion.
<html>
<span macro='tiddler NewPaper'></span>
<span macro ='tiddler RefreshTiddler with: "Refresh" "refresh this page"'></span></html>
{{borderlessL{
| ''Title:''|<html><textarea name="docTitle" rows="2" cols="70" /></html>|
| ''Document ID:''|<html><input type="text" name="docID" size="62" /></html>|
| ''Author:''|<html><input type="text" name="docAuthor" size="62" /></html>|
| ''Coauthors:''|<html><textarea name="docCoAuthors" rows="2" cols="70"></textarea></html>|
| ''Organization:''|<html><input type="text" name="docOrg" size="62" /></html>|
| ''Document Type:''|<html><select name="docType" size="4"><option value="SPE">SPE</option><option value="Livelink">Livelink</option><option value="OTC">OTC</option><option value="Book">Book</option><option value="Other">Other</option></select></html> ''Date:''<html><input type="text" size="25" name="docDateTxt" /></html>|
| ''Published in:''|<html><input type="text" name="docPublished" size="62" /></html>|
|vertical-align:top; ''Link:''|<html><textarea rows="2" cols="70" name="docLink"></textarea></html>|
}}}
<script>`
var tiddlerName = config.macros.formTiddler.getContainingTiddlerName(place);
var tid = store.getTiddler(tiddlerName);
var t = store.getTiddler(tiddlerName);
var tag = DataTiddler.getData(tiddlerName, "docType");
var doc_Link = DataTiddler.getData(tiddlerName,"docLink")
var docType = DataTiddler.getData(tiddlerName, "docType");
var docu = "";
var chars3 = tiddlerName.substring(0,3)
var newTitle = ""
var tiddlerElem=document.getElementById(story.tiddlerName); // current tiddler element
//document.write("<b>"+tiddlerName+"</b><br>");
//document.write(t.tags+"<br>")
//document.write(tag+"<br>")
if (doc_Link == undefined)
{doc_Link = ""}
else
{doc_Link = "Open document from this "+"[[Link|"+DataTiddler.getData(tiddlerName,"docLink")+"]]"}
if (docType == "Book") {
docu = "Book";
if (chars3 != "ISB") {
newTitle = "ISBN " + tiddlerName //t.text
store.saveTiddler(newTitle,newTitle,t.text,config.options.txtUserName,new Date(),t.tags, t.fields, true);
story.refreshTiddler(newTitle,null,true);
}
}
if (docType == "SPE")
{docu = "Paper"};
if (docType == "Livelink")
{docu = "File"};
if (!t || !t.tags) {
address = "";
return; }
if (t.tags.find(tag)==null) // if new tag is not in tag list
if (tag.length > 0)
{t.tags.push(tag)
address = "" }
//document.write(t.tags+"<br>");
//document.write(tag.length);
var address = "<html><b>Citation: </b></html>"
address += DataTiddler.getData(tiddlerName, "docAuthor") + ': "'
address += DataTiddler.getData(tiddlerName, "docTitle") + '", '
address += " " + docu + " " + DataTiddler.getData(tiddlerName, "docID") + ", "
address += 'published in "' + DataTiddler.getData(tiddlerName, "docPublished") + '", '
address += DataTiddler.getData(tiddlerName, "docDateTxt") + ".<br>"
//address += doc_Link
wikify(doc_Link+"\n\n",place);
out = address;
//return out + newTiddlerName + "@" + chars3 +tiddlerElem;
return out
</script>
/***
''Name:'' ReferencesPlugin
''Author:'' Garrett Lisi
''Description:'' Places a comma separated list of referring notes at the bottom of each note -- replacing the "references" command bar button.
''Installation:'' Copy this note, change the [[StyleSheet]] to set the references class style, and add a line in the [[ViewTemplate]].
''Code:''
***/
/*{{{*/
config.macros.references = {};
config.macros.references.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
var references = store.getReferringTiddlers(tiddler.title);
if(references.length>0)
{
// createTiddlyText(place,"\xAB ");
createTiddlyLink(place,references[0].title,true);
}
for(var r=1; r<references.length; r++)
if(references[r].title != tiddler.title)
{
createTiddlyText(place,", ");
createTiddlyLink(place,references[r].title,true);
}
}
/*}}}*/
.references {
font-size: 1em;
text-align: center;
color: #666;
margin-top: .75em;
padding: .25em;
border: 1px solid #eee;
background-color: #eee;}
.selected .references {
background-color: #eee;
border: 1px solid #ccc;}
.references .tiddlyLinkExisting {font-weight: normal;}
<div class='references' macro="references"></div>
Another important attribute of the intelligent well is the ability to acquire the relevant information required for future decision making. Assessing the relevance of information through prior modeling is an important part in defining the intelligence of a well.
/***
|Name:|RenameTagsPlugin|
|Description:|Allows you to easily rename or delete tags across multiple tiddlers|
|Version:|3.0 ($Rev: 5501 $)|
|Date:|$Date: 2008-06-10 23:11:55 +1000 (Tue, 10 Jun 2008) $|
|Source:|http://mptw.tiddlyspot.com/#RenameTagsPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License|http://mptw.tiddlyspot.com/#TheBSDLicense|
Rename a tag and you will be prompted to rename it in all its tagged tiddlers.
***/
//{{{
config.renameTags = {
prompts: {
rename: "Rename the tag '%0' to '%1' in %2 tidder%3?",
remove: "Remove the tag '%0' from %1 tidder%2?"
},
removeTag: function(tag,tiddlers) {
store.suspendNotifications();
for (var i=0;i<tiddlers.length;i++) {
store.setTiddlerTag(tiddlers[i].title,false,tag);
}
store.resumeNotifications();
store.notifyAll();
},
renameTag: function(oldTag,newTag,tiddlers) {
store.suspendNotifications();
for (var i=0;i<tiddlers.length;i++) {
store.setTiddlerTag(tiddlers[i].title,false,oldTag); // remove old
store.setTiddlerTag(tiddlers[i].title,true,newTag); // add new
}
store.resumeNotifications();
store.notifyAll();
},
storeMethods: {
saveTiddler_orig_renameTags: TiddlyWiki.prototype.saveTiddler,
saveTiddler: function(title,newTitle,newBody,modifier,modified,tags,fields,clearChangeCount,created) {
if (title != newTitle) {
var tagged = this.getTaggedTiddlers(title);
if (tagged.length > 0) {
// then we are renaming a tag
if (confirm(config.renameTags.prompts.rename.format([title,newTitle,tagged.length,tagged.length>1?"s":""])))
config.renameTags.renameTag(title,newTitle,tagged);
if (!this.tiddlerExists(title) && newBody == "")
// dont create unwanted tiddler
return null;
}
}
return this.saveTiddler_orig_renameTags(title,newTitle,newBody,modifier,modified,tags,fields,clearChangeCount,created);
},
removeTiddler_orig_renameTags: TiddlyWiki.prototype.removeTiddler,
removeTiddler: function(title) {
var tagged = this.getTaggedTiddlers(title);
if (tagged.length > 0)
if (confirm(config.renameTags.prompts.remove.format([title,tagged.length,tagged.length>1?"s":""])))
config.renameTags.removeTag(title,tagged);
return this.removeTiddler_orig_renameTags(title);
}
},
init: function() {
merge(TiddlyWiki.prototype,this.storeMethods);
}
}
config.renameTags.init();
//}}}
[img[SPE023471-SurveillanceApproach.png]]
* Decrease risk
* Increase oil and gas production
* Maximize recovery
* Minimize capital expenditure
* Minimize operating costs
* Maximize profitability
[img[SPE083974SurveillanceDataManagement.png]]
Numerical reservoir simulation, the most popular forecasting technique, is possible through an inverse modeling technique in which reservoir parameter are set to match the reservoir production history.
We present an industrial automation framework for control and optimization of hydrocarbon-producing fields while satisfying business and physical constraints. The all-encompassing reservoir-management problem is decomposed into a hierarchy of decision making problems at different time scales.
Constraints are imposed by the:
* reservoir
* wells
* surface
* equipment
* cost
* schedule
For example, in finding the solution for optimizing the deliverability of a well, the physical constraints are given by the reservoir productivity and the tubing performance, as shown in Fig.6, where the shaded area denotes the [[polytope|Polytope]] of feasible solutions.
[img[AreaFeasibleSolutions.png]]
Sulfur-Free Oxygen Scavenger
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Use of an Insulating Fluid for Casing Protection During Steam Injection","docID":"SPE-001732","docAuthor":"Willhite, Paul G. et al","docOrg":"Continental Oil Co.","docType":"SPE","docDateTxt":"Feb. 1967","docPublished":"AIME Annual Meeting in Los Angeles, California"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Thermal Protection of Wellbore Casings","docID":"SPE-003259","docAuthor":"Dase, W.G.","docCoAuthors":"Heyt, J.W.","docOrg":"Alcoa, U. of Texas","docType":"SPE","docDateTxt":"Oct. 1970","docPublished":"Unknown","docLink":""}</data>
<<formTiddler RefDocTemplate2>><data>{"docLink":"http://swwus-ep-livelink.shell.com/livelink/livelink.exe/fetch/-19044/2809951/3749599/11949167/Oilfield_Scale-Can_We_Handle_It_SPE_5879.pdf?nodeid=11953297&vernum=0","docAuthor":"Vetter, O.J.","docTitle":"Oilfield Scale, Can we handle it","docID":"SPE-005879","docDateTxt":"1976","docType":"SPE"}</data>
<<formTiddler RefDocTemplate2>><data>{"docType":"SPE","docTitle":"Corrosion inhibition in deep, hot Wyoming wells","docID":"SPE-009035","docAuthor":"Kelley, Joe A.","docDateTxt":"May 1980"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"CORROSION MONITORING ON ROD-PUMPED WELLS USING LINEAR POLARIZATION PROBES","docID":"SPE-009363","docType":"SPE","docAuthor":"Shehorn, Steve L.","docDateTxt":"Sep. 1980"}</data>
<<formTiddler RefDocTemplate2>><data>{"docDateTxt":"Jan. 1983","docAuthor":"Millhone, Ralph S.","docTitle":"Completion Fluids for Maximizing Productivity - State of the Art","docID":"SPE-010030-PA","docType":"SPE"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":" Automatic Optimisation of Infinite Variable Control Valves","docID":"SPE-010319","docAuthor":"Elmsallati, S.M.","docCoAuthors":"Davies, S.R.\n","docOrg":"SPE, Heriot-Watt U.","docType":"SPE","docDateTxt":"Nov. 2005","docPublished":"International Petroleum Technology Conference (IPTC) 2005, Doha, Qatar"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Critical Points Regarding Internal Corrosion and Corrosion Control of Offshore Process Facilities","docID":"SPE-010449","docType":"SPE","docAuthor":"Eliassen, G.H.; et al","docDateTxt":"Feb. 1982"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Saudi Arabia's Master Gas System-Its Overview and the Corrosion Control Programs","docID":"SPE-011107","docAuthor":"Chen, Edmund Y.; et al","docOrg":"Aramco","docType":"SPE","docDateTxt":"Sep. 1982","docPublished":"57th SPE Annual Fall Technical Conference and Exhibition, New Orleans"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Corrosion Mitigation- A Critical Facet of Well Completion Design","docID":"SPE-011185","docType":"SPE","docAuthor":"Bradburn, Joe B.","docDateTxt":"Feb 1983"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"SPE-012317: Production Technology Experience in Michigan Waterfloods","docID":"SPE-012317","docType":"SPE","docAuthor":"Barnes, P.F.; et al","docDateTxt":"1985","docOrg":"Shell Oil","docPublished":"Journal of Petroleum Technology"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"SPE-023471: Waterflood surveillance Techniques - A Reservoir Management Approach","docID":"SPE-023471","docType":"SPE","docAuthor":"Thakur, G.C.","docDateTxt":"October 1991","docOrg":"Chevron USA","docPublished":"Distinguished Author Series 81-1983","docLink":"https://swwus-ep-livelink.shell.com/livelink/livelink.exe/^^^SPE-023471_-_Waterflood_surveillance_Techniques_-_A_Reservoir_Management_Approach.pdf?func=doc.Fetch&nodeId=19974951&docTitle=%5E%5E%5ESPE%2D023471+%2D+Waterflood+surveillance+Techniques+%2D+A+Reservoir+Management+Approach%2Epdf"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"SPE-024079: Steam Distribution Surveillance and Analysis","docID":"SPE-024079","docAuthor":"Peake, W.T.","docOrg":"Chevron USA","docType":"SPE","docDateTxt":"March 1992","docPublished":"Western Regional Meeting held in Bakersfield, California","docLink":"https://swwus-ep-livelink.shell.com/livelink/livelink.exe/^^^SPE-024079_-_Steam_Distribution_Surveillance_and_Analysis.pdf?func=doc.Fetch&nodeId=19976276&docTitle=%5E%5E%5ESPE%2D024079+%2D+Steam+Distribution+Surveillance+and+Analysis%2Epdf"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"SPE-029666 - Data Integration and Synergy Improve Reservoir Surveillance at South Belridge Tulare Field","docID":"SPE-029666","docAuthor":"Yonke, C.L.","docCoAuthors":"","docOrg":"CalResources","docType":"SPE","docDateTxt":"March 1995","docPublished":"Western Regional Meeting in Bakersfieldm CA","docLink":"https://swwus-ep-livelink.shell.com/livelink/livelink.exe/^^^SPE-088792_-_A_Novel_Approach_to_Reservoir_Surveillance_Planning.pdf?func=doc.Fetch&nodeId=19974917&docTitle=%5E%5E%5ESPE%2D088792+%2D+A+Novel+Approach+to+Reservoir+Surveillance+Planning%2Epdf"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"SPE-035218: ALWORKS - An Artificial Lift Surveillance Tool","docID":"SPE-035218","docAuthor":"Burleson, G.L.","docCoAuthors":"Redden J.D.","docOrg":"Exxon Co. USA","docType":"SPE","docDateTxt":"April 1996","docPublished":"SPE Permian Basin Oil and Recovery Conference, Midland, TX"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Corrosion Control in the Oil and Gas Industry Using Nodal Analysis and Two-Phase Flow Modeling Techniques","docID":"SPE-036127","docType":"SPE","docAuthor":"Palacios, Carlos; et al","docDateTxt":"Apr 1996"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Intelligent Completion for Oil and Gas Production Control in Subsea Multi-lateral Well","docID":"SPE-036582","docAuthor":"Tubel, Paulo","docCoAuthors":"Hopmann, Mark","docOrg":"Baker Oil Tools","docType":"SPE","docDateTxt":"Oct. 1996","docPublished":"SPE Annual Technical Conference and Exhibition, Denver, Colorado"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Intelligent Completion Systems - The Reservoir Rationale","docID":"SPE-050587","docAuthor":"Jalali, Y. et al","docCoAuthors":"Bussear, T\nSharma, S.","docOrg":"Baker Oil Tools","docType":"SPE","docDateTxt":"Oct. 1998","docPublished":"SPE European Petroleum Conference, The Hague, The Netherlands"}</data>
<<formTiddler RefDocTemplate2>><data>{"docType":"SPE","docTitle":"Corrosion Inhibitor Considerations for Deepwater Systems","docID":"SPE-050758","docAuthor":"Ramachandran S.; et al","docDateTxt":"Jan 1999"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Integrating Seismic Monitoring and Intelligent Wells","docID":"SPE-062878","docAuthor":"Mjaaland, Svein et al","docCoAuthors":"Wuff, Angelika\nCausse, Emmanuel\nNyhavn, Fridjof","docOrg":"SPE, SINTEF Petroleum Research","docType":"SPE","docDateTxt":"Oct. 2000","docPublished":"SPE Annual technical Conference and Exhibition, Dallas, Texas"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"The Modelling of Advanced Intelligent Well - An Application","docID":"SPE-062950","docAuthor":"Yu, S. et al","docCoAuthors":"Davies, D.R.\nSherrard, D.W.","docOrg":"SPE, Heriot-Watt U.","docType":"SPE","docDateTxt":"Oct. 2000","docPublished":"SPE Annual technical Conference and Exhibition, Dallas, Texas"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"A model for predicting corrosion rates in oil well containing Carbon Dioxide","docID":"SPE-066651","docAuthor":"Garber, J.D.","docOrg":"University of Lousiana, Corrosion Research Center","docType":"SPE","docDateTxt":"Feb. 2001","docPublished":"SPE/EPA/DOE E&P Environmental Coference, San Antonio"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Corrosion Inhibition Foamer Combination Treatment to Enhance Gas Production","docID":"SPE-067325","docAuthor":"Campbell, Samuel et al","docDateTxt":"Mar. 2001","docType":"SPE","docCoAuthors":"Bartrip, Keith\nRamachandran, Sunder","docOrg":"SPE, Baker Petrolite, ","docPublished":"SPE Production and Operations Symposium, Oklahoma City, Oklahoma"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Networking Intelligent Subsea Completions Using Industrial Standards","docID":"SPE-071532","docAuthor":"Hiron, Stephane","docOrg":"SPE Schlumberger","docType":"SPE","docDateTxt":"Sep. 2001","docPublished":"SPE Annual technical Conference and Exhibition, New Orlean, Lousiana","docCoAuthors":"None"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Design and Deployment of an Intelligent Completion with Sand Control","docID":"SPE-071674","docAuthor":"Bixenman, P.W.","docCoAuthors":"Toffanin, E.P.\nSalam, M.A.","docOrg":"SPE Schlumberger","docType":"SPE","docDateTxt":"Sep. 2001","docPublished":"SPE Annual technical Conference and Exhibition, New Orlean, Lousiana"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"A Method to Assess the Value of Intelligent Wells","docID":"SPE-077941","docAuthor":"Gai, H.","docOrg":"SPE, BP","docType":"SPE","docDateTxt":"Oct. 2002","docPublished":"SPE Asia Pacific Oil and Gas Conference and Exhibition, Melbourne, Australia","docCoAuthors":"None"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Evaluating the Appropriateness of Intelligent Completion Technology - A Case Study in a Shallow Clastics Gas Reservoir","docID":"SPE-078273","docAuthor":"Bhat, Suniti K. et al","docCoAuthors":"Thomson, Andrew W.\nSarkar, Radheshyam\nMohd-Nor, Norlizah\nHuang, Edmund","docOrg":"SPE, Halliburton, Shell Sarawak Berhad","docType":"SPE","docDateTxt":"Oct. 2002","docPublished":"SPE 13th European Petroleum Conference, Abeerdeen, Scotland, UK"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Quantifying Value Creation from Intelligent Completion Technology Implementation","docID":"SPE-078277","docAuthor":"Sharma, A.K. et al","docCoAuthors":"Chorn, L.G.\nHan, J.\nRajagopalan, S.","docOrg":"SPE, WellDynamics, Real Options Software","docType":"SPE","docDateTxt":"Oct. 2002","docPublished":"SPE 13th European Petroleum Conference, Abeerdeen, Scotland, UK"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"An investigation of the Economic Benefit of Inflow Control devices in Horizontal Well Completions Using a Reservoir-Wellbore Coupled Model","docID":"SPE-078293","docAuthor":"Augustine, Jody R.","docOrg":"SPE, Baker Oil Tools","docType":"SPE","docDateTxt":"Oct. 2002","docPublished":"SPE 13th European Petroleum Conference, Abeerdeen, Scotland, UK","docCoAuthors":"None"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Optimization of Smart Well Control","docID":"SPE-079031","docAuthor":"Yeten, Burak et al","docCoAuthors":"Durlofrsky, Louis J.\nAziz, Khalid","docOrg":"SPE Stanford U., Chevron Texaco","docType":"SPE","docDateTxt":"Nov. 2002","docPublished":"SPE International Thermal Operations and Heavy Oil Symposium and International Horizontal Well Technology Conference, Calgary, Alberta, Canada"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Reservoir Aspects of Smart Wells","docID":"SPE-081107","docAuthor":"Glandt, Carlos A.","docCoAuthors":"None","docOrg":"Shell International","docType":"SPE","docDateTxt":"Apr. 2003","docPublished":"Spe Latin American and Caribbean Petroleum Engineering Conference, Port of Spain, Trinidad"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"SPE-083974: Automated Reservoir Surveillance through Data Mining Software","docID":"SPE-083974","docAuthor":"de Jonge, G.","docOrg":"ChevronTexaco; SPE","docCoAuthors":"Gert de Jonge\nMichael Stundner\nGeorg Zangl","docType":"SPE","docDateTxt":"September 2003","docPublished":"Offshore Europe held in Aberdeen, UK","docLink":"https://swwus-ep-livelink.shell.com/livelink/livelink.exe/^^^SPE-083974_-_Automated_Reservoir_Surveillance_through_Data_Mining_Software.pdf?func=doc.Fetch&nodeId=19976030&docTitle=%5E%5E%5ESPE%2D083974+%2D+Automated+Reservoir+Surveillance+through+Data+Mining+Software%2Epdf"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Self-Learning Reservoir Management","docID":"SPE-084064","docAuthor":"Saputelly, L.","docCoAuthors":"Nikolau, M.\nEconomides, M.J.\n","docType":"SPE","docOrg":"SPE, PDVSA, U.Houston","docDateTxt":"Oct. 2003","docPublished":"2003 SPE Annual Technical Conference and Exhibition, Denver,","docLink":"https://swwus-ep-livelink.shell.com/livelink/livelink.exe/^^^SPE-084064-PA_-_Self-Learning_Reservoir_Management.pdf?func=doc.Fetch&nodeId=19971511&docTitle=%5E%5E%5ESPE%2D084064%2DPA+%2D+Self%2DLearning+Reservoir+Management%2Epdf"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Coupling of a Surface Network With Reservoir Simulation","docID":"SPE-084220","docAuthor":"Kosmala, Alexandre et al","docCoAuthors":"Aanonsen, Sigurd\nGajraj, Allyson\nBiran, Valerie\nBrusdal, Kari\nStokkeness, Arild\nTorrens, Richard\n","docType":"SPE","docOrg":"SPE, Schlumberger, Norsk Hydro","docDateTxt":"Oct. 2003","docPublished":"SPE Annual Technical Conference and Exhibition, Denver, Colorado"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"A New Planning Tool for Smart Fields Evaluation","docID":"SPE-084323","docAuthor":"Gai, H.","docCoAuthors":"None","docOrg":"SPE, BP","docType":"SPE","docDateTxt":"Oct. 2003","docPublished":"SPE Annual Technical Conference and Exhibition, Denver, Colorado"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Integrated Optimization for Rate Allocation in reservoir simulation","docID":"SPE-087309","docAuthor":"Davidson, Jeffrey E. et al","docCoAuthors":"Beckner, Bret L.","docOrg":"SPE, Exxon Mobil","docType":"SPE","docDateTxt":"Aug. 2003","docPublished":"S{E Reservoir Simulation Symposium, Houston, Texas"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"SPE-088792: A Novel Approach to Reservoir Surveillance Planning","docID":"SPE-088792","docLink":"https://swwus-ep-livelink.shell.com/livelink/livelink.exe/^^^SPE-088792_-_A_Novel_Approach_to_Reservoir_Surveillance_Planning.pdf?func=doc.Fetch&nodeId=19974917&docTitle=%5E%5E%5ESPE%2D088792+%2D+A+Novel+Approach+to+Reservoir+Surveillance+Planning%2Epdf","docType":"SPE","docAuthor":"Sinha, S.P.","docCoAuthors":"Satyendra P. Sinha\nRaghad Al-Qattan","docOrg":"Kuwait Oil Co.","docDateTxt":"October 2004","docPublished":"Abu Dhabi International Petroleum Exhibition and Conference, UAE"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Oilfield Environment-Induced Stress Corrosion Cracking of CRAs in Completion Brines","docID":"SPE-090188","docAuthor":"Stevens, Richard; et al","docOrg":"SPE","docType":"SPE","docDateTxt":"Sep. 2004","docPublished":"SPE Annual Technical Conference and Exhibition, Houston"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"SPE-090213: Real Time Optimization - Classification and Assessment","docID":"SPE-090213","docAuthor":"Mochizuki, S.","docCoAuthors":"Saputelli, L.A., Halliburton\nKabir, C.S., ChevronTexaco\nCramer, R., Shell\nLockman, M.J., Topsail Ventures\nReese, R.D., Case Services\nHarms, L.K., ConocoPhilips\nSisk, C.D., BP\nHite, J.R., Business Fundamentals Group\nEscorcia, A., Halliburton\n","docOrg":"SPE, ExxonMobil, Halliburton, ChevronTexaco, Shell, etc.","docType":"SPE","docDateTxt":"September 2004","docPublished":"SPE Annual Technical Conference and Exhibition held in Houston, TX","docLink":"https://swwus-ep-livelink.shell.com/livelink/livelink.exe/^^^SPE-090213_-_Real_Time_Optimization_-_Classification_and_Assessment.pdf?func=doc.Fetch&nodeId=19987565&docTitle=%5E%5E%5ESPE%2D090213+%2D+Real+Time+Optimization+%2D+Classification+and+Assessment%2Epdf"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Flow Assurance and Subsea Productivity - Closing the Loop with Connectivity and Measurements","docID":"SPE-90244 ","docType":"SPE","docAuthor":"Ratulowski, J., et al","docDateTxt":"Sep. 2004","docLink":"hard disk"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"SPE-090244 - Flow Assurance and Subsea Productivity, Closing the Loop with Connectivity and Measurements","docID":"SPE-090244","docAuthor":"Ratulowski, J.","docCoAuthors":"A. Amin, SPE\nA. Hammami, SPE\nM. Muhammad, SPE\nM. Riding, Schlumberger","docType":"SPE","docDateTxt":"September 2004","docPublished":"SPE Annual Technical Conference and Exhibition held in Houston, TX","docLink":"https://swwus-ep-livelink.shell.com/livelink/livelink.exe/^^^SPE-090244_-_Flow_Assurance_and_Subsea_Productivity__Closing_the_Loop_with_Connectivity_and_Measurements.pdf?func=doc.Fetch&nodeId=19987736&docTitle=%5E%5E%5ESPE%2D090244+%2D+Flow+Assurance+and+Subsea+Productivity_+Closing+the+Loop+with+Connectivity+and+Measurements%2Epdf"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"SPE-094543: Developments in the visualisation of well tubular condition","docID":"SPE-094543","docType":"SPE","docAuthor":"Oliver, D.","docDateTxt":"13 May 2005","docPublished":"SPE International Symposium on Oilfield Corrosion held in Aberdeen, UK","docLink":"https://swwus-ep-livelink.shell.com/livelink/livelink.exe/^^_SPE-094543_-_Developments_in_the_visualisation_of_well_tubular_condition.pdf?func=doc.Fetch&nodeId=19973022&docTitle=%5E%5E_SPE%2D094543+%2D+Developments+in+the+visualisation+of+well+tubular+condition%2Epdf"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Tube Pickling Procedures - Mathematical Modeling and Case Studies","docID":"SPE-095004","docAuthor":"Al-Mutairi, S.H.","docOrg":"SPE","docType":"SPE","docDateTxt":"May 2005","docPublished":"SPE European Formation Damage Conference, The Netherlands"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Production optimization, A moving horizon approach","docAuthor":"Nikolaou, M. et al","docCoAuthors":"Cullick, A.S.\nSaputelli, L.","docOrg":"SPE, U. of Houston, Halliburton","docType":"SPE","docDateTxt":"Apr. 2006","docPublished":"SPE Intelligent Energy Conference, Amsterdam, The Netherlands","docID":"SPE-099358"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"A rigorous Well Model to Optimize Production from Intelligent Wells and Establish the Back-allocation Algorithm","docID":"SPE-099994 ","docAuthor":"Graf, T. et al","docCoAuthors":"Graf, S.P.\nEvbomoen, P.\nUmadia, C.","docOrg":"SPE, Schlumberger","docType":"SPE","docDateTxt":"Jun. 2006","docPublished":"SPE/EAGE Annual Conference and Exhibition, Vienna, Austria"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Impact of Intelligent Wells on Oilfield scale management","docAuthor":"Kavle, V. et al","docCoAuthors":"Elmsallati, S.\nMacKay, E.\nDavies, D.","docOrg":"Heriot-Watt U.","docType":"SPE","docDateTxt":"Jun. 2006","docPublished":"SPE/EAGE Annual Conference and Exhibition, Vienna, Austria"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Techniques for Optimum Placement of Interval Control Valve(s) in an Intelligent Well","docID":"SPE-100191","docAuthor":"Ebadi, F. et al","docCoAuthors":"Davies, D.R.","docOrg":"SPE, Heriot-Watt U.","docDateTxt":"Jun. 2006","docPublished":"SPE Annual Coneference and Exhibition 2006, Vienna, Austria","docType":"SPE"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Failure Analysis of String Corrosion and Its Protection during Constructing and Operating Gas Storage Facility in Bedded Salt Deposit","docID":"SPE-100386","docType":"SPE","docAuthor":"Guangjie, Yuan","docDateTxt":"May 2006"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"An Evolution from Smart Wells to Smart Fields","docID":"SPE-100710 ","docAuthor":"Van der Steen, E.","docCoAuthors":"None","docOrg":"Brunei Shell Petroleum","docType":"OTC","docDateTxt":"Apr. 2006","docPublished":"SPE Intelligent Energy Conference, Amsterdam, The Netherlands"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"SPE-103222: Rate Allocation Using Permanent Downhole Pressures","docID":"SPE-103222","docAuthor":"McCracken, M. et al","docCoAuthors":"Chorneyko, D.","docOrg":"Exxon Mobil","docType":"SPE","docDateTxt":"Sep. 2006","docPublished":"SPE Annual Technical Conference and Exhibition, San Antonio, Texas","docLink":"https://swwus-ep-livelink.shell.com/livelink/livelink.exe/^-^SPE-103222-MS_-_Rate_Allocation_Using_Permanent_Downhole_Pressures.pdf?func=doc.Fetch&nodeId=19971867&docTitle=%5E%2D%5ESPE%2D103222%2DMS+%2D+Rate+Allocation+Using+Permanent+Downhole+Pressures%2Epdf"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"SPE-107279: Surveillance Planning - The Key to Managing a Mature Gas Reservoir","docID":"SPE-107279","docAuthor":"Samsundar, Kamal","docOrg":"BP Trinidad y Tobago","docType":"SPE","docDateTxt":"Apr. 2007","docPublished":"2007 SPE Latin American and Caribbean Petroleum Engineering Conference, Buenos Aires","docLink":"https://swwus-ep-livelink.shell.com/livelink/livelink.exe/SPE-107279_-_Surveillance_Planning__The_Key_to_Managing_a_Mature_Gas_Reservoir.pdf?func=doc.Fetch&nodeId=19968143&docTitle=SPE%2D107279+%2D+Surveillance+Planning_+The+Key+to+Managing+a+Mature+Gas+Reservoir%2Epdf"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Accurate Corrosion Prediction through and Integrated Approach","docID":"SPE-0111430","docType":"SPE","docAuthor":"Bondos, J.C.","docDateTxt":"August 2006"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Crude-Oil Foaming Problems at the Sullom Voe Terminal","docType":"SPE","docDateTxt":"Dec. 1985","docID":"SPE-12809"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"SPE-56917: Primary Separation and New Generation of Interface Level Measurement Systems","docID":"SPE-56917","docType":"SPE","docAuthor":"Yang, M.","docDateTxt":"Sep. 1999"}</data>
<<formTiddler RefDocTemplate2>><data>{"docType":"SPE","docTitle":"Scaling Challenges in Tinggi Operation - A Case History of Scaling Management","docID":"SPE-60199","docAuthor":"Kabir, A.H.","docDateTxt":"Jan. 2000"}</data>
<<formTiddler RefDocTemplate2>><data>{"docLink":"http://swwus-ep-livelink.shell.com/livelink/livelink.exe/fetch/-19044/2809951/3749599/11949167/Combined_Scale_Removal_and_Scale_Inhibition_Treatments_SPE_60222.pdf?nodeid=11952059&vernum=0","docTitle":"Combined Scale Removal and Scale Inhibition Treatments","docID":"SPE-60222","docType":"SPE","docAuthor":"Smith, P.S.","docDateTxt":"2000"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Foamy-Oil Flow","docID":"SPE-68885","docType":"SPE","docAuthor":"Maini, Brij B.","docDateTxt":"2001"}</data>
<<formTiddler RefDocTemplate2>><data>{"docID":"SPE-75177","docTitle":"Foam Generation in Porous Media","docType":"SPE","docAuthor":"Gauglitz, P.A.","docDateTxt":"Apr. 2002"}</data>
<<formTiddler RefDocTemplate2>><data>{"docTitle":"Integrated Risk Analysis for Scale Management in Deepwater Developments","docAuthor":"Mackay, E.J.","docID":"SPE-87459","docType":"SPE","docDateTxt":"2004","docLink":"http://swwus-ep-livelink.shell.com/livelink/livelink.exe/Integrated_Risk_Analysis_for_Scale_Management_in_Deepwater_Developments_SPE_87459.pdf?func=doc.Fetch&nodeId=11950195&docTitle=Integrated+Risk+Analysis+for+Scale+Management+in+Deepwater+Developments+SPE+87459%2Epdf"}</data>
[[Oilfield Scales]]
[[Scale forming mechanisms]]
[[Sulphide Stress Corrosion Cracking]]
/***
|Name:|SaveCloseTiddlerPlugin|
|Description:|Provides two extra toolbar commands, saveCloseTiddler and cancelCloseTiddler|
|Version:|3.0 ($Rev: 5502 $)|
|Date:|$Date: 2008-06-10 23:31:39 +1000 (Tue, 10 Jun 2008) $|
|Source:|http://mptw.tiddlyspot.com/#SaveCloseTiddlerPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
To use these you must add them to the tool bar in your EditTemplate
***/
//{{{
merge(config.commands,{
saveCloseTiddler: {
text: 'done/close',
tooltip: 'Save changes to this tiddler and close it',
handler: function(ev,src,title) {
var closeTitle = title;
var newTitle = story.saveTiddler(title,ev.shiftKey);
if (newTitle)
closeTitle = newTitle;
return config.commands.closeTiddler.handler(ev,src,closeTitle);
}
},
cancelCloseTiddler: {
text: 'cancel/close',
tooltip: 'Undo changes to this tiddler and close it',
handler: function(ev,src,title) {
// the same as closeTiddler now actually
return config.commands.closeTiddler.handler(ev,src,title);
}
}
});
//}}}
Should consider the following conditions:
* Thermodynamic
* Kinetic
* Hydrodynamic
* Adherence
"a secondary deposit of mainly inorganic chemical compunds caused by the presence or flow of fluids in a system ..."
# Decrease in pressure and/or increase in temperature of a brine
# Mixing incompatible brines
# Brine evaporation
Scale particles and fine sands helped stabilize emulsion, which started to occupy a big part of separators and water handling vessels. This together with sand accumulation caused the liquid retention time in vessels to reduce. Level controller interpreted emulsion as oil phase. So even in automatic operation mode, emulsion overflow to the oil line occurred frequently.
> Short term measures
>> Scale inhibitor chemical injection program
>> Routine stroking of control valves
>> Identification of scale prone reservoir
>> Flowline scale deposition monitoring
>> THP trending
>> Descaling: scheduled and online
> Long term measures
>> Maintaing high THP
>> Chemical optimization study
>> Perform research
The search for materials that reduce heat flow in the casing annulus begins by comparing thermal conductivities of possible constituents. Many oils have a moderately low thermal conductivity (0.08 Btu/hr-ft °F) and appear to be suitable insulators. However, heat transfer by conduction is supplemented by natural convection when the fluid is movules. Natural convection can increase the heat transmissibility of an oil by a factor of 10 to 20 over molecular conduction. Under these conditions oil is a poor insulator.
/***
|Name:|SelectThemePlugin|
|Description:|Lets you easily switch theme and palette|
|Version:|1.0.1 ($Rev: 3646 $)|
|Date:|$Date: 2008-02-27 02:34:38 +1000 (Wed, 27 Feb 2008) $|
|Source:|http://mptw.tiddlyspot.com/#SelectThemePlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!Notes
* Borrows largely from ThemeSwitcherPlugin by Martin Budden http://www.martinswiki.com/#ThemeSwitcherPlugin
* Theme is cookie based. But set a default by setting config.options.txtTheme in MptwConfigPlugin (for example)
* Palette is not cookie based. It actually overwrites your ColorPalette tiddler when you select a palette, so beware.
!Usage
* {{{<<selectTheme>>}}} makes a dropdown selector
* {{{<<selectPalette>>}}} makes a dropdown selector
* {{{<<applyTheme>>}}} applies the current tiddler as a theme
* {{{<<applyPalette>>}}} applies the current tiddler as a palette
* {{{<<applyTheme TiddlerName>>}}} applies TiddlerName as a theme
* {{{<<applyPalette TiddlerName>>}}} applies TiddlerName as a palette
***/
//{{{
config.macros.selectTheme = {
label: {
selectTheme:"select theme",
selectPalette:"select palette"
},
prompt: {
selectTheme:"Select the current theme",
selectPalette:"Select the current palette"
},
tags: {
selectTheme:'systemTheme',
selectPalette:'systemPalette'
}
};
config.macros.selectTheme.handler = function(place,macroName)
{
var btn = createTiddlyButton(place,this.label[macroName],this.prompt[macroName],this.onClick);
// want to handle palettes and themes with same code. use mode attribute to distinguish
btn.setAttribute('mode',macroName);
};
config.macros.selectTheme.onClick = function(ev)
{
var e = ev ? ev : window.event;
var popup = Popup.create(this);
var mode = this.getAttribute('mode');
var tiddlers = store.getTaggedTiddlers(config.macros.selectTheme.tags[mode]);
// for default
if (mode == "selectPalette") {
var btn = createTiddlyButton(createTiddlyElement(popup,'li'),"(default)","default color palette",config.macros.selectTheme.onClickTheme);
btn.setAttribute('theme',"(default)");
btn.setAttribute('mode',mode);
}
for(var i=0; i<tiddlers.length; i++) {
var t = tiddlers[i].title;
var name = store.getTiddlerSlice(t,'Name');
var desc = store.getTiddlerSlice(t,'Description');
var btn = createTiddlyButton(createTiddlyElement(popup,'li'), name?name:t, desc?desc:config.macros.selectTheme.label['mode'], config.macros.selectTheme.onClickTheme);
btn.setAttribute('theme',t);
btn.setAttribute('mode',mode);
}
Popup.show();
return stopEvent(e);
};
config.macros.selectTheme.onClickTheme = function(ev)
{
var mode = this.getAttribute('mode');
var theme = this.getAttribute('theme');
if (mode == 'selectTheme')
story.switchTheme(theme);
else // selectPalette
config.macros.selectTheme.updatePalette(theme);
return false;
};
config.macros.selectTheme.updatePalette = function(title)
{
if (title != "") {
store.deleteTiddler("ColorPalette");
if (title != "(default)")
store.saveTiddler("ColorPalette","ColorPalette",store.getTiddlerText(title),
config.options.txtUserName,undefined,"");
refreshAll();
if(config.options.chkAutoSave)
saveChanges(true);
}
};
config.macros.applyTheme = {
label: "apply",
prompt: "apply this theme or palette" // i'm lazy
};
config.macros.applyTheme.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
var useTiddler = params[0] ? params[0] : tiddler.title;
var btn = createTiddlyButton(place,this.label,this.prompt,config.macros.selectTheme.onClickTheme);
btn.setAttribute('theme',useTiddler);
btn.setAttribute('mode',macroName=="applyTheme"?"selectTheme":"selectPalette"); // a bit untidy here
}
config.macros.selectPalette = config.macros.selectTheme;
config.macros.applyPalette = config.macros.applyTheme;
config.macros.refreshAll = { handler: function(place,macroName,params,wikifier,paramString,tiddler) {
createTiddlyButton(place,"refresh","refresh layout and styles",function() { refreshAll(); });
}};
//}}}
Laboratory testing to select corrosion inhibitors can be placed in three major categories:
# Corrosion inhibitor compatibility with system fluids
# Corrosion inhibitor compatibility with system facilities
# Corrosion inhibitor performance
In all three of these categories, information from modeling helps to establish the proper conditions for the testing procedures. The tests on corrosion inhibitor fluid compatibility provide a simple means of weeding out undesirable corrosion inhibitor candidates.
... we develop in this work an [[MPC]] (receding horizon) scheme that underlies a supervisory optimization level, which predics the best operating points of a hydrocarbon-producing field. The resulting structure is a self-learning and self-adaptive scheme that optimizwes multiphase fluid migration and compartmentilized reservoir while integrating downhole completion, wellhead restrictions, and business objectives and constraints.
... a strategy can be achieved by combining the following elements:
* Parametric fluid flow modeling
* [[Model Predictive Control|MPC]]
* NPV optimization
/%
|Name|SetDefaultTiddlers|
|Source|http://www.TiddlyTools.com/#SetDefaultTiddlers|
|Version|1.0.3|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <<br>>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|script|
|Requires|InlineJavascriptPlugin|
|Overrides||
|Description|set contents of DefaultTiddlers list to match currently displayed tiddlers|
Usage: <<tiddler SetDefaultTiddlers>>
%/<script label="set default tiddlers">
// get list of current open tiddlers
var tids=[];
story.forEachTiddler(function(title,element){tids.push("[["+title+"]]")}); // always put titles in brackets
// if (!confirm("DefaultTiddlers will be set to:\n\n%0\n\nIs it OK to proceed?".format([tids.join(" ")]))) //return;
tids=tids.join("\n"); // separate tiddler links by newlines for easier reading
var title="DefaultTiddlers";
var t=store.getTiddler(title);
store.saveTiddler(title,title,tids,config.options.txtUserName,new Date(),t?t.tags:"",t?t.fields:null);
story.refreshTiddler(title,null,true);
displayMessage(title+" has been "+(t?"updated":"created"));
// alfonso reyes added this on August
setTimeout ( "saveChanges()", 2000 );
</script>
# too much time spent chasing data
# much time wasted reconciling data from different origins
# data received inaccurate, incomplete or not needed
# energy and effort invested manipulating data to present in useful formats
# poor decisions based on incomplete information
# users creating own ad-hoc databases on personal computers because official data not trusted or accesible
# unable to improve data management processes; porr data quality or data management considered a bureaucratic activity
<<search>><<closeAll>><<permaview>><<newTiddler>><<newJournal "DD MMM YYYY" "journal">><<saveChanges>><<tiddler TiddlyHomeSidebar>><<tiddler SetDefaultTiddlers>><<slider chkSliderOptionsPanel OptionsPanel "options »" "Change TiddlyWiki advanced options">>
|<<siteMap Production 2>><<siteMap [[Flow Assurance]] 2>><<siteMap Completions 2>>|<<siteMap Reservoir 2>><<siteMap [[Heat Transfer]] 2>>|<<siteMap Surveillance 2>><<siteMap [[SmartWells]] 2>>|
|noBorder threeCol|k
/***
| Name:|SiteMapMacro|
| Author:|Simon Baird|
| Location:|http://simonbaird.com/mptw/#SiteMapMacro|
| Version:|1.0.3, 15-Mar-06|
!!Examples
See SiteMap and SliderSiteMap for example usage.
!!Parameters
* Name of tiddler to start at
* Max depth (a number)
* Format (eg, nested, see formats below)
* Don't show root flag (anything other than null turns it on)
* Tags - a string containing a bracketed list of tags that we are interested in
!!History
* 1.0.3 (15-Mar-06)
** added tag filtering
* 1.0.2 (15-Mar-06)
** Added json format and dontshowroot option
* 1.0.1 (9-Mar-06)
** Added selectable formats and fixed nested slider format
* 1.0.0 (8-Mar-06)
** first release
***/
//{{{
version.extensions.SiteMapMacro = {
major: 1,
minor: 0,
revision: 3,
date: new Date(2006,3,15),
source: "http://simonbaird.com/mptw/#SiteMapMacro"
};
config.macros.siteMap = {
formats: {
bullets: {
formatString: "%0[[%1]]\n%2",
indentString: "*"
},
// put this in your StyleSheet to make it look good.
// .sliderPanel { margin-left: 2em; }
sliders: {
formatString: "[[%1]]+++\n%2===\n\n",
formatStringLeaf: "[[%1]]\n"
},
openSliders: {
formatString: "[[%1]]++++\n%2===\n\n",
formatStringLeaf: "[[%1]]\n"
},
popups: {
formatString: "[[%1]]+++^\n%2===\n\n",
formatStringLeaf: "[[%1]]\n"
},
// these don't work too well
openPopups: {
formatString: "[[%1]]++++^\n%2===\n\n",
formatStringLeaf: "[[%1]]\n"
},
// this is a little nuts but it works
json: {
formatString: '\n%0{"%1":[%2\n%0]}',
formatStringLeaf: '\n%0"%1"',
indentString: " ",
separatorString: ","
}
},
defaultFormat: "bullets",
treeTraverse: function(title,depth,maxdepth,format,dontshowroot,tags,excludetags) {
var tiddler = store.getTiddler(title);
var tagging = store.getTaggedTiddlers(title);
if (dontshowroot)
depth = 0;
var indent = "";
if (this.formats[format].indentString)
for (var j=0;j<depth;j++)
indent += this.formats[format].indentString;
var childOutput = "";
if (!maxdepth || depth < parseInt(maxdepth))
for (var i=0;i<tagging.length;i++)
if (tagging[i].title != title) {
if (this.formats[format].separatorString && i != 0)
childOutput += this.formats[format].separatorString;
childOutput += this.treeTraverse(tagging[i].title,depth+1,maxdepth,format,null,tags,excludetags);
}
if (childOutput == "" && (
(tags && tags != "" && !tiddler.tags.containsAll(tags.readBracketedList())) ||
(excludetags && excludetags != "" && tiddler.tags.containsAny(excludetags.readBracketedList()))
)
) {
// so prune it cos it doesn't have the right tags and neither do any of it's children
return "";
}
if (dontshowroot)
return childOutput;
if (this.formats[format].formatStringLeaf && childOutput == "") {
// required for nestedSliders
return this.formats[format].formatStringLeaf.format([indent,title,childOutput]);
}
return this.formats[format].formatString.format([indent,title,childOutput]);
},
handler: function (place,macroName,params,wikifier,paramString,tiddler) {
wikify(this.treeTraverse(
params[0] && params[0] != '.' ? params[0] : tiddler.title, 1,
params[1] && params[1] != '.' ? params[1] : null, // maxdepth
params[2] && params[2] != '.' ? params[2] : this.defaultFormat, // format
params[3] && params[3] != '.' ? params[3] : null, // dontshowroot
params[4] && params[4] != '.' ? params[4] : null, // tags
params[5] && params[5] != '.' ? params[5] : null // excludetags
),place);
}
}
//}}}
collection of select papers
http://thesmartfield.com/tw/papers/
The "smart" technologies are intended to enable:
* Remote adjustement of the well's operating point
* continuous and automatic fine tuning of production
* improvement of project economics
[img[SPE-090213_SpiderDiagramTechnologyStatus.png]]
High-pressure steam injection causes casing failure in wells completed with J-55 short-thread casing. Tensile failures are the result of casing deformation when temperature-generated compressive forces exceed the yield strength of the casing steel.
Preventing casing damage in injection injection or producing wells requires reducing the casing temperature and/or the thermally induced compressive forces.
Data management can be defined as a systematic approach to data collection, manipulation, distribution and analysis. Consequently, Information Technology (IT) is any technology that supports data management activities.
As noted by several authors 8,9,10, an experienced multidisciplinary team must be charged with the ongoing
responsibility of updating the information technology plan.
The structure of foam in porous media is different from that of polyhedral foams commonly encountered with soaps. It is rather a dispersion of gas in a continuous liquid phase with at least some gas flow paths made discontinuous by thin liquid films called [[lamellae]].
[[TagglyTaggingStyles]]
.viewer td {vertical-align:top;}
.viewer table.noBorder {border-style:none;}
.viewer table.noBorder td {border-style:none;}
.viewer table.threeCol td {width:33%;}
[[FormTableStyleSheet]]
[[ReferencesStyleSheet]]
SUlphide stress corrosion cracking is generally related to hydrogen embrittlement. The sulphide ions are generally believed to catalized entry of hydrogen into the material. If the material is susceptible and when applied to tensile stresses, cracking may occur.
SSCC has been studied in detail by NACE ... such as NACE-MR-01-75 and TM-01-78. The latter gives criteria on when a system must be considered to be sour and gives guidelines on materials ...
# [[Productivity-index]] and inflow-performance plots coupled with well-test plots of water cut and oil rates.
# [[Reservoir withdrawal calculations]]
# Geochemical program
# BHP transient analysis using type curves and traditional analysis methids
# [[Injectivity plots]] with profile survey comparisons
<<tabs txtMoreTab "Tags" "All Tags" TabAllTags "Miss" "Missing tiddlers" TabMoreMissing "Orph" "Orphaned tiddlers" TabMoreOrphans "Shad" "Shadowed tiddlers" TabMoreShadowed>>
<<allTags excludeLists [a-z]>>
[img[SPE023471-SurveillanceTable1.png]]
/***
|Name|TagglyListPlugin|
|Created by|SimonBaird|
|Location|http://simonbaird.com/mptw/#TagglyListPlugin|
|Version|1.1.2 25-Apr-06|
|Requires|See TagglyTagging|
!History
* 1.1.2 (25-Apr-2006) embedded TagglyTaggingStyles. No longer need separated tiddler for styles.
* 1.1.1 (6-Mar-2006) fixed bug with refreshAllVisible closing tiddlers being edited. Thanks Luke Blanshard.
***/
/***
!Setup and config
***/
//{{{
version.extensions.TagglyListPlugin = {
major: 1, minor: 1, revision: 2,
date: new Date(2006,4,25),
source: "http://simonbaird.com/mptw/#TagglyListPlugin"
};
config.macros.tagglyList = {};
config.macros.tagglyListByTag = {};
config.macros.tagglyListControl = {};
config.macros.tagglyListWithSort = {};
config.macros.hideSomeTags = {};
// change this to your preference
config.macros.tagglyListWithSort.maxCols = 6;
config.macros.tagglyList.label = "Tagged as %0:";
// the default sort options. set these to your preference
config.macros.tagglyListWithSort.defaults = {
sortBy:"title", // title|created|modified
sortOrder: "asc", // asc|desc
hideState: "show", // show|hide
groupState: "nogroup", // nogroup|group
numCols: 1
};
// these tags will be ignored by the grouped view
config.macros.tagglyListByTag.excludeTheseTags = [
"systemConfig",
"TiddlerTemplates"
];
config.macros.tagglyListControl.tags = {
title:"sortByTitle",
modified: "sortByModified",
created: "sortByCreated",
asc:"sortAsc",
desc:"sortDesc",
hide:"hideTagged",
show:"showTagged",
nogroup:"noGroupByTag",
group:"groupByTag",
cols1:"list1Cols",
cols2:"list2Cols",
cols3:"list3Cols",
cols4:"list4Cols",
cols5:"list5Cols",
cols6:"list6Cols",
cols7:"list7Cols",
cols8:"list8Cols",
cols9:"list9Cols"
}
// note: should match config.macros.tagglyListControl.tags
config.macros.hideSomeTags.tagsToHide = [
"sortByTitle",
"sortByCreated",
"sortByModified",
"sortDesc",
"sortAsc",
"hideTagged",
"showTagged",
"noGroupByTag",
"groupByTag",
"list1Cols",
"list2Cols",
"list3Cols",
"list4Cols",
"list5Cols",
"list6Cols",
"list7Cols",
"list8Cols",
"list9Cols"
];
//}}}
/***
!Utils
***/
//{{{
// from Eric
function isTagged(title,tag) {
var t=store.getTiddler(title); if (!t) return false;
return (t.tags.find(tag)!=null);
}
// from Eric
function toggleTag(title,tag) {
var t=store.getTiddler(title); if (!t || !t.tags) return;
if (t.tags.find(tag)==null) t.tags.push(tag);
else t.tags.splice(t.tags.find(tag),1);
}
function addTag(title,tag) {
var t=store.getTiddler(title); if (!t || !t.tags) return;
t.tags.push(tag);
}
function removeTag(title,tag) {
var t=store.getTiddler(title); if (!t || !t.tags) return;
if (t.tags.find(tag)!=null) t.tags.splice(t.tags.find(tag),1);
}
// from Udo
Array.prototype.indexOf = function(item) {
for (var i = 0; i < this.length; i++) {
if (this[i] == item) {
return i;
}
}
return -1;
};
Array.prototype.contains = function(item) {
return (this.indexOf(item) >= 0);
}
//}}}
/***
!tagglyList
displays a list of tagged tiddlers.
parameters are sortField and sortOrder
***/
//{{{
// not used at the moment...
function sortedListOfOtherTags(tiddler,thisTag) {
var list = tiddler.tags.concat(); // so we are working on a clone..
for (var i=0;i<config.macros.hideSomeTags.tagsToHide.length;i++) {
if (list.find(config.macros.hideSomeTags.tagsToHide[i]) != null)
list.splice(list.find(config.macros.hideSomeTags.tagsToHide[i]),1); // remove hidden ones
}
for (var i=0;i<config.macros.tagglyListByTag.excludeTheseTags.length;i++) {
if (list.find(config.macros.tagglyListByTag.excludeTheseTags[i]) != null)
list.splice(list.find(config.macros.tagglyListByTag.excludeTheseTags[i]),1); // remove excluded ones
}
list.splice(list.find(thisTag),1); // remove thisTag
return '[[' + list.sort().join("]] [[") + ']]';
}
function sortHelper(a,b) {
if (a == b) return 0;
else if (a < b) return -1;
else return +1;
}
config.macros.tagglyListByTag.handler = function (place,macroName,params,wikifier,paramString,tiddler) {
var sortBy = params[0] ? params[0] : "title";
var sortOrder = params[1] ? params[1] : "asc";
var result = store.getTaggedTiddlers(tiddler.title,sortBy);
if (sortOrder == "desc")
result = result.reverse();
var leftOvers = []
for (var i=0;i<result.length;i++) {
leftOvers.push(result[i].title);
}
var allTagsHolder = {};
for (var i=0;i<result.length;i++) {
for (var j=0;j<result[i].tags.length;j++) {
if (
result[i].tags[j] != tiddler.title // not this tiddler
&& config.macros.hideSomeTags.tagsToHide.find(result[i].tags[j]) == null // not a hidden one
&& config.macros.tagglyListByTag.excludeTheseTags.find(result[i].tags[j]) == null // not excluded
) {
if (!allTagsHolder[result[i].tags[j]])
allTagsHolder[result[i].tags[j]] = "";
allTagsHolder[result[i].tags[j]] += "**[["+result[i].title+"]]\n";
if (leftOvers.find(result[i].title) != null)
leftOvers.splice(leftOvers.find(result[i].title),1); // remove from leftovers. at the end it will contain the leftovers...
}
}
}
var allTags = [];
for (var t in allTagsHolder)
allTags.push(t);
allTags.sort(function(a,b) {
var tidA = store.getTiddler(a);
var tidB = store.getTiddler(b);
if (sortBy == "title") return sortHelper(a,b);
else if (!tidA && !tidB) return 0;
else if (!tidA) return -1;
else if (!tidB) return +1;
else return sortHelper(tidA[sortBy],tidB[sortBy]);
});
var markup = "";
if (sortOrder == "desc") {
allTags.reverse();
}
else {
// leftovers first...
for (var i=0;i<leftOvers.length;i++)
markup += "*[["+leftOvers[i]+"]]\n";
}
for (var i=0;i<allTags.length;i++)
markup += "*[["+allTags[i]+"]]\n" + allTagsHolder[allTags[i]];
if (sortOrder == "desc") {
// leftovers last...
for (var i=0;i<leftOvers.length;i++)
markup += "*[["+leftOvers[i]+"]]\n";
}
wikify(markup,place);
}
config.macros.tagglyList.handler = function (place,macroName,params,wikifier,paramString,tiddler) {
var sortBy = params[0] ? params[0] : "title";
var sortOrder = params[1] ? params[1] : "asc";
var numCols = params[2] ? params[2] : 1;
var result = store.getTaggedTiddlers(tiddler.title,sortBy);
if (sortOrder == "desc")
result = result.reverse();
var listSize = result.length;
var colSize = listSize/numCols;
var remainder = listSize % numCols;
var upperColsize;
var lowerColsize;
if (colSize != Math.floor(colSize)) {
// it's not an exact fit so..
lowerColsize = Math.floor(colSize);
upperColsize = Math.floor(colSize) + 1;
}
else {
lowerColsize = colSize;
upperColsize = colSize;
}
var markup = "";
var c=0;
var newTaggedTable = createTiddlyElement(place,"table");
var newTaggedBody = createTiddlyElement(newTaggedTable,"tbody");
var newTaggedTr = createTiddlyElement(newTaggedBody,"tr");
for (var j=0;j<numCols;j++) {
var foo = "";
var thisSize;
if (j<remainder)
thisSize = upperColsize;
else
thisSize = lowerColsize;
for (var i=0;i<thisSize;i++)
foo += ( "*[[" + result[c++].title + "]]\n"); // was using splitList.shift() but didn't work in IE;
var newTd = createTiddlyElement(newTaggedTr,"td",null,"tagglyTagging");
wikify(foo,newTd);
}
};
/* snip for later.....
//var groupBy = params[3] ? params[3] : "t.title.substr(0,1)";
//var groupBy = params[3] ? params[3] : "sortedListOfOtherTags(t,tiddler.title)";
//var groupBy = params[3] ? params[3] : "t.modified";
var groupBy = null; // for now. groupBy here is working but disabled for now.
var prevGroup = "";
var thisGroup = "";
if (groupBy) {
result.sort(function(a,b) {
var t = a; var aSortVal = eval(groupBy); var aSortVal2 = eval("t".sortBy);
var t = b; var bSortVal = eval(groupBy); var bSortVal2 = eval("t".sortBy);
var t = b; var bSortVal2 = eval(groupBy);
return (aSortVal == bSortVal ?
(aSortVal2 == bSortVal2 ? 0 : (aSortVal2 < bSortVal2 ? -1 : +1)) // yuck
: (aSortVal < bSortVal ? -1 : +1));
});
}
if (groupBy) {
thisGroup = eval(groupBy);
if (thisGroup != prevGroup)
markup += "*[["+thisGroup+']]\n';
markup += "**[["+t.title+']]\n';
prevGroup = thisGroup;
}
*/
//}}}
/***
!tagglyListControl
Use to make the sort control buttons
***/
//{{{
function getSortBy(title) {
var tiddler = store.getTiddler(title);
var defaultVal = config.macros.tagglyListWithSort.defaults.sortBy;
if (!tiddler) return defaultVal;
var usetags = config.macros.tagglyListControl.tags;
if (tiddler.tags.contains(usetags["title"])) return "title";
else if (tiddler.tags.contains(usetags["modified"])) return "modified";
else if (tiddler.tags.contains(usetags["created"])) return "created";
else return defaultVal;
}
function getSortOrder(title) {
var tiddler = store.getTiddler(title);
var defaultVal = config.macros.tagglyListWithSort.defaults.sortOrder;
if (!tiddler) return defaultVal;
var usetags = config.macros.tagglyListControl.tags;
if (tiddler.tags.contains(usetags["asc"])) return "asc";
else if (tiddler.tags.contains(usetags["desc"])) return "desc";
else return defaultVal;
}
function getHideState(title) {
var tiddler = store.getTiddler(title);
var defaultVal = config.macros.tagglyListWithSort.defaults.hideState;
if (!tiddler) return defaultVal;
var usetags = config.macros.tagglyListControl.tags;
if (tiddler.tags.contains(usetags["hide"])) return "hide";
else if (tiddler.tags.contains(usetags["show"])) return "show";
else return defaultVal;
}
function getGroupState(title) {
var tiddler = store.getTiddler(title);
var defaultVal = config.macros.tagglyListWithSort.defaults.groupState;
if (!tiddler) return defaultVal;
var usetags = config.macros.tagglyListControl.tags;
if (tiddler.tags.contains(usetags["group"])) return "group";
else if (tiddler.tags.contains(usetags["nogroup"])) return "nogroup";
else return defaultVal;
}
function getNumCols(title) {
var tiddler = store.getTiddler(title);
var defaultVal = config.macros.tagglyListWithSort.defaults.numCols; // an int
if (!tiddler) return defaultVal;
var usetags = config.macros.tagglyListControl.tags;
for (var i=1;i<=config.macros.tagglyListWithSort.maxCols;i++)
if (tiddler.tags.contains(usetags["cols"+i])) return i;
return defaultVal;
}
function getSortLabel(title,which) {
// TODO. the strings here should be definable in config
var by = getSortBy(title);
var order = getSortOrder(title);
var hide = getHideState(title);
var group = getGroupState(title);
if (which == "hide") return (hide == "show" ? "−" : "+"); // 0x25b8;
else if (which == "group") return (group == "group" ? "normal" : "grouped");
else if (which == "cols") return "cols±"; // ±
else if (by == which) return which + (order == "asc" ? "↓" : "↑"); // ↑ ↓
else return which;
}
function handleSortClick(title,which) {
var currentSortBy = getSortBy(title);
var currentSortOrder = getSortOrder(title);
var currentHideState = getHideState(title);
var currentGroupState = getGroupState(title);
var currentNumCols = getNumCols(title);
var tags = config.macros.tagglyListControl.tags;
// if it doesn't exist, lets create it..
if (!store.getTiddler(title))
store.saveTiddler(title,title,"",config.options.txtUserName,new Date(),null);
if (which == "hide") {
// toggle hide state
var newHideState = (currentHideState == "hide" ? "show" : "hide");
removeTag(title,tags[currentHideState]);
if (newHideState != config.macros.tagglyListWithSort.defaults.hideState)
toggleTag(title,tags[newHideState]);
}
else if (which == "group") {
// toggle hide state
var newGroupState = (currentGroupState == "group" ? "nogroup" : "group");
removeTag(title,tags[currentGroupState]);
if (newGroupState != config.macros.tagglyListWithSort.defaults.groupState)
toggleTag(title,tags[newGroupState]);
}
else if (which == "cols") {
// toggle num cols
var newNumCols = currentNumCols + 1; // confusing. currentNumCols is an int
if (newNumCols > config.macros.tagglyListWithSort.maxCols || newNumCols > store.getTaggedTiddlers(title).length)
newNumCols = 1;
removeTag(title,tags["cols"+currentNumCols]);
if (("cols"+newNumCols) != config.macros.tagglyListWithSort.defaults.groupState)
toggleTag(title,tags["cols"+newNumCols]);
}
else if (currentSortBy == which) {
// toggle sort order
var newSortOrder = (currentSortOrder == "asc" ? "desc" : "asc");
removeTag(title,tags[currentSortOrder]);
if (newSortOrder != config.macros.tagglyListWithSort.defaults.sortOrder)
toggleTag(title,tags[newSortOrder]);
}
else {
// change sortBy only
removeTag(title,tags["title"]);
removeTag(title,tags["created"]);
removeTag(title,tags["modified"]);
if (which != config.macros.tagglyListWithSort.defaults.sortBy)
toggleTag(title,tags[which]);
}
store.setDirty(true); // save is required now.
story.refreshTiddler(title,false,true); // force=true
}
config.macros.tagglyListControl.handler = function (place,macroName,params,wikifier,paramString,tiddler) {
var onclick = function(e) {
if (!e) var e = window.event;
handleSortClick(tiddler.title,params[0]);
e.cancelBubble = true;
if (e.stopPropagation) e.stopPropagation();
return false;
};
createTiddlyButton(place,getSortLabel(tiddler.title,params[0]),"Click to change sort options",onclick,params[0]=="hide"?"hidebutton":"button");
}
//}}}
/***
!tagglyListWithSort
put it all together..
***/
//{{{
config.macros.tagglyListWithSort.handler = function (place,macroName,params,wikifier,paramString,tiddler) {
if (tiddler && store.getTaggedTiddlers(tiddler.title).length > 0)
// todo make this readable
wikify(
"<<tagglyListControl hide>>"+
(getHideState(tiddler.title) != "hide" ?
'<html><span class="tagglyLabel">'+config.macros.tagglyList.label.format([tiddler.title])+' </span></html>'+
"<<tagglyListControl title>><<tagglyListControl modified>><<tagglyListControl created>><<tagglyListControl group>>"+(getGroupState(tiddler.title)=="group"?"":"<<tagglyListControl cols>>")+"\n" +
"<<tagglyList" + (getGroupState(tiddler.title)=="group"?"ByTag ":" ") + getSortBy(tiddler.title)+" "+getSortOrder(tiddler.title)+" "+getNumCols(tiddler.title)+">>" // hacky
// + \n----\n" +
//"<<tagglyList "+getSortBy(tiddler.title)+" "+getSortOrder(tiddler.title)+">>"
: ""),
place,null,tiddler);
}
config.macros.tagglyTagging = { handler: config.macros.tagglyListWithSort.handler };
//}}}
/***
!hideSomeTags
So we don't see the sort tags.
(note, they are still there when you edit. Will that be too annoying?
***/
//{{{
// based on tags.handler
config.macros.hideSomeTags.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
var theList = createTiddlyElement(place,"ul");
if(params[0] && store.tiddlerExists[params[0]])
tiddler = store.getTiddler(params[0]);
var lingo = config.views.wikified.tag;
var prompt = tiddler.tags.length == 0 ? lingo.labelNoTags : lingo.labelTags;
createTiddlyElement(theList,"li",null,"listTitle",prompt.format([tiddler.title]));
for(var t=0; t<tiddler.tags.length; t++)
if (!this.tagsToHide.contains(tiddler.tags[t])) // this is the only difference from tags.handler...
createTagButton(createTiddlyElement(theList,"li"),tiddler.tags[t],tiddler.title);
}
//}}}
/***
!Refresh everything when we save a tiddler. So the tagged lists never get stale. Is this too slow???
***/
//{{{
function refreshAllVisible() {
story.forEachTiddler(function(title,element) {
if (element.getAttribute("dirty") != "true")
story.refreshTiddler(title,false,true);
});
}
story.saveTiddler_orig_mptw = story.saveTiddler;
story.saveTiddler = function(title,minorUpdate) {
var result = this.saveTiddler_orig_mptw(title,minorUpdate);
refreshAllVisible();
return result;
}
store.removeTiddler_orig_mptw = store.removeTiddler;
store.removeTiddler = function(title) {
this.removeTiddler_orig_mptw(title);
refreshAllVisible();
}
config.shadowTiddlers.TagglyTaggingStyles = "/***\nTo use, add {{{[[TagglyTaggingStyles]]}}} to your StyleSheet tiddler, or you can just paste the CSS in directly. See also ViewTemplate, EditTemplate and TagglyTagging.\n***/\n/*{{{*/\n.tagglyTagged li.listTitle { display:none;}\n.tagglyTagged li { display: inline; font-size:90%; }\n.tagglyTagged ul { margin:0px; padding:0px; }\n.tagglyTagging { padding-top:0.5em; }\n.tagglyTagging li.listTitle { display:none;}\n.tagglyTagging ul { margin-top:0px; padding-top:0.5em; padding-left:2em; margin-bottom:0px; padding-bottom:0px; }\n\n/* .tagglyTagging .tghide { display:inline; } */\n\n.tagglyTagging { vertical-align: top; margin:0px; padding:0px; }\n.tagglyTagging table { margin:0px; padding:0px; }\n\n\n.tagglyTagging .button { display:none; margin-left:3px; margin-right:3px; }\n.tagglyTagging .button, .tagglyTagging .hidebutton { color:#aaa; font-size:90%; border:0px; padding-left:0.3em;padding-right:0.3em;}\n.tagglyTagging .button:hover, .hidebutton:hover { background:#eee; color:#888; }\n.selected .tagglyTagging .button { display:inline; }\n\n.tagglyTagging .hidebutton { color:white; } /* has to be there so it takes up space. tweak if you're not using a white tiddler bg */\n.selected .tagglyTagging .hidebutton { color:#aaa }\n\n.tagglyLabel { color:#aaa; font-size:90%; }\n\n.tagglyTagging ul {padding-top:0px; padding-bottom:0.5em; margin-left:1em; }\n.tagglyTagging ul ul {list-style-type:disc; margin-left:-1em;}\n.tagglyTagging ul ul li {margin-left:0.5em; }\n\n.editLabel { font-size:90%; padding-top:0.5em; }\n/*}}}*/\n";
refreshStyles("TagglyTaggingStyles");
//}}}
// // <html>▸▾−±</html>
/***
|Name:|TagglyTaggingPlugin|
|Description:|tagglyTagging macro is a replacement for the builtin tagging macro in your ViewTemplate|
|Version:|3.3.1 ($Rev: 6100 $)|
|Date:|$Date: 2008-07-27 01:42:07 +1000 (Sun, 27 Jul 2008) $|
|Source:|http://mptw.tiddlyspot.com/#TagglyTaggingPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!Notes
See http://mptw.tiddlyspot.com/#TagglyTagging
***/
//{{{
merge(String.prototype,{
parseTagExpr: function(debug) {
if (this.trim() == "")
return "(true)";
var anyLogicOp = /(!|&&|\|\||\(|\))/g;
var singleLogicOp = /^(!|&&|\|\||\(|\))$/;
var spaced = this.
// because square brackets in templates are no good
// this means you can use [(With Spaces)] instead of [[With Spaces]]
replace(/\[\(/g," [[").
replace(/\)\]/g,"]] ").
// space things out so we can use readBracketedList. tricky eh?
replace(anyLogicOp," $1 ");
var expr = "";
var tokens = spaced.readBracketedList(false); // false means don't uniq the list. nice one JR!
for (var i=0;i<tokens.length;i++)
if (tokens[i].match(singleLogicOp))
expr += tokens[i];
else
expr += "tiddler.tags.contains('%0')".format([tokens[i].replace(/'/,"\\'")]); // fix single quote bug. still have round bracket bug i think
if (debug)
alert(expr);
return '('+expr+')';
}
});
merge(TiddlyWiki.prototype,{
getTiddlersByTagExpr: function(tagExpr,sortField) {
var result = [];
var expr = tagExpr.parseTagExpr();
store.forEachTiddler(function(title,tiddler) {
if (eval(expr))
result.push(tiddler);
});
if(!sortField)
sortField = "title";
result.sort(function(a,b) {return a[sortField] < b[sortField] ? -1 : (a[sortField] == b[sortField] ? 0 : +1);});
return result;
}
});
config.taggly = {
// for translations
lingo: {
labels: {
asc: "\u2191", // down arrow
desc: "\u2193", // up arrow
title: "title",
modified: "modified",
created: "created",
show: "+",
hide: "-",
normal: "normal",
group: "group",
commas: "commas",
sitemap: "sitemap",
numCols: "cols\u00b1", // plus minus sign
label: "Tagged as '%0':",
exprLabel: "Matching tag expression '%0':",
excerpts: "excerpts",
descr: "descr",
slices: "slices",
contents: "contents",
sliders: "sliders",
noexcerpts: "title only",
noneFound: "(none)"
},
tooltips: {
title: "Click to sort by title",
modified: "Click to sort by modified date",
created: "Click to sort by created date",
show: "Click to show tagging list",
hide: "Click to hide tagging list",
normal: "Click to show a normal ungrouped list",
group: "Click to show list grouped by tag",
sitemap: "Click to show a sitemap style list",
commas: "Click to show a comma separated list",
numCols: "Click to change number of columns",
excerpts: "Click to show excerpts",
descr: "Click to show the description slice",
slices: "Click to show all slices",
contents: "Click to show entire tiddler contents",
sliders: "Click to show tiddler contents in sliders",
noexcerpts: "Click to show entire title only"
},
tooDeepMessage: "* //sitemap too deep...//"
},
config: {
showTaggingCounts: true,
listOpts: {
// the first one will be the default
sortBy: ["title","modified","created"],
sortOrder: ["asc","desc"],
hideState: ["show","hide"],
listMode: ["normal","group","sitemap","commas"],
numCols: ["1","2","3","4","5","6"],
excerpts: ["noexcerpts","excerpts","descr","slices","contents","sliders"]
},
valuePrefix: "taggly.",
excludeTags: ["excludeLists","excludeTagging"],
excerptSize: 50,
excerptMarker: "/%"+"%/",
siteMapDepthLimit: 25
},
getTagglyOpt: function(title,opt) {
var val = store.getValue(title,this.config.valuePrefix+opt);
return val ? val : this.config.listOpts[opt][0];
},
setTagglyOpt: function(title,opt,value) {
if (!store.tiddlerExists(title))
// create it silently
store.saveTiddler(title,title,config.views.editor.defaultText.format([title]),config.options.txtUserName,new Date(),"");
// if value is default then remove it to save space
return store.setValue(title,
this.config.valuePrefix+opt,
value == this.config.listOpts[opt][0] ? null : value);
},
getNextValue: function(title,opt) {
var current = this.getTagglyOpt(title,opt);
var pos = this.config.listOpts[opt].indexOf(current);
// a little usability enhancement. actually it doesn't work right for grouped or sitemap
var limit = (opt == "numCols" ? store.getTiddlersByTagExpr(title).length : this.config.listOpts[opt].length);
var newPos = (pos + 1) % limit;
return this.config.listOpts[opt][newPos];
},
toggleTagglyOpt: function(title,opt) {
var newVal = this.getNextValue(title,opt);
this.setTagglyOpt(title,opt,newVal);
},
createListControl: function(place,title,type) {
var lingo = config.taggly.lingo;
var label;
var tooltip;
var onclick;
if ((type == "title" || type == "modified" || type == "created")) {
// "special" controls. a little tricky. derived from sortOrder and sortBy
label = lingo.labels[type];
tooltip = lingo.tooltips[type];
if (this.getTagglyOpt(title,"sortBy") == type) {
label += lingo.labels[this.getTagglyOpt(title,"sortOrder")];
onclick = function() {
config.taggly.toggleTagglyOpt(title,"sortOrder");
return false;
}
}
else {
onclick = function() {
config.taggly.setTagglyOpt(title,"sortBy",type);
config.taggly.setTagglyOpt(title,"sortOrder",config.taggly.config.listOpts.sortOrder[0]);
return false;
}
}
}
else {
// "regular" controls, nice and simple
label = lingo.labels[type == "numCols" ? type : this.getNextValue(title,type)];
tooltip = lingo.tooltips[type == "numCols" ? type : this.getNextValue(title,type)];
onclick = function() {
config.taggly.toggleTagglyOpt(title,type);
return false;
}
}
// hide button because commas don't have columns
if (!(this.getTagglyOpt(title,"listMode") == "commas" && type == "numCols"))
createTiddlyButton(place,label,tooltip,onclick,type == "hideState" ? "hidebutton" : "button");
},
makeColumns: function(orig,numCols) {
var listSize = orig.length;
var colSize = listSize/numCols;
var remainder = listSize % numCols;
var upperColsize = colSize;
var lowerColsize = colSize;
if (colSize != Math.floor(colSize)) {
// it's not an exact fit so..
upperColsize = Math.floor(colSize) + 1;
lowerColsize = Math.floor(colSize);
}
var output = [];
var c = 0;
for (var j=0;j<numCols;j++) {
var singleCol = [];
var thisSize = j < remainder ? upperColsize : lowerColsize;
for (var i=0;i<thisSize;i++)
singleCol.push(orig[c++]);
output.push(singleCol);
}
return output;
},
drawTable: function(place,columns,theClass) {
var newTable = createTiddlyElement(place,"table",null,theClass);
var newTbody = createTiddlyElement(newTable,"tbody");
var newTr = createTiddlyElement(newTbody,"tr");
for (var j=0;j<columns.length;j++) {
var colOutput = "";
for (var i=0;i<columns[j].length;i++)
colOutput += columns[j][i];
var newTd = createTiddlyElement(newTr,"td",null,"tagglyTagging"); // todo should not need this class
wikify(colOutput,newTd);
}
return newTable;
},
createTagglyList: function(place,title,isTagExpr) {
switch(this.getTagglyOpt(title,"listMode")) {
case "group": return this.createTagglyListGrouped(place,title,isTagExpr); break;
case "normal": return this.createTagglyListNormal(place,title,false,isTagExpr); break;
case "commas": return this.createTagglyListNormal(place,title,true,isTagExpr); break;
case "sitemap":return this.createTagglyListSiteMap(place,title,isTagExpr); break;
}
},
getTaggingCount: function(title,isTagExpr) {
// thanks to Doug Edmunds
if (this.config.showTaggingCounts) {
var tagCount = config.taggly.getTiddlers(title,'title',isTagExpr).length;
if (tagCount > 0)
return " ("+tagCount+")";
}
return "";
},
getTiddlers: function(titleOrExpr,sortBy,isTagExpr) {
return isTagExpr ? store.getTiddlersByTagExpr(titleOrExpr,sortBy) : store.getTaggedTiddlers(titleOrExpr,sortBy);
},
getExcerpt: function(inTiddlerTitle,title,indent) {
if (!indent)
indent = 1;
var displayMode = this.getTagglyOpt(inTiddlerTitle,"excerpts");
var t = store.getTiddler(title);
if (t && displayMode == "excerpts") {
var text = t.text.replace(/\n/," ");
var marker = text.indexOf(this.config.excerptMarker);
if (marker != -1) {
return " {{excerpt{<nowiki>" + text.substr(0,marker) + "</nowiki>}}}";
}
else if (text.length < this.config.excerptSize) {
return " {{excerpt{<nowiki>" + t.text + "</nowiki>}}}";
}
else {
return " {{excerpt{<nowiki>" + t.text.substr(0,this.config.excerptSize) + "..." + "</nowiki>}}}";
}
}
else if (t && displayMode == "contents") {
return "\n{{contents indent"+indent+"{\n" + t.text + "\n}}}";
}
else if (t && displayMode == "sliders") {
return "<slider slide>\n{{contents{\n" + t.text + "\n}}}\n</slider>";
}
else if (t && displayMode == "descr") {
var descr = store.getTiddlerSlice(title,'Description');
return descr ? " {{excerpt{" + descr + "}}}" : "";
}
else if (t && displayMode == "slices") {
var result = "";
var slices = store.calcAllSlices(title);
for (var s in slices)
result += "|%0|<nowiki>%1</nowiki>|\n".format([s,slices[s]]);
return result ? "\n{{excerpt excerptIndent{\n" + result + "}}}" : "";
}
return "";
},
notHidden: function(t,inTiddler) {
if (typeof t == "string")
t = store.getTiddler(t);
return (!t || !t.tags.containsAny(this.config.excludeTags) ||
(inTiddler && this.config.excludeTags.contains(inTiddler)));
},
// this is for normal and commas mode
createTagglyListNormal: function(place,title,useCommas,isTagExpr) {
var list = config.taggly.getTiddlers(title,this.getTagglyOpt(title,"sortBy"),isTagExpr);
if (this.getTagglyOpt(title,"sortOrder") == "desc")
list = list.reverse();
var output = [];
var first = true;
for (var i=0;i<list.length;i++) {
if (this.notHidden(list[i],title)) {
var countString = this.getTaggingCount(list[i].title);
var excerpt = this.getExcerpt(title,list[i].title);
if (useCommas)
output.push((first ? "" : ", ") + "[[" + list[i].title + "]]" + countString + excerpt);
else
output.push("*[[" + list[i].title + "]]" + countString + excerpt + "\n");
first = false;
}
}
return this.drawTable(place,
this.makeColumns(output,useCommas ? 1 : parseInt(this.getTagglyOpt(title,"numCols"))),
useCommas ? "commas" : "normal");
},
// this is for the "grouped" mode
createTagglyListGrouped: function(place,title,isTagExpr) {
var sortBy = this.getTagglyOpt(title,"sortBy");
var sortOrder = this.getTagglyOpt(title,"sortOrder");
var list = config.taggly.getTiddlers(title,sortBy,isTagExpr);
if (sortOrder == "desc")
list = list.reverse();
var leftOvers = []
for (var i=0;i<list.length;i++)
leftOvers.push(list[i].title);
var allTagsHolder = {};
for (var i=0;i<list.length;i++) {
for (var j=0;j<list[i].tags.length;j++) {
if (list[i].tags[j] != title) { // not this tiddler
if (this.notHidden(list[i].tags[j],title)) {
if (!allTagsHolder[list[i].tags[j]])
allTagsHolder[list[i].tags[j]] = "";
if (this.notHidden(list[i],title)) {
allTagsHolder[list[i].tags[j]] += "**[["+list[i].title+"]]"
+ this.getTaggingCount(list[i].title) + this.getExcerpt(title,list[i].title) + "\n";
leftOvers.setItem(list[i].title,-1); // remove from leftovers. at the end it will contain the leftovers
}
}
}
}
}
var allTags = [];
for (var t in allTagsHolder)
allTags.push(t);
var sortHelper = function(a,b) {
if (a == b) return 0;
if (a < b) return -1;
return 1;
};
allTags.sort(function(a,b) {
var tidA = store.getTiddler(a);
var tidB = store.getTiddler(b);
if (sortBy == "title") return sortHelper(a,b);
else if (!tidA && !tidB) return 0;
else if (!tidA) return -1;
else if (!tidB) return +1;
else return sortHelper(tidA[sortBy],tidB[sortBy]);
});
var leftOverOutput = "";
for (var i=0;i<leftOvers.length;i++)
if (this.notHidden(leftOvers[i],title))
leftOverOutput += "*[["+leftOvers[i]+"]]" + this.getTaggingCount(leftOvers[i]) + this.getExcerpt(title,leftOvers[i]) + "\n";
var output = [];
if (sortOrder == "desc")
allTags.reverse();
else if (leftOverOutput != "")
// leftovers first...
output.push(leftOverOutput);
for (var i=0;i<allTags.length;i++)
if (allTagsHolder[allTags[i]] != "")
output.push("*[["+allTags[i]+"]]" + this.getTaggingCount(allTags[i]) + this.getExcerpt(title,allTags[i]) + "\n" + allTagsHolder[allTags[i]]);
if (sortOrder == "desc" && leftOverOutput != "")
// leftovers last...
output.push(leftOverOutput);
return this.drawTable(place,
this.makeColumns(output,parseInt(this.getTagglyOpt(title,"numCols"))),
"grouped");
},
// used to build site map
treeTraverse: function(title,depth,sortBy,sortOrder,isTagExpr) {
var list = config.taggly.getTiddlers(title,sortBy,isTagExpr);
if (sortOrder == "desc")
list.reverse();
var indent = "";
for (var j=0;j<depth;j++)
indent += "*"
var childOutput = "";
if (depth > this.config.siteMapDepthLimit)
childOutput += indent + this.lingo.tooDeepMessage;
else
for (var i=0;i<list.length;i++)
if (list[i].title != title)
if (this.notHidden(list[i].title,this.config.inTiddler))
childOutput += this.treeTraverse(list[i].title,depth+1,sortBy,sortOrder,false);
if (depth == 0)
return childOutput;
else
return indent + "[["+title+"]]" + this.getTaggingCount(title) + this.getExcerpt(this.config.inTiddler,title,depth) + "\n" + childOutput;
},
// this if for the site map mode
createTagglyListSiteMap: function(place,title,isTagExpr) {
this.config.inTiddler = title; // nasty. should pass it in to traverse probably
var output = this.treeTraverse(title,0,this.getTagglyOpt(title,"sortBy"),this.getTagglyOpt(title,"sortOrder"),isTagExpr);
return this.drawTable(place,
this.makeColumns(output.split(/(?=^\*\[)/m),parseInt(this.getTagglyOpt(title,"numCols"))), // regexp magic
"sitemap"
);
},
macros: {
tagglyTagging: {
handler: function (place,macroName,params,wikifier,paramString,tiddler) {
var parsedParams = paramString.parseParams("tag",null,true);
var refreshContainer = createTiddlyElement(place,"div");
// do some refresh magic to make it keep the list fresh - thanks Saq
refreshContainer.setAttribute("refresh","macro");
refreshContainer.setAttribute("macroName",macroName);
var tag = getParam(parsedParams,"tag");
var expr = getParam(parsedParams,"expr");
if (expr) {
refreshContainer.setAttribute("isTagExpr","true");
refreshContainer.setAttribute("title",expr);
refreshContainer.setAttribute("showEmpty","true");
}
else {
refreshContainer.setAttribute("isTagExpr","false");
if (tag) {
refreshContainer.setAttribute("title",tag);
refreshContainer.setAttribute("showEmpty","true");
}
else {
refreshContainer.setAttribute("title",tiddler.title);
refreshContainer.setAttribute("showEmpty","false");
}
}
this.refresh(refreshContainer);
},
refresh: function(place) {
var title = place.getAttribute("title");
var isTagExpr = place.getAttribute("isTagExpr") == "true";
var showEmpty = place.getAttribute("showEmpty") == "true";
removeChildren(place);
addClass(place,"tagglyTagging");
var countFound = config.taggly.getTiddlers(title,'title',isTagExpr).length
if (countFound > 0 || showEmpty) {
var lingo = config.taggly.lingo;
config.taggly.createListControl(place,title,"hideState");
if (config.taggly.getTagglyOpt(title,"hideState") == "show") {
createTiddlyElement(place,"span",null,"tagglyLabel",
isTagExpr ? lingo.labels.exprLabel.format([title]) : lingo.labels.label.format([title]));
config.taggly.createListControl(place,title,"title");
config.taggly.createListControl(place,title,"modified");
config.taggly.createListControl(place,title,"created");
config.taggly.createListControl(place,title,"listMode");
config.taggly.createListControl(place,title,"excerpts");
config.taggly.createListControl(place,title,"numCols");
config.taggly.createTagglyList(place,title,isTagExpr);
if (countFound == 0 && showEmpty)
createTiddlyElement(place,"div",null,"tagglyNoneFound",lingo.labels.noneFound);
}
}
}
}
},
// todo fix these up a bit
styles: [
"/*{{{*/",
"/* created by TagglyTaggingPlugin */",
".tagglyTagging { padding-top:0.5em; }",
".tagglyTagging li.listTitle { display:none; }",
".tagglyTagging ul {",
" margin-top:0px; padding-top:0.5em; padding-left:2em;",
" margin-bottom:0px; padding-bottom:0px;",
"}",
".tagglyTagging { vertical-align: top; margin:0px; padding:0px; }",
".tagglyTagging table { margin:0px; padding:0px; }",
".tagglyTagging .button { visibility:hidden; margin-left:3px; margin-right:3px; }",
".tagglyTagging .button, .tagglyTagging .hidebutton {",
" color:[[ColorPalette::TertiaryLight]]; font-size:90%;",
" border:0px; padding-left:0.3em;padding-right:0.3em;",
"}",
".tagglyTagging .button:hover, .hidebutton:hover, ",
".tagglyTagging .button:active, .hidebutton:active {",
" border:0px; background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]];",
"}",
".selected .tagglyTagging .button { visibility:visible; }",
".tagglyTagging .hidebutton { color:[[ColorPalette::Background]]; }",
".selected .tagglyTagging .hidebutton { color:[[ColorPalette::TertiaryLight]] }",
".tagglyLabel { color:[[ColorPalette::TertiaryMid]]; font-size:90%; }",
".tagglyTagging ul {padding-top:0px; padding-bottom:0.5em; margin-left:1em; }",
".tagglyTagging ul ul {list-style-type:disc; margin-left:-1em;}",
".tagglyTagging ul ul li {margin-left:0.5em; }",
".editLabel { font-size:90%; padding-top:0.5em; }",
".tagglyTagging .commas { padding-left:1.8em; }",
"/* not technically tagglytagging but will put them here anyway */",
".tagglyTagged li.listTitle { display:none; }",
".tagglyTagged li { display: inline; font-size:90%; }",
".tagglyTagged ul { margin:0px; padding:0px; }",
".excerpt { color:[[ColorPalette::TertiaryDark]]; }",
".excerptIndent { margin-left:4em; }",
"div.tagglyTagging table,",
"div.tagglyTagging table tr,",
"td.tagglyTagging",
" {border-style:none!important; }",
".tagglyTagging .contents { border-bottom:2px solid [[ColorPalette::TertiaryPale]]; padding:0 1em 1em 0.5em;",
" margin-bottom:0.5em; }",
".tagglyTagging .indent1 { margin-left:3em; }",
".tagglyTagging .indent2 { margin-left:4em; }",
".tagglyTagging .indent3 { margin-left:5em; }",
".tagglyTagging .indent4 { margin-left:6em; }",
".tagglyTagging .indent5 { margin-left:7em; }",
".tagglyTagging .indent6 { margin-left:8em; }",
".tagglyTagging .indent7 { margin-left:9em; }",
".tagglyTagging .indent8 { margin-left:10em; }",
".tagglyTagging .indent9 { margin-left:11em; }",
".tagglyTagging .indent10 { margin-left:12em; }",
".tagglyNoneFound { margin-left:2em; color:[[ColorPalette::TertiaryMid]]; font-size:90%; font-style:italic; }",
"/*}}}*/",
""].join("\n"),
init: function() {
merge(config.macros,this.macros);
config.shadowTiddlers["TagglyTaggingStyles"] = this.styles;
store.addNotification("TagglyTaggingStyles",refreshStyles);
}
};
config.taggly.init();
//}}}
/***
InlineSlidersPlugin
By Saq Imtiaz
http://tw.lewcid.org/sandbox/#InlineSlidersPlugin
// syntax adjusted to not clash with NestedSlidersPlugin
// added + syntax to start open instead of closed
***/
//{{{
config.formatters.unshift( {
name: "inlinesliders",
// match: "\\+\\+\\+\\+|\\<slider",
match: "\\<slider",
// lookaheadRegExp: /(?:\+\+\+\+|<slider) (.*?)(?:>?)\n((?:.|\n)*?)\n(?:====|<\/slider>)/mg,
lookaheadRegExp: /(?:<slider)(\+?) (.*?)(?:>)\n((?:.|\n)*?)\n(?:<\/slider>)/mg,
handler: function(w) {
this.lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source)
if(lookaheadMatch && lookaheadMatch.index == w.matchStart ) {
var btn = createTiddlyButton(w.output,lookaheadMatch[2] + " "+"\u00BB",lookaheadMatch[2],this.onClickSlider,"button sliderButton");
var panel = createTiddlyElement(w.output,"div",null,"sliderPanel");
panel.style.display = (lookaheadMatch[1] == '+' ? "block" : "none");
wikify(lookaheadMatch[3],panel);
w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
}
},
onClickSlider : function(e) {
if(!e) var e = window.event;
var n = this.nextSibling;
n.style.display = (n.style.display=="none") ? "block" : "none";
return false;
}
});
//}}}
/***
To use, add {{{[[TagglyTaggingStyles]]}}} to your StyleSheet tiddler, or you can just paste the CSS in directly. See also ViewTemplate, EditTemplate and TagglyTagging.
***/
/*{{{*/
.tagglyTagged li.listTitle { display:none;}
.tagglyTagged li { display: inline; font-size:90%; }
.tagglyTagged ul { margin:0px; padding:0px; }
.tagglyTagging { padding-top:0.5em; }
.tagglyTagging li.listTitle { display:none;}
.tagglyTagging ul { margin-top:0px; padding-top:0.5em; padding-left:2em; margin-bottom:0px; padding-bottom:0px; }
/* .tagglyTagging .tghide { display:inline; } */
.tagglyTagging { vertical-align: top; margin:0px; padding:0px; }
.tagglyTagging table { margin:0px; padding:0px; }
.tagglyTagging .button { display:none; margin-left:3px; margin-right:3px; }
.tagglyTagging .button, .tagglyTagging .hidebutton { color:#aaa; font-size:90%; border:0px; padding-left:0.3em;padding-right:0.3em;}
.tagglyTagging .button:hover, .hidebutton:hover { background:#eee; color:#888; }
.selected .tagglyTagging .button { display:inline; }
.tagglyTagging .hidebutton { color:white; } /* has to be there so it takes up space. tweak if you're not using a white tiddler bg */
.selected .tagglyTagging .hidebutton { color:#aaa }
.tagglyLabel { color:#aaa; font-size:90%; }
.tagglyTagging ul {padding-top:0px; padding-bottom:0.5em; margin-left:1em; }
.tagglyTagging ul ul {list-style-type:disc; margin-left:-1em;}
.tagglyTagging ul ul li {margin-left:0.5em; }
.editLabel { font-size:90%; padding-top:0.5em; }
/*}}}*/
There are a number of new technologies that have been developed for the purpose of monitoring the interface level, the thickness of emulsion and foam layers simultaneously. These include capacitance based using embedded sensors; ultrasonic based with two transducers operating in pulseecho mode; and devices based on measuring the variations in fluids heat transport; as well as nucleonic with which a number of ways have been configured specifically for the application of subsea separation systems.
The industry has clearly embraced the role of intelligent well completions in improving reservoir management, optimizing production and recovery, and minimizing well intervention.
New thickness measuring tools, together with improved software, provide thickness data which can be displayed either as an image based solely on thickness or combined with internal measurement to provide 3D pictures that are analogues of the actual metal remaining within the well.
A new slim [[Magnetic Thickness Tool]] ([[MTT]]) was recently introduced (~2004).
... one guideline is very important for longer tubing life: the ID through te upset region should be smooth and even with no recesses. The presence of an uneven ID through the pin-box area not only creates turbulence but also furnishes a zone that has a tendency for [[crevice corrosion]]. This can accelerate the corrosion in the highly susceptible pin-box area.
/***
|''Name:''|TiddlyHomeSetupPlugin|
|''Description:''|Check and setup all components|
|''Version:''|1.0.0|
|''Date:''|Jul 28, 2007|
|''Source:''|http://tiddlywiki.bidix.info/#TiddlyHomeSetupPlugin|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''License:''|[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D ]]|
|''~CoreVersion:''|2.2.0|
|''Requires:''|UploadToHomeMacro|
***/
//{{{
version.extensions.TiddlyHomeSetupPlugin = {
major: 1, minor: 0, revision: 0,
date: new Date("Jul 28, 2007"),
source: 'http://tiddlywiki.bidix.info/#TiddlyHomeSetupPlugin',
author: 'BidiX (BidiX (at) bidix (dot) info)',
coreVersion: '2.2.0'
};
if (!window.bidix) window.bidix = {}; // bidix namespace
bidix.checkPlugin = function(plugin, major, minor, revision) {
var ext = version.extensions[plugin];
if (!
(ext &&
((ext.major > major) ||
((ext.major == major) && (ext.minor > minor)) ||
((ext.major == major) && (ext.minor == minor) && (ext.revision >= revision))))) {
// write error in PluginManager
if (pluginInfo)
pluginInfo.log.push("Requires " + plugin + " " + major + "." + minor + "." + revision);
eval(plugin); // generate an error : "Error: ReferenceError: xxxx is not defined"
}
};
bidix.getParamsFromTiddler = function(tiddlerTitle, sliceNames) {
tiddlerTitle = (tiddlerTitle ? tiddlerTitle:this.messages.homeParamsTiddler);
if (!store.tiddlerExists(tiddlerTitle) && !store.isShadowTiddler(tiddlerTitle)) {
throw(config.macros.uploadToHome.messages.tiddlerNotFound.toString().format([tiddlerTitle]));
}
return sliceValues = store.getTiddlerSlices(tiddlerTitle,sliceNames);
};
bidix.initOption = function(name,value) {
if (!config.options[name])
config.options[name] = value;
};
bidix.checkPlugin('UploadPlugin',4,1,0);
config.macros.upload.authenticateUser = false; // authentication check by .htaccess
// default TiddlyHomeParameters in shadows
// user can overide this
merge(config.shadowTiddlers,{
'TiddlyHomeParameters':[
"|owner:|BidiX|",
"|site:|BidiXTW|",
"|url:|http://TiddlyWiki.bidix.info/|",
"|rootUrl:|http://TiddlyHome.bidix.info/|"
].join("\n")});
// get config from TiddlyHomeParameters
config.tiddlyHome = {};
merge(config.tiddlyHome, bidix.getParamsFromTiddler('TiddlyHomeParameters',['user','site','url','rootUrl']));
// add TiddlyHomeSidebar in SideBarOptions
config.shadowTiddlers.SideBarOptions = config.shadowTiddlers.SideBarOptions.replace(/(<<saveChanges>>)/,
"$1<<tiddler TiddlyHomeSidebar>>");
merge(config.shadowTiddlers,{
// link to favicon.ico
'MarkupPreHead': [
"<!--{{{-->",
"<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml'/>",
"<link rel=\"shortcut icon\"href=\"" +
config.tiddlyHome.rootUrl +
"_th/images/favicon.ico\" type=\"image/vnd.microsoft.icon\" />",
"<link rel=\"icon\" href=\"" +
config.tiddlyHome.rootUrl +
"_th/images/favicon.ico\" type=\"image/vnd.microsoft.icon\" /> ",
"<!--}}}-->"
].join("\n"),
// tweaks to UploadToHomeMacro parameters
'HomeParameters': [
"|UploadUserName:||",
"|UploadStoreUrl:|" + config.tiddlyHome.url + "store.php|",
"|UploadDir:|.|",
"|UploadFilename:|index.html|",
"|UploadBackupDir:|backup|",
"!Usefull url for your site",
"*" + config.tiddlyHome.url + "backup : List of backup files",
"*" + config.tiddlyHome.url + "download.php : to download thisTiddlyWiki",
"*" + config.tiddlyHome.url + "index.xml : your RSSFeed",
"*" + config.tiddlyHome.url + "news.php : to display your RSSFeed",
"!Access and change data",
"*" + config.tiddlyHome.rootUrl + "#Site : Site properties",
"*" + config.tiddlyHome.rootUrl + "#User : User properties",
"!More Information on TiddlyHome",
"*" + config.tiddlyHome.rootUrl + " for your hosting service",
"*http://TiddlyHome.bidix.info/ for BidiX's TiddlyHome Package"
].join("\n"),
'TiddlyHomeSidebar':[
"<<uploadToHome>><html><a href=" +
config.tiddlyHome.url + "download.php class='button'>download</a></html>"
].join("\n")
});
// Options tweaks
//config.options.txtUserName = config.tiddlyHome.user;
//config.options.pasUploadPassword = '';
config.options.txtBackupFolder = "backup";
config.options.chkSaveBackups = true;
config.options.chkAutoSave = false;
config.options.chkRegExpSearch = false;
config.options.chkCaseSensitiveSearch = false;
config.options.chkAnimate = false;
config.options.chkGenerateAnRssFeed = true;
config.options.chkSaveEmptyTemplate = false;
//}}}
<<uploadToHome>> <html><a href=http://reyesaguayo.com/osp/download.php class='button'>download</a></html>
|~ViewToolbar|closeTiddler closeOthers copyTiddler +editTiddler > fields syncing permalink references jump|
|~EditToolbar|+saveTiddler -cancelTiddler deleteTiddler|
p1. Traditionally, flow assurance has focused on evaluating potential production problems associated with produced fluid issue such as waxes, asphaltenes, hydrates and scale. A combination of fluid sampling, laboratory techniques, and predictive modeling are then used for system selection and design of prevention and remediation strategies.
The selection of the proper ID is important in highly corrosive well because of the synergistic effect of erosion and corrosion. This synergism can accelerete the overall corrosion rate by a hundred-fold by the removal of protective scales, oxides, and/or corrosion inhibitor films. Therefore, calculation of erosional velocity and the proper sizing of the tubing ID is a critical facet in mitigating the aggressiveness of a corrosive environment.
Tubing pickle is the process of removing mill scale, pipe dope, debris and other contaminants from the well tubulars using acids and/or other solvents without permitting the entrance of these fluids into the formation.
From well stimulation point of view, the purpose of the tubing pickle treatment is to clean the production tubing from any damaging material prior to conducting the main stimulation treatment. If not removed or bypassed, these materials can enter the formation can cause severe damage.
p2,c2: Frequent well accessibility problem experienced by wireline and flowlines & piping restrictions due to scale deposition witnessed during shutdown inspections suggest that piping restrictions at various points from downhole to liquid discharge/export line was prevalent. In Sep ’95 a flowline (from the wellhead to the inlets of production / test separators) descaling campaign was carried out.1 Figures 3-8 show some pictures of the flowline elements before and after descaling. This descaling campaign resulted in a production gain of 2.2 MSTB/d. However the gain was short lived (2-3 months). This proved the fact that piping restrictions were causing production bottlenecking and it is one of the causes of production decline.
In general, the best foaming ability is found for surfactants exhibiting a surface tension of the order 50
mN/m. The surface tension must be measured under dynamic conditions which will be encountered in the system.
... most common method is ultrasonics and it must be used regularly to detect metal loss. Ultrasonic testing lends itself to both to measuring general and local corrosion.
General corrosion and wall thinning is reliably measured by the pulse-echo straight beam technique using normal probes adjusted to the actual wall thickness.
p4,c1:
Understanding the meaning of the measurement and incorporating it properly into the design and surveillance models are critical. Because of the large variability in measurement procedures and an unclear link to modeling software data are often used improperly.
* integrated process is necessary
* all failure modes must be evaluated
* the entire life cycle of the asset must be considered
* the service environment must be faithfully replicated
* the test method must be properly designed and calibrated to simulate dthe field chemistry and hydrodynamics
* analysis must be performed in a rigorous manner consistent with the physics of the corrosion process.
*
| !date | !user | !location | !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |
| 14/02/2009 00:03:02 | AlfonsoReyes | [[papers-2.4.1.html|file:///C:/Documents%20and%20Settings/All%20Users.WINX64/Documents/papers-2.4.1.html]] | [[store.php|http://thesmartfield.com/tw/papers/store.php]] | . | [[index.html | http://thesmartfield.com/tw/papers/index.html]] | backup | ok |
| 14/02/2009 00:08:21 | AlfonsoReyes | [[papers-2.4.1.html|file:///C:/Documents%20and%20Settings/All%20Users.WINX64/Documents/papers-2.4.1.html]] | [[store.php|http://thesmartfield.com/tw/papers/store.php]] | . | [[index.html | http://thesmartfield.com/tw/papers/index.html]] | backup | ok |
| 14/02/2009 00:13:32 | AlfonsoReyes | [[papers-2.4.1.html|file:///C:/Documents%20and%20Settings/All%20Users.WINX64/Documents/papers-2.4.1.html]] | [[store.php|http://thesmartfield.com/tw/papers/store.php]] | . | [[index.html | http://thesmartfield.com/tw/papers/index.html]] | backup | ok |
| 14/02/2009 00:17:46 | AlfonsoReyes | [[papers-2.4.1.html|file:///C:/Documents%20and%20Settings/All%20Users.WINX64/Documents/papers-2.4.1.html]] | [[|file:///C:/Documents%20and%20Settings/All%20Users.WINX64/Documents/]] | . | [[papers-2.4.1.html | file:///C:/Documents%20and%20Settings/All%20Users.WINX64/Documents/papers-2.4.1.html]] | |
| 14/02/2009 13:37:59 | AlfonsoReyes | [[papers-2.4.1.html|file:///C:/Documents%20and%20Settings/All%20Users.WINX64/Documents/papers-2.4.1.html]] | [[store.php|http://thesmartfield.com/tw/papers/store.php]] | . | [[index.html | http://thesmartfield.com/tw/papers/index.html]] | backup | ok |
| 14/02/2009 13:42:29 | AlfonsoReyes | [[papers-2.4.1.html|file:///C:/Documents%20and%20Settings/All%20Users.WINX64/Documents/papers-2.4.1.html]] | [[store.php|http://thesmartfield.com/tw/papers/store.php]] | . | [[index.html | http://thesmartfield.com/tw/papers/index.html]] | backup | ok |
| 17/02/2009 18:52:29 | AlfonsoReyes | [[papers-2.4.1.html|file:///C:/Documents%20and%20Settings/All%20Users.WINX64/Documents/papers-2.4.1.html]] | [[store.php|http://thesmartfield.com/tw/papers/store.php]] | . | [[index.html | http://thesmartfield.com/tw/papers/index.html]] | backup | ok |
| 17/02/2009 18:56:35 | AlfonsoReyes | [[papers-2.4.1.html|file:///C:/Documents%20and%20Settings/All%20Users.WINX64/Documents/papers-2.4.1.html]] | [[store.php|http://thesmartfield.com/tw/papers/store.php]] | . | [[index.html | http://thesmartfield.com/tw/papers/index.html]] | backup | ok |
| 27/04/2009 13:20:27 | AlfonsoReyes | [[papers-2.4.1.html|file:///CIFS/.mnt/shared%5Bcolorado%5D/linux-home/Databases/TiddlyWiki/papers-2.4.1.html]] | [[store.php|http://thesmartfield.com/tw/papers/store.php]] | . | [[index.html | http://thesmartfield.com/tw/papers/index.html]] | backup | ok |
| 22/08/2009 14:41:20 | AlfonsoReyes | [[papers.html|file:///home/shared/Databases/TiddlyWiki/papers.html]] | [[store.php|http://thesmartfield.com/tw/papers/store.php]] | . | [[index.html | http://thesmartfield.com/tw/papers/index.html]] | backup |
/***
|''Name:''|UploadPlugin|
|''Description:''|Save to web a TiddlyWiki|
|''Version:''|4.1.3|
|''Date:''|Feb 24, 2008|
|''Source:''|http://tiddlywiki.bidix.info/#UploadPlugin|
|''Documentation:''|http://tiddlywiki.bidix.info/#UploadPluginDoc|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''License:''|[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D ]]|
|''~CoreVersion:''|2.2.0|
|''Requires:''|PasswordOptionPlugin|
***/
//{{{
version.extensions.UploadPlugin = {
major: 4, minor: 1, revision: 3,
date: new Date("Feb 24, 2008"),
source: 'http://tiddlywiki.bidix.info/#UploadPlugin',
author: 'BidiX (BidiX (at) bidix (dot) info',
coreVersion: '2.2.0'
};
//
// Environment
//
if (!window.bidix) window.bidix = {}; // bidix namespace
bidix.debugMode = false; // true to activate both in Plugin and UploadService
//
// Upload Macro
//
config.macros.upload = {
// default values
defaultBackupDir: '', //no backup
defaultStoreScript: "store.php",
defaultToFilename: "index.html",
defaultUploadDir: ".",
authenticateUser: true // UploadService Authenticate User
};
config.macros.upload.label = {
promptOption: "Save and Upload this TiddlyWiki with UploadOptions",
promptParamMacro: "Save and Upload this TiddlyWiki in %0",
saveLabel: "save to web",
saveToDisk: "save to disk",
uploadLabel: "upload"
};
config.macros.upload.messages = {
noStoreUrl: "No store URL in parmeters or options",
usernameOrPasswordMissing: "Username or password missing"
};
config.macros.upload.handler = function(place,macroName,params) {
if (readOnly)
return;
var label;
if (document.location.toString().substr(0,4) == "http")
label = this.label.saveLabel;
else
label = this.label.uploadLabel;
var prompt;
if (params[0]) {
prompt = this.label.promptParamMacro.toString().format([this.destFile(params[0],
(params[1] ? params[1]:bidix.basename(window.location.toString())), params[3])]);
} else {
prompt = this.label.promptOption;
}
createTiddlyButton(place, label, prompt, function() {config.macros.upload.action(params);}, null, null, this.accessKey);
};
config.macros.upload.action = function(params)
{
// for missing macro parameter set value from options
if (!params) params = {};
var storeUrl = params[0] ? params[0] : config.options.txtUploadStoreUrl;
var toFilename = params[1] ? params[1] : config.options.txtUploadFilename;
var backupDir = params[2] ? params[2] : config.options.txtUploadBackupDir;
var uploadDir = params[3] ? params[3] : config.options.txtUploadDir;
var username = params[4] ? params[4] : config.options.txtUploadUserName;
var password = config.options.pasUploadPassword; // for security reason no password as macro parameter
// for still missing parameter set default value
if ((!storeUrl) && (document.location.toString().substr(0,4) == "http"))
storeUrl = bidix.dirname(document.location.toString())+'/'+config.macros.upload.defaultStoreScript;
if (storeUrl.substr(0,4) != "http")
storeUrl = bidix.dirname(document.location.toString()) +'/'+ storeUrl;
if (!toFilename)
toFilename = bidix.basename(window.location.toString());
if (!toFilename)
toFilename = config.macros.upload.defaultToFilename;
if (!uploadDir)
uploadDir = config.macros.upload.defaultUploadDir;
if (!backupDir)
backupDir = config.macros.upload.defaultBackupDir;
// report error if still missing
if (!storeUrl) {
alert(config.macros.upload.messages.noStoreUrl);
clearMessage();
return false;
}
if (config.macros.upload.authenticateUser && (!username || !password)) {
alert(config.macros.upload.messages.usernameOrPasswordMissing);
clearMessage();
return false;
}
bidix.upload.uploadChanges(false,null,storeUrl, toFilename, uploadDir, backupDir, username, password);
return false;
};
config.macros.upload.destFile = function(storeUrl, toFilename, uploadDir)
{
if (!storeUrl)
return null;
var dest = bidix.dirname(storeUrl);
if (uploadDir && uploadDir != '.')
dest = dest + '/' + uploadDir;
dest = dest + '/' + toFilename;
return dest;
};
//
// uploadOptions Macro
//
config.macros.uploadOptions = {
handler: function(place,macroName,params) {
var wizard = new Wizard();
wizard.createWizard(place,this.wizardTitle);
wizard.addStep(this.step1Title,this.step1Html);
var markList = wizard.getElement("markList");
var listWrapper = document.createElement("div");
markList.parentNode.insertBefore(listWrapper,markList);
wizard.setValue("listWrapper",listWrapper);
this.refreshOptions(listWrapper,false);
var uploadCaption;
if (document.location.toString().substr(0,4) == "http")
uploadCaption = config.macros.upload.label.saveLabel;
else
uploadCaption = config.macros.upload.label.uploadLabel;
wizard.setButtons([
{caption: uploadCaption, tooltip: config.macros.upload.label.promptOption,
onClick: config.macros.upload.action},
{caption: this.cancelButton, tooltip: this.cancelButtonPrompt, onClick: this.onCancel}
]);
},
options: [
"txtUploadUserName",
"pasUploadPassword",
"txtUploadStoreUrl",
"txtUploadDir",
"txtUploadFilename",
"txtUploadBackupDir",
"chkUploadLog",
"txtUploadLogMaxLine"
],
refreshOptions: function(listWrapper) {
var opts = [];
for(i=0; i<this.options.length; i++) {
var opt = {};
opts.push();
opt.option = "";
n = this.options[i];
opt.name = n;
opt.lowlight = !config.optionsDesc[n];
opt.description = opt.lowlight ? this.unknownDescription : config.optionsDesc[n];
opts.push(opt);
}
var listview = ListView.create(listWrapper,opts,this.listViewTemplate);
for(n=0; n<opts.length; n++) {
var type = opts[n].name.substr(0,3);
var h = config.macros.option.types[type];
if (h && h.create) {
h.create(opts[n].colElements['option'],type,opts[n].name,opts[n].name,"no");
}
}
},
onCancel: function(e)
{
backstage.switchTab(null);
return false;
},
wizardTitle: "Upload with options",
step1Title: "These options are saved in cookies in your browser",
step1Html: "<input type='hidden' name='markList'></input><br>",
cancelButton: "Cancel",
cancelButtonPrompt: "Cancel prompt",
listViewTemplate: {
columns: [
{name: 'Description', field: 'description', title: "Description", type: 'WikiText'},
{name: 'Option', field: 'option', title: "Option", type: 'String'},
{name: 'Name', field: 'name', title: "Name", type: 'String'}
],
rowClasses: [
{className: 'lowlight', field: 'lowlight'}
]}
};
//
// upload functions
//
if (!bidix.upload) bidix.upload = {};
if (!bidix.upload.messages) bidix.upload.messages = {
//from saving
invalidFileError: "The original file '%0' does not appear to be a valid TiddlyWiki",
backupSaved: "Backup saved",
backupFailed: "Failed to upload backup file",
rssSaved: "RSS feed uploaded",
rssFailed: "Failed to upload RSS feed file",
emptySaved: "Empty template uploaded",
emptyFailed: "Failed to upload empty template file",
mainSaved: "Main TiddlyWiki file uploaded",
mainFailed: "Failed to upload main TiddlyWiki file. Your changes have not been saved",
//specific upload
loadOriginalHttpPostError: "Can't get original file",
aboutToSaveOnHttpPost: 'About to upload on %0 ...',
storePhpNotFound: "The store script '%0' was not found."
};
bidix.upload.uploadChanges = function(onlyIfDirty,tiddlers,storeUrl,toFilename,uploadDir,backupDir,username,password)
{
var callback = function(status,uploadParams,original,url,xhr) {
if (!status) {
displayMessage(bidix.upload.messages.loadOriginalHttpPostError);
return;
}
if (bidix.debugMode)
alert(original.substr(0,500)+"\n...");
// Locate the storeArea div's
var posDiv = locateStoreArea(original);
if((posDiv[0] == -1) || (posDiv[1] == -1)) {
alert(config.messages.invalidFileError.format([localPath]));
return;
}
bidix.upload.uploadRss(uploadParams,original,posDiv);
};
if(onlyIfDirty && !store.isDirty())
return;
clearMessage();
// save on localdisk ?
if (document.location.toString().substr(0,4) == "file") {
var path = document.location.toString();
var localPath = getLocalPath(path);
saveChanges();
}
// get original
var uploadParams = new Array(storeUrl,toFilename,uploadDir,backupDir,username,password);
var originalPath = document.location.toString();
// If url is a directory : add index.html
if (originalPath.charAt(originalPath.length-1) == "/")
originalPath = originalPath + "index.html";
var dest = config.macros.upload.destFile(storeUrl,toFilename,uploadDir);
var log = new bidix.UploadLog();
log.startUpload(storeUrl, dest, uploadDir, backupDir);
displayMessage(bidix.upload.messages.aboutToSaveOnHttpPost.format([dest]));
if (bidix.debugMode)
alert("about to execute Http - GET on "+originalPath);
var r = doHttp("GET",originalPath,null,null,username,password,callback,uploadParams,null);
if (typeof r == "string")
displayMessage(r);
return r;
};
bidix.upload.uploadRss = function(uploadParams,original,posDiv)
{
var callback = function(status,params,responseText,url,xhr) {
if(status) {
var destfile = responseText.substring(responseText.indexOf("destfile:")+9,responseText.indexOf("\n", responseText.indexOf("destfile:")));
displayMessage(bidix.upload.messages.rssSaved,bidix.dirname(url)+'/'+destfile);
bidix.upload.uploadMain(params[0],params[1],params[2]);
} else {
displayMessage(bidix.upload.messages.rssFailed);
}
};
// do uploadRss
if(config.options.chkGenerateAnRssFeed) {
var rssPath = uploadParams[1].substr(0,uploadParams[1].lastIndexOf(".")) + ".xml";
var rssUploadParams = new Array(uploadParams[0],rssPath,uploadParams[2],'',uploadParams[4],uploadParams[5]);
var rssString = generateRss();
// no UnicodeToUTF8 conversion needed when location is "file" !!!
if (document.location.toString().substr(0,4) != "file")
rssString = convertUnicodeToUTF8(rssString);
bidix.upload.httpUpload(rssUploadParams,rssString,callback,Array(uploadParams,original,posDiv));
} else {
bidix.upload.uploadMain(uploadParams,original,posDiv);
}
};
bidix.upload.uploadMain = function(uploadParams,original,posDiv)
{
var callback = function(status,params,responseText,url,xhr) {
var log = new bidix.UploadLog();
if(status) {
// if backupDir specified
if ((params[3]) && (responseText.indexOf("backupfile:") > -1)) {
var backupfile = responseText.substring(responseText.indexOf("backupfile:")+11,responseText.indexOf("\n", responseText.indexOf("backupfile:")));
displayMessage(bidix.upload.messages.backupSaved,bidix.dirname(url)+'/'+backupfile);
}
var destfile = responseText.substring(responseText.indexOf("destfile:")+9,responseText.indexOf("\n", responseText.indexOf("destfile:")));
displayMessage(bidix.upload.messages.mainSaved,bidix.dirname(url)+'/'+destfile);
store.setDirty(false);
log.endUpload("ok");
} else {
alert(bidix.upload.messages.mainFailed);
displayMessage(bidix.upload.messages.mainFailed);
log.endUpload("failed");
}
};
// do uploadMain
var revised = bidix.upload.updateOriginal(original,posDiv);
bidix.upload.httpUpload(uploadParams,revised,callback,uploadParams);
};
bidix.upload.httpUpload = function(uploadParams,data,callback,params)
{
var localCallback = function(status,params,responseText,url,xhr) {
url = (url.indexOf("nocache=") < 0 ? url : url.substring(0,url.indexOf("nocache=")-1));
if (xhr.status == 404)
alert(bidix.upload.messages.storePhpNotFound.format([url]));
if ((bidix.debugMode) || (responseText.indexOf("Debug mode") >= 0 )) {
alert(responseText);
if (responseText.indexOf("Debug mode") >= 0 )
responseText = responseText.substring(responseText.indexOf("\n\n")+2);
} else if (responseText.charAt(0) != '0')
alert(responseText);
if (responseText.charAt(0) != '0')
status = null;
callback(status,params,responseText,url,xhr);
};
// do httpUpload
var boundary = "---------------------------"+"AaB03x";
var uploadFormName = "UploadPlugin";
// compose headers data
var sheader = "";
sheader += "--" + boundary + "\r\nContent-disposition: form-data; name=\"";
sheader += uploadFormName +"\"\r\n\r\n";
sheader += "backupDir="+uploadParams[3] +
";user=" + uploadParams[4] +
";password=" + uploadParams[5] +
";uploaddir=" + uploadParams[2];
if (bidix.debugMode)
sheader += ";debug=1";
sheader += ";;\r\n";
sheader += "\r\n" + "--" + boundary + "\r\n";
sheader += "Content-disposition: form-data; name=\"userfile\"; filename=\""+uploadParams[1]+"\"\r\n";
sheader += "Content-Type: text/html;charset=UTF-8" + "\r\n";
sheader += "Content-Length: " + data.length + "\r\n\r\n";
// compose trailer data
var strailer = new String();
strailer = "\r\n--" + boundary + "--\r\n";
data = sheader + data + strailer;
if (bidix.debugMode) alert("about to execute Http - POST on "+uploadParams[0]+"\n with \n"+data.substr(0,500)+ " ... ");
var r = doHttp("POST",uploadParams[0],data,"multipart/form-data; ;charset=UTF-8; boundary="+boundary,uploadParams[4],uploadParams[5],localCallback,params,null);
if (typeof r == "string")
displayMessage(r);
return r;
};
// same as Saving's updateOriginal but without convertUnicodeToUTF8 calls
bidix.upload.updateOriginal = function(original, posDiv)
{
if (!posDiv)
posDiv = locateStoreArea(original);
if((posDiv[0] == -1) || (posDiv[1] == -1)) {
alert(config.messages.invalidFileError.format([localPath]));
return;
}
var revised = original.substr(0,posDiv[0] + startSaveArea.length) + "\n" +
store.allTiddlersAsHtml() + "\n" +
original.substr(posDiv[1]);
var newSiteTitle = getPageTitle().htmlEncode();
revised = revised.replaceChunk("<title"+">","</title"+">"," " + newSiteTitle + " ");
revised = updateMarkupBlock(revised,"PRE-HEAD","MarkupPreHead");
revised = updateMarkupBlock(revised,"POST-HEAD","MarkupPostHead");
revised = updateMarkupBlock(revised,"PRE-BODY","MarkupPreBody");
revised = updateMarkupBlock(revised,"POST-SCRIPT","MarkupPostBody");
return revised;
};
//
// UploadLog
//
// config.options.chkUploadLog :
// false : no logging
// true : logging
// config.options.txtUploadLogMaxLine :
// -1 : no limit
// 0 : no Log lines but UploadLog is still in place
// n : the last n lines are only kept
// NaN : no limit (-1)
bidix.UploadLog = function() {
if (!config.options.chkUploadLog)
return; // this.tiddler = null
this.tiddler = store.getTiddler("UploadLog");
if (!this.tiddler) {
this.tiddler = new Tiddler();
this.tiddler.title = "UploadLog";
this.tiddler.text = "| !date | !user | !location | !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |";
this.tiddler.created = new Date();
this.tiddler.modifier = config.options.txtUserName;
this.tiddler.modified = new Date();
store.addTiddler(this.tiddler);
}
return this;
};
bidix.UploadLog.prototype.addText = function(text) {
if (!this.tiddler)
return;
// retrieve maxLine when we need it
var maxLine = parseInt(config.options.txtUploadLogMaxLine,10);
if (isNaN(maxLine))
maxLine = -1;
// add text
if (maxLine != 0)
this.tiddler.text = this.tiddler.text + text;
// Trunck to maxLine
if (maxLine >= 0) {
var textArray = this.tiddler.text.split('\n');
if (textArray.length > maxLine + 1)
textArray.splice(1,textArray.length-1-maxLine);
this.tiddler.text = textArray.join('\n');
}
// update tiddler fields
this.tiddler.modifier = config.options.txtUserName;
this.tiddler.modified = new Date();
store.addTiddler(this.tiddler);
// refresh and notifiy for immediate update
story.refreshTiddler(this.tiddler.title);
store.notify(this.tiddler.title, true);
};
bidix.UploadLog.prototype.startUpload = function(storeUrl, toFilename, uploadDir, backupDir) {
if (!this.tiddler)
return;
var now = new Date();
var text = "\n| ";
var filename = bidix.basename(document.location.toString());
if (!filename) filename = '/';
text += now.formatString("0DD/0MM/YYYY 0hh:0mm:0ss") +" | ";
text += config.options.txtUserName + " | ";
text += "[["+filename+"|"+location + "]] |";
text += " [[" + bidix.basename(storeUrl) + "|" + storeUrl + "]] | ";
text += uploadDir + " | ";
text += "[[" + bidix.basename(toFilename) + " | " +toFilename + "]] | ";
text += backupDir + " |";
this.addText(text);
};
bidix.UploadLog.prototype.endUpload = function(status) {
if (!this.tiddler)
return;
this.addText(" "+status+" |");
};
//
// Utilities
//
bidix.checkPlugin = function(plugin, major, minor, revision) {
var ext = version.extensions[plugin];
if (!
(ext &&
((ext.major > major) ||
((ext.major == major) && (ext.minor > minor)) ||
((ext.major == major) && (ext.minor == minor) && (ext.revision >= revision))))) {
// write error in PluginManager
if (pluginInfo)
pluginInfo.log.push("Requires " + plugin + " " + major + "." + minor + "." + revision);
eval(plugin); // generate an error : "Error: ReferenceError: xxxx is not defined"
}
};
bidix.dirname = function(filePath) {
if (!filePath)
return;
var lastpos;
if ((lastpos = filePath.lastIndexOf("/")) != -1) {
return filePath.substring(0, lastpos);
} else {
return filePath.substring(0, filePath.lastIndexOf("\\"));
}
};
bidix.basename = function(filePath) {
if (!filePath)
return;
var lastpos;
if ((lastpos = filePath.lastIndexOf("#")) != -1)
filePath = filePath.substring(0, lastpos);
if ((lastpos = filePath.lastIndexOf("/")) != -1) {
return filePath.substring(lastpos + 1);
} else
return filePath.substring(filePath.lastIndexOf("\\")+1);
};
bidix.initOption = function(name,value) {
if (!config.options[name])
config.options[name] = value;
};
//
// Initializations
//
// require PasswordOptionPlugin 1.0.1 or better
bidix.checkPlugin("PasswordOptionPlugin", 1, 0, 1);
// styleSheet
setStylesheet('.txtUploadStoreUrl, .txtUploadBackupDir, .txtUploadDir {width: 22em;}',"uploadPluginStyles");
//optionsDesc
merge(config.optionsDesc,{
txtUploadStoreUrl: "Url of the UploadService script (default: store.php)",
txtUploadFilename: "Filename of the uploaded file (default: in index.html)",
txtUploadDir: "Relative Directory where to store the file (default: . (downloadService directory))",
txtUploadBackupDir: "Relative Directory where to backup the file. If empty no backup. (default: ''(empty))",
txtUploadUserName: "Upload Username",
pasUploadPassword: "Upload Password",
chkUploadLog: "do Logging in UploadLog (default: true)",
txtUploadLogMaxLine: "Maximum of lines in UploadLog (default: 10)"
});
// Options Initializations
bidix.initOption('txtUploadStoreUrl','');
bidix.initOption('txtUploadFilename','');
bidix.initOption('txtUploadDir','');
bidix.initOption('txtUploadBackupDir','');
bidix.initOption('txtUploadUserName','');
bidix.initOption('pasUploadPassword','');
bidix.initOption('chkUploadLog',true);
bidix.initOption('txtUploadLogMaxLine','10');
// Backstage
merge(config.tasks,{
uploadOptions: {text: "upload", tooltip: "Change UploadOptions and Upload", content: '<<uploadOptions>>'}
});
config.backstageTasks.push("uploadOptions");
//}}}
/***
|''Name:''|UploadToHomeMacro|
|''Description:''|Save TiddlyWiki using HomeParameters tiddler|
|''Version:''|0.0.2|
|''Date:''|May 19, 2007|
|''Source:''|http://tiddlywiki.bidix.info/#UploadToHomeMacro|
|''Author:''|BidiX (BidiX (at) bidix (dot) info)|
|''License:''|[[BSD open source license|http://tiddlywiki.bidix.info/#%5B%5BBSD%20open%20source%20license%5D%5D ]]|
|''~CoreVersion:''|2.2.0 (#2125)|
|''Requires:''|UploadPlugin|
|''Usage:''|{{{<<uploadToHome [HomeParameters]>>}}}<br>{{{HomeParameters:}}} optional - Tiddler with upload parameters in slices (see HomeParameters).|
***/
//{{{
version.extensions.UploadToHomeMacro = {
major: 0, minor: 0, revision: 2,
date: new Date("May 19, 2007"),
source: 'http://tiddlywiki.bidix.info/#UploadToHomeMacro',
author: 'BidiX (BidiX (at) bidix (dot) info',
coreVersion: '2.2.0 (#3125)'
};
//
// Environment
//
if (!window.bidix) window.bidix = {}; // bidix namespace
bidix.debugMode = false; // true to activate both in Plugin and UploadService
bidix.checkPlugin("UploadPlugin", 4, 1, 0);
//
// uploadUsing Macro
//
config.macros.uploadToHome = {
handler: function(place,macroName,params) {
if (readOnly)
return;
var label;
if (document.location.toString().substr(0,4) == "http")
label = config.macros.upload.label.saveLabel;
else
label = config.macros.upload.label.uploadLabel;
var prompt;
var homeParams = (params[0] ? params[0]:this.messages.homeParamsTiddler);
if (store.tiddlerExists(homeParams) || store.isShadowTiddler(homeParams)) {
prompt = this.messages.prompt.toString().format([homeParams]);
} else {
throw(this.messages.tiddlerNotFound.toString().format([homeParams]));
}
var prompt = this.messages.prompt.toString().format([homeParams]);
createTiddlyButton(place, label, prompt, function() {config.macros.uploadToHome.action(homeParams);}, null, null, this.accessKey);
},
action: function(homeParams) {
homeParams = (homeParams ? homeParams : config.macros.uploadToHome.messages.homeParamsTiddler);
if (!store.tiddlerExists(homeParams) && !store.isShadowTiddler(homeParams)) {
throw(config.macros.uploadToHome.messages.tiddlerNotFound.toString().format([homeParams]));
}
config.macros.upload.action(config.macros.uploadToHome.getParamsFromTiddler(homeParams));
},
getParamsFromTiddler: function(tiddlerTitle) {
tiddlerTitle = (tiddlerTitle ? tiddlerTitle:this.messages.homeParamsTiddler);
if (!store.tiddlerExists(tiddlerTitle) && !store.isShadowTiddler(tiddlerTitle)) {
throw(config.macros.uploadToHome.messages.tiddlerNotFound.toString().format([tiddlerTitle]));
}
var sliceNames = [
"UploadStoreUrl",
"UploadFilename",
"UploadBackupDir",
"UploadDir",
"UploadUserName"
//"UploadPassword", // no password in tiddlers
];
var sliceValues = store.getTiddlerSlices(tiddlerTitle,sliceNames);
var parameters = [];
for(var i=0; i<sliceNames.length; i++) {
parameters.push(sliceValues[sliceNames[i]]);
}
return parameters;
},
messages: {
homeParamsTiddler: "HomeParameters",
prompt: "Save and Upload this TiddlyWiki using parameters in '%0' tiddler",
tiddlerNotFound: "Tiddler %0 not found"
},
initAtLoad: function () {
// install Shadowed HomeParameters
var storeUrl;
if ((document.location.toString().substr(0,4) == "http"))
storeUrl = bidix.dirname(document.location.toString())+'/'+config.macros.upload.defaultStoreScript;
else
storeUrl = config.macros.upload.defaultStoreScript;
var shadowedHomeParameters = (config.shadowTiddlers['HomeParameters']?config.shadowTiddlers['HomeParameters']:'');
shadowedHomeParameters += [
"|UploadUserName:|"+config.options['txtUploadUserName']+"|",
"|UploadStoreUrl:|"+storeUrl+"|",
"|UploadDir:|.|",
"|UploadFilename:|index.html|",
"|UploadBackupDir:||"
].join("\n");
merge(config.shadowTiddlers,{'HomeParameters': shadowedHomeParameters});
// install Backstage uploadToHome
merge(config.tasks,{
uploadToHome: {text: "uploadToHome", tooltip: "Upload using '" + this.messages.homeParamsTiddler + "' tiddler", action: this.action}
});
config.backstageTasks.push("uploadToHome");
}
};
config.macros.uploadToHome.initAtLoad();
//}}}
The use of chemicals that act as foaming agents and corrosion inhibitors have great utility in
gas wells with excessive water holdup. The underlying physical principles and measurable parameters include
dynamic interfacial tension, foaming ability, and corrosion inhibition.
* loops in time
* field operation hierarchy
* surveillance models
* data integration
* data mining
* client-server architecture
* user interfaces
* surveillance data management
* SQL server
* data acquistion and preparation tasks
The first of this process involves identifying the value of data ([[VOD]]). All the potential risks for the Mahogany wells were highlighted together with all possible surveillance tools that could be used to preven t risk occurrwence. A matrix was developed, as shown in Figure 5, to present this information.
[img[ValueOfDataMatrix.png]]
The colors represent the degree to which tool can help. The red circle is indicative of a tool being unable to afffect a particular risk, a yellow indicated some measure over improving the risk and the green has a big impact on preventing the risk from occurring.
For a packer fluid, NaBr is a more versatile fluid than CaBr2, which is significantly more versatile than CaCl2.
CaBr2 and NaBr brines promote stability of passive film.
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='references' macro="references"></div>
<div class='tagClear'></div>
<!--}}}-->
p2, c2:
For wax, the following are measured on a dead oil:
* normal parffin distribution using [[HTGC]]
* wax appearance temperature
* viscosity
* pour point
... indicate only an average corrosion rate over a period of time, while pitting or localized corrosion rates are often 10 to 50 times the "average" rates. Therefore, weight loss coupons are limited in their use as an indicator of the changed of corrosion due to production changes, inhibitor treatment, etc.
... These risks are then highlighted in the plot shown in Figure 3. This risk plot provides a quick visual method of capturing the major risks for the well.
[img[RiskManagementGraphRadar.png]]
This well risk management method plays an important part in defining the surveillance plan. One of the main challenges for conduting surveillance work is that there is no direct production gain as compared to conducting well work. What the well risk management offers is the ability to capture a legitimate reason for conducting surveillance work.
The authors would argue without using information a well cannot be considered intelligent based simply on installed equipment.
The process by which one uses data to identify values of the parameters of an emprirical or hydbrid model is referred to as learning. We call self-learning the process by which a system uses its past operating data to learn a related model. The term learning has been used extensively in conjunction with neural networks to denote their ability to "learn arbitrarily complex non-linear mappings from available data".
At tills point the question still remains, what to do to control corrosion?. The first thing to do is to install a corrosion monitoring device downstream of the choke to corroborate the measured corrosion rates with the theoretical ones: and if the corrosion rates are close to the predicted value or higher than 0.125 mm/yr (5 mpy) then the use of downhole injection of inhibitors should be considered. Since the flow velocities are well below 10 m/s, inhibitors could be used. ''Inhibitors may loose their protectiveness at velocities higher than 10 m/s, as observed by Duncan in the Khuff Gas field''. In the consideration of using inhibitors, an economical analysis has to be performed to compare their use against [[CRA]]s, tanking into consideration that to install downhole injection systems the completion will have to have either a flatpack or a sleeve (to inject inhibitor through the annular space through the sleeve to the tubing) located at a depth near the bubble point pressure.
/***
|''Name:''|YourSearchPlugin|
|''Version:''|2.1.3 (2008-04-16)|
|''Source:''|http://tiddlywiki.abego-software.de/#YourSearchPlugin|
|''Author:''|UdoBorkowski (ub [at] abego-software [dot] de)|
|''Licence:''|[[BSD open source license (abego Software)|http://www.abego-software.de/legal/apl-v10.html]]|
|''Copyright:''|© 2005-2008 [[abego Software|http://www.abego-software.de]]|
|''~CoreVersion:''|2.1.0|
|''Community:''|[[del.icio.us|http://del.icio.us/post?url=http://tiddlywiki.abego-software.de/index.html%23YourSearchPlugin]]|
|''Browser:''|Firefox 1.0.4+; Firefox 1.5; ~InternetExplorer 6.0|
!About YourSearch
YourSearch gives you a bunch of new features to simplify and speed up your daily searches in TiddlyWiki. It seamlessly integrates into the standard TiddlyWiki search: just start typing into the 'search' field and explore!
For more information see [[Help|YourSearch Help]].
!Compatibility
This plugin requires TiddlyWiki 2.1.
Check the [[archive|http://tiddlywiki.abego-software.de/archive]] for ~YourSearchPlugins supporting older versions of TiddlyWiki.
!Source Code
***/
/***
This plugin's source code is compressed (and hidden). Use this [[link|http://tiddlywiki.abego-software.de/archive/YourSearchPlugin/Plugin-YourSearch-src.2.1.3.js]] to get the readable source code.
***/
///%
if(!version.extensions.YourSearchPlugin){version.extensions.YourSearchPlugin={major:2,minor:1,revision:3,source:"http://tiddlywiki.abego-software.de/#YourSearchPlugin",licence:"[[BSD open source license (abego Software)|http://www.abego-software.de/legal/apl-v10.html]]",copyright:"Copyright (c) abego Software GmbH, 2005-2008 (www.abego-software.de)"};if(!window.abego){window.abego={};}
if(!Array.forEach){Array.forEach=function(_1,_2,_3){for(var i=0,len=_1.length;i<len;i++){_2.call(_3,_1[i],i,_1);}};Array.prototype.forEach=function(_5,_6){for(var i=0,len=this.length;i<len;i++){_5.call(_6,this[i],i,this);}};}
abego.toInt=function(s,_9){if(!s){return _9;}
var n=parseInt(s);return(n==NaN)?_9:n;};abego.createEllipsis=function(_b){var e=createTiddlyElement(_b,"span");e.innerHTML="…";};abego.shallowCopy=function(_d){if(!_d){return _d;}
var _e={};for(var n in _d){_e[n]=_d[n];}
return _e;};abego.copyOptions=function(_10){return!_10?{}:abego.shallowCopy(_10);};abego.countStrings=function(_11,s){if(!s){return 0;}
var len=s.length;var n=0;var _15=0;while(1){var i=_11.indexOf(s,_15);if(i<0){return n;}
n++;_15=i+len;}
return n;};abego.getBracedText=function(_17,_18,_19){if(!_18){_18=0;}
var re=/\{([^\}]*)\}/gm;re.lastIndex=_18;var m=re.exec(_17);if(m){var s=m[1];var _1d=abego.countStrings(s,"{");if(!_1d){if(_19){_19.lastIndex=re.lastIndex;}
return s;}
var len=_17.length;for(var i=re.lastIndex;i<len&&_1d;i++){var c=_17.charAt(i);if(c=="{"){_1d++;}else{if(c=="}"){_1d--;}}}
if(!_1d){if(_19){_19.lastIndex=i-1;}
return _17.substring(m.index+1,i-1);}}};abego.select=function(_21,_22,_23,_24){if(!_24){_24=[];}
_21.forEach(function(t){if(_22.call(_23,t)){_24.push(t);}});return _24;};abego.consumeEvent=function(e){if(e.stopPropagation){e.stopPropagation();}
if(e.preventDefault){e.preventDefault();}
e.cancelBubble=true;e.returnValue=true;};abego.TiddlerFilterTerm=function(_27,_28){if(!_28){_28={};}
var _29=_27;if(!_28.textIsRegExp){_29=_27.escapeRegExp();if(_28.fullWordMatch){_29="\\b"+_29+"\\b";}}
var _2a=new RegExp(_29,"m"+(_28.caseSensitive?"":"i"));this.tester=new abego.MultiFieldRegExpTester(_2a,_28.fields,_28.withExtendedFields);};abego.TiddlerFilterTerm.prototype.test=function(_2b){return this.tester.test(_2b);};abego.parseNewTiddlerCommandLine=function(s){var m=/(.*?)\.(?:\s+|$)([^#]*)(#.*)?/.exec(s);if(!m){m=/([^#]*)()(#.*)?/.exec(s);}
if(m){var r;if(m[3]){var s2=m[3].replace(/#/g,"");r=s2.parseParams("tag");}else{r=[[]];}
var _30=m[2]?m[2].trim():"";r.push({name:"text",value:_30});r[0].text=[_30];return{title:m[1].trim(),params:r};}else{return{title:s.trim(),params:[[]]};}};abego.parseTiddlerFilterTerm=function(_31,_32,_33){var re=/\s*(?:(?:\{([^\}]*)\})|(?:(=)|([#%!])|(?:(\w+)\s*\:(?!\/\/))|(?:(?:("(?:(?:\\")|[^"])+")|(?:\/((?:(?:\\\/)|[^\/])+)\/)|(\w+\:\/\/[^\s]+)|([^\s\)\-\"]+)))))/mg;var _35={"!":"title","%":"text","#":"tags"};var _36={};var _37;re.lastIndex=_32;while(1){var i=re.lastIndex;var m=re.exec(_31);if(!m||m.index!=i){throw"Word or String literal expected";}
if(m[1]){var _3a={};var _3b=abego.getBracedText(_31,0,_3a);if(!_3b){throw"Invalid {...} syntax";}
var f=Function("tiddler","return ("+_3b+");");return{func:f,lastIndex:_3a.lastIndex,markRE:null};}
if(m[2]){_37=true;}else{if(m[3]){_36[_35[m[3]]]=1;}else{if(m[4]){_36[m[4]]=1;}else{var _3d=m[6];var _3e=m[5]?window.eval(m[5]):m[6]?m[6]:m[7]?m[7]:m[8];var _33=abego.copyOptions(_33);_33.fullWordMatch=_37;_33.textIsRegExp=_3d;var _3f=[];for(var n in _36){_3f.push(n);}
if(_3f.length==0){_33.fields=_33.defaultFields;}else{_33.fields=_3f;_33.withExtendedFields=false;}
var _41=new abego.TiddlerFilterTerm(_3e,_33);var _42=_3d?_3e:_3e.escapeRegExp();if(_42&&_37){_42="\\b"+_42+"\\b";}
return{func:function(_43){return _41.test(_43);},lastIndex:re.lastIndex,markRE:_42?"(?:"+_42+")":null};}}}}};abego.BoolExp=function(s,_45,_46){this.s=s;var _47=_46&&_46.defaultOperationIs_OR;var _48=/\s*(?:(\-|not)|(\())/gi;var _49=/\s*\)/g;var _4a=/\s*(?:(and|\&\&)|(or|\|\|))/gi;var _4b=/\s*[^\)\s]/g;var _4c=/\s*(\-|not)?(\s*\()?/gi;var _4d;var _4e=function(_4f){_4c.lastIndex=_4f;var m=_4c.exec(s);var _51;var _52;if(m&&m.index==_4f){_4f+=m[0].length;_51=m[1];if(m[2]){var e=_4d(_4f);_49.lastIndex=e.lastIndex;if(!_49.exec(s)){throw"Missing ')'";}
_52={func:e.func,lastIndex:_49.lastIndex,markRE:e.markRE};}}
if(!_52){_52=_45(s,_4f,_46);}
if(_51){_52.func=(function(f){return function(_55){return!f(_55);};})(_52.func);_52.markRE=null;}
return _52;};_4d=function(_56){var _57=_4e(_56);while(1){var l=_57.lastIndex;_4a.lastIndex=l;var m=_4a.exec(s);var _5a;var _5b;if(m&&m.index==l){_5a=!m[1];_5b=_4e(_4a.lastIndex);}else{try{_5b=_4e(l);}
catch(e){return _57;}
_5a=_47;}
_57.func=(function(_5c,_5d,_5e){return _5e?function(_5f){return _5c(_5f)||_5d(_5f);}:function(_60){return _5c(_60)&&_5d(_60);};})(_57.func,_5b.func,_5a);_57.lastIndex=_5b.lastIndex;if(!_57.markRE){_57.markRE=_5b.markRE;}else{if(_5b.markRE){_57.markRE=_57.markRE+"|"+_5b.markRE;}}}};var _61=_4d(0);this.evalFunc=_61.func;if(_61.markRE){this.markRegExp=new RegExp(_61.markRE,_46.caseSensitive?"mg":"img");}};abego.BoolExp.prototype.exec=function(){return this.evalFunc.apply(this,arguments);};abego.BoolExp.prototype.getMarkRegExp=function(){return this.markRegExp;};abego.BoolExp.prototype.toString=function(){return this.s;};abego.MultiFieldRegExpTester=function(re,_63,_64){this.re=re;this.fields=_63?_63:["title","text","tags"];this.withExtendedFields=_64;};abego.MultiFieldRegExpTester.prototype.test=function(_65){var re=this.re;for(var i=0;i<this.fields.length;i++){var s=store.getValue(_65,this.fields[i]);if(typeof s=="string"&&re.test(s)){return this.fields[i];}}
if(this.withExtendedFields){return store.forEachField(_65,function(_69,_6a,_6b){return typeof _6b=="string"&&re.test(_6b)?_6a:null;},true);}
return null;};abego.TiddlerQuery=function(_6c,_6d,_6e,_6f,_70){if(_6e){this.regExp=new RegExp(_6c,_6d?"mg":"img");this.tester=new abego.MultiFieldRegExpTester(this.regExp,_6f,_70);}else{this.expr=new abego.BoolExp(_6c,abego.parseTiddlerFilterTerm,{defaultFields:_6f,caseSensitive:_6d,withExtendedFields:_70});}
this.getQueryText=function(){return _6c;};this.getUseRegExp=function(){return _6e;};this.getCaseSensitive=function(){return _6d;};this.getDefaultFields=function(){return _6f;};this.getWithExtendedFields=function(){return _70;};};abego.TiddlerQuery.prototype.test=function(_71){if(!_71){return false;}
if(this.regExp){return this.tester.test(_71);}
return this.expr.exec(_71);};abego.TiddlerQuery.prototype.filter=function(_72){return abego.select(_72,this.test,this);};abego.TiddlerQuery.prototype.getMarkRegExp=function(){if(this.regExp){return"".search(this.regExp)>=0?null:this.regExp;}
return this.expr.getMarkRegExp();};abego.TiddlerQuery.prototype.toString=function(){return(this.regExp?this.regExp:this.expr).toString();};abego.PageWiseRenderer=function(){this.firstIndexOnPage=0;};merge(abego.PageWiseRenderer.prototype,{setItems:function(_73){this.items=_73;this.setFirstIndexOnPage(0);},getMaxPagesInNavigation:function(){return 10;},getItemsCount:function(_74){return this.items?this.items.length:0;},getCurrentPageIndex:function(){return Math.floor(this.firstIndexOnPage/this.getItemsPerPage());},getLastPageIndex:function(){return Math.floor((this.getItemsCount()-1)/this.getItemsPerPage());},setFirstIndexOnPage:function(_75){this.firstIndexOnPage=Math.min(Math.max(0,_75),this.getItemsCount()-1);},getFirstIndexOnPage:function(){this.firstIndexOnPage=Math.floor(this.firstIndexOnPage/this.getItemsPerPage())*this.getItemsPerPage();return this.firstIndexOnPage;},getLastIndexOnPage:function(){return Math.min(this.getFirstIndexOnPage()+this.getItemsPerPage()-1,this.getItemsCount()-1);},onPageChanged:function(_76,_77){},renderPage:function(_78){if(_78.beginRendering){_78.beginRendering(this);}
try{if(this.getItemsCount()){var _79=this.getLastIndexOnPage();var _7a=-1;for(var i=this.getFirstIndexOnPage();i<=_79;i++){_7a++;_78.render(this,this.items[i],i,_7a);}}}
finally{if(_78.endRendering){_78.endRendering(this);}}},addPageNavigation:function(_7c){if(!this.getItemsCount()){return;}
var _7d=this;var _7e=function(e){if(!e){var e=window.event;}
abego.consumeEvent(e);var _80=abego.toInt(this.getAttribute("page"),0);var _81=_7d.getCurrentPageIndex();if(_80==_81){return;}
var _82=_80*_7d.getItemsPerPage();_7d.setFirstIndexOnPage(_82);_7d.onPageChanged(_80,_81);};var _83;var _84=this.getCurrentPageIndex();var _85=this.getLastPageIndex();if(_84>0){_83=createTiddlyButton(_7c,"Previous","Go to previous page (Shortcut: Alt-'<')",_7e,"prev");_83.setAttribute("page",(_84-1).toString());_83.setAttribute("accessKey","<");}
for(var i=-this.getMaxPagesInNavigation();i<this.getMaxPagesInNavigation();i++){var _87=_84+i;if(_87<0){continue;}
if(_87>_85){break;}
var _88=(i+_84+1).toString();var _89=_87==_84?"currentPage":"otherPage";_83=createTiddlyButton(_7c,_88,"Go to page %0".format([_88]),_7e,_89);_83.setAttribute("page",(_87).toString());}
if(_84<_85){_83=createTiddlyButton(_7c,"Next","Go to next page (Shortcut: Alt-'>')",_7e,"next");_83.setAttribute("page",(_84+1).toString());_83.setAttribute("accessKey",">");}}});abego.LimitedTextRenderer=function(){var _8a=40;var _8b=4;var _8c=function(_8d,_8e,_8f){var n=_8d.length;if(n==0){_8d.push({start:_8e,end:_8f});return;}
var i=0;for(;i<n;i++){var _92=_8d[i];if(_92.start<=_8f&&_8e<=_92.end){var r;var _94=i+1;for(;_94<n;_94++){r=_8d[_94];if(r.start>_8f||_8e>_92.end){break;}}
var _95=_8e;var _96=_8f;for(var j=i;j<_94;j++){r=_8d[j];_95=Math.min(_95,r.start);_96=Math.max(_96,r.end);}
_8d.splice(i,_94-i,{start:_95,end:_96});return;}
if(_92.start>_8f){break;}}
_8d.splice(i,0,{start:_8e,end:_8f});};var _98=function(_99){var _9a=0;for(var i=0;i<_99.length;i++){var _9c=_99[i];_9a+=_9c.end-_9c.start;}
return _9a;};var _9d=function(c){return(c>="a"&&c<="z")||(c>="A"&&c<="Z")||c=="_";};var _9f=function(s,_a1){if(!_9d(s[_a1])){return null;}
for(var i=_a1-1;i>=0&&_9d(s[i]);i--){}
var _a3=i+1;var n=s.length;for(i=_a1+1;i<n&&_9d(s[i]);i++){}
return{start:_a3,end:i};};var _a5=function(s,_a7,_a8){var _a9;if(_a8){_a9=_9f(s,_a7);}else{if(_a7<=0){return _a7;}
_a9=_9f(s,_a7-1);}
if(!_a9){return _a7;}
if(_a8){if(_a9.start>=_a7-_8b){return _a9.start;}
if(_a9.end<=_a7+_8b){return _a9.end;}}else{if(_a9.end<=_a7+_8b){return _a9.end;}
if(_a9.start>=_a7-_8b){return _a9.start;}}
return _a7;};var _aa=function(s,_ac){var _ad=[];if(_ac){var _ae=0;var n=s.length;var _b0=0;do{_ac.lastIndex=_ae;var _b1=_ac.exec(s);if(_b1){if(_ae<_b1.index){var t=s.substring(_ae,_b1.index);_ad.push({text:t});}
_ad.push({text:_b1[0],isMatch:true});_ae=_b1.index+_b1[0].length;}else{_ad.push({text:s.substr(_ae)});break;}}while(true);}else{_ad.push({text:s});}
return _ad;};var _b3=function(_b4){var _b5=0;for(var i=0;i<_b4.length;i++){if(_b4[i].isMatch){_b5++;}}
return _b5;};var _b7=function(s,_b9,_ba,_bb,_bc){var _bd=Math.max(Math.floor(_bc/(_bb+1)),_8a);var _be=Math.max(_bd-(_ba-_b9),0);var _bf=Math.min(Math.floor(_ba+_be/3),s.length);var _c0=Math.max(_bf-_bd,0);_c0=_a5(s,_c0,true);_bf=_a5(s,_bf,false);return{start:_c0,end:_bf};};var _c1=function(_c2,s,_c4){var _c5=[];var _c6=_b3(_c2);var pos=0;for(var i=0;i<_c2.length;i++){var t=_c2[i];var _ca=t.text;if(t.isMatch){var _cb=_b7(s,pos,pos+_ca.length,_c6,_c4);_8c(_c5,_cb.start,_cb.end);}
pos+=_ca.length;}
return _c5;};var _cc=function(s,_ce,_cf){var _d0=_cf-_98(_ce);while(_d0>0){if(_ce.length==0){_8c(_ce,0,_a5(s,_cf,false));return;}else{var _d1=_ce[0];var _d2;var _d3;if(_d1.start==0){_d2=_d1.end;if(_ce.length>1){_d3=_ce[1].start;}else{_8c(_ce,_d2,_a5(s,_d2+_d0,false));return;}}else{_d2=0;_d3=_d1.start;}
var _d4=Math.min(_d3,_d2+_d0);_8c(_ce,_d2,_d4);_d0-=(_d4-_d2);}}};var _d5=function(_d6,s,_d8,_d9,_da){if(_d9.length==0){return;}
var _db=function(_dc,s,_de,_df,_e0){var t;var _e2;var pos=0;var i=0;var _e5=0;for(;i<_de.length;i++){t=_de[i];_e2=t.text;if(_df<pos+_e2.length){_e5=_df-pos;break;}
pos+=_e2.length;}
var _e6=_e0-_df;for(;i<_de.length&&_e6>0;i++){t=_de[i];_e2=t.text.substr(_e5);_e5=0;if(_e2.length>_e6){_e2=_e2.substr(0,_e6);}
if(t.isMatch){createTiddlyElement(_dc,"span",null,"marked",_e2);}else{createTiddlyText(_dc,_e2);}
_e6-=_e2.length;}
if(_e0<s.length){abego.createEllipsis(_dc);}};if(_d9[0].start>0){abego.createEllipsis(_d6);}
var _e7=_da;for(var i=0;i<_d9.length&&_e7>0;i++){var _e9=_d9[i];var len=Math.min(_e9.end-_e9.start,_e7);_db(_d6,s,_d8,_e9.start,_e9.start+len);_e7-=len;}};this.render=function(_eb,s,_ed,_ee){if(s.length<_ed){_ed=s.length;}
var _ef=_aa(s,_ee);var _f0=_c1(_ef,s,_ed);_cc(s,_f0,_ed);_d5(_eb,s,_ef,_f0,_ed);};};(function(){function alertAndThrow(msg){alert(msg);throw msg;}
if(version.major<2||(version.major==2&&version.minor<1)){alertAndThrow("YourSearchPlugin requires TiddlyWiki 2.1 or newer.\n\nCheck the archive for YourSearch plugins\nsupporting older versions of TiddlyWiki.\n\nArchive: http://tiddlywiki.abego-software.de/archive");}
abego.YourSearch={};var _f2;var _f3;var _f4=function(_f5){_f2=_f5;};var _f6=function(){return _f2?_f2:[];};var _f7=function(){return _f2?_f2.length:0;};var _f8=4;var _f9=10;var _fa=2;var _fb=function(s,re){var m=s.match(re);return m?m.length:0;};var _ff=function(_100,_101){var _102=_101.getMarkRegExp();if(!_102){return 1;}
var _103=_100.title.match(_102);var _104=_103?_103.length:0;var _105=_fb(_100.getTags(),_102);var _106=_103?_103.join("").length:0;var _107=_100.title.length>0?_106/_100.title.length:0;var rank=_104*_f8+_105*_fa+_107*_f9+1;return rank;};var _109=function(_10a,_10b,_10c,_10d,_10e,_10f){_f3=null;var _110=_10a.reverseLookup("tags",_10f,false);try{var _111=[];if(config.options.chkSearchInTitle){_111.push("title");}
if(config.options.chkSearchInText){_111.push("text");}
if(config.options.chkSearchInTags){_111.push("tags");}
_f3=new abego.TiddlerQuery(_10b,_10c,_10d,_111,config.options.chkSearchExtendedFields);}
catch(e){return[];}
var _112=_f3.filter(_110);var _113=abego.YourSearch.getRankFunction();for(var i=0;i<_112.length;i++){var _115=_112[i];var rank=_113(_115,_f3);_115.searchRank=rank;}
if(!_10e){_10e="title";}
var _117=function(a,b){var _11a=a.searchRank-b.searchRank;if(_11a==0){if(a[_10e]==b[_10e]){return(0);}else{return(a[_10e]<b[_10e])?-1:+1;}}else{return(_11a>0)?-1:+1;}};_112.sort(_117);return _112;};var _11b=80;var _11c=50;var _11d=250;var _11e=50;var _11f=25;var _120=10;var _121="yourSearchResult";var _122="yourSearchResultItems";var _123;var _124;var _125;var _126;var _127;var _128=function(){if(version.extensions.YourSearchPlugin.styleSheetInited){return;}
version.extensions.YourSearchPlugin.styleSheetInited=true;setStylesheet(store.getTiddlerText("YourSearchStyleSheet"),"yourSearch");};var _129=function(){return _124!=null&&_124.parentNode==document.body;};var _12a=function(){if(_129()){document.body.removeChild(_124);}};var _12b=function(e){_12a();var _12d=this.getAttribute("tiddlyLink");if(_12d){var _12e=this.getAttribute("withHilite");var _12f=highlightHack;if(_12e&&_12e=="true"&&_f3){highlightHack=_f3.getMarkRegExp();}
story.displayTiddler(this,_12d);highlightHack=_12f;}
return(false);};var _130=function(){if(!_125){return;}
var root=_125;var _132=findPosX(root);var _133=findPosY(root);var _134=root.offsetHeight;var _135=_132;var _136=_133+_134;var _137=findWindowWidth();if(_137<_124.offsetWidth){_124.style.width=(_137-100)+"px";_137=findWindowWidth();}
var _138=_124.offsetWidth;if(_135+_138>_137){_135=_137-_138-30;}
if(_135<0){_135=0;}
_124.style.left=_135+"px";_124.style.top=_136+"px";_124.style.display="block";};var _139=function(){if(_124){window.scrollTo(0,ensureVisible(_124));}
if(_125){window.scrollTo(0,ensureVisible(_125));}};var _13a=function(){_130();_139();};var _13b;var _13c;var _13d=new abego.PageWiseRenderer();var _13e=function(_13f){this.itemHtml=store.getTiddlerText("YourSearchItemTemplate");if(!this.itemHtml){alertAndThrow("YourSearchItemTemplate not found");}
this.place=document.getElementById(_122);if(!this.place){this.place=createTiddlyElement(_13f,"div",_122);}};merge(_13e.prototype,{render:function(_140,_141,_142,_143){_13b=_143;_13c=_141;var item=createTiddlyElement(this.place,"div",null,"yourSearchItem");item.innerHTML=this.itemHtml;applyHtmlMacros(item,null);refreshElements(item,null);},endRendering:function(_145){_13c=null;}});var _146=function(){if(!_124||!_125){return;}
var html=store.getTiddlerText("YourSearchResultTemplate");if(!html){html="<b>Tiddler YourSearchResultTemplate not found</b>";}
_124.innerHTML=html;applyHtmlMacros(_124,null);refreshElements(_124,null);var _148=new _13e(_124);_13d.renderPage(_148);_13a();};_13d.getItemsPerPage=function(){var n=(config.options.chkPreviewText)?abego.toInt(config.options.txtItemsPerPageWithPreview,_120):abego.toInt(config.options.txtItemsPerPage,_11f);return(n>0)?n:1;};_13d.onPageChanged=function(){_146();};var _14a=function(){if(_125==null||!config.options.chkUseYourSearch){return;}
if((_125.value==_123)&&_123&&!_129()){if(_124&&(_124.parentNode!=document.body)){document.body.appendChild(_124);_13a();}else{abego.YourSearch.onShowResult(true);}}};var _14b=function(){_12a();_124=null;_123=null;};var _14c=function(self,e){while(e!=null){if(self==e){return true;}
e=e.parentNode;}
return false;};var _14f=function(e){if(e.target==_125){return;}
if(e.target==_126){return;}
if(_124&&_14c(_124,e.target)){return;}
_12a();};var _151=function(e){if(e.keyCode==27){_12a();}};addEvent(document,"click",_14f);addEvent(document,"keyup",_151);var _153=function(text,_155,_156){_123=text;_f4(_109(store,text,_155,_156,"title","excludeSearch"));abego.YourSearch.onShowResult();};var _157=function(_158,_159,_15a,_15b,_15c,_15d){_128();_123="";var _15e=null;var _15f=function(txt){if(config.options.chkUseYourSearch){_153(txt.value,config.options.chkCaseSensitiveSearch,config.options.chkRegExpSearch);}else{story.search(txt.value,config.options.chkCaseSensitiveSearch,config.options.chkRegExpSearch);}
_123=txt.value;};var _161=function(e){_15f(_125);return false;};var _163=function(e){if(!e){var e=window.event;}
_125=this;switch(e.keyCode){case 13:if(e.ctrlKey&&_127&&_129()){_127.onclick.apply(_127,[e]);}else{_15f(this);}
break;case 27:if(_129()){_12a();}else{this.value="";clearMessage();}
break;}
if(String.fromCharCode(e.keyCode)==this.accessKey||e.altKey){_14a();}
if(this.value.length<3&&_15e){clearTimeout(_15e);}
if(this.value.length>2){if(this.value!=_123){if(!config.options.chkUseYourSearch||config.options.chkSearchAsYouType){if(_15e){clearTimeout(_15e);}
var txt=this;_15e=setTimeout(function(){_15f(txt);},500);}}else{if(_15e){clearTimeout(_15e);}}}
if(this.value.length==0){_12a();}};var _166=function(e){this.select();clearMessage();_14a();};var args=_15c.parseParams("list",null,true);var _169=getFlag(args,"buttonAtRight");var _16a=getParam(args,"sizeTextbox",this.sizeTextbox);var btn;if(!_169){btn=createTiddlyButton(_158,this.label,this.prompt,_161);}
var txt=createTiddlyElement(_158,"input",null,null,null);if(_15a[0]){txt.value=_15a[0];}
txt.onkeyup=_163;txt.onfocus=_166;txt.setAttribute("size",_16a);txt.setAttribute("accessKey",this.accessKey);txt.setAttribute("autocomplete","off");if(config.browser.isSafari){txt.setAttribute("type","search");txt.setAttribute("results","5");}else{txt.setAttribute("type","text");}
if(_169){btn=createTiddlyButton(_158,this.label,this.prompt,_161);}
_125=txt;_126=btn;};var _16d=function(){_12a();var _16e=_f6();var n=_16e.length;if(n){var _170=[];for(var i=0;i<n;i++){_170.push(_16e[i].title);}
story.displayTiddlers(null,_170);}};var _172=function(_173,_174,_175,_176){invokeMacro(_173,"option",_174,_175,_176);var elem=_173.lastChild;var _178=elem.onclick;elem.onclick=function(e){var _17a=_178.apply(this,arguments);_146();return _17a;};return elem;};var _17b=function(s){var _17d=["''","{{{","}}}","//","<<<","/***","***/"];var _17e="";for(var i=0;i<_17d.length;i++){if(i!=0){_17e+="|";}
_17e+="("+_17d[i].escapeRegExp()+")";}
return s.replace(new RegExp(_17e,"mg"),"").trim();};var _180=function(){var i=_13b;return(i>=0&&i<=9)?(i<9?(i+1):0):-1;};var _182=new abego.LimitedTextRenderer();var _183=function(_184,s,_186){_182.render(_184,s,_186,_f3.getMarkRegExp());};var _187=TiddlyWiki.prototype.saveTiddler;TiddlyWiki.prototype.saveTiddler=function(_188,_189,_18a,_18b,_18c,tags,_18e){_187.apply(this,arguments);_14b();};var _18f=TiddlyWiki.prototype.removeTiddler;TiddlyWiki.prototype.removeTiddler=function(_190){_18f.apply(this,arguments);_14b();};config.macros.yourSearch={label:"yourSearch",prompt:"Gives access to the current/last YourSearch result",handler:function(_191,_192,_193,_194,_195,_196){if(_193.length==0){return;}
var name=_193[0];var func=config.macros.yourSearch.funcs[name];if(func){func(_191,_192,_193,_194,_195,_196);}},tests:{"true":function(){return true;},"false":function(){return false;},"found":function(){return _f7()>0;},"previewText":function(){return config.options.chkPreviewText;}},funcs:{itemRange:function(_199){if(_f7()){var _19a=_13d.getLastIndexOnPage();var s="%0 - %1".format([_13d.getFirstIndexOnPage()+1,_19a+1]);createTiddlyText(_199,s);}},count:function(_19c){createTiddlyText(_19c,_f7().toString());},query:function(_19d){if(_f3){createTiddlyText(_19d,_f3.toString());}},version:function(_19e){var t="YourSearch %0.%1.%2".format([version.extensions.YourSearchPlugin.major,version.extensions.YourSearchPlugin.minor,version.extensions.YourSearchPlugin.revision]);var e=createTiddlyElement(_19e,"a");e.setAttribute("href","http://tiddlywiki.abego-software.de/#YourSearchPlugin");e.innerHTML="<font color=\"black\" face=\"Arial, Helvetica, sans-serif\">"+t+"<font>";},copyright:function(_1a1){var e=createTiddlyElement(_1a1,"a");e.setAttribute("href","http://www.abego-software.de");e.innerHTML="<font color=\"black\" face=\"Arial, Helvetica, sans-serif\">© 2005-2008 <b><font color=\"red\">abego</font></b> Software<font>";},newTiddlerButton:function(_1a3){if(_f3){var r=abego.parseNewTiddlerCommandLine(_f3.getQueryText());var btn=config.macros.newTiddler.createNewTiddlerButton(_1a3,r.title,r.params,"new tiddler","Create a new tiddler based on search text. (Shortcut: Ctrl-Enter; Separators: '.', '#')",null,"text");var _1a6=btn.onclick;btn.onclick=function(){_12a();_1a6.apply(this,arguments);};_127=btn;}},linkButton:function(_1a7,_1a8,_1a9,_1aa,_1ab,_1ac){if(_1a9<2){return;}
var _1ad=_1a9[1];var text=_1a9<3?_1ad:_1a9[2];var _1af=_1a9<4?text:_1a9[3];var _1b0=_1a9<5?null:_1a9[4];var btn=createTiddlyButton(_1a7,text,_1af,_12b,null,null,_1b0);btn.setAttribute("tiddlyLink",_1ad);},closeButton:function(_1b2,_1b3,_1b4,_1b5,_1b6,_1b7){var _1b8=createTiddlyButton(_1b2,"close","Close the Search Results (Shortcut: ESC)",_12a);},openAllButton:function(_1b9,_1ba,_1bb,_1bc,_1bd,_1be){var n=_f7();if(n==0){return;}
var _1c0=n==1?"open tiddler":"open all %0 tiddlers".format([n]);var _1c1=createTiddlyButton(_1b9,_1c0,"Open all found tiddlers (Shortcut: Alt-O)",_16d);_1c1.setAttribute("accessKey","O");},naviBar:function(_1c2,_1c3,_1c4,_1c5,_1c6,_1c7){_13d.addPageNavigation(_1c2);},"if":function(_1c8,_1c9,_1ca,_1cb,_1cc,_1cd){if(_1ca.length<2){return;}
var _1ce=_1ca[1];var _1cf=(_1ce=="not");if(_1cf){if(_1ca.length<3){return;}
_1ce=_1ca[2];}
var test=config.macros.yourSearch.tests[_1ce];var _1d1=false;try{if(test){_1d1=test(_1c8,_1c9,_1ca,_1cb,_1cc,_1cd)!=_1cf;}else{_1d1=(!eval(_1ce))==_1cf;}}
catch(ex){}
if(!_1d1){_1c8.style.display="none";}},chkPreviewText:function(_1d2,_1d3,_1d4,_1d5,_1d6,_1d7){var _1d8=_1d4.slice(1).join(" ");var elem=_172(_1d2,"chkPreviewText",_1d5,_1d7);elem.setAttribute("accessKey","P");elem.title="Show text preview of found tiddlers (Shortcut: Alt-P)";return elem;}}};config.macros.foundTiddler={label:"foundTiddler",prompt:"Provides information on the tiddler currently processed on the YourSearch result page",handler:function(_1da,_1db,_1dc,_1dd,_1de,_1df){var name=_1dc[0];var func=config.macros.foundTiddler.funcs[name];if(func){func(_1da,_1db,_1dc,_1dd,_1de,_1df);}},funcs:{title:function(_1e2,_1e3,_1e4,_1e5,_1e6,_1e7){if(!_13c){return;}
var _1e8=_180();var _1e9=_1e8>=0?"Open tiddler (Shortcut: Alt-%0)".format([_1e8.toString()]):"Open tiddler";var btn=createTiddlyButton(_1e2,null,_1e9,_12b,null);btn.setAttribute("tiddlyLink",_13c.title);btn.setAttribute("withHilite","true");_183(btn,_13c.title,_11b);if(_1e8>=0){btn.setAttribute("accessKey",_1e8.toString());}},tags:function(_1eb,_1ec,_1ed,_1ee,_1ef,_1f0){if(!_13c){return;}
_183(_1eb,_13c.getTags(),_11c);},text:function(_1f1,_1f2,_1f3,_1f4,_1f5,_1f6){if(!_13c){return;}
_183(_1f1,_17b(_13c.text),_11d);},field:function(_1f7,_1f8,_1f9,_1fa,_1fb,_1fc){if(!_13c){return;}
var name=_1f9[1];var len=_1f9.length>2?abego.toInt(_1f9[2],_11e):_11e;var v=store.getValue(_13c,name);if(v){_183(_1f7,_17b(v),len);}},number:function(_200,_201,_202,_203,_204,_205){var _206=_180();if(_206>=0){var text="%0)".format([_206.toString()]);createTiddlyElement(_200,"spa