2007年5月29日星期二

opengis下WFS查询和与数据库链接查询的实现【1】

opengis下WFS查询和与数据库链接查询的实现



这个学期奉导师命令入手搞geoserver,这个地图系统的确让我研究了半天,一个是


中文资料太少,另外一个是体系和那些收费地图系统很不一样。


搞了几个月,略有小成,也搞出一套,支持放大、缩小、拖动,地图信息检索和查询


的系统。在这里写些经验之谈,希望刚入门的同学可以比我少花点时间



第一篇:简单的介绍我的GEOSERVER工作环境


这里所说的opengis,主要是基于geoserver体系下的gis工程。 自从上研后给导师


干了不少活,很多都是和GIS相关的。也使用过中科院遥感所的geobeans地图系统。和


超图公司的supermap IS系统 。这些都是自成一派的体系,比如在地图格式上:


geoserver的地图为geo格式,supermap也有自己的格式。地图之间数据共享和数据接口


统一,干起来也很不爽。很多时间都花在地图处理上了。


后转入研究geoserver,由于我本来是学计算机的,半路来搞,也只浅尝即止。谈谈对


geoserver的感觉。


很明显的,geoserver仅仅是一个地图支持系统,而进行地图处理的是其他软件,在


此推荐用uDig来进行简单的地图处理。如果要进行复杂的话,可以用mapinfo什么的。


只要用shp都可以很方便的读取。



而客户端浏览软件,有网络端和桌面端,桌面端直接是uDig就可以了。而在网络端,


有很多成型的客户端大多使用AJAX技术,其实我的大部分时间都花在写JAVASCRIPT和


xml上面了。推荐两个成型的系统,一个是自带的mapbuilder,这个虽然看起来界面简单


时间的功能很强大,体系也是典型的Ajax体系。我主要就是基于这个客户端的。还有一个


是openlayers,这个相对于mapbuilder功能少很多,更主要的是对WFS(Web Feture Service)


几乎不支持,但是如果只作简单的地图的话,还是很方便的,入手比mapbuilder简单多了。



地图数据库,如果是小品式的地图显示可以直接读SHP地图格式,但是,如果想功能更强大,


使用更合理,还是推荐使用地图数据库,幸运的,geoserver有一个很棒的地图数据库作为


配备。就是PostgreSQL,这个开源数据库功能强大,中文支持也相当好,和JDBC链接也很方便


可以说,比留下的MYSQL更好。最好使用PostgreSQL作为你的地图数据库。也可以顺便解决了


有点麻烦的SHP中文乱码问题。



GEOSERVER常见的缩写



GML:我把它看作是XML的一个子集,可以用来描述地图的情况,也可以用来查询检索地图,比如在WFS情况下,


一般来说,页面里面处理的一堆东西都是这。





SLD:地图描述,很多时候导入的地图和心里想的不一样,就是地图描述没搞好。这个也是XML形式的语言。简单的


可以用uDig里面找到。





WMS:网页地图服务,如果看到想看到地图什么的就找这个吧关注放大、缩写、拖动等功能


WFS:网页地图信息服务,这个是地图信息的服务,比如地图查询,知道名字找地图,或者是点地图看地点信息等,就是


这个支持的。




应该看看的站点:


兽族的荣耀:提供了一个系列的入门文章,我也是看着来学的。


PostgreSQL 中文之家:Postgresql数据库的交流中文站


Geoinformatics:一位搞GIS同学的BLOG,比较郁闷的是都是英文。


http://geoserver.org/:geoserver的官网,除了英文多了点外,其他都很好,有很完整的教程。


Mapbuilder :mapbuilder的站点,相当好,非常多的例子,很教学。


Building A Web App :一个很完整的例子,我的就是抄他的做的。



阅读全文

对中国股市的现状的思考

在SC论坛的高人小布的一篇文章。
转载过来,研究研究

从今年1月以来,我的思考方向从如何在牛市中获利,转变成泡沫是如何破灭的.提早一步做到心里有数,主要研究方向是历次大国崛起中的泡沫形成与破灭,在本世纪较有参考性的则是美国的三次,29年,69年,01年.日本则是89年.虽然中美日国情不同,但是经济规律总有其普遍性的一面.美国和日本的经济基础都不同,美国是大国,地产与股市资源宽裕,自由市场为主导,体现出的是地产与股市互为起落的特征.同时美国三次大泡沫中,有两次是技术突破带来的泡沫,只有69年是纯资金推动型.日本则为政府主导,出口导向型,长期高储蓄率,高外汇储备,货币升值后带来了纯资金推动型泡沫,但日本是小国,证券土地资源都很有限,所以呈现了土地证券全面上涨的态势.







中国是两国特征兼而有之,又有不同,我们具备美国的容量,日本的架构,同时还有两者都没有的强大发展潜力.那中国的资产市场将会在这些特征下如何发展呢?







悲观的莫过于泡沫论,说中国股市,房市和发达国家成熟市场相比都远远高估,中国资产市场将遇到泡沫破灭,陷于崩溃的局面.这种观点是忽略了中国作为世界第一人口大国崛起的力量和速度.资产市场的价格就是预计未来,13亿中国人从落后贫穷,到大家衣时住行都要小康,当中要发挥多大的力量?成熟市场的GDP增长只有2%,大象企业增长5%.中国则分别是10%和20%以上,既然增长如此不同,那对未来的复合增长预期自然要相差很大,那市盈率自然会差别很大,直接拿西方成熟市场作为参照的是不科学的.







乐观的观点,则是正好相反,极力夸大中国的高增长,认为只要中国高增长,就能包医百病.首先中国高增长也是建立实体经济发展的基础之上的,实体经济的成长决没有虚拟经济增长那么容易,中国还有各种各样的体制性问题,资源性问题要解决.所以中国的高增长也只会在合理的速度成长,而不是大跃进的速度成长.第二,中国经济高增长也不是这两年牛市才有的事情,中国经济高增长已经持续了很多年,但照样产生02-05四年大熊市,说明股市在中短期内并不一定会和经济增长同步,而是随着经济增长上下波动.看好中国未来成长现在不过成为了很多散户或者投机者内心的救命草而已,给投机一个看似合理的理由。





那么中国的股市到底是如何趋向呢?是否见顶呢?如果拿市盈率作为指标,美国的平均市赢率是达到60多-70倍破灭的,而日本则是达到200倍.但是巧合的是相对比较稳定的市净率却是一致的从1.5倍到5倍而崩盘.打个可能不完全恰当的比如,把美国股市和日本股市看成两个股票,那美国无疑是大盘绩优股,而89年的日本则是小盘成长股.那中国当前的现状就是拥有资产重组题材的大盘成长股了.那么这样来说中国平均市盈率的极限应该美国之上,日本之下.再拿数据说话,据统计,一般上市公司的平均业绩增长是GDP增长速度的2.5倍到4倍,中国连续多年10%左右的速度成长,那中国上市公司的平均业绩增长至少是25%-40%.抛去07年新会计准则的调整,以受影响较小的大盘蓝筹股如中石化,工商银行,中国人寿等的业绩增长都是超过30% H股没有涉及会计调整,同样获得同样的业绩涨幅, 并非只是会计游戏,而是经济增长的体现.如此强劲的增长之下,中国市盈率溢价是合情合理的.按照国际上市盈率计算法则,30%的增长,可以获得30倍的动态市盈率以及一年期69倍静态市盈率.将近70倍市盈率在美国市场几乎可判死刑,而在中国的强劲增长条件下,却只能算的上是合理估值,如果按照高估的定义,高出30%以上的实际价值,至少也要高出21点,即整体市场90倍市盈率才是中国市场的泡沫破裂的极限.而目前中国市场的整体市盈率还只有50倍出头,虽然不低,却离极限还有相当距离.从另一个指标,市净率指标,目前中国整体市净率是4倍,离5倍这个破裂值也有25%的差距,同时随着资产注入,股本增发的增多,中国企业的资产上升也是相当快速的.从而延缓了市净率的增长速度.从更长期来看,中国的人口红利即生育高峰的人口到达45岁高消费期还有20年的时间,中国将面临的极有可能不仅是黄金10年,可能是20年.中国的规模有足够的惯性和容量.







据上面的一些指标分析,是不是说明中国股市目前很健康?答案也没有那么简单.的确中国股市还有上升的空间,但是从个股来讲,却不是如此.那些业绩好,成长快,占据行业优势\的优质企业并未产生很重大的泡沫,而许多概念股,垃圾股却已经大大超出了实际价值,进入了危险的区间.纵观本次牛市行情,可以说07年3月以前还是合理的,理智的.资金主要是抢占优质行业,优质企业.3月之后的市场则开始了相当的疯狂,可以说出现了很多牛市末日的特征:散户控盘,概念垃圾当道,IPO热潮,短线交易盛行,鸡尾酒理论第四阶段等等.曾经受到做为市场风向标的基金,QFII在这两个月中是踏空的,以他们的标准来看市场已经到了危险的地步.相反大量的散户的涌入,导致了市场力量的改变,机构从90%减少的30%,而散户却上升到了70%.散户在两个月内大大战胜了基金,战胜了专业投资人.这一切合理吗?难道毫无经验的散户真的能够战胜专业,资金雄厚消息灵通的机构投资人?或许少数散户能够做到,但是整个散户群都能做到战胜机构却是不可思议的.从短期来讲,散户控盘是非常危险的.投资大师说投资三大要素:常识,独立思考,耐心,这三条散户都不具备,散户市是建立在脆弱的基础上,短线的股市如同一个巨大的旁氏骗局,每个人需要更多的下线才能保持收益,一旦大盘无力上攻,或新入资本不足,散户就极易造成恐慌式崩盘.以美国1962年为例,做为美国历史上最后一次散户市,散户在盲目追高股市后又恐慌抛盘,最后被机构逢低接盘,机构成了大赢家和大英雄.从此机构彻底成为市场的主力.在国外市场,机构要占据市场的8成以上,这是成熟市场发展的必然趋势.







所以中国的股市,长期来讲只是起步,中期来说也有理论的空间.而短期积累的风险却非常大了.这并不是说一定要立刻出现调整,或者急挫.在狂热的市场投机心理下,任何超出想象的奇迹都会发生,而结果却是不用想象的灾难.所以在中国股市中,除了散户,机构,企业以外,另一个至关重要的角色一定要出场了,那就是中国政府的态度以及手段.诚如前面所分析的:中国股市还有非常远大的前景,中国股市远还未到达实现资产证券化,高效率配置金融资源的融资市场的境界.在多数人眼里,股市还不过一个几年一遇的大赌场而已.政府的态度可以断定:股市一定要保,但是不是通过上涨,吸引更多的投机资本或不稳定的散户资本来保.目前散户控盘的急速上涨的局面如果不加以控制,那么发展下去极有可能让未来大有可为的股市又一夜回到革命前.覆巢之下焉有完卵,泡沫破灭之下的败局,是需要全社会来承担的.如果等到日本89年已经泡沫到不可收拾的时刻,政府才加以控制,代价是几乎20年的停滞和倒退.所以长痛不如短痛,政府必将干预股市.所幸政府能够使用的工具还很多.第一控制流动性泛滥:低利率,低汇率曾经是中国前几年快速增长的两个法宝.企业能够以低成本获得资本,并低价格进行出口.但是如同日本当年一样,中国人民币一经升值,立刻引来了两大挑战,一个是国外资本流入获取升值利益,导致国内资产价格上涨, 从而让国内低利息高储蓄率环境下的资金也一拥而出,追逐资产价格上涨的收益.二是汇率上升是否将对出口导向型的企业造成巨大的压力?吸取日本当年升值过快导致资产上涨过快,企业实力却下降的教训.中国政府是坚持逐步提高汇率,以时间换空间,让市场,让企业都获得缓冲的机会.政府两难的地方在于降低国内的流动性过剩必须升息,升息却又会进一步吸引外部的流动资本进入导致进一步升值这样的恶性循环.,难免使用国家调控工具的时候投鼠忌器.2007前几个月国内经济运行的情况来看,形势比较危急了,已经到了过热的边缘:能源,农产品价格直线上升,名义CPI到达了政府可以容忍的上线,实际CPI更多还要高出不少.股市异常火爆,5个月就翻了一翻而苦心打压的房市也开始卷土重来.政府必须要拿出决心了,国内流动性过剩即将到了不可控制的地步,而汇率却还在国家控制力之内,目前第一要务就是缓解国内的流动性过剩问题.几次提高储备金率,提高利率,甚至在5月21日历史第一次三大棒齐下,前面已经说过了提高利率是双刃剑,政府要进行调控的决心是显而易见,是坚定的.那股市又如何反映呢?散户控盘的情况下,无知无畏.把每次政府的调控举措当作是利空出净.当作是利好.目前QFII,社保,保险等机构已经成撤离状态,基金也是仓位下降.散户却还是义无反顾,天天数钱.中国的散户都是使用自有资金,所以上升0.27的利率对散户来说实在太没有吸引力了,政府对老百姓的自有财产也是控制力不足.正因为如此,要改变现在股市逐步迈向危险的格局最好的办法是一个措施接一个措施的出台,让股市暂时失去赚钱效应,让散户能够在损失还不至于严重影响社会和谐的条件下,把钱流出.,即便不流回银行,即使不撤离股市也要流到政府更容易控制的基金,估值相对较低的H股,B股,甚至于QDII产品中去.或者加速大盘红筹的回归,扩大股票供给,或者尽快建立做空机制,让机构有套期保值的工具得以规避系统性风险.无论怎么说,于2007年3,4月进入股市的散户来讲,不但虚幻的胜利果实终将全部要吐出去,而且会为自己的无知和不理智付上学费.


阅读全文

2007年5月26日星期六

这个两个老家伙是不是很面熟呀

帕克莱利,和菲尔杰克逊,在NBA教练里也算是东邪西毒的人物,没想到以前还过过招呀。
而且还一个是纽约一个在湖人,互换东家呀


阅读全文

暗黑破坏神2 或许借鉴 夺宝奇兵中的一个桥段

今天正在看夺宝奇兵1,突然发现里面一个桥段和暗黑二中的一段剧情特别相似。
就是琼斯博士用镶有水晶的折射阳光,得到藏宝的地址。
而在暗黑2中的ACT2,玩家用赫拉迪克法杖折射光线,找到都瑞尔的地堡。
两个桥段如此相似,又都是在有阿拉伯情调的地方(电影是在埃及)。
很怀疑暴雪公司的员工也是DR.JONES的粉丝呀。
阅读全文

2007年5月25日星期五

如何在博客首页中实现摘要显示

有时候文章很长,如果在首页显示就会占用太多空间。
而blogspot现在还不支持摘要显示。


这个的确是一个让人麻烦的问题。


经过搜来搜去在水瓶子 这个博客上找到一个凑合的方法。


1.在template里面找到



<p><data:post.body/></p>



2.把这个替换为


<b:if cond='data:blog.pageType == "item"'>

<style>.fullpost{display:inline;}</style>

<p><data:post.body/></p>

<b:else/>

<style>.fullpost{display:none;}</style>

<p><data:post.body/>

<br></br>

<b:if cond='data:post.url'>

<a expr:href='data:post.url'>More......</a>

<b:else/>

<data:post.title/>

</b:if>

</p>

</b:if>






3.然后在问题中要隐藏的部分前后加上


<span class="fullpost"></span>

阅读全文

个人看好中信证券到100

个人看好中信证券到100
到100是计算出来的,不是想出来的
按照2季度的成交量,中信获利至少1元/股
全面保守估计是3元
还不包括H股增发和估指期货效应不明
3元,按照保守的静态市盈率来算,上100不过33倍
如果市场热到按照动态市盈率来算,120-150都有可能
驰红信者去年5月只有30元,今年年初已经190元了(复权计算)
如果年底中信证券发布高年报,高配送,那能涨到多少我也没谱了

阅读全文

每 日 A 股 参 考 -------5月25日

每天看内参中 个人感觉有意思的东西
下周初存在变盘的可能

【博览财经报道】周四大盘剧烈震荡,沪市成交与5月9日的天量相当。消息面上,1、证监会发布《关于证券公司依法合规经营,进一步加强投资者教育有关工作的通知》,这与前期发给基金公司和投资咨询公司的规范和警示文件对应。2、多家国内商业银行正根据银监会去年底明确的“严格禁止任何企业和个人挪用银行信贷资金直接或间接进入股市”精神,加大对日常信贷运行和管理的检查力度。此调控举措,将导致部分违规资金出逃。3、QFII额度提高到300亿美元,国家决定放开国外证券公司进入国内证券市场,这对多头信心有一定提振。近阶段密集的信息传递到多方和空方阵营会有不同的解读,但一系列的政策调控和风险警示下,多空的分歧也开始加大,体现在盘面中就是股指剧烈震荡,盘中不时出现快速跳水和快速反弹,并且在此过程中成交量能急剧放大。
盘中的跳水击穿了5日线的支撑并一度击穿4100点。但并没有回补5月22日14点的跳空缺口。可见多头仍在维持盘面的强势。而尾盘的回升表明在短暂消化了消息面不利因素后有短线技术性买盘加入。投资者谨慎情绪加重导致拉高意愿减弱,但回调过程中下档承接盘也比较有力。而连续三日量能的充沛一方面表明多空争夺的加剧,另一方也预示短线仍有反复。顶部的构筑依然是复杂的过程,不要想象的过于简单。
政策面和技术面的共振使得5月底和6月初的走势变得非常敏感。一方面,投资者要感受到政策面的变化,对于现在鱼尾行情的性质要有充分的认识。另一方面,要认识到顶部构筑的复杂性,特别是这样一个大行情的顶部,从时间上和空间上都会与一般的顶部有不同。现在只能算是顶部构筑的初期,其间依然会有反复,甚至可能会有继续推高指数的动作,近日不排除会再出阳线,但这也是做顶的一部分。今日重要支撑是缺口4086点,压力为昨日高点4208点。如果今日击穿昨日下影线低点则短线形势可能恶化,否则依然运行再温和推高卸除投资者防卫心理的过程中。顶部的构筑往往在明显利空出台时开始,但高点往往在大部分投资者对利空麻木和淡忘的时候形成。在市场防卫心理松懈的时候往往会有震撼性的打击。现在的市场在政策面的连续警示和调控及舆论的配合下,投资者的防卫心理很强。那么,现在可能不是最震撼的时候。下周初将是对周末消息面反应及收月线的时候,存在变盘的可能,密切关注。(李永阳)
如果管理层下决心打压股市是一定能成功的

【博览财经报道】从市场参与各方的言论看,QFII以唱空为主,基金对于后市看法低调,肯表态者较少,券商人士大多看多后市。各类经济学家多空参半,刘纪鹏和韩志国以唱多为主,唱空的也出现了空军司令,这是嘴上的争斗。还有力量上的争夺,这就要看管理层与市场主力之间的动作。管理层连出利空,存款准备金、加息都用上了,主力资金却拿管理层的利空政策当洗盘的契机:你发一个利空,我低开一下,然后大资金拉起,继续上扬。看似管理层的调控每次都有了收效,但无奈市场资金太多,利空都被淹没在人民币的汪洋大海之中。虽然股市钱多,但总有上市公司估值,别看现在股价涨得欢实,但市盈率是越来越高,再涨下去,风险也就越来越大,管理层调控股市,主要是为了避免风险。
后面还有没有利空,肯定还有,提高印花税,再不行就开征资本利得税,虽然刚有人站出来说:“未听说要提高印花税。”但“未听说”可不是管理层没说要提高印花税,只是有关人士没听说而已。提高印花税可是大利空,要说主力资金并非来自银行信贷,或对些许利率提高不重视,这都说的过去,但在股市交易,能不缴印花税吗?如果加到历史最高水平0.5%,每天3000亿元的成交量将缴纳30亿元印花税,主力怕不怕?还不怕,再开征资本利得税,炒股收入要上缴20%所得税,还有多少人炒股票?所以说,如果管理层下决心打压股市,是一定能够成功的。之所以没有贸然加税,很可能是希望市场自己实现软着陆。可以肯定的是,对于目前股市这头疯牛,管理层已看不顺眼了,如果疯牛不加治理,很可能会演变成未来的大型股灾。防患于未然,在股市还能控制的时候及早调控,才能实现黄金十年,十年牛市比两年疯狂要对中国经济有利得多。(北京商报)
短线荐股精选
飞乐音响(600651):收购券商超越河池
近期,以河池化工为首的收购券商股权题材极为火爆,而公司近期公告拟收购华鑫证券20000万股股权,收购完成后,公司将持有华鑫证券24000万股,为其第二大股东,而华鑫证券总资产高达28.8亿元,并拥有21家证券营业部,此外,公司还持有申银万国176万股,申银万国是我国券商中排行前三的行业巨头,06年其业绩暴增了192%,因此公司的券商题材极为强大,其股权增值十分迅猛,特别是券商的借壳上市更将是引发其股价连续暴涨的导火索。近期该股走出了价升量增的走势,主力进场吸纳迹象十分明显,股价即将再度井喷。(联合证券)
五洲交通(600368):列在建设“新特区”首位
目前广西全区高速公路的经营、建设等,主要由广西交通厅属下的广西高速公路管理局管理,其正不断把高速公路资产注入到五洲交通,如把岑罗高速、坛百高速股权转让给五洲交通。五洲交通在06年报中表示,将争取收购新的高速公路,包括加快收购南宁环城高速公路(108公里)的工作进程。综合分析,北部湾经济区入选第三个“新特区”的机会很高,成功后区内的交通建设工作将被摆在首位,作为区内唯一的公路建设股,五洲交通自然当仁不让,大股东广西高速公路管理局也会全力支持,且区内的车流量将会随经济区开发而激增,路费收入将水涨船高。该股在低价股当中,业绩属中上,盘子不大,且发展前景非常广阔,未来有较大的潜力。(银河证券 魏志华)

阅读全文

2007年5月24日星期四

Elevator Control System(1)

电梯问题作业,第一篇
The general requirement is to design and implement a program to schedule and control four elevators in a building with 40 floors. The elevators will be used to carry people from one floor to another in the conventional way.

Efficiency: The program should schedule the elevators efficiently and reasonably. For example, if someone summons an elevator by pushing the down button on the fourth floor, the next elevator that reaches the fourth floor travelling down should stop at the fourth floor to accept the passenger(s). On the other hand, if an elevator has no passengers (no outstanding destination requests), it should park at the last floor it visited until it is needed again. An elevator should not reverse its direction of travel until its passengers who want to travel in its current direction have reached their destinations. (As we will see below, the program cannot really have information about an elevator's actual passengers; it only knows about destination button presses for a given elevator. For example, if some mischievous or sociopathic passenger boards the elevator at the first floor and then presses the destination buttons for the fourth, fifth, and twentieth floor, the program will cause the elevator to travel to and stop at the fourth, fifth, and twentieth floors. The computer and its program have no information about actual passenger boardings and exits.) An elevator that is filled to capacity should not respond to a new summon request. (There is an overweight sensor for each elevator. The computer and its program can interrogate these sensors.)
Destination button: The interior of each elevator is furnished with a panel containing array of 40 buttons, one button for each floor, marked with the floor numbers (1 to 4 These destination buttons can be illuminated by signals sent from the computer to t panel. When a passenger presses a destination button not already lit, the circuitry behind the panel sends an interrupt to the computer (there is a separate interrupt for each elevator). When the computer receives one of these (vectored) interrupts, its program can re the appropriate memory mapped eight-bit input registers (there is one for each interrupt hence one for each elevator) that contains the floor number corresponding to the desti tion button that caused the interrupt. Of course, the circuitry behind the panel writes t floor number into the appropriate memory-mapped input register when it causes the v tored interrupt. (Since there are 40 floors in this application, only the first six bits of ea input register will be used by the implementation; but the hardware would support a bui ing with up to 256 floors.)
Destination button lights: As mentioned earlier, the destination buttons can be illu nated (by bulbs behind the panels). When the interrupt service routine in the progr receives a destination button interrupt, it should send a signal to the appropriate panel illuminate the appropriate button. This signal is sent by the program's loading the number the button into the appropriate memory-mapped output register (there is one such regis for each elevator), The illumination of a button notifies the passenger(s) that the syst has taken note of his or her request and also prevents further interrupts caused by ad tional (impatient?) pressing of the button. When the controller stops an elevator at a floor should send a signal to its destination button panel to turn off the destination button for t floor.

Floor sensors: There is a floor sensor switch for each floor for each elevator sh When an elevator is within eight inches of a floor, a wheel on the elevator closes the swi for that floor and sends an interrupt to the computer (there is a separate interrupt for the of switches in each elevator shaft). When the computer receives one of these (vectore interrupts, its program can read the appropriate memory mapped eight-bit input regis (there is one for each interrupt, hence one for each elevator) that contains the floor numb corresponding to the floor sensor switch that caused the interrupt.
Arrival lights: The interior of each elevator is furnished with a panel containing one ill minable indicator for each floor number. This panel is located just above the doors. T purpose of this panel -is to tell the passengers in the elevator the number of the floor which the elevator is arriving (and at which it may be stopping). The program should illu nate the indicator for a floor when it arrives at the floor and extinguish the indicator for floor when it leaves a floor or arrives at a different floor. This signal is sent by the progra loading the number of the floor indicator into the appropriate memory-mapped output regi ter (there is one register for each elevator).
Summons buttons: Each floor of the building is furnished with a panel containing su mon button(s). Each floor except the ground floor (floor 1) and the top floor (floor 40) is f nished with a panel containing two summon buttons, one marked UP and one mark DOWN. The ground floor summon panel has only an UP button. The top floor summ panel has only a DOWN button. Thus, there are 78 summon buttons altogether, 39 UP b tons and 39 DOWN buttons. Would-be passengers press these buttons in order to summ an elevator. (Of course, the would-be passenger cannot summon a particular elevator. T scheduler decides which elevator should respond to a summon request.) These summ buttons can be illuminated by signals sent from the computer to the panel. When a passenger presses a summon button not already lit, the circuitry behind the panel sends a vectored interrupt to the computer (there is one interrupt for UP buttons and another for DO buttons). When the computer receives one of these two (vectored) interrupts, its program can read the appropriate memory mapped eight-bit register that contains the floor number corresponding to the summon button that caused the interrupt. Of course, the cir cuitry behind the panel writes the floor number into the appropriate memory-mapped inpu register when it causes the vectored interrupt.
Summon button lights: The summon buttons can be illuminated (by bulbs behind the panels). When the summon button interrupt service routine in the program receives an UP or DOWN button vectored interrupt, it should send a signal to the appropriate panel to illuminate the appropriate button. This signal is sent by the program's loading the number of the button in the appropriate memory-mapped output register, one for the UP buttons and one for the DOWN buttons. The illumination of a button notifies the passenger(s) that the system has taken note of his or her request and also prevents further interrupts caused by additional pressing of the button. When the controller stops an elevator at a floor, it should send a signal to the floor's summon button panel to turn off the appropriate (UP or DOWN) button for that floor.

Elevator motor controls (Up, Down, Stop): There is a memory-mapped control word for each elevator motor. Bit 0 of this word commands the elevator to go up, bit 1 commands the elevator to do down, and bit 2 commands the elevator to stop at the floor whose sensor switch is closed. The elevator mechanism will not obey any inappropriate or unsafe command. If no floor sensor switch is closed when the computer issues a stop signal, the elevator mechanism ignores the stop signal until a floor sensor switch is closed. The computer program does not have to worry about controlling an elevator's doors or stopping an elevator exactly at a level (home) position at a floor. The elevator manufacturer uses conventional switches, relays, circuits, and safety interlocks for these purposes so that the manufacturer can certify the safety of the elevators without regard for the computer controller. For example, if the computer issues a stop command for an elevator when it is within eight inches of a floor (so that its floor sensor switch is closed), the conventional, approved mechanism stops and levels the elevator at that floor, opens and holds its doors open appropriately, and then closes its door. If the computer issues an up or down command during this period (while the door is open, for example), the manufacturer's mechanism ignores the command until its conditions for movement are met. (Therefore, it is safe for the computer to issue and up or down command while an elevator's door is still open.) One condition for an elevator's movement is that its stop button not be depressed. Each elevator's destination button panel contains a stop button. This button does not go to the computer. Its sole purpose is to hold an elevator at a floor with its door open when the elevator is currently stopped at a floor. A red emergency stop switch stops and holds the elevator at the very next floor it reaches irrespective of computer scheduling. The red switch may also turn on an audible alarm. The red switch is not connected to the computer.
Target machine: The elevator scheduler and controller may be implemented for any contemporary microcomputer capable of handling this a lication.

阅读全文