課件pscad包學(xué)習(xí)筆記2substitutions_第1頁
課件pscad包學(xué)習(xí)筆記2substitutions_第2頁
課件pscad包學(xué)習(xí)筆記2substitutions_第3頁
課件pscad包學(xué)習(xí)筆記2substitutions_第4頁
課件pscad包學(xué)習(xí)筆記2substitutions_第5頁
已閱讀5頁,還剩14頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、Substitutions替換Substitutions are a fundamental element of component designt canappear in provide a sections,all parts of a Component Definition.Substitutions n Definitionmeans bringto communicate information beta dynamic aspect to component graphics, and help informatting code in PSCAD are asand Com

2、ments. listed below:The substitution operators available替換符是組件設(shè)計(jì)的基本元素,可以出現(xiàn)在組件定義的所有部分。替換符提供了各定義部分的信息交流途徑,給組件圖形帶來動態(tài)性,幫助規(guī)范代碼和注 釋。PSCAD 中有效的替換法如下:Value Substitution Prefix: $ Data Substitution Prefix: %Bra: Comment Operator: !值替換符 $數(shù)據(jù)替換符括號注釋符!$Value Substitution Prefix OperatorThe $ Value Substitution P

3、refix Operator (or simply $) is the mostimportant component characterof the substitution operators, and is used quite heavily indesign.The string, where$ operator is normally appended to athe string may represent a numerical value,or even other text, the evaluation pros been defined at Regardless of

4、 whatsome previous poins.the character string place of the string,represents, its value will be substituted in whenever a $ symbol prefixed to it.值替換前綴 ¥$值替換前綴是最重要的替換操作符,在組件設(shè)計(jì)中多次使用。值替換符加在字符串前,其中字符串代表一個(gè)數(shù)值,它的值將用字符串代替,只要加上前綴$。There are numerousways in which the $ operator may bele, the actual data valu

5、e entered by a userutilized.For exoan Input Field may prefixing $ to thebe substitutedo a Fortran sement bySymbol of the field.有多重方法使用$操作符。比如在輸入域中鍵入的實(shí)際值在 Fortran 片段中使用Symbol 名加前綴$代替。NOTE:The value substituted is the valueerms of the defaultunit specified entered value ishe Input Field properties dia

6、log.If the actualentered in another unit, then this value will beprosed, before substitution takes place.See the Unit System for more details on units.注意:替換后的值使用輸入域中指定的默認(rèn)。如果實(shí)際鍵入的值是另外一個(gè),在替換前要先進(jìn)性轉(zhuǎn)換。詳見 Unit System。Another ex another.Graphic is ensuresle is his used inthe substitution of a one variable

7、name bycase, a Connection definedhe componentby a $ prefix.This substituted wia Fortran sement precededt the Connection Symbol name will bepre-defined EMTDC variable name, compatible with the rest of the Fortran file for the Module where the Component Instance resides.另外一個(gè)例子是使用另外一個(gè)名字代替一個(gè)變量名。這種情況下,組件

8、圖形中定義的連接在 Fortran 片段中使用前綴$替換。這保證了連接的 Symbol 名將使用預(yù)定義的 EMTDC 變量名替換,它在組件實(shí)例模塊其它 Fortran 文件里兼容。In an effort to standardize the substitution syntax, the parser has been extended (beginning in PSCAD v4.2) to include a more formal wayof handling substitutions from other contexts.This comes from theneed to p

9、ull information from outside the Component Instance framework.By inserting delimiting symbols directly following the$ operator, texndling can be easily controlled.The standardsyntax is as follows:為了標(biāo)準(zhǔn)化替換語法,分析程序已擴(kuò)展成(從 PSCAD v4.2 開始)包括更正式的方式來處理其它環(huán)境里的替換。這個(gè)需求來自從組件實(shí)例框架的外部提取信息。通過在$后直接下:界定 symbol,文本處理變得很容易

10、處理。標(biāo)準(zhǔn)語法如$(:)The substitution contains bo and item separated by a Scope Operator anddelimited by round brackets, where:The contextt is to be used to scope the item Key.See below for a list of valid Context names.:Item key (actual substitution)t is to be placed atsubstitution po.See below for a list o

11、f valid Key names.替換包含和,被分號間隔,被圓括號界定。:context 用來指定 Key 的范圍。下面列出了有效的 Context 名: key(世界上的替換)放在替換位置。下面列出了有效的 Key 名The $ Value Substitution Prefix Operator may be usedext Labelswithhe Graphic Section, as well as the Fortran, DSDYN, DSOUT, Branch, M-Data, Matrix-Fill, Transformers, or T-Lines segments of

12、the Script Section.In addition to this, the $ operator may also beused to substitute Global Constants and various Keys under their respective Contexts.值替換前綴操作符可以用在繪圖部分的文本的 Fortran,DSDYN ,DSOUT ,Branch ,M里,同樣也可以用在-Data ,Matrix-Fill,部分Transformer,或 T-line 片段。除此之外,$操作符也可以用來替換全局常量Global Constants 和在各自 C

13、ontexts 下不同的 Key。$ may only precede variable names defined as one of the following:A Connection Symbol nameAn Input Field, Text Field, or Choice Box Symbol nameAny variable definedhe Compuions SegmentA Global Constant (within input parameters only) A Key name$前綴只能加載下面定義的變量名之一:接(Connection)Symbol 名一個(gè)

14、輸入域(Input Field),文本域(Text Field),選擇框(Choice Box)Symbol 名計(jì)算片段定義的任何變量Key 名NOTE:If a new variable needs to be defined directly within yourFortran code, you must define it as a local variable. #LOCAL Directive for more details.See the注意:如果你的 Fortran 代碼需要直接定義一個(gè)新的變量,你必須定義成本地變量。詳見#LOCAL 指令。Valid Context an

15、d Key Names有效的 Context 和 Key 名下面列出了有效的Context 和 Key 名Local Context Short Form本地 Context 縮寫形式When using substitutions withhe Context of the Component Instance, there is no need to include the identifier and ithence may be excluded along with the Scope Operator. the syntax is:In such casesContext Name

16、(case sensitive)DescriptionAvailable KeysAn empty context key is automatically context of the Component Instance.空 context 的 Key 默認(rèn)是Component 實(shí)例DefnContext ist of the Definition of the Component Instance.組件實(shí)例的 DefinitionName, Desc, PathProjectContext ist of the Projectt contains the Component Instan

17、ce.包含組件實(shí)例的工程N(yùn)ame, Desc, Ver, Author,PathSesContext ist of the current running sesof the application (PSCAD).PSCAD 最近一次運(yùn)行Name, VerSystemContext ist of the operating system.操作系統(tǒng)Name, Ver, User當(dāng)在組件實(shí)例環(huán)境內(nèi)使用子程序時(shí),沒有必要包含標(biāo)識符,因此也不需要分號。語法如下:$() or simply$This syntax is backwardly compatible with PSCAD ver v4.2

18、 and the simple un-delimited form is still the oneprevious to t is used delimited formatost cases (although both forms are now legal).Theverhasspel propertieshat it can be used toidentifiersor other fields where there isphanumerict-fix.Thisis a new capability and by design, if the following the $ op

19、erator is the same thencharactert character This allowsimmediayis copied directly to the stream without prosing.for $ insertions, for ex use $.le, to insert a dollar-sign character,這個(gè)語法向 PSCAD V4.2 之前的版本兼容,而且簡單的沒有界定是大多數(shù)情況下使用的形式(雖然兩者現(xiàn)在都合法)。有界定的版本在使用標(biāo)準(zhǔn)的標(biāo)識符或有 alphanumeric 后綴的情況下有特殊的性能。這是新設(shè)計(jì)的功能,如果直接在$之后

20、的字符是相同的,那么字符不處理直接到 stream 里。這允許$的插入,比如一個(gè)符號,使用$。Substituting Component Constantso Script替換組件常量到中One form ofsible substitution ist of pre-prosed constantso component Fortran code.Here, the actual numerical value of the constant (i.e. Connection, Input Parameter or any variabledefinedhe Compuions Segme

21、nt) will be directly substitutedupon compilation by PSCAD. within Commented Script, in certain pre-defined values Project.Substitutions may also be performed case the user would like to displayhe compiled Fortran files for the替換的形式之一是給組件 Fortran 代碼預(yù)處理常量。這里實(shí)際的常量數(shù)值(比如連接,輸入?yún)?shù)或任何定義在計(jì)算片段的變量)會直接被 PSCAD 編譯

22、。替換也可以在注釋中完成,這種情況下,用戶想要在工程編譯后的Fortran 文件里顯示特定的預(yù)定義值。EXLE 10-1:例 10-1A user component utilizes an external Fortran function, which requires an angle input argument in degrees to convert toradians.The data inputhis case is a Connection, defined inthe Graphic Section of the component definition, and has

23、 a SymbolName in. ConnectionThe function output out is defined as an output he Graphic Section.用戶組件使用了外部 Fortran 函數(shù),想要一個(gè)輸入?yún)?shù)從度轉(zhuǎn)換成弧度。輸入通過完成,定義在組件定義的繪圖部分,Symbol 名為in。函數(shù)輸出是out,是定義在繪圖部分的連接,symbol 名為out。By using the $ Variable Substitution Prefix Operator, the Fortran variables used by EMTDC to represent

24、 the Connections in and outcan be inserted directlyo Fortran code.The function call wouldappear similar to the following in either the Fortran, DSDYN or DSOUT segments:通過使用$變量替換前綴操作符,EMTDC 使用的代表連接in和outFortran 變量可直接到 Fortran 代碼里。函數(shù)調(diào)用代碼如下,可以在Fortran,DSDYN 或 DSOUT 片段中。NOTE:See the #FUNCTION Directive

25、for more details on declaring Fortran functions注意:關(guān)于Fortran 函數(shù),詳見#FUNCTION DirectiveEXLE 10-2:例 10-2A user-defined component definition called p has beenprogrammed to display the with the definition name, Fortran segment, namely:contents of certain key Input Fields, alongwithin Comments providedhe c

26、omponentFrequency with Symbol freq, value 60.0and units in Hz, and Voltage with Symbol volts, value 120.0 andunits in kV.Notet both freq and volts are local variablesand so the Local Context short form is used.一個(gè)名叫p的用戶自定義組件編程實(shí)現(xiàn)了在組件的 Fortran 片段提供的注釋里一起顯示特定的關(guān)鍵 Input Field 和它的定義名, 即:Sombol名為freq值為 60.0

27、 Hz 的頻率和 Symbol 名為volts值為 120.0kV 的電壓。注意freq和volts都是本地變量,因此本地環(huán)境(Context)省略掉了。When the component is evaluated, the Symbolnames (freq andto the component, and arevolts) are declared as variablesernalgiven the value enteredheir respectivefields.his case,freq = 60.0 and volts = 120.0.The user is nowfree

28、 to insert these using the $ Variablevariables elsewhere withhe component code bySubstitution Prefix Operator.當(dāng)組件評估后,Symbol 名(freq和volts)被為組件變量,且給定的對應(yīng)區(qū)域的鍵入值。在這個(gè)例子中,freq=60.0 volts=120.0。使用$變量前綴操作符,用戶可以把這些變量到組件代碼部分的任意位置。Something similar to the following comments could appear in either the Fortran, D

29、SDYN, or DSOUT segments:和下面注釋相似的注釋可以出現(xiàn)在 Fortran,DSDYN 或 DSOUT 片段中。This feature is excellent for ensuring the Project Fortran File code is always properly commented.這個(gè)功能使得確保工程 Fortran 文件代碼總能合適的注釋方面很出色。NOTE:The value substituted is the valueerms of the defaultunit specified entered value ishe Input Fi

30、eld properties dialog.If the actualentered in another unit, then this value will beprosed, before substitution takes place.Seethe Unit System for more details on units.注意:替換后的值使用 Input Field 屬性框里面默認(rèn)的。如果實(shí)際的詳見 Unit鍵入值是另外一個(gè)System。,那替換之前需要先處理。關(guān)于Substituting Component ConstantsoText Labels把組件常量替換到 Text L

31、abelsPre-prosed constants can be substituteddirectlyo Text Labelshe Graphic Section using the $ Variable Substitution Prefix Operator.This is a convenient feature, as it allows users to change text appearance on the component graphic according to input parameters.使用$變量替換前綴,預(yù)處理的常量可以直換到圖形部分的 Text Labe

32、ls里面。這是一個(gè)很方面的功能,因?yàn)樗试S用戶根據(jù)輸入?yún)?shù)改變組件圖形部分的文本外觀。EXLE 10-3:例:10-3A user has created a single-phase, two-winding transformer componentand wishes to display both the prind secondary winding voltageratings directly on the component graphic.The primary voltagerating input parameter Vprim is entered as 25.0 kV

33、 and thesecondary input Vsec is se4.0 kV as shown below:用戶建立了一個(gè)單相雙繞組的變壓器組件,希望在組件圖形上顯示一次和二次繞組的額定電壓。一次額定電壓輸入?yún)?shù)Vprim鍵入值為 25.0 kV,二次輸入Vsec設(shè)置為 4.0kV,如下所示。he component Graphic Section, the user adds tw itioned accordingly) and enters $Vprim and $VsecText Labelshe Text(field of the two Text Label Propertie

34、s dialogs as shown below:在圖形部分,用戶添加了兩個(gè) Text Labels(按下面放置)且鍵入$Vprim和$Sec到兩個(gè) Text Label 屬性框的 Text field。When the component is now viewed in Circuit view, values of the input parameters Vprim and Vsec should appear directly on the componentgraphic.For this exle,在 Circuit 視圖中觀察組件,輸入?yún)?shù)Vprim和Vsec直接會出現(xiàn)在組件圖

35、形上。比如:This feature is an excellent method of displaying key componentparameters directlyhe circuit.See Text Labels for moredetails on adding and editing Text Labels.這個(gè)功能在電路中顯示組件參數(shù)方面極為出色。對添加和編輯 Text Labels 詳見 Text Labels。% Data Substitution Prefix Operator數(shù)據(jù)替換前綴操作符%可以用來在 Fortran Comments 和 Text Opera

36、tor 中完成文本替換。數(shù)據(jù)替換符和值替換符非常相似,除了在處理之前,它的準(zhǔn)確內(nèi)容是文本類型的輸入?yún)?shù)。The % operator may be usedext Labels withhe Graphic Section, as well as within Commented codehe Fortran, DSDYN,DSOUT, Branch, M-Data, Matrix-Fill, Transformers, or T-Lines segments of the Script Section.%操作符可以用到圖形部分的 Text Labels ,同樣也可以用到 Fortran, D

37、SDYN,DSOUT, Branch, M的注釋部分。-Data, Matrix-Fill, Transformers, or T-Lines 片段% should only precede variable names defined as Input Parameters.Bracket delimitors (i.e. %(.) ) may be used whent-fix formatting is required.%應(yīng)該在輸入?yún)?shù)變量名之前。當(dāng)需要(Bracket delimitors)t-fix 格式時(shí),應(yīng)當(dāng)使用括號限定Substituting Texto Commented

38、Script在注釋中替換文本One form of substitution ist of texto component FortranComments.Unlike the $ Value Substitution Prefix Operator, theentire, unprosed contents of an input parameter (including the units) will be directly substituted upon component evaluation.一種形式的替換是組件 Fortran 注釋的文本。不像$值替換符,根據(jù)組件的評估,整個(gè)未處

39、理的輸入?yún)?shù)內(nèi)容(包含)會被直換。The % Data Substitution Prefix Operator (or simply %) can be used to make a simple text substitutiono Fortran Comments, as well aso Text Label objects.Data substitution is very similar to the$ Value Substitution Prefix Operator, exceptt it substitutes the exact contents of an input

40、parameter as text, before it is prosed.EXLE 10-4:例子:10.4Consider Exle 10-2 above, but replace the $ Value SubstitutionPrefix Operator with the % Data Substitution Prefix Operator.Thefollowing comments could then appear in either the Fortran, DSDYN or DSOUT segments:考慮上面的例 10-2,僅把值替換符$換成數(shù)據(jù)替換符%。下面的注釋可

41、以出現(xiàn)在Fortran,DSDYN 或 DSOUT 片段里。Substituting Texto Text Labels替換文本到 Text LabelsInput parameter text can be substituted directlyo Text Labels in the Graphic Section using the % Data Substitution PrefixOperator.This is a convenient feature, as it allows users to change text appearing on the component gr

42、aphic.使用%前綴數(shù)據(jù)替換操作符,輸入?yún)?shù)文本可以直換到圖形部分的 TextLabels 中。這對于在組件圖形中改變文本非常方面。EXLE 10-5:例 10-5Consider Exle 10-4 above, but replacethe $ operator with the %Data Substitution Prefix Operatorhenew Text Labels. values of the inputWhen thecomponent is now viewed in Circuit view,parameters Vprim and Vsec should app

43、ear on the component graphic as follows:考慮例 10-4,僅在新的 Text Labels 中用%替換$?,F(xiàn)在組件在電路視圖中如下,輸入?yún)?shù)Vprim和Vsec值組件上如下圖顯示。 Bra括號Bracan be used to perform mathematical, logical and formattingoperations before other Script is considered by the compiler.Bracan appear all over the component Definition.Thereare two

44、main Substitutionforms in which Bramay be used:Anonymous Expresand Block Prosing.The Brayntax is as follows:括號可以在其他被編譯器考慮之前,完成數(shù)學(xué)、邏輯和。括號可以出現(xiàn)在組件定義的任意位置。括號主要有兩種使用形式:表達(dá)式替換和塊處理。括號的語法如下:$Where:$:Optional.The $ Value Substitution Prefix Operator isnot required in some instan, such asost Block Prosing opera

45、tions.The important thing to remember ist the $ Operator should be included if some sort ofoperation is to be performed with contents are substituted.he Brabefore the格式化操作: block of text.Can be a mathematical expres, or simply a其中:$.可選。$在某些例子不需要,比如大部分的塊處理操作。需要記住的一件事,在內(nèi)容替換之前完成括號里的某些操作的情況下,要包含$。可以是一個(gè)數(shù)

46、學(xué)表達(dá)式,或者簡單的文本塊。It is important to notet mathematical and logical operations withinBraare performed prior to the insertion of codeo the EMTDC Subsequently,System Dynamics (or the electrical system Data File).these operations cannot involve variables only constants (such as constant input parameters, l

47、ocal constants, or constants defined in the Compu ions segment).很重要的一點(diǎn)值得注意,括號里的數(shù)學(xué)和邏輯操作比到 EMTystemDynamics(或電氣系統(tǒng)數(shù)據(jù)文件)里的代碼優(yōu)先完成。因此,這些操作不涉及變量僅僅是常量(比如常量輸入?yún)?shù),本地常量或計(jì)算片段 Compuions segment 里定義的常量)。Although a simple exles are provided here, you can find moreexles by looking at the Definitions of Master Librar

48、y components.雖然這里提供了一個(gè)簡單的例子,你也可以在 Master Library 組件的定義里找到的例子Anonymous ExpresSubstitution表達(dá)式替換EXLE 10-6:例 10-6The following exle shows how expresbracan be used withinText Labels to perform a mathematical operation on substituted valuesfrom the $ Variable Substitution Prefix Operator.Say input variabl

49、es are entered as A1 = 2.0 and A2 = 3.0. wants to display a value based on these values directly on component graphic as follows:t twoThe user the下面的例子表明了表達(dá)式括號如何用到 Text Labels 里完成一個(gè)數(shù)學(xué)操作,即通過變量替換前綴操作符$來替換 。假定鍵入的兩個(gè)輸入變量A1=2.0和 A2=3.0。用戶想要在組件圖形上直接展示這些值。Text Label = A1*A2 = 6.0The following could then be

50、entered dialog:o the Text LabelProperties可以把下面的內(nèi)容鍵入到 Text Label 的屬性框里。Block Prosing塊處理EXLE 10-6:例 10-6A user has modified include phase angle radians and radiansthe Fortran function PH_CON in Exle 10-1 toconverinboth directions (i.e. degrees to he component ParametersPtype is designed with twoto degrees).section, a Choice Box with Symbol options as shown be

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論