1、NO7基础ISSUE2.0
- 格式:doc
- 大小:505.50 KB
- 文档页数:60
Exercise 2.2.1aFor relation Accounts, the attributes are:acctNo, type, balanceFor relation Customers, the attributes are:firstName, lastName, idNo, accountExercise 2.2.1bFor relation Accounts, the tuples are:(12345, savings, 12000),(23456, checking, 1000),(34567, savings, 25)For relation Customers, the tuples are:(Robbie, Banks, 901-222, 12345),(Lena, Hand, 805-333, 12345),(Lena, Hand, 805-333, 23456)Exercise 2.2.1cFor relation Accounts and the first tuple, the components are: 123456 → acctNosavings → type12000 → balanceFor relation Customers and the first tuple, the components are: Robbie → firstNameBanks → lastName901-222 → idNo12345 → accountExercise 2.2.1dFor relation Accounts, a relation schema is:Accounts(acctNo, type, balance)For relation Customers, a relation schema is:Customers(firstName, lastName, idNo, account)Exercise 2.2.1eAn example database schema is:Accounts (acctNo,type,balance)Customers (firstName,lastName,idNo,account)Exercise 2.2.1fA suitable domain for each attribute:acctNo → Integertype → Stringbalance → IntegerfirstName → StringlastName → StringidNo → String (because there is a hyphen we cannot use Integer)account → IntegerExercise 2.2.1gAnother equivalent way to present the Account relation:Another equivalent way to present the Customers relation:Exercise 2.2.2Examples of attributes that are created for primarily serving as keys in a relation:Universal Product Code (UPC) used widely in United States and Canada to track products in stores.Serial Numbers on a wide variety of products to allow the manufacturer to individually track each product.Vehicle Identification Numbers (VIN), a unique serial number used by the automotive industryto identify vehicles.Exercise 2.2.3aWe can order the three tuples in any of 3! = 6 ways. Also, the columns can be ordered in any of 3! = 6 ways. Thus, the number of presentations is 6*6 = 36.Exercise 2.2.3bWe can order the three tuples in any of 5! = 120 ways. Also, the columns can be ordered in anyof 4! = 24 ways. Thus, the number of presentations is 120*24 = 2880Exercise 2.2.3cWe can order the three tuples in any of m! ways. Also, the columns can be ordered in any of n! ways. Thus, the number of presentations is n!m!Exercise 2.3.1aCREATE TABLE Product (maker CHAR(30),model CHAR(10) PRIMARY KEY,type CHAR(15));Exercise 2.3.1bCREATE TABLE PC (model CHAR(30),speed DECIMAL(4,2),ram INTEGER,hd INTEGER,price DECIMAL(7,2));Exercise 2.3.1cCREATE TABLE Laptop (model CHAR(30),speed DECIMAL(4,2),ram INTEGER,hd INTEGER,screen DECIMAL(3,1),price DECIMAL(7,2));Exercise 2.3.1dCREATE TABLE Printer (model CHAR(30),color BOOLEAN,type CHAR (10),price DECIMAL(7,2));Exercise 2.3.1eALTER TABLE Printer DROP color;Exercise 2.3.1fALTER TABLE Laptop ADD od CHAR (10) DEFAULT …none‟; Exercise 2.3.2aCREATE TABLE Classes (class CHAR(20),type CHAR(5),country CHAR(20),numGuns INTEGER,bore DECIMAL(3,1),displacement INTEGER);Exercise 2.3.2bCREATE TABLE Ships (name CHAR(30),class CHAR(20),launched INTEGER);Exercise 2.3.2cCREATE TABLE Battles (name CHAR(30),date DATE);Exercise 2.3.2dCREATE TABLE Outcomes (ship CHAR(30),battle CHAR(30),result CHAR(10));Exercise 2.3.2eALTER TABLE Classes DROP bore; Exercise 2.3.2fALTER TABLE Ships ADD yard CHAR(30); Exercise 2.4.1aR1 := σspeed ≥ 3.00 (PC)R2 := πmodel(R1)Exercise 2.4.1bR1 := σhd ≥ 100 (Laptop)R2 := Product (R1)R3 := πmaker (R2)Exercise 2.4.1cR1 := σmaker=B (Product PC)R2 := σmaker=B (Product Laptop)R3 := σmaker=B (Product Printer)R4 := πmodel,price (R1)R5 := πmodel,price (R2)R6: = πmodel,price (R3) R7 := R4R5 R6Exercise 2.4.1dR1 := σcolor = true AND type = laser (Printer)R2 := πmodel (R1)Exercise 2.4.1eR1 := σtype=laptop (Product)R2 := σtype=PC (Product)R3 := πmaker (R1)R4 := πmaker (R2)R5 := R3 – R4Exercise 2.4.1fR1 := ρPC1(PC)R2 := ρPC2(PC)R3 := R1 (PC1.hd = PC2.hd AND PC1.model <> PC2.model) R2R4 := πhd(R3)Exercise 2.4.1gR1 := ρPC1(PC)R2 := ρPC2(PC)R3 := R1 (PC1.speed = PC2.speed AND PC1.ram = PC2.ram AND PC1.model < PC2.model) R2 R4 := πPC1.model,PC2.model(R3)Exercise 2.4.1hR1 := πmodel(σspeed ≥ 2.80(PC)) πmodel(σspeed ≥ 2.80(Laptop))R2 := πmaker,model(R1 Product)R3 := ρR3(maker2,model2)(R2)R4 := R2 (maker = maker2 AND model <> model2) R3R5 := πmaker(R4)Exercise 2.4.1iR1 := πmodel,speed(PC)R2 := πmodel,speed(Laptop)R3 := R1 R2R4 := ρR4(model2,speed2)(R3)R5 := πmodel,speed (R3 (speed < speed2 ) R4)R6 := R3 – R5Product)Exercise 2.4.1jR1 := πmaker,speed (Product PC)R2 := ρR2(maker2,speed2)(R1)R3 := ρR3(maker3,speed3)(R1) R4 := R1 (maker = maker2 AND speed <> speed2) R2 R5 := R4 (maker3 = maker AND speed3 <> speed2 AND speed3 <> speed) R3 R6 := πmaker (R5)Exercise 2.4.1kR1 := πmaker,model (Product PC)R2 := ρR2(maker2,model2)(R1)R3 := ρR3(maker3,model3)(R1)R4 := ρR4(maker4,model4)(R1)R5 := R1 (maker = maker2 AND model <> model2) R2R6 := R3(maker3 = maker AND model3 <> model2 AND model3 <> model) R5 R7 := R4 (maker4 = maker AND (model4=model OR model4=model2 OR model4=model3)) R6 R8 := πmaker (R7)Exercise 2.4.2aπmodel σspeed≥3.00PCExercise 2.4.2bLaptopσhd ≥ 100 ProductπmakerExercise 2.4.2cσmaker=Bπmodel,price σmaker=B πmodel,priceσmaker=B πmodel,priceProduct PC Laptop Printer ProductProductExercise 2.4.2dPrinter σcolor = true AND type = laserπmodelExercise 2.4.2eσtype=laptopσtype=PC πmakerπmaker –Product ProductExercise 2.4.2fρPC1ρPC2 (PC1.hd = PC2.hd AND PC1.model <> PC2.model)πhd PC PCExercise 2.4.2gρPC1ρPC2PC PC (PC1.speed = PC2.speed AND PC1.ram = PC2.ram AND PC1.model < PC2.model)πPC1.model,PC2.modelExercise 2.4.2hPC Laptopσspeed ≥ 2.80σspeed ≥ 2.80πmodelπmodel Productπmaker,modelρR3(maker2,model2)(maker = maker2 AND model <> model2)πmakerExercise 2.4.2iPC LaptopProductπmodel,speed πmodel,speed ρR4(model2,speed2)πmodel,speed(speed < speed2 )–makerExercise 2.4.2jProduct PC πmaker,speed ρR3(maker3,speed3)ρR2(maker2,speed2)(maker = maker2 AND speed <> speed2)(maker3 = maker AND speed3 <> speed2 AND speed3 <> speed)makerExercise 2.4.2kπmaker(maker4 = maker AND (model4=model OR model4=model2 OR model4=model3)) (maker3 = maker AND model3 <> model2 AND model3 <> model)(maker = maker2 AND model <> model2)ρR2(maker2,model2)ρR3(maker3,model3)ρR4(maker4,model4)πmaker,modelProduct PCExercise 2.4.3aR1 := σbore ≥ 16 (Classes)R2 := πclass,country (R1)Exercise 2.4.3bR1 := σlaunched < 1921 (Ships)R2 := πname (R1)Exercise 2.4.3cR1 := σbattle=Denmark Strait AND result=sunk(Outcomes)R2 := πship (R1)Exercise 2.4.3dR1 := Classes ShipsR2 := σlaunched > 1921 AND displacement > 35000 (R1)R3 := πname (R2)Exercise 2.4.3eR1 := σbattle=Guadalcanal(Outcomes)R2 := Ships (ship=name) R1R3 := Classes R2R4 := πname,displacement,numGuns(R3)Exercise 2.4.3fR1 := πname(Ships)R2 := πship(Outcomes)R3 := ρR3(name)(R2)R4 := R1 R3Exercise 2.4.3gFrom 2.3.2, assuming that every class has one ship named after the class.R1 := πclass(Classes)R2 := πclass(σname <> class(Ships))R3 := R1 – R2Exercise 2.4.3hR1 := πcountry(σtype=bb(Classes))R2 := πcountry(σtype=bc(Classes))R3 := R1 ∩ R2Exercise 2.4.3iR1 := πship,result,date(Battles (battle=name) Outcomes)R2 := ρR2(ship2,result2,date2)(R1)R3 := R1 (ship=ship2 AND result=damaged AND date < date2) R2R4 := πship(R3)No results from sample data.Exercise 2.4.4aπclass,countryσbore ≥ 16ClassesExercise 2.4.4bπnameσlaunched < 1921ShipsExercise 2.4.4cπshipσbattle=Denmark Strait AND result=sunkOutcomesExercise 2.4.4dπnameσlaunched > 1921 AND displacement > 35000Classes Ships Exercise 2.4.4eσbattle=Guadalcanal Outcomes Ships(ship=name)πname,displacement,numGunsExercise 2.4.4f Ships Outcomesπnameπship ρR3(name)Exercise 2.4.4gClasses Ships πclass σname <> class πclass–Exercise 2.4.4hClasses Classes σtype=bb σtype=bcπcountry πcountry∩Exercise 2.4.4iBattles Outcomes (battle=name)πship,result,dateρR2(ship2,result2,date2)(ship=ship2 AND result=damaged AND date < date2)πshipExercise 2.4.5The result of the natural join has only one attribute from each pair of equated attributes. On the other hand, the result of the theta-join has both columns of the attributes and their values are identical.Exercise 2.4.6UnionIf we add a tuple to the arguments of the union operator, we will get all of the tuples ofthe original result and maybe the added tuple. If the added tuple is a duplicate tuple, then the set behavior will eliminate that tuple. Thus the union operator is monotone. IntersectionIf we add a tuple to the arguments of the intersection operator, we will get all of thetuples of the original result and maybe the added tuple. If the added tuple does not existin the relation that it is added but does exist in the other relation, then the result set willinclude the added tuple. Thus the intersection operator is monotone.DifferenceIf we add a tuple to the arguments of the difference operator, we may not get all of thetuples of the original result. Suppose we have relations R and S and we are computing R – S. Suppose also that tuple t is in R but not in S. The result of R – S would include tuple t. However, if we add tuple t to S, then the new result will not have tuple t. Thus thedifference operator is not monotone.ProjectionIf we add a tuple to the arguments of the projection operator, we will get all of the tuples of the original result and the projection of the added tuple. The projection operator onlyselects columns from the relation and does not affect the rows that are selected. Thus the projection operator is monotone.SelectionIf we add a tuple to the arguments of the selection operator, we will get all of the tuplesof the original result and maybe the added tuple. If the added tuple satisfies the selectcondition, then it will be added to the new result. The original tuples are included in thenew result because they still satisfy the select condition. Thus the selection operator ismonotone.Cartesian ProductIf we add a tuple to the arguments of the Cartesian product operator, we will get all of the tuples of the original result and possibly additional tuples. The Cartesian product pairs the tuples of one relation with the tuples of another relation. Suppose that we are calculating R x S where R has m tuples and S has n tuples. If we add a tuple to R that is not alreadyin R, then we expect the result of R x S to have (m + 1) * n tuples. Thus the Cartesianproduct operator is monotone.Natural JoinsIf we add a tuple to the arguments of a natural join operator, we will get all of the tuples of the original result and possibly additional tuples. The new tuple can only createadditional successful joins, not less. If, however, the added tuple cannot successfully join with any of the existing tuples, then we will have zero additional successful joins. Thusthe natural join operator is monotone.Theta JoinsIf we add a tuple to the arguments of a theta join operator, we will get all of the tuples of the original result and possibly additional tuples. The theta join can be modeled by aCartesian product followed by a selection on some condition. The new tuple can onlycreate additional tuples in the result, not less. If, however, the added tuple does not satisfy the select condition, then no additional tuples will be added to the result. Thus the thetajoin operator is monotone.RenamingIf we add a tuple to the arguments of a renaming operator, we will get all of the tuples of the original result and the added tuple. The renaming operator does not have any effect on whether a tuple is selected or not. In fact, the renaming operator will always return asmany tuples as its argument. Thus the renaming operator is monotone.Exercise 2.4.7aIf all the tuples of R and S are different, then the union has n + m tuples, and this number is the maximum possible.The minimum number of tuples that can appear in the result occurs if every tuple of one relation also appears in the other. Then the union has max(m , n) tuples.Exercise 2.4.7bIf all the tuples in one relation can pair successfully with all the tuples in the other relation, then the natural join has n * m tuples. This number would be the maximum possible.The minimum number of tuples that can appear in the result occurs if none of the tuples of one relation can pair successfully with all the tuples in the other relation. Then the natural join has zero tuples.Exercise 2.4.7cIf the condition C brings back all the tuples of R, then the cross product will contain n * m tuples. This number would be the maximum possible.The minimum number of tuples that can appear in the result occurs if the condition C brings back none of the tuples of R. Then the cross product has zero tuples.Exercise 2.4.7dAssuming that the list of attributes L makes the resulting relation πL(R) and relation S schema compatible, then the maximum possible tuples is n. This happens when all of the tuples of πL(R) are not in S.The minimum number of tuples that can appear in the result occurs when all of the tuples in πL(R) appear in S. Then the difference has max(n–m , 0) tuples.Exercise 2.4.8Defining r as the schema of R and s as the schema of S:1.πr(R S)2.R δ(πr∩s(S)) where δ is the duplicate-elimination operator in Section 5.2 pg. 2133.R – (R –πr(R S))Exercise 2.4.9Defining r as the schema of R1.R - πr(R S)Exercise 2.4.10πA1,A2…An(R S)Exercise 2.5.1aσspeed < 2.00 AND price > 500(PC) = øModel 1011 violates this constraint.Exercise 2.5.1bσscreen < 15.4 AND hd < 100 AND price ≥ 1000(Laptop) = øModel 2004 violates the constraint.Exercise 2.5.1cπmaker(σtype = laptop(Product)) ∩ πmaker(σtype = pc(Product)) = øManufacturers A,B,E violate the constraint.Exercise 2.5.1dThis complex expression is best seen as a sequence of steps in which we define temporary relations R1 through R4 that stand for nodes of expression trees. Here is the sequence: R1(maker, model, speed) := πmaker,model,speed(Product PC)R2(maker, speed) := πmaker,speed(Product Laptop)R3(model) := πmodel(R1 R1.maker = R2.maker AND R1.speed ≤ R2.speed R2)R4(model) := πmodel(PC)The constraint is R4 ⊆ R3Manufacturers B,C,D violate the constraint.Exercise 2.5.1eπmodel(σLaptop.ram > PC.ram AND Laptop.price ≤ PC.price(PC × Laptop)) = øModels 2002,2006,2008 violate the constraint.Exercise 2.5.2aπclass(σbore > 16(Classes)) = øThe Yamato class violates the constraint.Exercise 2.5.2bπclass(σnumGuns > 9 AND bore > 14(Classes)) = øNo violations to the constraint.Exercise 2.5.2cThis complex expression is best seen as a sequence of steps in which we define temporary relations R1 through R5 that stand for nodes of expression trees. Here is the sequence:R1(class,name) := πclass,name(Classes Ships)R2(class2,name2) := ρR2(class2,name2)(R1)R3(class3,name3) := ρR3(class3,name3)(R1)R4(class,name,class2,name2) := R1 (class = class2 AND name <> name2) R2R5(class,name,class2,name2,class3,name3) := R4 (class=class3 AND name <> name3 AND name2 <> name3) R3The constraint is R5 = øThe Kongo, Iowa and Revenge classes violate the constraint.Exercise 2.5.2dπcountry(σtype = bb(Classes)) ∩ πcountry(σtype = bc(Classes)) = øJapan and Gt. Britain violate the constraint.Exercise 2.5.2eThis complex expression is best seen as a sequence of steps in which we define temporary relations R1 through R5 that stand for nodes of expression trees. Here is the sequence:R1(ship,battle,result,class) := πship,battle,result,class(Outcomes (ship = name) Ships)R2(ship,battle,result,numGuns) := πship,battle,result,numGuns(R1 Classes)R3(ship,battle) := πship,battle(σnumGuns < 9 AND result = sunk (R2))R4(ship2,battle2) := ρR4(ship2,battle2)(πship,battle(σnumGuns > 9(R2)))R5(ship2) := πship2(R3 (battle = battle2) R4)The constraint is R5 = øNo violations to the constraint. Since there are some ships in the Outcomes table that are not in the Ships table, we are unable to determine the number of guns on that ship.Exercise 2.5.3Defining r as the schema A1,A2,…,A n and s as the schema B1,B2,…,B n:π(R) πs(S) = øwhere is the antisemijoinrExercise 2.5.4The form of a constraint as E1 = E2 can be expressed as the other two constraints.Using the “equating an expression to the empty set” method, we can simply say:E1– E2 = øAs a containment, we can simply say:E1⊆ E2 AND E2⊆ E1Thus, the form E1 = E2 of a constraint cannot express more than the two other forms discussed in this section.。
7-1.字典方法。
哪个字典方法可以用来把两个字典合并到一起。
答案:dict.update(dict2)将字典dict2的键-值对添加到字典dict中7-2.字典的键。
我们知道字典的值可以是任意的Python对象,那字典的键又如何呢?请试着将除数字和字符串意外的其他不同类型的对象作为字典的键,看看哪些类型可以,哪些不行。
对那些不能作为字典的键的对象类型,你认为是什么原因呢?答案:键必须是可哈希的。
所有不可变的类型都是可哈希的,因此他们都可以作为字典的键。
一个要说明的问题是:值相等的数字表示相同的键。
换句话说,整型数字1和浮点型1.0的哈希值是相同的,即它们是相同的键。
同时,也有一些可变对象(很少)是可哈希的,它们可以作为字典的键,但很少见。
用元组做有效的键,必须要加限制:元组中只包括像数字和字符串这样的不可变参数,才可以作为字典中有效的键。
内建函数hash()可以判断某个对象是否可以做一个字典的键,如果非可哈希类型作为参数传递给hash()方法,会产生TypeError错误,否则会产生hash值,整数。
>>> hash(1)1>>> hash('a')-468864544>>> hash([1,2])Traceback (most recent call last):File "<pyshell#2>", line 1, in <module>hash([1,2])TypeError: unhashable type: 'list'>>> hash({1:2,})Traceback (most recent call last):File "<pyshell#3>", line 1, in <module>hash({1:2,})TypeError: unhashable type: 'dict'>>> hash(set('abc'))Traceback (most recent call last):File "<pyshell#4>", line 1, in <module>hash(set('abc'))TypeError: unhashable type: 'set'>>> hash(('abc'))-1600925533>>> hash(1.0)1>>> hash(frozenset('abc'))-114069471>>> hash(((1,3,9)))1140186820>>> hash(((1,3,9),(1,2)))340745663>>> hash(((1,3,'9'),(1,2)))1944127872>>> hash(((1,3,'9'),[1,2],(1,2)))Traceback (most recent call last):File "<pyshell#11>", line 1, in <module>hash(((1,3,'9'),[1,2],(1,2)))TypeError: unhashable type: 'list'>>>7-3.字典和列表的方法。
ANSI/IEEE C57.12.01-2005美国国家标准协会/电气和电子工程师协会C57.12.01-2005IEEE Standard General Requirements for Dry-Type Distribution and Power Transformers, IncludingThose with Solid-Cast and/or Resin Encapsulated Windings干式配电和电力变压器通用要求,包括固体干式和环氧树脂浇注线圈Contents目录1. Overview (1)总则1.1 Scope (1)范围1.2 Purpose (1)目的1.3 Word usage (2)专有名词2. Normative references (2)参考标准3. Definitions (3)定义4. Service conditions ..................................... .. (3)使用条件4.1 Usual service conditions (3)正常使用条件4.2 Unusual service conditions (4)不正常使用条件5. Rating data (6)标定数据(额定值)5.1 Cooling classes of transformers (6)变压器冷却等级5.2 Frequency (7)频率5.3 Phases (7)相数5.4 Rated power (7)额定容量5.4 Voltage rating and taps (8)额定电压和分接5.5 Connections (8)联结组别5.6 Polarity, angular displacement, and terminal marks (8)极性,相位,和端子标号5.7 Impedance (10)阻抗5.8 Losses (10)损耗5.9 Insulation levels (10)绝缘等级5.10 T emperature rise and insulation-system capability (14)温升和绝缘系统温度(最高耐温能力)铭牌6. Construction (22)结构6.1 Tank-pressure requirements (22)外壳能够存受压力要求6.2 Finish of tank or enclosure (22)外壳的漆(表面处理)6.3 Handling provisions (22)起吊规定6.4 Transformer accessories (22)变压器附件6.5 Terminals (22)接线端子6.6 Grounding (22)接地6.6 Shipping (23)运输(海运)7. Short-circuit characteristics (23)突发短路特性7.1 General (23)通用(一般)7.2 Transformer categories (23)变压器范畴划分7.3 Short-circuit current duration and magnitude (23)短路电流持续时间和量级7.4 System zero-sequence data (26)系统的零序值(X0/ X1)7.5 Application conditions requiring special consideration (27)要求特殊考虑的施加条件7.6 Components....... . (27)组件7.6 Base power rating of a winding (27)线圈基准容量7.7 Effects of temperature on transformer windings during short-circuit conditions (28)在持续短路条件下变压器绕组上的温升影响7.8 Temperature limits of transformer for short-circuit conditions (28)短路条件下变压器的温升限值7.9 Calculation of winding temperature during a short circuit (28)在持续短路条件下绕组温升计算8. Testing and calculations (30)试验和计算8.1 General (30)一般8.2 Test classifications (30)试验分类8.3 Routine, design, and other tests for transformers (30)变压器例行,设计和其它试验8.4 Calculations (31)计算容许误差9.1 Ratio (31)变比9.2 Impedance (32)阻抗9.3 Losses (32)损耗10. Connection of transformers for shipment (32)变压器连接Y&Δ1. Overview总则1.1 Scope范围Electrical, mechanical, and safety requirements of ventilated, non-ventilated, and sealed dry-typedistribution and power transformers or auto-transformers (single and polyphase, with a voltage of 601 V or higher in the highest voltage winding) are described.本标准应用于通风、不通风和包封干式配电和电力变压器或自耦变压器(单相和多相,绕组的最高电压是601V或者更高)在电气、机械和安全上的要求。
...Be careful not to fall off!2.2. 解释器及其环境2.2.1. 错误处理有错误发生时,解释器打印一个错误信息和栈跟踪器。
交互模式下,它返回主提示符,如果从文件输入执行,它在打印栈跟踪器后以非零状态退出。
(异常可以由try语句中的except子句来控制,这样就不会出现上文中的错误信息)有一些非常致命的错误会导致非零状态下退出,这由通常由内部矛盾和内存溢出造成。
所有的错误信息都写入标准错误流;命令中执行的普通输出写入标准输出。
在主提示符或附属提示符输入中断符(通常是Control-C 或者DEL)就会取消当前输入,回到主命令行。
[1]执行命令时输入一个中断符会抛出一个KeyboardInterrupt异常,它可以被try 句截获。
2.2.2. 执行 Python 脚本BSD类的 Unix系统中,Python 脚本可以像 Shell 脚本那样直接执行。
只要在脚本文件开头写一行命令,指定文件和模式#! /usr/bin/env python(要确认 Python 解释器在用户的PATH中) #!必须是文件的前两个字符,在某些平台上,第一行必须以 Unix 风格的行结束符('n')结束,不能用 Windows ('rn')的结束符。
注意,'#'是Python中是行注释的起始符。
脚本可以通过chmod命令指定执行模式和权限$ chmod +x myscript.pyWindows 系统上没有“执行模式”。
Python 安装程序自动将.py文件关联到python.exe,所以在Python 文件图标上双击,它就会作为脚本执行。
同样.pyw也作了这样的关联,通常它执行时不会显示控制台窗口。
2.2.3. 源程序编码Python 的源文件可以通过编码使用 ASCII 以外的字符集。
最好的做法是在#!行后面用一个特殊的注释行来定义字符集# -*- coding: encoding -*-根据这个声明,Python 会尝试将文件中的字符编码转为encoding编码。
Group standardTL 211Issue 2014-07Class. No.:50243Descriptors:paint, paintwork, exterior plastic part, bumper, wheel trim, rear spoiler, tailgate, fenderPaint Coatings on Exterior Plastic Parts RequirementsPrevious issuesTL 211: 1974-11, 1983-10, 1989-07, 1992-08, 1992-09, 1995-03, 1995-10, 1998-06, 2003-02,2003-03, 2009-09, 2009-10ChangesThe following changes have been made to TL 211: 2009-10:–Section 3.1 "General requirements", Two-component compositions paragraph revised –Section 4.1 "General information" changed–Section 5 "Required properties": Table 2 changed–Section 6 "Supplier requirements, production monitoring" revised –Section 7 "Applicable documents" updated ScopeThis Technical Supply Specification (TL) defines the requirements for primer coat, single, and mul‐ti-layer paint coatings as per color combination table or special combination chart on plastic parts (hang-on parts, e.g. bumper, wheel trim, rear spoiler, trunk lid, tailgate, fender, etc.).DescriptionPaintwork as per TL 21112Always use the latest version of this standard.This electronically generated standard is authentic and valid without signature.The English translation is believed to be accurate. In case of discrepancies, the German version is alone authoritative and controlling.Page 1 of 10Page 2TL 211: 2014-07Requirements General requirementsApproval of first supply and changes as per Volkswagen standard VW 01155.Avoidance of hazardous substances as per VW 91101.In case pretreatment is necessary to activate the substrate, the related method must be specified (e.g. flame exposure, plasma treatment).The coating/paintwork, as well as any refinishing paint, must adhere firmly to the substrate or to the original paintwork, as the case may be.All areas of parts which are not subject to the requirements stated in this TL standard must be identified as such in the drawing.Master paint and hardener from the same manufacturer must be used for two-component composi‐tions. Any deviations must be coordinated with the Volkswagen Group department granting the re‐lease.The supplier must provide the following information for all parts to be tested:1.Specification of the base material (manufacturer designation and VDA (German Association of the Automotive Industry) designation)2.Color3.Paint structure (precise paint specifications, paint supplier), e.g.:Primer coat: Two-component primer 01-79008, by XXX, 20 μm Base coat: 831646, by XXX, 20 μmClear coat: Two-component clear coat GP72-0113, by XXX, 22 μm 4.Paint shop worker 5.Paint shop unit 6.Paint shop 7.Painting dateAppearance and haptic characteristicsThe parts must exhibit a uniform appearance on their entire surface; they must conform to the drawing requirements and to the released sample with respect to gloss and color.Pores, coarse cracks, and other flaws that adversely affect the specified appearance are not per‐missible.Color and gloss level must be documented in the first-sample test report or development sample test report as per VW 50195.Open-air weatheringAll painted components in the Volkswagen Group are subjected to open-air weathering as per VW 50185.The supplier is obligated to remove the cause for complaints occurring during this test and to im‐prove the paint system.3 3.13.23.3Page 3TL 211: 2014-07Painting processThe painting process must be coordinated between paint shop and paint manufacturer. Both par‐ties confirm the first-sample test report, meaning that both are responsible for fulfilling the specified requirements.Responsibilities are broken down as follows:–The paint manufacturer provides information on whether the TL requirements are being met. In addition, it provides its processing guidelines and provides support for the paint method used.–The paint shop provides information about the substrate (type of plastic material and commer‐cial name), checks the requirements as early as possible (this also applies to pre-production parts: at least for adhesion), confirms compliance with the paint manufacturer's processing guidelines, and requests assistance regarding the applied paint method.ConditioningAll samples delivered for testing must be pre-conditioned:7 days at room temperature with narrow air temperature range (18 °C to 28 °C) or 48 h at 60 °C.The tests are carried out after cooling down at room temperature for at least one hour.Requirements on structure and paint coat thickness General informationOnly one single re-paint job is permissible in the released process, considering the total paint coat thickness of < 150 µm (in the case of piano lacquer, paint coat thickness as per release status or drawing).The following color combinations are permissible for re-painting:1.First and second coat are of the same color2.Permissible base coats for all colors: Black, dark blue shades, dark gray shades (also metallic or pearlescent paints)Other color combinations must be agreed upon with the relevant release departments of each brand.NOTE 1: If an increased total paint coat thickness is necessary for technical reasons, this must be agreed upon by the parties involved. However, all other requirements stated in TL 211 must be ful‐filled.Exceptions: Only primed parts < 50 μm 1). Deviations require a corresponding drawing entry or a separate release.The requirements in TL 211 must also be complied with for re-painting of any sort. This must be documented with a first-sample test report. The purchaser's part owner can require a separate re‐lease for the re-painted parts.3.4 3.54 4.1Page 4TL 211: 2014-07Structure Base materialPlastic as per drawing.Primer coat/filler/primer surfacer 2)If specified (by drawing, release, or color standard) or required for technical reasons (depending on substrate).Top coat or intermediate coat (solid color, metallic, pearlescent paint)Base coat as per color standard or special combination chart, free of cadmium or cadmium com‐pounds.Clear coat (if required for decorative or technical reasons)As per released sample, testing as per IR spectrum.Paint systems and paint coat thicknesses in µmSee table 1.Table 1a)This only applies to parts with base coat/clear coat paint system without primer coat, filler, or primer surfacer.4.2 4.2.14.2.24.2.34.2.44.3Page 5TL 211: 2014-07 5Required propertiesThe requirements from the table 2 must be ensured on the entire component.Table 2Page 6TL 211: 2014-07Page 7TL 211: 2014-07Visible changes to color and gloss are not permissiblements as per table 2, consec. no. 2.1 must still be complied with.Page 8TL 211: 2014-07Visible changes to color and gloss are not permissiblements as per table 2, consec. no. 2.1 must still be complied with.Only for body components (e.g., trunk lid, tailgate, fender):Visible changes to the paint surface are not permissiblequirements as per table 2, consec. no. 2.1 must still be complieda)Greater care than with metal substrate must be taken to ensure that the cuts made in the crosscut test do enter the substrate, butdo not go too deep. The adhesive tape ("Tesagewebeband 4657" by Tesa) must be firmly pressed onto the surface before removing it.b)The adhesive tape ("Tesagewebeband 4657" by Tesa) must be firmly pressed onto the surface before removing it; however, with apreset testing force of 90 N and against a rigid backing.c)Reference clear coat ALD096050, made by BASF; reference sheets can be obtained from P10/D.d)50% balsam resin chips, from Willers, Engel & Co, Hamburg50% pine oil 55-60, from Overlack Lemro, Grevenbroiche)The coating must be tested using the released transit protection materials used in production (e.g., Bodygard 50530 by Tesa) andthe transit protection used by the supplier.f)All coatings must be cleaned prior to evaluation. Black matt paint coats must only be cleaned with clear water with a commerciallyavailable wetting agent (e.g., Pril) added, solid color and metallic paints using the polish P10 (Volkswagen material numberA 292777, procured from Menzerna, Ötigheim, Germany).Page 9TL 211: 2014-07Supplier requirements, production monitoringTo ensure the tested and released quality of the parts in ongoing production, the supplier must per‐form and document the tests as per table 3 on the painted parts:Table 3Deviations from the test frequency can be agreed upon in writing with the purchaser's appropriate part owner Applicable documentsThe following documents cited in this standard are necessary to its application.Some of the cited documents are translations from the German original. The translations of Ger‐man terms in such documents may differ from those used in this standard, resulting in terminologi‐cal inconsistency.Standards whose titles are given in German may be available only in German. Editions in other languages may be available from the institution issuing the H.893.018 (for Audi)Surface Requirements for Painted Exterior PartsPV 1200Vehicle Parts; Testing of Resistance to Environmental Cycle Test (+80/-40) °CPV 1502Clear Coat for Dual-Layer Metallic Paint Coatings; Testing for Resist‐ance to CrackingPV 1503Paint Coating of Metallic and Non-Metallic Materials; Pressure Washer TestPV 3.3.3Paints and Varnishes; Scratch Resistance Testing of Clear Coats PV 3929Non-Metallic Materials; Weathering in Dry, Hot Climate PV 3930Non-Metallic Materials; Weathering in Moist, Hot ClimatePV 3965Decorative Surfaces on and within the Vehicle; Visual Color Matching according to DIN EN ISO 3668TL 788Diesel Fuel; Fuel RequirementsVW 01155Vehicle Parts; Approval of First Supply and Changes VW 50185Vehicle Parts; Resistance to Open-Air WeatheringVW 50194Definition of Tolerances and Evaluation of the Differences in the Spar‐6 7Page 10TL 211: 2014-07VW 50195Colorimetric Evaluation of Automobile Paint CoatingsVW 91101Environmental Standard for Vehicles; Vehicle Parts, Materials, Operat‐ing Fluids; Avoidance of Hazardous SubstancesDIN 51604-2Methanolic FAM testing fluid for polymer materials; composition and re‐quirementsDIN EN 228Automotive fuels - Unleaded petrol - Requirements and test methods DIN EN ISO 20567-1Paints and varnishes - Determination of stone-chip resistance of coat‐ings - Part 1: Multi-impact testingDIN EN ISO 2409Paints and varnishes - Cross-cut testDIN EN ISO 2810Paints and varnishes - Natural weathering of coatings - Exposure andassessmentDIN EN ISO 2812-4Paints and varnishes - Determination of resistance to liquids - Part 4:Spotting methodsDIN EN ISO 2813Paints and varnishes - Determination of specular gloss of non-metallicpaint films at 20°, 60° und 85°DIN EN ISO 4628-2Paints and varnishes - Evaluation of degradation of coatings - Designa‐tion of quantity and size of defects, and of intensity of uniform changesin appearance - Part 2: Assessment of degree of blisteringDIN EN ISO 6270-2Paints and varnishes - Determination of resistance to humidity - Part 2:Procedure for exposing test specimens in condensation-water atmos‐pheresDIN ISO 3696Water for analytical laboratory use; specification and test methodsDIN ISO 4532Vitreous and porcelain enamels - Determination of the resistance ofenamelled articles to impact - Pistol test。
Travel journalunit 3 travel journalperiod one warming up,pre-reading and reading.1which kind of transport do you prefer to use:bus or train?(p17)拓展归纳prefer+n./doing sth.to+n./doing sth.宁愿……,不愿……prefer sb.to do sth.宁愿某人做某事prefer to do sth.rather than do sth.宁可……,不愿……show/have a preference for偏爱……have a preference of sth.to/over another宁要某物而不要另一物give preference to给某人优先权in preference to优先于……he prefers reading books to watching tv.他喜欢读书胜过看电视。
i prefer to stay with my children on holidays.我喜欢假日里和孩子们待在一起。
i prefer to walk there rather than ride on a crowded bus.我宁愿走着去那里也不愿乘坐拥挤的公共汽车。
i should prefer you not to stay there too long.我倒宁愿你别在那里待得太久。
翻译句子(1)我喜欢看电视而不喜欢出去。
(用两种方式翻译)i_prefer_to_watch_tv_rather_than_go_out.i_prefer_watching_tv_to_going_out.(2)我倒希望你马上就走。
(用两种方式翻译)i_prefer_you_to_go_at_once._i_prefer_that_you_should_go_at_once.(3)布朗先生比较喜欢把业余时间用来读点书。
This publication adds the Eight Channel RTD module to the Ovation I/O Reference Manual. It should be placed between Sections 19 and 20.Date: 04/03IPU No.243Ovation ® Interim Publication UpdatePUBLICATION TITLEOvation I/O Reference ManualPublication No. R3-1150Revision 3, March 2003Section 19A. Eight Channel RTDModule19A-1. DescriptionThe Eight (8) channel RTD module is used to convert inputs from Resistance Temperature Detectors (RTDs) to digital data. The digitized data is transmitted to the Controller.19A-2. Module Groups19A-2.1. Electronics ModulesThere is one Electronics module group for the 8 channel RTD Module:n5X00119G01 converts inputs for all ranges and is compatible only with Personality module 5X00121G01 (not applicable for CE Mark certified systems).19A-2.2. Personality ModulesThere is one Personality module groups for the 8 channel RTD Module:n5X00121G01 converts inputs for all ranges and is compatible only with Electronics module 5x00119G01 (not applicable for CE Mark certified systems).19A-2.3. Module Block Diagram and Field Connection WiringDiagramThe Ovation 8 Channel RTD module consists of two modules an electronics module contains a logic printed circuit board (LIA) and a printed circuit board (FTD). The electronics module is used in conjunction with a personalty module, which contains a single printed circuit board (PTD). The block diagram for the 8 channel RTD moduleis shown in Figure 19A-1.Table 19A-1. 8 Channel RTD Module Subsystem ChannelsElectronic Module Personality Module85X00119G015X00121G01Figure 19A-1. 8 Channel RTD Module Block Diagram and Field Connection Wiring Diagram19A-3. SpecificationsElectronics Module (5X00119)Personality Module (5X00121)Table 19A-2. 8 Channel RTD Module SpecificationsDescription ValueNumber of channels8Sampling rate50 HZ mode: 16.67/sec. normally. In 3 wire mode, leadresistance measurement occurs once every 6.45 sec.during which the rate drops to 3/sec.60 HZ mode: 20/sec. normally. In 3 wire mode, leadresistance measurement occurs once every 6.45 sec.during which the rate drops to 2/sec.Self Calibration Mode: Occurs on demand only. The ratedrops to 1/sec. once during each self calibration cycle.RTD ranges Refer to Table 19A-3.Resolution12 bitsGuaranteed accuracy (@25°C)0.10% ±[0.045 (Rcold/Rspan)]% ± [((Rcold + Rspan)/4096 OHM)]% ± [0.5 OHM/Rspan]% ±10 m V ± 1/2LSBwhere:Rcold and Rspan are in Ohms.Temperature coefficient 10ppm/°CDielectric isolation:Channel to channel Channel to logic 200V AC/DC 1000 V AC/DCInput impedance100 M OHM50 K OHM in power downModule power 3.6 W typical; 4.2 W maximumOperating temperature range0 to 60°C (32°F to 140°F)Storage temperature range-40°C to 85°C (-40°F to 185°F)Humidity (non-condensing)0 to 95%Self Calibration On Demand by Ovation ControllerCommon Mode Rejection120 dB @ DC and nominal power line frequency+/- 1/2%Normal Mode Rejection100 dB @ DC and nominal power line frequency+/- 1/2%Table 19A-3. 8 Channel RTD RangesScale #(HEX)Wires Type Tempo FTempo CRcold(ohm)Rhot(ohm)Excitationcurrent(ma)Accuracy± ±countsAccuracy± ±% ofSPAN1310OhmPL0 to1200–18 t o6496106.3 1.090.222310OhmCU 0 to302–18 t o1508.516.5 1.0 130.32D350OhmCU 32 to2840 to1405080 1.0110.2711350OhmCU 32 to2300 to1105378 1.0120.30193100Ohm PL –4 to334–16 t o16892163.671.0110.27223100Ohm PL 32 to5200 to269100200 1.0100.25233100Ohm PL 32 to10400 to561100301 1.0100.25253120Ohm NI –12 t o464–11 t o240109360 1.0100.25263120Ohm NI 32 to1500 to70120170 1.0130.32283120Ohm NI 32 to2780 to122120225 1.0110.27804100Ohm PL 32 to5440 to290100 208 1.0100.25814100Ohm PL 356 t o446180 t o230168 186 1.0300.74824200Ohm PL 32 to6980 to370200 473 1.0120.30834200Ohm PL 514 t o648268 t o342402452 1.0290.71844100Ohm PL 32 to1240 to51100120 1.0190.47854100Ohm PL 32 to2170 to103100 140 1.0130.3286 4100Ohm PL 32 to4120 to211100 180 1.0110.27874100Ohm PL 32 to7140 to379100 240 1.0100.25884120Ohm PL 511 t o662266 t o350200230 1.0240.5919A-4. 8 Channel RTD Terminal Block Wiring Information19A-4.1. Systems Using Personality Module 5X00121G01 Each Personality module has a simplified wiring diagram label on its side, which appears above the terminal block. This diagram indicates how the wiring from the field is to beconnected to the terminal block in the base unit. The following table lists and defines the abbreviations used in this diagram.Table 19A-4. Abbreviations Used in the DiagramAbbreviation Definition+IN, -IN Positive and negative sense input connectionEarth ground terminal. Used for landing shields when the shield is to begrounded at the module.PS+, PS-Auxiliary power supply terminals.RTN Return for current source connection.SH Shield connector. used for landing shields when the shield is to begrounded at the RTD.SRC Current source connection.Note:PS+ and PS- are not used by this module.19A-5. 8 Channel RTD Module Address Locations19A-5.1. Configuration and Status RegisterWord address 13 (D in Hex) is used for both module configuration and module status. The Module Status Register has both status and diagnostic information. The bit information contained within these words is shown in Table 19A-5.Definitions for the Configuration/Module Status Register bits:Bit 0:This bit configures the module (write) or indicates the configuration state of the module (read). A “1” indicates that the module is configured. Note that until the module is configured, reading from addresses #0 through #11 (B in Hex) will produce an attention status.Bit 1:This bit (write “1”) forces the module into the error state, resulting in the error LED being lit. The read of bit “1” indicates that there is an internal module error,or the controller has forced the module into the error state. The state of this bit is always reflected by the module’s Internal Error LED. Whenever this bit is set,an attention status is returned to the controller when address #0 through #11(B in Hex) are read.Table 19A-5. 8 Channel RTD Configuration/Status Register (Address 13 0xD in Hex)Bit Data Description -Configuration Register (Write)Data Description -Status Register (Read)0Configure Module Module Configured(1 = configured; 0 = unconfigured)1Force errorInternal or forced error(1 = forced error; 0 = no forced error)250/60 Hz select (0 = 60Hz, 1 = 50Hz)50/60 Hz System (1 = 50Hz) d(read back)3SELF_CAL (Initiates Self Calibration)Warming bit (set during power up or configuration)40050060Module Not Calibrated 708CH.1 _ 3/4 Wire.CH.1 _ 3/4 Wire - Configuration (read back)9CH.2 _ 3/4 Wire.CH.2 _ 3/4 Wire - Configuration (read back)10CH.3 _ 3/4 Wire.CH.3 _ 3/4 Wire - Configuration (read back)11CH.4 _ 3/4 Wire.CH.4 _ 3/4 Wire - Configuration (read back)12CH.5 _ 3/4 Wire.CH.5 _ 3/4 Wire - Configuration (read back)13CH.6 _ 3/4 Wire.CH.6 _ 3/4 Wire - Configuration (read back)14CH.7 _ 3/4 Wire.CH.7 _ 3/4 Wire - Configuration (read back)15CH.8 _ 3/4 Wire.CH.8 _ 3/4 Wire - Configuration (read back)Bit 2:The status of this bit (read) indicates the conversion rate of the module, write to this bit configures the conversion rate of A/D converters as shown below.see Table 19A-6.Bit3:Write: This bit is used to initiate self-calibration. Read: This bit indicates that the module is in the “Warming” state. this state exists after power up and ter-minates after 8.16 seconds. the module will be in the error condition during the warm up period.Bit4 & 5:These bits are not used and read as “0” under normal operation.Bit 6:This bit (read) is the result of a checksum test of the EEPROM. A failure of this test can indicate a bad EEPROM, but it typically indicates that the module has not been calibrated. A “0” indicates that there is no error condition. If an error is present, the internal error LED is lit and attention status will be returned for all address offsets 0-11 (0x0 - 0xB). The “1” state of this bit indicates an unre-coverable error condition in the field.Bit 7:This bits is not used and read as “0” under normal operation.Bit 8 - 15:These bits are used to configure channels 1 - 8 respectively for 3 or 4 wire op-eration. A “0” indicates 3 wire and a “1” indicates 4 wire operation, see Table 19A-7 and Table 19A-8).Word address 12 (0xC) is used to configure the appropriate scales for Channels 1 - 4 (refer to Table 19A-7 and Table 19A-8).Table 19A-6. Conversion Rate Conversion Rate (1/sec.)Bit 260 (for 60Hz systems)050 (for 50Hz systems)1Table 19A-7. Data Format for the Channel Scale Configuration Register(0xC)Bit Data Description Configuration (Write)Data Description Status (Read)0 Configure Channel #1scale - Bit 0Channel #1 scale configuration (read back) - Bit 01Configure Channel #1scale - Bit 1Channel #1 scale configuration (read back) - Bit 12Configure Channel #1scale - Bit 2Channel #1 scale configuration (read back) - Bit 23Configure Channel #1scale - Bit 3Channel #1 scale configuration (read back) - Bit 34Configure Channel #2 scale - Bit 0Channel #2 scale configuration (read back) - Bit 05Configure Channel #2 scale - Bit 1Channel #2 scale configuration (read back) - Bit 16Configure Channel #2 scale - Bit 2Channel #2 scale configuration (read back) - Bit 27Configure Channel #2 scale - Bit 3Channel #2 scale configuration (read back) - Bit 38Configure Channel #3 scale - Bit 0Channel #3 scale configuration (read back) - Bit 09Configure Channel #3 scale - Bit 1Channel #3 scale configuration (read back) - Bit 1Caution:Configuring any or all channel scales while the system is running will cause all channels to return attention status for up to two seconds following the reconfiguration.Caution:Configuring any or all channel scales while the system is running will cause all channels to return attention status for up to two seconds following the reconfiguration.10Configure Channel #3 scale - Bit 2Channel #3 scale configuration (read back) - Bit 211Configure Channel #3 scale - Bit 3Channel #3 scale configuration (read back) - Bit 312Configure Channel #4 scale - Bit 0Channel #4 scale configuration (read back) - Bit 013Configure Channel #4 scale - Bit 1Channel #4 scale configuration (read back) - Bit 114Configure Channel #4 scale - Bit 2Channel #4 scale configuration (read back) - Bit 215Configure Channel #4 scale - Bit 3Channel #4 scale configuration (read back) - Bit 3Table 19A-8. Data Format for the Channel Scale Configuration Register(0xE)Bit Data Description Configuration (Write)Data Description Status (Read)0 Configure Channel #5 scale - Bit 0Channel #5 scale configuration (read back) - Bit 01Configure Channel #5 scale - Bit 1Channel #5 scale configuration (read back) - Bit 12Configure Channel #5 scale - Bit 2Channel #5 scale configuration (read back) - Bit 23Configure Channel #5 scale - Bit 3Channel #5 scale configuration (read back) - Bit 34Configure Channel #6 scale - Bit 0Channel #6 scale configuration (read back) - Bit 05Configure Channel #6 scale - Bit 1Channel #6 scale configuration (read back) - Bit 16Configure Channel #6 scale - Bit 2Channel #6 scale configuration (read back) - Bit 27Configure Channel #6 scale - Bit 3Channel #6 scale configuration (read back) - Bit 38Configure Channel #7 scale - Bit 0Channel #7 scale configuration (read back) - Bit 09Configure Channel #7 scale - Bit 1Channel #7 scale configuration (read back) - Bit 110Configure Channel #7 scale - Bit 2Channel #7 scale configuration (read back) - Bit 211Configure Channel #7 scale - Bit 3Channel #7 scale configuration (read back) - Bit 312Configure Channel #8 scale - Bit 0Channel #8 scale configuration (read back) - Bit 013Configure Channel #8 scale - Bit 1Channel #8 scale configuration (read back) - Bit 114Configure Channel #8 scale - Bit 2Channel #8 scale configuration (read back) - Bit 215Configure Channel #8 scale - Bit 3Channel #8 scale configuration (read back) - Bit 3Table 19A-7. Data Format for the Channel Scale Configuration Register(0xC)19A-6. Diagnostic LEDsTable 19A-9. 8 Channel RTD Diagnostic LEDsLED DescriptionP (Green)Power OK LED. Lit when the +5V power is OK.C (Green)Communications OK LED. Lit when the Controller is communicatingwith the module.I (Red)Internal Fault LED. Lit whenever there is any type of error with themodule except to a loss of power. Possible causes are:n - Module initialization is in progress.n - I/O Bus time-out has occurred.n - Register, static RAM, or FLASH checksum error.n - Module resetn - Module is uncalibrated.n - Forced error has been received from the Controllern - Communication between the Field and Logic boards failedCH1 - CH 8 (Red)Channel error. Lit whenever there is an error associated with a channel or channels. Possible causes are:n - Positive overrangen - Negative overrangen Communication with the channel has failed。
Using Application Dependency Analysis to Enable Your Application on Windows Embedded Standard 7White PaperPublished April 2010Revised March 2012For the latest information, please see Table of ContentsUsing Application Dependency Analysis to Enable Your Application on Windows Embedded Standard 7 (1)Overview (3)Creating a Target Image (3)Reference Platform for Dependency Analysis (3)Understanding Application Dependencies (3)Types of Dependencies (4)Capturing the Dependencies (4)Using Package Mapper (5)Trimming the Answer File (6)Creating a Windows Embedded Standard 7 Image (6)Summary (7)Appendix A – Procmon (8)Introduction to Procmon (8)Specifying a Backing File (8)Process Tree Feature (8)Appendix B – Package Mapper (11)Introduction to Package Mapper (11)Prerequisites (11)Input Configuration File (12)Orphan Files (12)Files Mapped to Multiple Packages (12)Output Files (12)Additional Resources (13)OverviewThe design goal for an embedded system is typically very different from the design goal of a fully functional, general-purpose system. A general-purpose system with a full complement of features enables its users to enjoy the most free form, creative experience possible, and also to utilize the capabilities of its hardware platform to the fullest. An embedded system, by contrast, strives to lock down the functionality to enable only the function of the embedded application. Windows Embedded Standard 7 has achieved this goal, and it thus requires embedded systems developers to know the techniques and tools to determine the exact dependencies of the embedded application for inclusion in the operating system image. The purpose of this white paper is to educate the reader about those techniques and tools.Creating a Target ImageTo create a Target image, follow these three steps:1.Identify the dependencies of your Target applications with Process Monitor, a WindowsSysinternals tool.2.Feed the output of Step 1 to Package Mapper (a Windows Embedded Standard 7 application) tocreate a Windows Embedded Standard 7 Answer file.3.Create an embedded image with the Windows Embedded Standard 7 Answer file.Reference Platform for Dependency AnalysisIt is recommended to have one of the following operating systems for dependency analysis:∙Windows 7.∙Maxboot Image of Windows Embedded Standard 7 (Windows Embedded Standard 7 image with all of the packages included).It is always good to have a clean reference platform with an absolute minimum of applications and services running. This helps ensure that fewer events occur during dependency analysis. To keep the reference platform clean during dependency analysis, follow these suggestions:1.Do not install any extra applications.2.Do not enable Windows Update.3.Disable Prefetching.Understanding Application DependenciesEach application has a list of implicit dependencies that are mandatory for launching an application successfully.In addition to implicit dependencies, each application can have runtime dependencies that are loaded on demand. These are loaded only when a particular functionality within an application is exercised. Procmon (a Sysinternals application) is capable of capturing both of these dependencies together.Types of DependenciesFor each application, two types of dependencies must be identified:1.Installer dependencies, which are required for an application to be installed successfully (if theapplication has an installer).2. Application dependencies, which are needed for an application to run successfully.Capturing the Dependenciesunch Procmon (refer to Appendix A).2.Configure the settings (refer to Appendix A).3.Reset the events that are captured already (Edit->Clear Display).4.Enable Capture Events (File->Capture Events).5.To capture the Installer dependencies, launch the installer and install the Target application. Tocapture the Applications dependencies, launch the application and run through the list of test cases, exercising all of the functionalities that the application should satisfy (Procmon captures all of the events that happen during this activity).6.Disable Capture Events, as we are not interested in any further events.unch Process Tree in Procmon (Tools->Process Tree).8.Identify the Process IDs corresponding to the application (refer to Appendix A).9.There are two types of events that are important in this situation:a.Load Image activity, which gives the list of binaries loaded in the Target applicationaddress space.b.File Read activity, which provides the list of files read by the Target application.The steps that follow illustrate how these dependencies can be extracted by setting the rightfilters.Figure 1- Process Monitor Filter.unch Filter dialog (Filter->Filter…). Click the Reset button to reset any filters that are currentlyin effect. After clicking Reset, there will be still some entries in the Filter list. These excludesystem activity and Procmon’s own activity. It is permissible to have these events). Now addthe following filters:a.Add Include Filters for the Process IDs identified in Step 8.b.Add Include Filter for the Operation Load Image.c.Add Include Filter for the Result Success.unch Tools->Count Occurrences. Choose Path from the combo box adjacent to the label“Column” (see Figure 2 below) and click the Count Button. Click the Save button to save theoutput.Figure 2- Process Monitor Count Occurrences Dialog.unch Filter dialog (Filter->Filter…). Change the following filters:a.Remove the Include Filter for Operation Load Image (this Filter was added in Step 10).b.Add Include Filter for the Operation ReadFile.unch Tools->Count Occurrences. Choose Path from the combo box adjacent to the label“Column” and click on the button “Count”. Click on the “Save” button to save the output.14.Building an OS image in Windows Embedded Standard 7 involves identifying a set of packages.Each package encapsulates an OS feature and contains all of the binaries that contribute to that feature. After identifying the set of binaries from the steps above, the binaries must be mapped to the packages with Package Mapper.Using Package MapperPackage Mapper is a Windows application located in the Value-Add Folder in the media. Refer to Appendix B for more details on Package Mapper.Package Mapper application maps binary files to packages. Package Mapper is also capable of processing the Procmon Output file.To use the Procmon Output file with Package Mapper, follow these two steps:1.Open the Procmon Output file (captured in the previous section) in Excel and delete the Countcolumn. Also delete the header line in the first column.2.Feed this file as input to Package Mapper (refer to the Package Mapper manual for the inputparameters).The output of Package Mapper is a Windows Embedded Standard 7 Answer file, which lists the packages that are necessary for the Target application to run successfully on an Embedded OS.Package Mapper accepts any number of Input files; it can also be used to pass in both of the Output files (Installer dependencies and Application dependencies). The output of Package Mapper is a Windows Embedded Standard Answer file that will support the entire Target application.Package Mapper also outputs a Mapping file. This file lists the packages in the Answer file and the binary files that are contained in those packages.Trimming the Answer File1.Open the Answer file in Image Configuration Editor and review the packages in Answer file.2.Open the Mapping file (one of the Output files of Package Mapper) to see why each package hasbeen brought in. If there are very few binary dependencies for any package, it is worthwhile to investigate to see if the package can be removed. If a package looks totally irrelevant,investigate to see if it can be removed.3.Make a careful judgment whether or not this package can be removed by understanding thefunctionality provided by the package in Windows Embedded Standard 7. If you decide toremove the package, you can do so safely within Image Configuration Editor.4.Resolve the required package dependencies within Image Configuration Editor and save the finalAnswer file.Creating a Windows Embedded Standard 7 Imageunch Windows Embedded Standard 7 Setup.2.Choose “Build an Image” in the first screen and continue through the Wizard.3.In the Wizard step “Choose How to create your Image,” click “Use a Template” then browse tothe path that contains your Answer file. Continue through the Wizard.4.In the Wizard step “Summary of Drivers and Features”check “Modify Drivers” and “ModifyFeatures.” Continue through the Wizard.5.In the Wizard step “Find and Select Device D rivers,” choose “Automatically Detect Devices.” Ifyou have a PMQ file, choose the second Option. Continue through the Wizard.6.In the Wizard step “Select the P ackages to Include in Your Image,” uncheck “Resolve OptionalDependencies.” Review the packages on this screen. Add/Remove packages as needed. Click“Resolve” to resolve the dependencies. Continue through the Wizard.SummaryYou have now successfully created a Windows Embedded Standard 7 image that should support all of the Target applications. Install the Target application and run through all of its test cases to ensure that it is running 100% successfully on the new Windows Embedded Standard 7 image.Appendix A – ProcmonIntroduction to ProcmonProcmon is a Sysinternals tool that monitors file system activity, network activity, registry activity and process and thread activity. You can download and learn more about Procmon here.Specifying a Backing FileBy default, Procmon saves the Capture data in the Paging file. In Windows Embedded Standard 7, the Page file is disabled by default. This means that Procmon would continue to consume the system RAM for events tracing and would gradually slow down the system. Using a Backing file improves performance. Backing files can be specified as follows:unch File->Backing Files.Figure 3- Process Monitor Backing File specification.2.Click on the Radio button “Use File Named” and specify a B acking file on a drive that hassufficient space.There is also an option to provide a Backing file while launching Procmon from the Command line. The syntax is as follows:Command:Procmon.exe /BackingFile “c:\backFile.pml”Process Tree FeatureEach application has a list of binary dependencies. In addition, there may be dependencies between applications. An application might, for example, create a Child Process and depend on it. An applicationcan also depend on some Windows Services. It is essential to identify these inter-process dependencies, and the Process Tree can be very helpful in doing so.By using Process Tree, for instance, you can easily identify the Child Process that your application is creating.Figure 4- Process Tree feature.The Process Tree has six features that are helpful for analysis:1.List of all processes running at the time an event is captured. The Process Tree helps in easilyidentifying an application's Parent Process and Child Process.2.Full Path of the Executable file for each process in the Tree.mand line parameter of each process.4.Start Time and End Time of all processes.5.Life Time graph (third column in the figure above).6.Process ID of each process.The following steps help to identify the list of dependencies of these processes:1.Any Child Process that is created by the Target application is a dependency.2.Any process that is running from the application installation directory/sub-directory is adependency.3.Any process that is created after the Target application is created is a good candidate for being adependency. Look for its Command-line parameters to see if this process might be adependency. The Life Time column has a graph to easily identify the list of processes that is created after the creation of the Target application.Appendix B – Package MapperIntroduction to Package MapperPackage Mapper is a Windows Embedded Standard 7 application that helps to map binaries to packages. The output of Package Mapper is a Windows Embedded Standard 7 Answer file. You can find the most recent version of Package Mapper and the manual on the Application Compatibility Web site here. Prerequisites∙.NET 3.5 Framework is a requirement for this application to work.∙ICE (Image Configuration Editor) should be installed.∙Register the COM DLL EmbeddedDSI.dll present in the ICE installation folder(regsvr32 EmbeddedDSI.dll).Figure 5- Package Mapper.Input Configuration FilePackage Mapper application takes a Configuration file as input. A sample Configuration file is listed below:This Configuration file has three types of entries:∙[InputFile] — Full path to the input CSV/TXT file. The CSV/TXT file has only one column, which isa list of binary names. The file names can be absolute/relative. If you have multiple CSV Files,you can specify one [InputFile] entry for each.∙[DSPath] – Full path to the Distribution Share. This can be 32-bit or a 64-bit Distribution Share.∙[ICEPath] – Full path to the ICE (Image Configuration Editor) installation path.Orphan FilesThe Orphan files section contains binaries that are not OS binaries. Only OS binaries are encapsulated inside packages. Orphan files might contain binaries installed from some out-of-box applications. Review the list to identify the out-of-box application that must be installed.Files Mapped to Multiple PackagesThere are some files that are found in more than one package. Review this list and resolve the packages to be included in the Answer file. It is optional to resolve the packages. You can still continue to save the Answer file without resolving some/all of the entries in this list.Output FilesPackage Mapper has two Output files:1.Windows Embedded Standard 7 Answer file. This file contains a list of packages thatencapsulates the binaries specified in the Input files.2.Mapping file. This file lists the packages in the Answer file and the Binary files that arecontained in each package.Additional ResourcesMicrosoft Windows Embedded Web site:/windowsembeddedThe information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication.This white paper is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THISDOCUMENT.Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in, or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation.Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.© 2010 Microsoft Corporation. All rights reserved.Microsoft, MS-DOS, Windows, Windows Server, Windows Vista, Excel, Groove, InfoPath, OneNote, Outlook, PowerPoint, Visual Studio Windows, Fluent, and Windows Server are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.。
IK003001 NO7基础课程说明Issue 2.0课程说明课程介绍本课程介绍七号信令系统的基本理论、基本概念。
包括消息传递部分(MTP)、电话用户部分(TUP)课程目标本课程主要目标:✓七号信令系统的原理✓七号信令网的概念及组成✓七号信令网的分层结构✓电话用户部分(TUP)相关资料1.《C&C08 交换机运行手册》第二卷2.《C&C08-SSCP业务交换点操作手册》3.《C&C08-SSCP技术手册》第1章信令基本概念1.1 概述为了保证通信网的正常运行,除了交换设备和传输系统之外,还要有完善的信令方式。
信令方式,也叫信令系统,是用户话机和交换机之间以及交换机和交换机之间控制接续、协调工作、进行“对话”所使用的语言,是使电信网正常运行、完成任何用户之间通信的重要因素。
在通信网中交换局经历了步进制交换局纵横制交换局到目前的程控交换局几代的发展。
信令方式也随着不断发展和完善。
从最早步进制交换局所采用的简单的直流脉冲信令发展到了纵横制交换局所采用的多频互控信令,不仅提高了信令的速度,而且增加了信令的容量。
程控交换局尤其是数字程控交换局的引入对信令方式提出了更高的要求和实现的可能。
于是又出现了公共信道信令——No.7信令系统,又称为七号信令系统。
七号信令系统不但信令容量大,传送速率快,而且可以传送除电路接续信令以外的各种业务的控制信令和数据。
使用七号信令的网络节点不但可以是程控交换节点,还可以包括网管中心、业务控制点、网络数据库等各种智能节点,这正是通信网向智能化、综合化和个人化发展的要求。
因此可以说,七号信令系统和数字传输、程控交换以及计算机智能控制构成了支持现代通信网的基石。
1.2 信令系统概念信令就是各交换局在完成呼叫接续中的一种通信语言。
譬如一个用户要求呼叫,他必须先摘话机,于是就由用户话机向交换局送出摘机信令;然后用户必须将被叫用户号码告诉交换局,这就是拨号,送出拨号信令。
交换局经过处理之后要叫出被叫用户,要向被叫用户振铃,送振铃信令等等。
这些都属于交换局和用户之间的信令。
在2个或2个以上的交换局来完成呼叫接续任务时,除了上述信令外,还要求交换局传递各种信令,例如主叫用户号码、被叫用户号码以及其他有关信息。
不管是在哪一个范围内传输的信令,都是为完成呼叫接续这个目的服务的,要求发送和接收双方都能够理解,也就是说必须规定一种共同语言——共同的信令方式——才能使呼叫接续得以实现。
随着通信网的发展,各国提出了各种各样的信令方式,CCITT也已建议了No.1至No.7的各种信令,相应我国也已规定了中国No.1和中国No.7信令方式。
随着通信网的不断发展,要求有一个完善的、统一的信令方式。
从目前的发展趋势来看,今后会统一在No.7信令方式。
1.3 信令的分类1.3.1 按工作区域分类1. 用户线信令:用户终端与交换机之间传递的信令;2. 局间信令:交换设备之间传递的信令。
图1-1为用户线信令和局间信令举例:图1-1 户线信令与局间信令No.7信令是交换设备之间传递的控制信令,属于局间信令。
局间信令就如同交换设备之间的对话语言,双方遵守同一个语法规则。
No.7信令的语法规则就是由国际电联ITU提出的No.7信令技术规范。
我国根据这个规范制订出中国No.7信令技术规范。
在我国通信网上运行的交换设备都是符合中国规范的。
因此任何两种交换设备之间都可以实现No.7信令的互通。
1.3.2 按功能分类1. 线路信令:反映线路工作状态的信令,如空闲、占用、释放等。
2. 路由信令:提供接续信息的信令,如被叫号码、主叫类别等。
3. 管理信令:传递网络管理信息,如测试、维护等。
No.7信令包含了以上三部分的功能。
而且信息内容非常丰富,因此功能强大。
1.3.3 按信道分类1. 随路信令(CAS):信令信息在对应的话音通道上传送,或者在与话音通道对应的固定通道上传送(如数字线路信令)。
图1-2 是交换机使用随路信令的情况。
图1-2 随路信令的传输通道2. 共路信令(CCS):信令信息在专门的高速数据通道上传送,如64kbps数字通道。
图1-3 是交换机使用共路信令的情况。
图1-3 共路信令传输通道中国一号信令属随路信令,No.7信令属共路信令。
1.4 随路信令和共路信令1.4.1 中国一号信令1. 信令在话音通道上传送。
信令频率范围在780HZ ~1140HZ 及1380HZ ~1980HZ 之间。
2. 收发互控、传送速度慢。
信令持续时间为一个发收周期,如图1-4。
交换网络交换网络信令设备信令设备公共控制公共控制交换机A 交换机B 话路数据链路图1-4 一号信令的一个信令周期由图1-4,收发互控信令,发送持续时间长,一个信令只能包含一个数字,如被叫号码为8位,则发端局发送8位被叫号码,就需要8个信令收发周期,实际要持续几秒钟的时间。
大家可以从一号中继实验中观察到这个时间。
3. 信息容量小。
中国一号信令的前向信令只有15种不同的组合,后向信令只有6种不同的组合。
要为用户提供多种复杂的业务,就需要大量的信令信息,中国一号显然不能满足要求。
4. 通信期间无信令通道。
由于信令通道使用的是用户的话路,因此用户通话期间无信令通道可用。
这就会限制一些新业务的提供。
如业务转换,通话转为传真,或通话转为文件传送等。
1.4.2 No.7 信令1. 有独立的信令数据通道。
信令通道为64kbps的数字通道。
之所以采用这个速率,是因为目前电话交换机的中继电路是每条话路占一个64kbps数字通道,局间传递的No.7信令就是利用现有的中继话路,因此信令通道的速率为64kbps。
2. 信息容量大,传递速度快。
No.7信令的信息以二进制编码的形式表示,一个八位码就能表示256种不同的含义,可见其信息容量是很大的。
而在64kbps的数字通道上,只需125us就能发送出去一个8位码,每秒钟能发送8000个8位码。
可以看出其传递信息的速度是相当快的。
3. 应用范围广,适应未来发展。
No.7信令可以为ISDN、移动网、智能网提供信令支持,以前使用的各种信令则不能。
4. 通信期间仍可传送信令。
由于传送信令不占用话路,因此可以在用户通信期间同时传送信令。
5. 要求传输系统误码率低。
由于No.7信令信息以二进制编码形式发送,如果传输时出现误码,就会使信息传送出错,如果传输误码率高,就会使信息无法发送。
因此要求传输系统的误码率在10 7以下。
6. 要求话路有自检能力。
No.7信令在向对局发送占用信令之前,要确保将要占用的这条话路是畅通的。
因此中继设备应能检测话路的状态,并报告给信令处理部分。
1.5 No.7信令基本术语和定义1.5.1 No.7信令网逻辑上独立于通信网,专门用于传送信令的网络,由信令点和互连的信令链路组成。
一般说来,在物理上它和通信网是融为一体的。
No.7信令网是电信网中用于传输No.7信令消息的专用数据网。
它由信令点SP、信令转接点STP和信令链路Link组成。
信令网是独立于电话网的一个支撑网,我国No7信令网由三级结构组成。
如图1-5。
HSTPLSTPSP图1-5 我国信令网的三级结构1.5.2 信令点SP信令网上产生和接收信令消息的节点。
它将产生的信令消息从某一条信令链路上发出,或者从信令链路上接收消息,送给本节点的用户部分。
在信令网示意图中用○表示一个信令点。
通常信令点就是通信网中的交换或处理接点,例如交换局,网络数据库等,但也可能是只具有信令功能而不具备通信业务功能的独立的信令转接点。
1.5.3 信令转接点STP如某信令点既非消息源点,又非消息目的地点,其作用仅是将从某一信令链路上接收到的消息转发至另一信令链路上去,则称该信令点为信令转接点。
与此区别,一般常用缩写SP表示该信令点只是消息的端点(源点或目的点),不具备信令转接功能。
在信令网示意图中用□表示。
1.5.4 信令链路连接各个信令点,传送信令消息的物理链路称为信令链路。
通常信令链路就是通信网中通信链路的一部分,它可以是透明的数字通路,也可以是高质量的模拟通路,可以是有线传输媒体,也可以是无线传输媒体。
在信令网示意图中用直线表示。
1.5.5 信令链路集连接两个节点之间的一束平行的信令链路。
当两个节点之间有多条信令链路时,可以将它们组成一个或多个链路集。
1.5.6 信令点编码信令网中用于标识每一个节点的唯一编码。
1.5.7 信令单元信令点之间传递信令消息的最小单位,以数字编码的形式构成。
信令单元的长度是可变的。
信令单元比较长,由多个8bit组成,这一长串的编码在发送时是截成一个个8bit,插在PCM系统的某一个时隙中传输的。
1.5.8 信令路由信令消息从源点到目的地点所行的路径,它决定于信令关系和信令传送方式。
1.6 No.7信令传送方式信令传送方式(Signalling Transfre Mode)即信令消息传送路径和该消息所属信令关系之间的结合方式,也就是说,消息是经由怎样的路线由源点发送至目的地点的。
1.6.1 直连方式属于两个邻接信令点之间某信令关系的消息沿着直接互连这两个信令点的信令链路组传送,这种方式称为直连方式。
两个信令点之间通过直达信令链路传递消息。
此时话路和信令链路是平行的。
如图1-6。
图1-6 直联方式1.6.2 准直连方式在这种方式中,两个交换局之间的信令消息通过两段或两段以上串接的信令链路来传送,并且只允许通过预定的路径和信令转接点(STP)。
如图1-7。
图1-7 准直联方式在七号信令系统中,规定只采用直连和准直连两种方式。
其中直连方式主要用于STP,为了充分利用信令链路的容量,两个非STP交换局之间采用直连方式的条件是,这两个局之间应有足够大的中继电路群。
1.7 No.7信令功能结构1.7.1 基本功能结构No.7信令系统的基本功能结构由两部分组成:公共的消息传递部分(MTP,Message Transfer Part)。
它为正在通信的用户功能之间提供信令消息的可靠传递。
适合不同用户的独立用户部分(UP,User Part)。
它是使用消息传递部分传递能力的功能实体。
如图1-8。
图1-8 信令系统结构1.7.2 分级功能结构图1-9 展示了No.7信令系统的分级功能结构。
图1-9 No.7信令系统功能分层图中:MTP:消息传递部分SCCP:信令连接控制部分(Signalling Connection and Control Part)TUP:电话用户部分DUP:数据用户部分ISUP:ISDN用户部分TCAP:事务处理能力应用部分其中MTP和SCCP相当于OSI协议的一~三层,TCAP相当于OSI的七层;四~六层正在研究中。
1.7.3 各部分主要功能1、MTPMTP由三个功能级组成。
它们是:信令数据链路、信令链路功能和信令网功能。