当前位置:文档之家› Self-consistent random phase approximation in the Schutte-Da-Providencia fermion-boson mode

Self-consistent random phase approximation in the Schutte-Da-Providencia fermion-boson mode

Self-consistent random phase approximation in the Schutte-Da-Providencia fermion-boson mode
Self-consistent random phase approximation in the Schutte-Da-Providencia fermion-boson mode

a r X i v :n u c l -t h

/0305077v 2 6 N o v 2003

Self-consistent random phase approximation in the Sch¨u tte-Da-Providencia

fermion-boson model

A.Rabhi 1,2,?

1

Laboratoire de Physique de la Mati`e re Condens′e e,

Facult′e des Sciences de Tunis,Campus Universitaire,Le Belv′e d`e re-1060,Tunisia 2

IPN-Lyon,43Bd du 11novembre 1918,F-69622Villeurbanne Cedex,France

(Dated:February 8,2008)

The Self-consistent random phase approximation (SCRPA)is applied to the exactly solvable model with fermion boson coupling proposed by Sch¨u tte and Da-Providencia.Very encouraging results in comparison with the exact solution of the model for various observables are obtained.The transition from the normal phase to the phase with a spontaneously broken symmetry is carefully investigated.The strong reduction of the variance in SCRPA vs HF is pointed out.

PACS numbers:21.60.Jz,https://www.doczj.com/doc/6617107834.html,

During the last decade the so-called Self-Consistent version of the Random Phase Approximation (SCRPA)has seen very encouraging successes in a number of non trivial model cases (see for example [1]for a detailed de-scription of the method and [2]for the application of SCRPA to the many level pairing model).In spite of these performances of the theory,there are remaining problems.In ?rst place this concerns situations with spontaneously broken symmetries.Such situations were treated in [1,3,4].Whereas in the Lipkin model [3]the symmetry broken (’deformed’)phase caused no prob-lem because the broken symmetry is discrete (parity),in the other two cases [1,4],with a continuous broken symmetry,problems appeared with the low-lying mode known to be exactly at zero energy in the standard HF-RPA approach (the spurious or Goldstone mode).In the two cases cited [1,4]the low-lying mode does not appear at zero energy in SCRPA because the RPA oper-ator does not contain the symmetry operator as a limit case.Indeed,e.g.the number operator in quasiparticle (BCS)representation contains a purely hermitian piece α?k αk which can not be incorporated in the RPA operator which by de?nition is non hermitian.The same situation is present in the Sch¨u tte-Da-Providenica boson-fermion model [5]where the symmetry operator contains the bo-son and fermion number operators.The violation of the Goldstone theorem signi?es that the Ward identities and conservations laws are not respected.Though this viola-tion seems relatively mild and to go away in macroscopic systems (the hermitian pieces becoming of zero weight),the situation remains annoying for ?nite systems.

In this note which can be considered as a sequel of [4]we want again to investigate the Sch¨u tte-Da-Providenica model

H =ˉn +αb ?b +G (τ+b ?+τ?b )

(1)with b ?,b ideal boson operators and,n =

N

i =1

a ?0i a 0i ,

2(ˉ

n ?n ),where the a ?,a are fermion operators.

In analogy to the work in [4]we will introduce the more general RPA operator

Q ?ν=X νt +?Y νt ?+λνB ??μνB +U νβ?β?

?V νββ,ν=1,2,3

(2)

where

t ±

=

T ±

?2 T 0

and β?β?

=

B ?B ?2(1+2 B ?B )

.(3)

The operators T ±,T 0are obtained from τ±,τ0by writ-ing the latter ones in the ”deformed”basis

α?1k α0k =

u ?v v u a ?1k a ?0k ,u 2+v 2=1.(4)The bosons operators B ?and B are obtained from the

original ones by a shift transformation B →b ?σ,where σis a c -number characterizing the appearance of the Bose condensate.The introduction of the boson pair operators β?β?is motivated by the fact that otherwise there exists a certain dissymmetry between fermions and bosons,the fermions being in any case bilinear whereas the bosons are otherwise only contained to linear order in (2).Also the symmetry operator P =b ?b ?ˉn contains the bosons quadratically and the extended ansatz (2)may therefore show improved behavior with respect to the Goldstone mode.The formalism goes exactly in the same way as in [1,2,4]using the equation of motion method

[δQ,[H ′,Q ?ν]] =?ν [δQ,Q ?

ν]

(5)

to determine the amplitudes in (2).As in [4],in order to

?x the value L = P ,we use in (5)the cranked Hamil-tonian H ′=H ?μP in the symmetry broken phase,oth-erwise H ′=H .The mean-?eld amplitudes u ,v and σare readily obtained from a minimization of the ground-state energy,leading to [H ′,t +] = [H ′,B ?] =0.The amplitudes in (2)form a complete orthonormal set when

calculated from(5).Then(2)can be inverted and with the usual condition for the RPA ground-state

Qν|RPA =0,ν=1,2,3.(6) all expectation values appearing in(5)like for example t+B? , t+B and B?B can directly be expressed in terms of the RPA amplitudes.The only unknown quan-tity at this point preventing a fully self-consistent solu-tion of the SCRPA equations Eq.(5)is the expectation value T0 .However,in analogy to our previous study for the two-level pairing model[1]this quantity can be expressed as an expression in the operators T+and T?up to any order in a fast converging series according to

T0=?N

N

T+T?+

1

N/α.

SCRPA always shows a clear superiority over standard RPA,though,besides for some quantities,the di?erences are not very pronounced.Concerning the ground-state energy we do not give results but we only notice that we arrive practically at the same interpretations as in[4]. However,in order to test the accuracy of our approach it is instructive to calculate the di?erences of energies of the ground-state band with L values just one unit away from the absolute ground-state.One such quantity is the ”chemical potential”which should be identi?ed with the Lagrange parameter used for restoring the symmetry

μ=1

1.1-1-0.0131-0.0485-0.04850.1160

1.4-30.03250.03480.04050.1303

1.8-3-0.0341-0.0315-0.03290.0060

2.200.03200.03000.02400.0345

2.640.03050.02850.02210.0207

3.090.02040.01950.01350.0071

SCRPA(4)results for the excitation energy?E?1=E0L?E0L?1in the deformed region.

region,we present in

Fig.2a comparison between stan-

dard RPA,SCRPA(4)and SCRPA(6)with exact results. In the”spherical”phase we notice that the eigenvalue?1 is identi?ed with the exact”intraband”excitation?E?1. Furthermore,we see the important improvement of the SCRPA results in both cases SCRPA(4)and SCRPA(6) with respect to standard RPA result.After the phase transition?E?1remains?nite but very small,slowly de-creasing for increasing x,while the lowest eigenvalue in standard RPA corresponds to the spurious mode?1=0. Concerning the low-lying eigenvalue in SCRPA calcula-tion we see that SCRPA(6)improves the result with re-spect to SCRPA(4)but it is still quite far from the ex-act result.We can notice that the Goldstone theorem is not correctly ful?lled in this case.Therefore,the prob-lem of the identi?cation of the low-lying eigenvalue is not yet solved in SCRPA in spite of the introduction of the quadratic boson terms in(2).

From the presence of the quadratic boson terms in the RPA excitation operator the SCRPA method produces an supplementary eigenvalue which is noted?3.Let us now discuss the results for this mode,i.e.the third eigen-value RPA of the SCRPA(6)which is presented in Fig.3. In the spherical region we notice that this mode is iden-ti?ed with very good accuracy to the exact”intraband”excitation?E+2.However,in the deformed region(not shown),the result obtained for this mode cannot be iden-ti?ed with one of the exact excitations of the system.At present we do not have an explanation of this fact.It is likely related to the failure of the Goldstone theorem mentioned above.See also further discussion of this point at the end of this note.The di?culty may be of the same origin as with the?1mode.

A quantity which is particularly sensitive to the correct treatment of correlations in the ground-state is the mean boson number(not shown in Ref.[4]).This expectation value can be obtained in terms of the RPA amplitudes for the spurious mode?1compared with the exact energy of the excitation?E?1.

mode?3compared with the exact energy of the excitation ?E+2in the spherical region.

according to

N b= b?b = B?B +σ2,(10) where B?B is given,in SCRPA(6),by B?B =μ21+μ22+μ23.In Fig.4we show the results of the SCRPA(6), SCRPA(4),standard RPA and mean?eld methods for this quantity.Again with SCRPA(6)one notices a sig-ni?cant improvement over standard RPA and HF method for which the agreement with the exact result is not sat-isfying.Also,we note in Fig.4that the SCRPA(6)im-proves slightly the result over the SCRPA(4)specially in the deformed region.Furthermore,we note that in stan-dard RPA method,because we have a Goldstone mode in the deformed region,we cannot calculate this quantity. Another quantity which is very interesting to investi-gate in the SCRPA method is the variance of the sym-

4

metry operator P given by

222b b SCRPA(6),SCRPA(4),RPA and mean ?eld methods as func-tion of the interaction strength x .

In conclusion we reconsidered the work of Bertrand et al.[4]who treated the schematic Sch¨u tte-Da-Providencia model for interacting bosons and fermions within the SCRPA scheme.In [4]the RPA operator consisted only out of one boson and fermions pairs.Here we extended this con?guration space and included in addition bosons pairs.One of the motivations to do this was to see whether the Goldstone theorem which was quite strongly violated in [4]is improved.It was found that the low-lying mode in the ”deformed”zone,i.e.symmetry bro-ken region,indeed is lowered by ~30%when boson pair terms are added to the RPA operator.However,with respect to the ?rst physical state,the position of the spurious mode is still too high and one therefore can not say that it decouples to a good approximation from the

physical spectrum.However,in spite of this somewhat disappointing result,the introduction of the extra terms

5

[1]A.Rabhi,R.Bennaceur,G.Chanfray and P.Schuck,

Phys.Rev.C66,064315(2002).

[2]J.G.Hirsch,A.Mariano,J.Dukelsky and P.Schuck,Ann.

Phys.296,187(2002).

[3]J.Dukelsky,P.Schuck,Nucl.Phys.A512,466(1990).[4]T.Bertrand,P.Schuck,G.Chanfray,Z.Aouissat and J.

Dukelsky,Phys.Rev.C63,024301(2001).

[5]D.Sch¨u tte and J.Da Providencia,Nucl.Phys.A282,518

(1977).

实验5 JAVA常用类

山西大学计算机与信息技术学院 实验报告 姓名学号专业班级 课程名称 Java实验实验日期成绩指导教师批改日期 实验5 JAVA常用类实验名称 一.实验目的: (1)掌握常用的String,StringBuffer(StringBuilder)类的构造方法的使用;(2)掌握字符串的比较方法,尤其equals方法和==比较的区别; (3)掌握String类常用方法的使用; (4)掌握字符串与字符数组和byte数组之间的转换方法; (5)Date,Math,PrintWriter,Scanner类的常用方法。 二.实验内容 1.二进制数转换为十六进制数(此程序参考例题249页9. 2.13) 程序源代码 import java.util.*; public class BinToHexConversion{ //二进制转化为十六进制的方法 public static String binToHex(String bin){ int temp; //二进制转化为十六进制的位数 if(bin.length()%4==0) temp = bin.length()/4; else temp = bin.length()/4 + 1; char []hex = new char[temp]; //十六进制数的字符形式 int []hexDec = new int[temp];//十六进制数的十进制数形式 int j = 0; for(int i=0;i=0&&dec<10) return (char)('0'+dec-0); else if(dec>=10&&dec<=15) return (char)('A'+dec-10); else return '@'; }

孙鑫深入详解MFC学习笔记

Windows编程 一、#define的几个注意点 ①#与##的用法; #xxx将后面的参数xxx字符串化 xxx##yyy,将两个参数连接 ②\的用法 一行结束使用,表示一行未结束。 二、函数调用约定_stdcall _stdcall是Pascal方式清理C方式压栈,通常用于Win32Api中,函数采用从右到左的压栈方式,堆栈由它自己清理。在win32应用程序里,宏APIENTRY,WINAPI,都表示_stdcall,非常常见。 相对应的_cdecl,堆栈由main()函数或者其他函数清理。 C和C++程序的缺省调用方式则为__cdecl,下图为VC++6.0的默认设置,因此在不显式写明调用约定的情况下,一般都是采用__cdecl方式,而在与Windows API打交道的场景下,通常都是显式的写明使用__stdcall,才能与Windows API保持一致。 另外,还要注意的是,如printf此类支持可变参数的函数,由于不知道调用者会传递多少个参数,也不知道会压多少个参数入栈,因此函数本身内部不可能清理堆栈,只能由调用者清理了。 三、防止头文件重复包含----预编译 在写好的类的首位加上预编译代码,例如: #ifndef xxx_h #define xxx_h Class xxx { ... }; #endif 四、HDC、CDC、CClientDC、CWindowDC HDC是平台SDK提供的全局类,与设备上下文相关 CDC则是类似于封装在CWnd中的一个HDC。 CClientDC:继承于CDC,构造函数完成获取DC,析构函数完成释放DC。 CWindowDC:继承于CDC,构造函数完成获取DC,析构函数完成释放DC,在整个窗口上绘图 CMetaFileDC:图元文件设备描述环境类 创建:CMetaFileDC dc; dc.Create(); 接下来用一般dc的绘图操作,绘图的内容均会保存至图元文件中; HMETAFILE m_hMetaFile=dc.Close();//图元文件赋予数据成员显示图元文件:用一般dc的PlayMetaFile(m_hMetaFile)显示图元文件 窗口销毁时删除图元文件 SDK函数::DeleteMetaFile(m_hMetaFile) 五、OnDraw函数、OnCreate函数 OnDraw函数:窗口重绘的时候被框架类FrameWnd调用,响应WM_PAINT消息。 OnCreate函数:窗口建立的时候调用的函数,响应WM_CREATE消息。

三角函数,反三角函数公式大全

三角函数公式 两角和公式 sin(A+B) = sinAcosB+cosAsinB sin(A-B) = sinAcosB-cosAsinB cos(A+B) = cosAcosB-sinAsinB cos(A-B) = cosAcosB+sinAsinB tan(A+B) = tanAtanB -1tanB tanA + tan(A-B) =tanAtanB 1tanB tanA +- cot(A+B) =cotA cotB 1-cotAcotB + cot(A-B) =cotA cotB 1 cotAcotB -+ 倍角公式 tan2A = A tan 12tanA 2 - Sin2A=2SinA?CosA Cos2A = Cos 2A-Sin 2A=2Cos 2A-1=1-2sin 2A 三倍角公式 sin3A = 3sinA-4(sinA)3 cos3A = 4(cosA)3-3cosA tan3a = tana ·tan(3π+a)·tan(3 π -a) 半角公式 sin( 2A )=2cos 1A - cos(2A )=2cos 1A + tan(2A )=A A cos 1cos 1+- cot(2 A )= A A cos 1cos 1-+ tan(2 A )=A A sin cos 1-=A A cos 1sin + 和差化积 sina+sinb=2sin 2b a +cos 2b a - sina-sinb=2cos 2b a +sin 2b a - cosa+cos b = 2cos 2b a +cos 2b a - cosa-cosb = -2sin 2b a +sin 2 b a - tanA+tanB=sin(A+B)/cosAcosB tanA-tanB=sin(A-B)/cosAcosB ctgA+ctgB=sin(A+B)/sinAsinB -ctgA+ctgB=sin(A+B)/sinAsinB 积化和差 sinasinb = - 21[cos(a+b)-cos(a-b)] cosacosb = 2 1 [cos(a+b)+cos(a-b)]

JAVA中常用类的常用方法

JAVA屮常用类的常用方法 一.java?丨ang.Object 类 1、clone()方法 创建丼返M此对象的一个副木。要进行“克隆”的对象所属的类必须实现https://www.doczj.com/doc/6617107834.html,ng. Cloneable 接口。 2、equals(Objectobj)方法 0 功能:比较引用类型数据的等价性。 0 等价标准.?引用类型比较引用,基木类型比较值。 0 存在特例.?对File、String、Date及封装类等类型来说,是比较类型及对象的内稃而+ 考虑引用的是否为同一实例。 3、finalize〇方法 当垃圾丨"丨收器确定>(、存在对该对象的更多引用时,由对象的垃圾丨"丨收器调用此方法。 4、hashCode〇方法返 回该对象的哈希码值。 5、notify〇方法 唤醒在此对象监视器上等待的中?个线祝。 6、notifyAII〇方法 唤醒在此对象监视器上等待的所有线程= 7、toString()方法 返W该对象的字符串表示。在进行String与其它类型数据的连接操作时,&动调用tostringo 方法。可以根据耑要重写toStringO方法。 8、wait()方法 在其他线程调用此对象的n〇tify()方法或notifyAIIO方法前,异致当前线程等待。 二、字符串相关类 I String 类 charAt(int index)返回指定索引处的char值。compareTo{String anotherString)按字

典顺序比较两个字符串。compareTolgnoreCase(Stringstr)按字典顺序比较两个字 符串,不考虑人小写。concat(String str)将指定字符串连接到此字符串的结尾。 endsWith(String suffix)测试此字符串是否以指定的〗?缀结束。equals{Object anObject)将此字符串与指定的对象比较。 equalslgnoreCase(String anotherString)将此String 与另一个String 比较,考虑人小'与’。indexOf(int ch)返H指定字符在此字符串屮第一次出现处的索引。 indexOf(String str)返回第一次出现的指定子字符串在此字符串屮的索引, lastlndexOf(intch)返回指定字符在此字符串中最后??次出现处的索引。 length()返|n丨此字符串的长度。 replace(char oldChar, char newChar) 返回一个新的字符串,它是通过用newChar替换此字符串中出现的所有oldChar得到的。 split(String regex)根据给定正则表达式的匹配拆分此字符串。startsWith{String prefix)测试此字符 串是否以指定的前缀开始。substring(int beginlndex) 返回一个新的字符串,它是此字符串的一个子字符串。该子字符串始于指定索引处的字符,一直到此字符串末尾。 substring(int beginlndex, int endlndex) 返回一个新字符串,它是此字符串的一个子字符串。该子字符串从指定的beginlndex 处开始,一直到索引endlndex-1处的字符。 t〇CharArray()将此字符串转换为一个新的字符数组。

CRichEditCtrl

CRichEditCtrl MFC Library Reference Using CRichEditCtrl(https://www.doczj.com/doc/6617107834.html,/tie/7576199.html)rich edit控件是用户能够输入和编辑文本的窗口。文本能被指定字符和段落格式,并且也能包含嵌入式OLE对象。rich edit 控件在MFC中通过CRichEditCtrl类描绘。关于哪些你想知道更多?RichEdit控件概述 如果你在对话框中使用rich edit控件(不管你的程序是SDI,MDI,还是基本对话框),你必须在对话框显示之前调用AfxInitRichEdit一次。调用此函数的典型位置 在你的程序的InitInstance成员函数中。你不必每次显示对话框时调用它,仅仅第一次就可以了。如果你使用CRichEditView你不必调用 AfxInitRichEdit.Rich edit控件(CRichEditCtrl)为格式化文本提供程序接口。然而,一个程序必须实现任一用户接口组件,这个组件对于用户格式化操作可用是必要 的。那就是,Rich edit控件支持选定文本的字符或段落属性的改变。字符属性

的一些例子就是黑粗体,斜体,字体系列,和点大小。段落属性的例子如对齐,页边空白,和移字键 (英文原文:tab stops.表示在rich edit中按下tab键光标会移动一段距离)。然而,这是给你提供的用户接口,不管那是一个工具条按钮,菜单项,或是一个格式化字符对话框。也有函数对目 前选择查询richedit控件。使用这些函数显示当前属性设置,比如,设置一个选定标记在用户接口上,如果当前选择是黑粗体字符格式属性。参见CharacterFomatting和paragraph formatting查看更多字符段落格式化信息。rich edit控件支持几乎所有多行编辑控件( multiline edit controls)的操作和通知消息。因此,使用EDIT控件的应用程序很容易的变换为使用RICH EDIT控件。附加的消息和通知(notifications)能使程序访问richedit的其它特性。参看CEdit查看编辑控件消息。与rich edit控件有关的类 CRichEditView, CRichEditDoc, 和CRichEditCntrItem类提供在MFC的文档/视图结构环境内的RICH EDIT控件的功能。CRichEditView保持着文本和文本的格式化特性。CRichEditDoc保持着视图中OLE客户项的序列。CRichEditCntrItem提供对OLE客户项的container-side

反三角函数公式(完整)

反三角函数 分类 反正弦 反余弦 余弦函数x y cos =在]0[π,上的反函数,叫做反余弦函数。记作x cos arc ,表示一个 余弦值为x 的角,该角的范围在]0[π,区间内。定义域]11[, - , 值域]0[π,。 反正切 反余切 余切函数y=cot x 在)0(π,上的反函数,叫做反余切函数。记作x arc cot ,表示一个余切值为x 的角,该角的范围在)0(π,区间内。定义域R ,值域)0(π,。

反正割 反余割 运算公式 余角关系 2 arccos sin arc π = +x x 2 cot tan arc π =+x arc x 2 csc ec a π = +x arc x rcs 负数关系 x x sin arc )sin(arc -=- x x rc arccos )cos(a -=-π x x tan arc )tan(arc -=- x rc x c cot a )(ot arc -=-π

x rc x sec a )(arcsec -=-π x arc x c sec )(sc arc -=- 倒数关系 x arc x csc )1 arcsin(= x arc x sec )1 arccos(= x arc x arc x cot 2cot )1arctan(-==π x x x arc arctan 23arctan )1cot(-=+=ππ x x arc arccos )1 sec(= x x arc arcsin )1 csc(= 三角函数关系

加减法公式 1. ) 10,0()11arcsin(arcsin arcsin ) 10,0()11arcsin(arcsin arcsin ) 10()11arcsin(arcsin arcsin 22222 2 222222>+<<-+---=+>+>>-+--=+≤+≤-+-=+y x y x x y y x y x y x y x x y y x y x y x xy x y y x y x ,,或ππ 2. ) 10,0()11arcsin(arcsin arcsin ) 10,0()11arcsin(arcsin arcsin ) 10()11arcsin(arcsin arcsin 22222 2 222222>+><-----=->+<>----=-≤+≥---=-y x y x x y y x y x y x y x x y y x y x y x xy x y y x y x ,,或ππ 3. ) 0() 11arccos(2arccos arccos ) 0() 11arccos(arccos arccos 2 2 22<+----=+≥+---=+y x x y xy y x y x x y xy y x π 4. ) () 11arccos(arccos arccos ) () 11arccos(arccos arccos 2 2 22y x x y xy y x y x x y xy y x <--+=-≥--+-=- 5. ) 1,0(1arctan arctan arctan ) 1,0(1arctan arctan arctan ) 1(1arctan arctan arctan ><-++-=+>>-++=+<-+=+xy x xy y x y x xy x xy y x y x xy xy y x y x ππ

过程控制实习报告

过程控制工程实习报告 学院:机械与控制工程班级:自动化10-3班 学号: 姓名:傅 指导老师:周 日期:年月

目录 1 绪论 (2) 1.1 过程控制系统的概述 (2) 2 西门子PLC的介绍 (2) 2.1 S7-300PLC介绍 (2) 2.2 S7-3O0主要功能模块介绍 (2) 3 基于PLC的双容量水箱控制系统硬件组成 (3) 3.1硬件模块 (3) 3.2 双容量水箱控制系统实验装置 (4) 3.3双容量水箱对象组成 (4) 4 基于PLC的双容量水箱控制系统的编程设计 (5) 4.1 控制原理 (5) 4.2 STEP 7简介 (6) 4.3 SEP7硬件组态及参数设置 (6) 4.4 SETP7程序设计 (8) 5 控制系统程序编写及调试、运行 (8) 5.1 S7-300_PLC模拟量输入输出量程转换模块FC105简介 (8) 5.2 系统的I/O地址分配 (8) 5.3 双容量水箱控制系统程序 (9) 6 实习结语 (13)

1 绪论 1.1 过程控制系统的概述 过程控制是指根据工业生产过程的特点,采用测量仪表、执行机构和计算机等自动化工具,应用控制理论,设计工业生产过程控制系统,实现工业生产过程自动化。随着生产过程的连续化﹑大型化和不断强化, 随着对过程内在规律的进一步了解,以及仪表﹑计算机技术的不断发展, 生产过程控制技术近年来发展异常迅速.所谓生产过程自动化, 一般指工业生产中(如石油﹑化工﹑冶金﹑炼焦﹑造纸﹑建材﹑陶瓷及热力发电等)连续的或按一定程序周期进行的生产过程的自动控制.凡是采用模拟或数字控制方式对生产过程的某一或某些物理参数(如温度﹑压力﹑流量等)进行的自动控制统称为过程控制,随着科学技术的飞速前进,过程控制也在日新月异地发展。它不仅在传统的工业改造中,起到了提高质量,节约原材料和能源,减少环境污染等十分重要的作用。生产过程自动化是保持生产稳定、降低消耗、减少成本、改善劳动条件、保证安全和提高劳动生产率重要手段,在社会生产的各个行业起着极其重要的作用。 2 西门子PLC的介绍 2.1 S7-300PLC介绍 S7-300是通用可编程控制器,它广泛地应用于自动化领域,涉及多个行业,可用于组建集中式或分布式结构的测控系统,重点在于为生产制造工程中的系统解决方案提供一个通用的自动化平台,性能优良,运行可靠。 S7-300PLC采用模块化结构,模块种类的品种繁多,功能齐全,应用范围十分广泛,可用于集中形式的扩展,也可用于带ET200M分布式结构的配置。S7系列PLC用DIN标准导轨安装,各模块用总线连接器连接在一起,系统配置灵活、维护简便、易扩展。CPU模块是PLC的核心,负责存储并执行用户程序,存取其他模块的数据,一般还具有某种类型的通信功能。信号模块用来传送数字量及模拟量信号,通信模块可提供PROFIBUS、以太网等通信连接形式。 2.2 S7-3O0主要功能模块介绍 1、导轨(Rail) S7-300的模块机架(起物理支撑作用,无背板总线),西门子提供五种规格的导轨。 2、电源模块(PS) 将市电电压(AC120/230V)转换为DC24V,为CPU和24V直流负载电路(信号模块、传感器、执行器等)提供直流电源。输出电流有2A、5A、10A三种*正常:绿色LED灯亮 *过载:绿色LED灯闪

《网络程序设计》复习题

1、什么叫套接字?套接字按通信性质可以分为哪两类? 2、理解线程的创建与使用方法,并能应用到程序设计中。 3、异构环境下的网络程序设计需要考虑哪些问题? 4、为什么在数据结构struct sockaddr_in中,成员变量sin_addr和sin_port需要转换为网络字节顺序,而sin_family不需要呢? 5、从网络编程的角度来简述和比较IP地址和端口的作用。 6、为什么网络编程时需要考虑字节顺序问题? 7、WinSock编程中需要哪些文件? 8、UDP程序的工作模型隐含着通信标识五元组的建立过程。这五元组在UDP的客户与服务端是由哪些函数分别确定的? 9、什么是阻塞与非阻塞通信?请解释两者的区别。 10、简述各种类型数据的发送与接收处理的方法。 11、简述基于UDP的客户机/服务器端socket编程流程。 12、什么是通信三元组和五元组?三元组和五元组每个元素在网络连接中起到什么作用? 13、为什么服务端在TCP通信过程中需要调用bind( )函数而客户端不需要?为什么客户机通常不需要绑定自己的端口号? 14、简述套接字Select模型原理,以及select模型的优势和不足。 15、简述阻塞模式服务器和客户端工作流程,以及阻塞模式套接字的优势和不足。 16、在实际应用中,很多TCP服务器程序在非正常退出时,如果立即重启服务器进程则会发生绑定服务器端口失败的错误,从而无法启动服务器进程,但等待一段时间后就可以了。为什么会发生这种情况呢?如何解决这个问题(或采取什么措施可以立即重启服务器进程)?(要求掌握setsockopt()函数的用法) 17、TCP程序的工作模型隐含着通信标识五元组的建立过程。这五元组在TCP的客户与服务端是由哪些函数分别确定的? 18、accept( )为什么要返回一个套接口?或者说,为什么要为每一个连接创建一个套接口来处理?UDP 服务器端为什么不需要多个套接口? 19、理解生产者-消费者模型,理解线程的同步与互斥方法(event和critical-section),并能应用到程序设计中。 20、采用阻塞式I/O模型时,套接字函数recv()的返回值有哪几种?分别对应什么情况? 21、closesocket()函数和shutdown()函数有何差别? 22、什么是TCP的三次握手机制?为什么要使用TCP的三次握手机制? 23、服务器端并发的两种模型及编程实现。 考试形式:闭卷 考试时间:120分钟 考试题型:选择题(2’×10=20’)、简答题(10’×6=60’)、程序设计题(20’)

4:一个经典的多线程同步问题汇总

一个经典的多线程同步问题 程序描述: 主线程启动10个子线程并将表示子线程序号的变量地址作为参数传递给子线程。子线程接收参数 -> sleep(50) -> 全局变量++ -> sleep(0) -> 输出参数和全局变量。 要求: 1.子线程输出的线程序号不能重复。 2.全局变量的输出必须递增。 下面画了个简单的示意图: 分析下这个问题的考察点,主要考察点有二个: 1.主线程创建子线程并传入一个指向变量地址的指针作参数,由于线程启动须要花费一定的时间,所以在子线程根据这个指针访问并保存数据前,主线程应等待子线程保存完毕后才能改动该参数并启动下一个线程。这涉及到主线程与子线程之间的同步。 2.子线程之间会互斥的改动和输出全局变量。要求全局变量的输出必须递增。这涉及到各子线程间的互斥。 下面列出这个程序的基本框架,可以在此代码基础上进行修改和验证。 //经典线程同步互斥问题 #include #include #include long g_nNum; //全局资源 unsigned int__stdcall Fun(void *pPM); //线程函数 const int THREAD_NUM = 10; //子线程个数 int main() { g_nNum = 0;

HANDLE handle[THREAD_NUM]; int i = 0; while (i < THREAD_NUM) { handle[i] = (HANDLE)_beginthreadex(NULL, 0, Fun, &i, 0, NULL); i++;//等子线程接收到参数时主线程可能改变了这个i的值} //保证子线程已全部运行结束 WaitForMultipleObjects(THREAD_NUM, handle, TRUE, INFINITE); return 0; } unsigned int__stdcall Fun(void *pPM) { //由于创建线程是要一定的开销的,所以新线程并不能第一时间执行到这来int nThreadNum = *(int *)pPM; //子线程获取参数 Sleep(50);//some work should to do g_nNum++; //处理全局资源 Sleep(0);//some work should to do printf("线程编号为%d 全局资源值为%d\n", nThreadNum, g_nNum); return 0; } 运行结果:

常用反三角函数公式表

反三角函数公式

反三角函数图像与特征 1 :

反三角函数的定义域与主值范围 式中n为任意整数.

反三角函数的相互关系 sin x = x-x3/3!+x5/5!-...(-1)k-1*x2k-1/(2k-1)!+... (-∞= -1 And x < -0.5 Then ArcSin = -Atn(Sqr(1 - x * x) / x) - 2 * Atn(1) If x >= -0.5 And x <= 0.5 Then ArcSin = Atn(x / Sqr(1 - x * x))

If x > 0.5 And x <= 1 Then ArcSin = -Atn(Sqr(1 - x * x) / x) + 2 * Atn(1) End Function ArcCos(x) 函数 功能:返回一个指定数的反余弦值,以弧度表示,返回类型为Double。 语法:ArcCos(x)。 说明:其中,x的取值范围为[-1,1],x的数据类型为Double。 程序代码: Function ArcCos(x As Double) As Double If x >= -1 And x < -0.5 Then ArcCos = Atn(Sqr(1 - x *x) / x) + 4 * Atn(1) If x >= -0.5 And x <= 0.5 Then ArcCos = -Atn(x/ Sqr(1 - x * x)) + 2 * Atn(1) If x> 0.5 And x <= 1 Then ArcCos = Atn(Sqr(1 - x*x) / x) End Function

Java常用类库介绍

教学内容 第七讲Java常用类库介绍 7.1 Java类库的结构 类库就是Java API(Application Programming Interface,应用程序接口),是系统提供的已实现的标准类的集合。在程序设计中,合理和充分利用类库提供的类和接口,不仅可以完成字符串处理、绘图、网络应用、数学计算等多方面的工作,而且可以大大提高编程效率,使程序简练、易懂。 Java类库中的类和接口大多封装在特定的包里,每个包具有自己的功能。表7.1列出了Java中一些常用的包及其简要的功能。其中,包名后面带“. *”的表示其中包括一些相关的包。有关类的介绍和使用方法,Java中提供了极其完善的技术文档。我们只需了解技术文档的格式就能方便地查阅文档。 表7.1Java提供的部分常用包 注:在使用Java时,除了https://www.doczj.com/doc/6617107834.html,ng外,其他的包都需要import语句引入之后才能使用。 7.2 https://www.doczj.com/doc/6617107834.html,ng包中的常用类

https://www.doczj.com/doc/6617107834.html,ng是Java语言最广泛使用的包。它所包括的类是其他包的基础,由系统自动引入,程序中不必用import语句就可以使用其中的任何一个类。https://www.doczj.com/doc/6617107834.html,ng中所包含的类和接口对所有实际的Java程序都是必要的。下面我们将分别介绍几个常用的类。 7.2.1 String类和StringBuffer类 许多语言中,字符串是语言固有的基本数据类型。但在Java语言中字符串通过String类和StringBuffer类来处理。 1.String类 Java语言中的字符串属于String类。虽然有其它方法表示字符串(如字符数组),但Java使用String 类作为字符串的标准格式。Java编译器把字符串转换成String对象。String对象一旦被创建了,就不能被改变。如果需要进行大量的字符串操作,应该使用StringBuffer类或者字符数组,最终结果可以被转换成String格式。 (1)创建字符串 创建字符串的方法有多种方式,通常我们用String类的构造器来建立字符串。表6.2列出了String 类的构造器及其简要说明。 表7.2 String类构造器概要 【例7.1】使用多种方法创建一个字符串并输出字符串内容。 public class StrOutput { public static void main(Sring[] args) { //将字符串常量作为String对象对待,实际上是将一个String对象赋值给另一个 String s1 = "Hello,java!"; //声明一个字符串,然后为其赋值 String s2; s2 = "Hello,java!";

CSerialPort类解析

CserialPort类的功能及成员函数介绍 CserialPort类是免费提供的串口类,Codeguru是一个非常不错的源代码网站CserialPort类支持线连接(非MODEM)的串口编程操作。 CserialPort类是基于多线程的,其工作流程如下:首先设置好串口参数,再开启串口检测工作线程,串口检测工作线程检测到串口接收到的数据、流控制事件或其他串口事件后,就以消息方式通知主程序,激发消息处理函数来进行数据处理,这是对接受数据而言的,发送数据可直接向串口发送。 介绍几个经常用到的函数: 1、串口初始化函数InitPort 这个函数是用来初始化串口的,即设置串口的通信参数:需要打开的串口号、波特率、奇偶校验方式、数据位、停止位,这里还可以用来进行事件的设定。如果串口初始化成功,就返回TRUE,若串口被其他设备占用、不存在或存在其他股占,就返回FALSE,编程者可以在这儿提示串口操作是否成功如果在当前主串口调用这个函数,那么pPortOwner可用this指针表示,串口号在函数中做了限制,只能用1,2,3和4四个串口号,而事实上在编程时可能用到更多串口号,可以通过通过注释掉本函数中“assert(portur>0&&portnr<5)”语句取消对串口号的限制。 if (m_ComPort[0].InitPort(this,1,9600,'N',8,1,EV_RXFLAG | EV_RXCHAR,512)) //portnr=1(2),baud=9600,parity='N',databits=8,stopsbits=1,

//dwCommEvents=EV_RXCHAR|EV_RXFLAG,nBufferSize=512 { m_ComPort[0].StartMonitoring(); //启动串口监视线程 SetTimer(1,1000,NULL); //设置定时器,1秒后发送数据} e lse { CString str; str.Format("COM1 没有发现,或被其它设备占用"); AfxMessageBox(str); } 2、启动串口通信监测线程函数StartMonitoring() 串口初始化成功后,就可以调用BOOL StartMonitoring()来启动串口检测线程,线程启动成功,返回TRUE。 BOOL CSerialPort::StartMonitoring() { if (!(m_Thread = AfxBeginThread(CommThread, this))) return FALSE; TRACE("Thread started\n"); return TRUE; } 注意这个函数一旦调用,就会建立一个线程,这个线程一直不会结束,调用StopMonitoring ()只是将这个线程挂起。 3、暂停或停止监测线程函数StopMonitoring() 该函数暂停或停止串口检测,要注意的是,调用该函数后,串口资源仍然被占用 // // Suspend the comm thread // BOOL CSerialPort::StopMonitoring() { TRACE("Thread suspended\n"); m_Thread->SuspendThread(); return TRUE; } 4、关闭串口函数ClosePort() 该函数功能是关闭串口,释放串口资源,调用该函数后,如果要继续使用串口,还需要调用InitPort()函数。 这里有一个问题,在以前的版本中,如果调用了StartMonitoring函数,关闭串口后,再打开就会出现问题,及网上所说的关闭死锁问题。找了大量资料后,

JAVA中常用类的常用方法

JAVA中常用类的常用方法 一、类 1、clone()方法 创建并返回此对象的一个副本。要进行“克隆”的对象所属的类必须实现. Cloneable接口。 2、equals(Object obj)方法 功能:比较引用类型数据的等价性。 等价标准:引用类型比较引用,基本类型比较值。 存在特例:对File、String、Date及封装类等类型来说,是比较类型及对象的内容而不考虑引用的是否为同一实例。 3、finalize()方法 当垃圾回收器确定不存在对该对象的更多引用时,由对象的垃圾回收器调用此方法。 4、hashCode()方法返回该对象的哈希码值。 5、notify()方法唤醒在此对象监视器上等待的单个线程。 6、notifyAll()方法唤醒在此对象监视器上等待的所有线程。 7、toString()方法 返回该对象的字符串表示。在进行String与其它类型数据的连接操作时,自动调用toString()方法。可以根据需要重写toString()方法。 8、wait()方法 在其他线程调用此对象的 notify() 方法或 notifyAll() 方法前,导致当前线程等待。

二、字符串相关类 l String类 charAt(int index) 返回指定索引处的 char 值。 compareTo(String anotherString) 按字典顺序比较两个字符串。compareToIgnoreCase(String str) 按字典顺序比较两个字符串,不考虑大小写。concat(String str) 将指定字符串连接到此字符串的结尾。 endsWith(String suffix) 测试此字符串是否以指定的后缀结束。 equals(Object anObject) 将此字符串与指定的对象比较。 equalsIgnoreCase(String anotherString) 将此 String 与另一个 String 比较,不考虑大小写。 indexOf(int ch) 返回指定字符在此字符串中第一次出现处的索引。 indexOf(String str) 返回第一次出现的指定子字符串在此字符串中的索引。lastIndexOf(int ch) 返回指定字符在此字符串中最后一次出现处的索引。length() 返回此字符串的长度。 replace(char oldChar, char newChar) 返回一个新的字符串,它是通过用 newChar 替换此字符串中出现的所有 oldChar 得到的。 split(String regex) 根据给定正则表达式的匹配拆分此字符串。 startsWith(String prefix) 测试此字符串是否以指定的前缀开始。 substring(int beginIndex) 返回一个新的字符串,它是此字符串的一个子字符串。该子字符串始于指定索引处的字符,一直到此字符串末尾。

C多线程编程实例实战

C#多线程编程实例实战 问题的提出 所谓单个写入程序/ 多个阅读程序的线程同步问题,是指任意数量的线程访问共享资源时,写入程序(线程)需要修改共享资源,而阅读程序(线程)需要读取数据。在这个同步问题中,很容易得到下面二个要求: 1 )当一个线程正在写入数据时,其他线程不能写,也不能读。 2 )当一个线程正在读入数据时,其他线程不能写,但能够读。在数据库应 用程序环境中经常遇到这样的问题。比如说,有n 个最终 用户,他们都要同时访问同一个数据库。其中有m个用户要将数据存入数据库,n-m 个用户要读取数据库中的记录。 很显然,在这个环境中,我们不能让两个或两个以上的用户同时更新同一条记录,如果两个或两个以上的用户都试图同时修改同一记录,那么该记录中的信息就会被破坏。 我们也不让一个用户更新数据库记录的同时,让另一用户读取记录的内容。因为读取的记录很有可能同时包含了更新和没有更新的信息,也就是说这条记录是无效的记录。 实现分析 规定任一线程要对资源进行写或读操作前必须申请锁。根据操作的不同,分为阅读锁和写入锁,操作完成之后应释放相应的锁。将单个写入程序/ 多个阅读程序的要求改变一下,可以得到如下的形式: 一个线程申请阅读锁的成功条件是:当前没有活动的写入线程。 一个线程申请写入锁的成功条件是:当前没有任何活动(对锁而言)

的线程 因此,为了标志是否有活动的线程,以及是写入还是阅读线程,引入一个变量m_nActive ,如果m_nActive > 0 ,则表示当前活动阅读线程的数目,如果 m_nActive=0 ,则表示没有任何活动线程,m_nActive <0 ,表示当前有写入线程在活动,注意m_nActive<0 ,时只能取-1 的值,因为只允许有一个写入线程活动。 为了判断当前活动线程拥有的锁的类型,我们采用了线程局部存储技术(请参阅其它参考书籍) ,将线程与特殊标志位关联起来。 申请阅读锁的函数原型为:public void AcquireReaderLock( int millisecondsTimeout ) ,其中的参数为线程等待调度的时间。函数定义如下:public void AcquireReaderLock( int millisecondsTimeout ) { // m_mutext 很快可以得到,以便进入临界区m_mutex.WaitOne( ); // 是否有写入线程存在 bool bExistingWriter = ( m_nActive < 0 ); if( bExistingWriter ) { // 等待阅读线程数目加1, 当有锁释放时,根据此数目来调度线程 m_nWaitingReaders++; } else { // 当前活动线程加1 m_nActive++; } m_mutex.ReleaseMutex();

高级语言C++程序设计高级编程-期末考试 - 答案

高级语言C++程序设计-高级编程-考试试卷—答案 姓名: ________________ 成绩__________________ 第一题选择( 1. 设x和y均为bool量,则x&&y为真的条件是( A ) A)它们均为真B)其中一个为真C)它们均为假D)其中一个为假 2. 假定a为一个整型数组名,则元素a[4]的字节地址为( C ) A)a+4 B)a+8 C)a+16 D)a+32 3. 下面的哪个保留字不能作为函数的返回类型( C ) A)void B)int C)new D)long 4. 在编译指令中,宏定义使用哪个指令( B ) A)#include B)#define C)#if D)#else 5. 设存在函数int max(int,int)返回两参数中较大值,若求22,59,70三者中最大值,下列表达式不正确的是:(C ) A)int m = max(22,max(59,70));B)int m = max(max(22,59),70); C)int m = max(22,59,70);D)int m = max(59,max(22,70)); 6. 对于int *pa[5];的描述中,正确的是:( D ) A)pa是一个指向数组的指针,所指向的数组是5个int型元素 B)pa是一个指向某数组中第5个元素的指针,该元素是int型变量 C)pa[5]表示数组的第5个元素的值,是int型的值 D)pa是一个具有5个元素的指针数组,每个元素是一个int型指针 7. 对C++语言和C语言的兼容性,描述正确的是:( A ) A)C++兼容C B)C++部分兼容C C)C++不兼容C D)C兼容C++ 8. 下列的各类函数中,不是类的成员函数。( C ) A)构造函数B)析构函数C)友元函数D)拷贝初始化构造函数 9. 在类定义的外部,可以被访问的成员有( C ) A)public和protected类成员B)private的类成员 C) 仅public的类成员D)public和private的类成员 10. 关于类和对象不正确的说法是:( C ) A)类是一种类型,它封装了数据和操作B)对象是类的实例 C)一个类的对象只有一个D)一个对象必属于某个类 11. 在C++中用( D )能够实现将参数值带回。 A)数组和指针B)指针和引用C)仅指针D)数组, 指针和引用 12. 在公有继承的情况下,基类的成员(私有的除外)在派生类中的访问权限( B ) A)受限制B)保持不变C)受保护D)不受保护 13. 关于构造函数的说法,不正确的是:( A ) A)没有定义构造函数时,系统将不会调用它B)其名与类名完全相同 C)它在对象被创建时由系统自动调用D)没有返回值 14. 系统在调用重载函数时,不能作为确定哪个重载函数被调用的依据是:( D )

大学高数 函数与反三角函数图像

三角函数公式和图象总结 1.与角α终边相同的角,连同角α在内,都可以表示为S={β|β=α+k ×360,k ∈Z} 2.弧长公式:α?=r l 扇形面积公式lR S 21 = 其中l 是扇形弧长,R 是圆的半径。 3.三角函数定义: sin ,cos ,tan y x y r r x ααα===,其中P (,)x y 是α终边上一点,||r OP = 4.同角三角函数的两个基本关系式 22 sin sin cos 1 tan cos ααααα +== sin sin αsin β tan tan α

sin cos), a x b x x? +=+其中tan b a ?=,?所在的象限与点(,) a b所在的象限一 致。

12.①sin()(0)y A x b A ω?=++>、cos()(0)y A x b A ω?=++>的最小正周期为 || ω,最大值为A+b ,最小值为-A+b. ②tan()(0)y A x b A ω?=++>的最小正周期为|| π ω 13.正弦定理: A a sin = B b sin =C c sin = 2R (R 为三角形外接圆半径) 14.余弦定理:2 2 2 2cos a b c bc A =+- bc a c b A 2cos 2 22-+= 15.S ⊿= 21a a h ?=21ab C sin =21bc A sin =2 1ac B sin =R abc 4=2R 2 A sin B sin C sin =))()((c p b p a p p ---(其中)(2 1 c b a p ++=, r 为三角形内切圆半径) 反三角函数图像与反三角函数特征 反正弦曲线 反余弦曲线 拐点(同曲线对称中心):,该点切线斜率为1 拐点

相关主题
文本预览
相关文档 最新文档