课件pscad包学习笔记2substitutions_第1页
课件pscad包学习笔记2substitutions_第2页
课件pscad包学习笔记2substitutions_第3页
课件pscad包学习笔记2substitutions_第4页
课件pscad包学习笔记2substitutions_第5页
已阅读5页,还剩14页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

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替换符是组件设计的基本元素,可以出现在组件定义的所有部分。替换符提供了各定义部分的信息交流途径,给组件图形带来动态性,帮助规范代码和注 释。PSCAD 中有效的替换法如下:Value Substitution Prefix: $ Data Substitution Prefix: %Bra: Comment Operator: !值替换符 $数据替换符括号注释符!$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.值替换前缀 ¥$值替换前缀是最重要的替换操作符,在组件设计中多次使用。值替换符加在字符串前,其中字符串代表一个数值,它的值将用字符串代替,只要加上前缀$。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.有多重方法使用$操作符。比如在输入域中键入的实际值在 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.注意:替换后的值使用输入域中指定的默认。如果实际键入的值是另外一个,在替换前要先进性转换。详见 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.另外一个例子是使用另外一个名字代替一个变量名。这种情况下,组件

8、图形中定义的连接在 Fortran 片段中使用前缀$替换。这保证了连接的 Symbol 名将使用预定义的 EMTDC 变量名替换,它在组件实例模块其它 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:为了标准化替换语法,分析程序已扩展成(从 PSCAD v4.2 开始)包括更正式的方式来处理其它环境里的替换。这个需求来自从组件实例框架的外部提取信息。通过在$后直接下:界定 symbol,文本处理变得很容易

10、处理。标准语法如$(:)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 名一个

14、输入域(Input Field),文本域(Text Field),选择框(Choice Box)Symbol 名计算片段定义的任何变量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 代码需要直接定义一个新的变量,你必须定义成本地变量。详见#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 默认是Component 实例DefnContext ist of the Definition of the Component Instance.组件实例的 DefinitionName, Desc, PathProjectContext ist of the Projectt contains the Component Instan

17、ce.包含组件实例的工程Name, Desc, Ver, Author,PathSesContext ist of the current running sesof the application (PSCAD).PSCAD 最近一次运行Name, VerSystemContext ist of the operating system.操作系统Name, Ver, User当在组件实例环境内使用子程序时,没有必要包含标识符,因此也不需要分号。语法如下:$() 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,这个语法向 PSCAD V4.2 之前的版本兼容,而且简单的没有界定是大多数情况下使用的形式(虽然两者现在都合法)。有界定的版本在使用标准的标识符或有 alphanumeric 后缀的情况下有特殊的性能。这是新设计的功能,如果直接在$之后

20、的字符是相同的,那么字符不处理直接到 stream 里。这允许$的插入,比如一个符号,使用$。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 代码预处理常量。这里实际的常量数值(比如连接,输入参数或任何定义在计算片段的变量)会直接被 PSCAD 编译

22、。替换也可以在注释中完成,这种情况下,用户想要在工程编译后的Fortran 文件里显示特定的预定义值。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 函数,想要一个输入参数从度转换成弧度。输入通过完成,定义在组件定义的绘图部分,Symbol 名为in。函数输出是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 代码里。函数调用代码如下,可以在Fortran,DSDYN 或 DSOUT 片段中。NOTE:See the #FUNCTION Directive

25、for more details on declaring Fortran functions注意:关于Fortran 函数,详见#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.一个名叫p的用户自定义组件编程实现了在组件的 Fortran 片段提供的注释里一起显示特定的关键 Input Field 和它的定义名, 即:Sombol名为freq值为 60.0

27、 Hz 的频率和 Symbol 名为volts值为 120.0kV 的电压。注意freq和volts都是本地变量,因此本地环境(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.当组件评估后,Symbol 名(freq和volts)被为组件变量,且给定的对应区域的键入值。在这个例子中,freq=60.0 volts=120.0。使用$变量前缀操作符,用户可以把这些变量到组件代码部分的任意位置。Something similar to the following comments could appear in either the Fortran, D

29、SDYN, or DSOUT segments:和下面注释相似的注释可以出现在 Fortran,DSDYN 或 DSOUT 片段中。This feature is excellent for ensuring the Project Fortran File code is always properly commented.这个功能使得确保工程 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 属性框里面默认的。如果实际的详见 Unit键入值是另外一个System。,那替换之前需要先处理。关于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.使用$变量替换前缀,预处理的常量可以直换到图形部分的 Text Labe

32、ls里面。这是一个很方面的功能,因为它允许用户根据输入参数改变组件图形部分的文本外观。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:用户建立了一个单相双绕组的变压器组件,希望在组件图形上显示一次和二次绕组的额定电压。一次额定电压输入参数Vprim键入值为 25.0 kV,二次输入Vsec设置为 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:在图形部分,用户添加了两个 Text Labels(按下面放置)且键入$Vprim和$Sec到两个 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 视图中观察组件,输入参数Vprim和Vsec直接会出现在组件图

35、形上。比如:This feature is an excellent method of displaying key componentparameters directlyhe circuit.See Text Labels for moredetails on adding and editing Text Labels.这个功能在电路中显示组件参数方面极为出色。对添加和编辑 Text Labels 详见 Text Labels。% Data Substitution Prefix Operator数据替换前缀操作符%可以用来在 Fortran Comments 和 Text Opera

36、tor 中完成文本替换。数据替换符和值替换符非常相似,除了在处理之前,它的准确内容是文本类型的输入参数。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.%应该在输入参数变量名之前。当需要(Bracket delimitors)t-fix 格式时,应当使用括号限定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 注释的文本。不像$值替换符,根据组件的评估,整个未处

39、理的输入参数内容(包含)会被直换。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,仅把值替换符$换成数据替换符%。下面的注释可

41、以出现在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.使用%前缀数据替换操作符,输入参数文本可以直换到图形部分的 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 中用%替换$。现在组件在电路视图中如下,输入参数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:括号可以在其他被编译器考虑之前,完成数学、逻辑和。括号可以出现在组件定义的任意位置。括号主要有两种使用形式:表达式替换和块处理。括号的语法如下:$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其中:$.可选。$在某些例子不需要,比如大部分的块处理操作。需要记住的一件事,在内容替换之前完成括号里的某些操作的情况下,要包含$。可以是一个数

46、学表达式,或者简单的文本块。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).很重要的一点值得注意,括号里的数学和逻辑操作比到 EMTystemDynamics(或电气系统数据文件)里的代码优先完成。因此,这些操作不涉及变量仅仅是常量(比如常量输入参数,本地常量或计算片段 Compuions segment 里定义的常量)。Although a simple exles are provided here, you can find moreexles by looking at the Definitions of Master Librar

48、y components.虽然这里提供了一个简单的例子,你也可以在 Master Library 组件的定义里找到的例子Anonymous ExpresSubstitution表达式替换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下面的例子表明了表达式括号如何用到 Text Labels 里完成一个数学操作,即通过变量替换前缀操作符$来替换 。假定键入的两个输入变量A1=2.0和 A2=3.0。用户想要在组件图形上直接展示这些值。Text Label = A1*A2 = 6.0The following could then be

50、entered dialog:o the Text LabelProperties可以把下面的内容键入到 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. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论