<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article  PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd"><article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="3.0" xml:lang="en" article-type="research article"><front><journal-meta><journal-id journal-id-type="publisher-id">IJCNS</journal-id><journal-title-group><journal-title>International Journal of Communications, Network and System Sciences</journal-title></journal-title-group><issn pub-type="epub">1913-3715</issn><publisher><publisher-name>Scientific Research Publishing</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.4236/ijcns.2009.24034</article-id><article-id pub-id-type="publisher-id">IJCNS-543</article-id><article-categories><subj-group subj-group-type="heading"><subject>Articles</subject></subj-group><subj-group subj-group-type="Discipline-v2"><subject>Computer Science&amp;Communications</subject></subj-group></article-categories><title-group><article-title>
 
 
  Design and Implementation for Ladder Diagram in Hydropower Simulation System Based on All Paths Searching Algorithm
 
</article-title></title-group><contrib-group><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>o</surname><given-names>LI</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Hai</surname><given-names>ZHAO</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Chun-He</surname><given-names>SONG</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Hui</surname><given-names>LI</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Jun</surname><given-names>AI</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib></contrib-group><aff id="aff1"><addr-line>College of Information Science and Engineering, Northeastern University, Shenyang, China</addr-line></aff><pub-date pub-type="epub"><day>15</day><month>07</month><year>2009</year></pub-date><volume>02</volume><issue>04</issue><fpage>318</fpage><lpage>324</lpage><history><date date-type="received"><day>August</day>	<month>13,</month>	<year>2008</year></date><date date-type="rev-recd"><day>November</day>	<month>18,</month>	<year>2008</year>	</date><date date-type="accepted"><day>January</day>	<month>29,</month>	<year>2009</year></date></history><permissions><copyright-statement>&#169; Copyright  2014 by authors and Scientific Research Publishing Inc. </copyright-statement><copyright-year>2014</copyright-year><license><license-p>This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/</license-p></license></permissions><abstract><p>
 
 
  An approach to design and implement the control function of LD (Ladder Diagram) in the hydropower simulation system based on all paths searching algorithm is proposed in this paper. LD is widely used as a programming language for PLC (Programmable Logic Controller), but it doesn’t be executed automatically in the hydropower simulation system which is a software system, and there is no compiler or interpretation for LD in it. The approach in this paper is not only to present a graphical interface to design LD, but also implement its control function through transforming it to a corresponding undigraph, in which, all paths be-tween two vertexes (live wire and null line) are searched by the proposed algorithm. An application example is presented to verify the validity of the algorithm and shows that the algorithm is correct and practicable. In addition, how to implement the control function based on object-oriented thought is introduced. The running time is shown at last, which proves that the system with the algorithm can meet the real-time request in the hydropower simulation system.
 
</p></abstract><kwd-group><kwd>Ladder Diagram</kwd><kwd> Object-oriented Thought</kwd><kwd> Undigraph</kwd></kwd-group></article-meta></front><body><sec id="s1"><title>1.&#160; Introduction</title><p>Recently, great changes have arisen in the electrical virtual instruments, e.g. the hydropower simulation system [1–4]. It is a comprehensive system including hydraulic, water conservancy, mechanics and autocontrol. LD control system plays an important role in the system, so an user friendly design interface component-based should be developed for users, and meanwhile, unlikely in the PLC, the control function of LD must be implemented without compiler or interpretation.</p><p>Reference [<xref ref-type="bibr" rid="scirp.543-ref5">5</xref>] proposed a control modeling approach using PNs, an automated CNC lathe door interlocking control program is used as an example, for which model is constructed and validated via PNs. Reference [<xref ref-type="bibr" rid="scirp.543-ref6">6</xref>] proposed a method to design an LD based on a PN modeling approach. A general method for mapping PNs to LDs is implemented. But converting LDs to PNs can not solve the problem in the hydropower simulation system. Reference [<xref ref-type="bibr" rid="scirp.543-ref7">7</xref>] converts from a ladder diagram to a native code directly, and a benchmark test in an automotive manufacturing process shows that the translation method fairly speeds up execution in comparison with existing interpretation methods, but there is no interpretation for the code in the software system. Reference [<xref ref-type="bibr" rid="scirp.543-ref8">8</xref>] extracts the relations of control elements in LD, it presents a transformation method that is achieved by traversing AOV digraph, which is mapped from LD. This method obtains logic relations in the LD by predefining meaning of graphical symbols. It can’t be obviously applied in our system since there need an interpretation for the relations.</p><p>Fengman hydroelectric power station is the earliest large hydropower station in china, the simulation system in it has run more than 10 years, the work in this paper is based on the system of the next version.</p></sec><sec id="s2"><title>2.  Problem Description</title><p><xref ref-type="fig" rid="fig1">Figure 1</xref> shows the accident control circuit of high pressure compressor. Its control principle is that: When the pressures of the first, second, and third stages are higher than the specified value, pressure relays 2YX1, 3YX1and 4YX1 are open respectively, signal relay coils 2XJ1 (controlled by relay 2YX1), 3XJ1(controlled by relay 3YX1),and 4XJ1(controlled by relay 4YX1) are excited, and then, contacts 2XJ1(controlled by relay coil 2XJ1), 3XJ1(controlled by relay coil 3XJ1), and 4XJ1 (controlled by relay coil 4XJ1) are open,BCJ1 is excited, leading to the accident shutdown.</p><p>When the pressure of the third stage is lower than the specified value, pressure relay 5YX1 is open, the signal relay coil 5XJ1 is excited, the contact 5XJ1 is open, BCJ1 is excited, leading to the accident shutdown.</p><p>In a word, all paths between the live wire and the null line should be searched to find out which controls are in the same path between the live wire and the null line, e.g. the pressure relay 2YX1 and the signal relay coil 2XJ1,the Pressure Relay 5YX1 and the signal relay coil 5XJ1, etc.</p><p>There are few elements, e.g. the signal relay coil 5XJ1 and the contact 5XJ1, are not in the same path, their control relations can be achieved through adding member variables respectively. There are many other types of circuit elements of which control functions are as similar as ones mentioned above in the ladder diagram.</p><p>Firstly, a graphical interface to design LD must be presented, as demonstrated in the following sections.</p></sec><sec id="s3"><title>3.  The Graphical Interface for LD</title><p>In the hydropower simulation system, which is developed with Microsoft c#.net, each circuit element is an user control. The relay coil and the contact, which are the main elements in LD, are taken as examples to illustrate the class structure of the circuit elements. <xref ref-type="fig" rid="fig2">Figure 2</xref> shows the class diagram of the voltage relay coil and the current relay coil.</p><p>IRelay is the interface of all the types of the relay coils. VoltageRelay and CurrentRelay are two subclasses, The main attributes and methods of the VoltageRelay are as follows:</p><p>_isExciting;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //&#160;&#160; the excitation state of the coil</p><p>_standardVoltage; //&#160;&#160; the standard induced voltage of the coil</p><p>_currentVoltage;&#160;&#160;&#160;&#160; //&#160;&#160; the current voltage of the coil</p><p>_title;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;//&#160;&#160; an attribute to determine which contact is controlled by it SetState();&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // set _isExciting of the coil</p><p>SetStandardVlotage(); //&#160;&#160; set _standardVoltage of the coil IsExciting();&#160;&#160;&#160;&#160;&#160;&#160;&#160; //&#160;&#160; return the excitation state of the coil GetTitle();&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //&#160;&#160; return _title Run();&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;//&#160;&#160; to judge whether the coil should be excited The attributes and methods of CurrentRelay are similar to VoltageRelay. <xref ref-type="fig" rid="fig3">Figure 3</xref> shows the class diagram of the contact. Its main attributes and methods are as follows:</p><p>_isConnect:&#160;&#160;&#160;&#160;&#160;&#160; //&#160;&#160;&#160; the state of the contact(open or closed)</p><p>_type:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //&#160;&#160;&#160; the type of the contact(normally open or normally closed)</p><p>_title:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;//&#160;&#160; an attribute corresponding to the one in the relay coil, when they are equal,the contact is controlled by the coil SetState():&#160;&#160;&#160;&#160;&#160;&#160;&#160; //&#160;&#160; set _isConnect of the coil</p><p>The line is a special user control, connects two user controls, which are the member variables of the line: control1 and control2.These two member variables are also used in the all paths searching algorithm, as demonstrated in Section 4.</p><p>Besides the graphical interface of the circuit elements, the edit function for LD is also presented, of which the class diagram is shown in <xref ref-type="fig" rid="fig4">Figure 4</xref>. It is developed based on the command pattern, which encapsulates the detail of processing the messages. The functions of the controls such as adding, copying, cutting, moving and plastering can be performed through the menu or the shortcut keys. The function Add() of the menu is to add the user controls to the panel. Clicked() is to select an user control and generates the corresponding instance of the Command subclass, then call the function Execute() and sends the requirements to the control, which determines what to do. As mentioned above, based on the Command pattern, the details of the execution after sending a message is transparent for the menu.</p><p><xref ref-type="fig" rid="fig5">Figure 5</xref> shows the graphical interface corresponding to <xref ref-type="fig" rid="fig1">Figure 1</xref>, The right part of the interface is the library of circuit elements. After designing the interface, the control function of LD should be implemented, as presented in Section 4.</p></sec></body><back><ref-list><title>References</title><ref id="scirp.543-ref1"><label>1</label><mixed-citation publication-type="other" xlink:type="simple">P. Sanderson, W. B. L. Wong, S. Choudhury, and R. Memisevic, “Hydro scheme control in a deregulated environment: Cognitive work models and design implications,” Annual Meeting of the Human Factors and Ergo-nomics Society, Santa Monica, CA, 2003.</mixed-citation></ref><ref id="scirp.543-ref2"><label>2</label><mixed-citation publication-type="other" xlink:type="simple">J. R. Hajdukiewicz and K. J. Vicente, “What does computer- mediated control of a thermal-hydraulic system have to do with moving your jaw to speak?” Ecological Psychology, Vol. 16, No. 4, pp. 255-285, 2004.</mixed-citation></ref><ref id="scirp.543-ref3"><label>3</label><mixed-citation publication-type="other" xlink:type="simple">R. Memisevic, P. Sanderson, S. Choudhury, and W. Wong, “A low-cost, easy-to-use, realtime power system simulator,” in Proceedings of International Conference on Power and Energy Systems, Clearwater Beach, FL, 2004.</mixed-citation></ref><ref id="scirp.543-ref4"><label>4</label><mixed-citation publication-type="other" xlink:type="simple"> 
Y. Su, H. Zhao, W. J. Su, and Y. Xu, “GHS: Research and application of grid based hydroelectrical simulation system platform,” Journal of System Simulation, Vol. 17, No. 5, pp. 1230-1233, 2004.</mixed-citation></ref><ref id="scirp.543-ref5"><label>5</label><mixed-citation publication-type="other" xlink:type="simple">E, R. R. Kato, O. Morandin Jr., P. R. Politano, and H. A.Camargo, “A modular modeling approach for CNC machines control using Petri nets,” in Proceedings of International Conference on Systems, Man and Cybernetics, Nashville, TN, Vol. 5, pp. 3417-3152, 2000.</mixed-citation></ref><ref id="scirp.543-ref6"><label>6</label><mixed-citation publication-type="other" xlink:type="simple"> 
J.-L. Chirn and D. C. Mcfarlane, “Petri net based design of ladder logic diagram,” Working paper, Institute for manufacturing, University of Cambridge, UK, 2000.</mixed-citation></ref><ref id="scirp.543-ref7"><label>7</label><mixed-citation publication-type="other" xlink:type="simple">H. S. Kim, W. H. Kwon, and N. Chang, “A translation method for ladder diagram with application to a manufacturing process,” in Proceedings of International Conference on Robotics and Automation, Vol. 1, pp. 793-798, 1999.</mixed-citation></ref><ref id="scirp.543-ref8"><label>8</label><mixed-citation publication-type="other" xlink:type="simple">X. L. Cui and Z. C. Zhou, “The algorithm of transformation between the ladder language and the sentence table language of PLC,” Microelectronics and Computer, China, Vol. 1, No. 17, pp. 26-30, 2000.</mixed-citation></ref></ref-list></back></article>