Model train control system

Information

  • Patent Application
  • 20020113171
  • Publication Number
    20020113171
  • Date Filed
    May 15, 2001
    24 years ago
  • Date Published
    August 22, 2002
    22 years ago
Abstract
A system which operates a digitally controlled model railroad transmitting a first command from a first client program to a resident external controlling interface through a first communications transport. A second command is transmitted from a second client program to the resident external controlling interface through a second communications transport. The first command and the second command are received by the resident external controlling interface which queues the first and second commands. The resident external controlling interface sends third and fourth commands representative of the first and second commands, respectively, to a digital command station for execution on the digitally controlled model railroad.
Description


BACKGROUND OF THE INVENTION

[0001] The present invention relates to a system for controlling a model railroad.


[0002] Model railroads have traditionally been constructed with of a set of interconnected sections of train track, electric switches between different sections of the train track, and other electrically operated devices, such as train engines and draw bridges. Train engines receive their power to travel on the train track by electricity provided by a controller through the track itself. The speed and direction of the train engine is controlled by the level and polarity, respectively, of the electrical power supplied to the train track. The operator manually pushes buttons or pulls levers to cause the switches or other electrically operated devices to function, as desired. Such model railroad sets are suitable for a single operator, but unfortunately they lack the capability of adequately controlling multiple trains independently. In addition, such model railroad sets are not suitable for being controlled by multiple operators, especially if the operators are located at different locations distant from the model railroad, such as different cities.


[0003] A digital command control (DDC) system has been developed to provide additional controllability of individual train engines and other electrical devices. Each device the operator desires to control, such as a train engine, includes an individually addressable digital decoder. A digital command station (DCS) is electrically connected to the train track to provide a command in the form of a set of encoded digital bits to a particular device that includes a digital decoder. The digital command station is typically controlled by a personal computer. A suitable standard for the digital command control system is the NMRA DCC Standards, issued March 1997, and is incorporated herein by reference. While providing the ability to individually control different devices of the railroad set, the DCC system still fails to provide the capability for multiple operators to control the railroad devices, especially if the operators are remotely located from the railroad set and each other.


[0004] DigiToys Systems of Lawrenceville, Ga. has developed a software program for controlling a model railroad set from a remote location. The software includes an interface which allows the operator to select desired changes to devices of the railroad set that include a digital decoder, such as increasing the speed of a train or switching a switch. The software issues a command locally or through a network, such as the internet, to a digital command station at the railroad set which executes the command. The protocol used by the software is based on Cobra from Open Management Group where the software issues a command to a communication interface and awaits confirmation that the command was executed by the digital command station. When the software receives confirmation that the command executed, the software program sends the next command through the communication interface to the digital command station. In other words, the technique used by the software to control the model railroad is analogous to an inexpensive printer where commands are sequentially issued to the printer after the previous command has been executed. Unfortunately, it has been observed that the response of the model railroad to the operator appears slow, especially over a distributed network such as the internet. One technique to decrease the response time is to use high-speed network connections but unfortunately such connections are expensive.


[0005] What is desired, therefore, is a system for controlling a model railroad that effectively provides a high-speed connection without the additional expense associated therewith.


[0006] The foregoing and other objectives, features, and advantages of the invention will be more readily understood upon consideration of the following detailed description of the invention, taken in conjunction with the accompanying drawings.



SUMMARY OF THE PRESENT INVENTION

[0007] The present invention overcomes the aforementioned drawbacks of the prior art, in a first aspect, by providing a system for operating a digitally controlled model railroad that includes transmitting a first command from a first client program to a resident external controlling interface through a first communications transport. A second command is transmitted from a second client program to the resident external controlling interface through a second communications transport. The first command and the second command are received by the resident external controlling interface which queues the first and second commands. The resident external controlling interface sends third and fourth commands representative of the first and second commands, respectively, to a digital command station for execution on the digitally controlled model railroad.


[0008] Incorporating a communications transport between the multiple client program and the resident external controlling interface permits multiple operators of the model railroad at locations distant from the physical model railroad and each other. In the environment of a model railroad club where the members want to simultaneously control devices of the same model railroad layout, which preferably includes multiple trains operating thereon, the operators each provide commands to the resistant external controlling interface, and hence the model railroad. In addition by queuing by commands at a single resident external controlling interface permits controlled execution of the commands by the digitally controlled model railroad, would may otherwise conflict with one another.


[0009] In another aspect of the present invention the first command is selectively processed and sent to one of a plurality of digital command stations for execution on the digitally controlled model railroad based upon information contained therein. Preferably, the second command is also selectively processed and sent to one of the plurality of digital command stations for execution on the digitally controlled model railroad based upon information contained therein. The resident external controlling interface also preferably includes a command queue to maintain the order of the commands.


[0010] The command queue also allows the sharing of multiple devices, multiple clients to communicate with the same device (locally or remote) in a controlled manner, and multiple clients to communicate with different devices. In other words, the command queue permits the proper execution in the cases of: (1) one client to many devices, (2) many clients to one device, and (3) many clients to many devices.


[0011] In yet another aspect of the present invention the first command is transmitted from a first client program to a first processor through a first communications transport. The first command is received at the first processor. The first processor provides an acknowledgement to the first client program through the first communications transport indicating that the first command has properly executed prior to execution of commands related to the first command by the digitally controlled model railroad. The communications transport is preferably a COM or DCOM interface.


[0012] The model railroad application involves the use of extremely slow real-time interfaces between the digital command stations and the devices of the model railroad. In order to increase the apparent speed of execution to the client, other than using high-speed communication interfaces, the resident external controller interface receives the command and provides an acknowledgement to the client program in a timely manner before the execution of the command by the digital command stations. Accordingly, the execution of commands provided by the resident external controlling interface to the digital command stations occur in a synchronous manner, such as a first-in-first-out manner. The COM and DCOM communications transport between the client program and the resident external controlling interface is operated in an asynchronous manner, namely providing an acknowledgement thereby releasing the communications transport to accept further communications prior to the actual execution of the command. The combination of the synchronous and the asynchronous data communication for the commands provides the benefit that the operator considers the commands to occur nearly instantaneously while permitting the resident external controlling interface to verify that the command is proper and cause the commands to execute in a controlled manner by the digital command stations, all without additional high-speed communication networks. Moreover, for traditional distributed software execution there is no motivation to provide an acknowledgment prior to the execution of the command because the command executes quickly and most commands are sequential in nature. In other words, the execution of the next command is dependent upon proper execution of the prior command so there would be no motivation to provide an acknowledgment prior to its actual execution.







BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

[0013]
FIG. 1 is a block diagram of an exemplary embodiment of a model train control system.


[0014]
FIG. 2 is a more detailed block diagram of the model train control system of FIG. 1 including external device control logic.


[0015]
FIG. 3 is a block diagram of the external device control logic of FIG. 2.


[0016]
FIG. 4 is an illustration of a track and signaling arrangement.


[0017]
FIG. 5 is an illustration of a manual block signaling arrangement.


[0018]
FIG. 6 is an illustration of a track circuit.


[0019]
FIGS. 7A and 7B are illustrations of block signaling and track capacity.


[0020]
FIG. 8 is an illustration of different types of signals.


[0021]
FIGS. 9A and 9B are illustrations of speed signaling in approach to a junction.


[0022]
FIG. 10 is a further embodiment of the system including a dispatcher.


[0023]
FIG. 11 is an exemplary embodiment of a command queue.







DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT

[0024] Referring to FIG. 1, a model train control system 10 includes a communications transport 12 interconnecting a client program 14 and a resident external controlling interface 16. The client program 14 executes on the model railroad operator's computer and may include any suitable system to permit the operator to provide desired commands to the resident external controlling interface 16. For example, the client program 14 may include a graphical interface representative of the model railroad layout where the operator issues commands to the model railroad by making changes to the graphical interface. The client program 14 also defines a set of Application Programming Interfaces (API's), described in detail later, which the operator accesses using the graphical interface or other programs such as Visual Basic, C++, Java, or browser based applications. There may be multiple client programs interconnected with the resident external controlling interface 16 so that multiple remote operators may simultaneously provide control commands to the model railroad.


[0025] The communications transport 12 provides an interface between the client program 14 and the resident external controlling interface 16. The communications transport 12 may be any suitable communications medium for the transmission of data, such as the internet, local area network, satellite links, or multiple processes operating on a single computer. The preferred interface to the communications transport 12 is a COM or DCOM interface, as developed for the Windows operating system available from Microsoft Corporation. The communications transport 12 also determines if the resident external controlling interface 16 is system resident or remotely located on an external system. The communications transport 12 may also use private or public communications protocol as a medium for communications. The client program 14 provides commands and the resident external controlling interface 16 responds to the communications transport 12 to exchange information. A description of COM (common object model) and DCOM (distributed common object model) is provided by Chappel in a book entitled Understanding ActiveX and OLE, Microsoft Press, and is incorporated by reference herein.


[0026] Incorporating a communications transport 12 between the client program(s) 14 and the resident external controlling interface 16 permits multiple operators of the model railroad at locations distant from the physical model railroad and each other. In the environment of a model railroad club where the members want to simultaneously control devices of the same model railroad layout, which preferably includes multiple trains operating thereon, the operators each provide commands to the resistant external controlling interface, and hence the model railroad.


[0027] The manner in which commands are executed for the model railroad under COM and DCOM may be as follows. The client program 14 makes requests in a synchronous manner using COM/DCOM to the resident external interface controller 16. The synchronous manner of the request is the technique used by COM and DCOM to execute commands. The communications transport 12 packages the command for the transport mechanism to the resident external controlling interface 16. The resident external controlling interface 16 then passes the command to the digital command stations 18 which in turn executes the command. After the digital command station 18 executes the command an acknowledgement is passed back to the resident external controlling interface 16 which in turn passes an acknowledgement to the client program 14. Upon receipt of the acknowledgement by the client program 14, the communications transport 12 is again available to accept another command. The train control system 10, without more, permits execution of commands by the digital command stations 18 from multiple operators, but like the DigiToys Systems' software the execution of commands is slow.


[0028] The present inventor came to the realization that unlike traditional distributed systems where the commands passed through a communications transport are executed nearly instantaneously by the server and then an acknowledgement is returned to the client, the model railroad application involves the use of extremely slow real-time interfaces between the digital command stations and the devices of the model railroad. The present inventor came to the further realization that in order to increase the apparent speed of execution to the client, other than using high-speed communication interfaces, the resident external controller interface 16 should receive the command and provide an acknowledgement to the client program 12 in a timely manner before the execution of the command by the digital command stations 18. Accordingly, the execution of commands provided by the resident external controlling interface 16 to the digital command stations 18 occur in a synchronous manner, such as a first-in-first-out manner. The COM and DCOM communications transport 12 between the client program 14 and the resident external controlling interface 16 is operated in an asynchronous manner, namely providing an acknowledgement thereby releasing the communications transport 12 to accept further communications prior to the actual execution of the command. The combination of the synchronous and the asynchronous data communication for the commands provides the benefit that the operator considers the commands to occur nearly instantaneously while permitting the resident external controlling interface 16 to verify that the command is proper and cause the commands to execute in a controlled manner by the digital command stations 18, all without additional high-speed communication networks. Moreover, for traditional distributed software execution there is no motivation to provide an acknowledgment prior to the execution of the command because the command executes quickly and most commands are sequential in nature. In other words, the execution of the next command is dependent upon proper execution of the prior command so there would be no motivation to provide an acknowledgment prior to its actual execution. It is to be understood that other devices, such as digital devices, may be controlled in a manner as described for model railroads.


[0029] Referring to FIG. 2, the client program 14 sends a command over the communications transport 12 that is received by an asynchronous command processor 100. The asynchronous command processor 100 queries a local database storage 102 to determine if it is necessary to package a command to be transmitted to a command queue 104. The local database storage 102 primarily contains the state of the devices of the model railroad, such as for example, the speed of a train, the direction of a train, whether a draw bridge is up or down, whether a light is turned on or off, and the configuration of the model railroad layout. If the command received by the asynchronous command processor 100 is a query of the state of a device, then the asynchronous command processor 100 retrieves such information from the local database storage 102 and provides the information to an asynchronous response processor 106. The asynchronous response processor 106 then provides a response to the client program 14 indicating the state of the device and releases the communications transport 12 for the next command.


[0030] The asynchronous command processor 100 also verifies, using the configuration information in the local database storage 102, that the command received is a potentially valid operation. If the command is invalid, the asynchronous command processor 100 provides such information to the asynchronous response processor 106, which in turn returns an error indication to the client program 14.


[0031] The asynchronous command processor 100 may determine that the necessary information is not contained in the local database storage 102 to provide a response to the client program 14 of the device state or that the command is a valid action. Actions may include, for example, an increase in the train's speed, or turning on/off of a device. In either case, the valid unknown state or action command is packaged and forwarded to the command queue 104. The packaging of the command may also include additional information from the local database storage 102 to complete the client program 14 request, if necessary. Together with packaging the command for the command queue 104, the asynchronous command processor 100 provides a command to the asynchronous request processor 106 to provide a response to the client program 14 indicating that the event has occurred, even though such an event has yet to occur on the physical railroad layout.


[0032] As such, it can be observed that whether or not the command is valid, whether or not the information requested by the command is available to the asynchronous command processor 100, and whether or not the command has executed, the combination of the asynchronous command processor 100 and the asynchronous response processor 106 both verifies the validity of the command and provides a response to the client program 14 thereby freeing up the communications transport 12 for additional commands. Without the asynchronous nature of the resident external controlling interface 16, the response to the client program 14 would be, in many circumstances, delayed thereby resulting in frustration to the operator that the model railroad is performing in a slow and painstaking manner. In this manner, the railroad operation using the asynchronous interface appears to the operator as nearly instantaneously responsive.


[0033] Each command in the command queue 104 is fetched by a synchronous command processor 110 and processed. The synchronous command processor 110 queries a controller database storage 112 for additional information, as necessary, and determines if the command has already been executed based on the state of the devices in the controller database storage 112. In the event that the command has already been executed, as indicated by the controller database storage 112, then the synchronous command processor 110 passes information to the command queue 104 that the command has been executed or the state of the device. The asynchronous response processor 106 fetches the information from the command cue 104 and provides a suitable response to the client program 14, if necessary, and updates the local database storage 102 to reflect the updated status of the railroad layout devices.


[0034] If the command fetched by the synchronous command processor 110 from the command queue 104 requires execution by external devices, such as the train engine, then the command is posted to one of several external device control logic 114 blocks. The external device control logic 114 processes the command from the synchronous command processor 110 and issues appropriate control commands to the interface of the particular external device 116 to execute the command on the device and ensure that an appropriate response was received in response. The external device is preferably a digital command control device that transmits digital commands to decoders using the train track. There are several different manufacturers of digital command stations, each of which has a different set of input commands, so each external device is designed for a particular digital command station. In this manner, the system is compatible with different digital command stations. The digital command stations 18 of the external devices 116 provide a response to the external device control logic 114 which is checked for validity and identified as to which prior command it corresponds to so that the controller database storage 112 may be updated properly. The process of transmitting commands to and receiving responses from the external devices 116 is slow.


[0035] The synchronous command processor 110 is notified of the results from the external control logic 114 and, if appropriate, forwards the results to the command queue 104. The asynchronous response processor 100 clears the results from the command queue 104 and updates the local database storage 102 and sends an asynchronous response to the client program 14, if needed. The response updates the client program 14 of the actual state of the railroad track devices, if changed, and provides an error message to the client program 14 if the devices actual state was previously improperly reported or a command did not execute properly.


[0036] The use of two separate database storages, each of which is substantially a mirror image of the other, provides a performance enhancement by a fast acknowledgement to the client program 14 using the local database storage 102 and thereby freeing up the communications transport 12 for additional commands. In addition, the number of commands forwarded to the external device control logic 114 and the external devices 116, which are relatively slow to respond, is minimized by maintaining information concerning the state and configuration of the model railroad. Also, the use of two separate database tables 102 and 112 allows more efficient multi-threading on multi-processor computers.


[0037] In order to achieve the separation of the asynchronous and synchronous portions of the system the command queue 104 is implemented as a named pipe, as developed by Microsoft for Windows. The queue 104 allows both portions to be separate from each other, where each considers the other to be the destination device. In addition, the command queue maintains the order of operation which is important to proper operation of the system.


[0038] The use of a single command queue 104 allows multiple instantrations of the asynchronous functionality, with one for each different client. The single command queue 104 also allows the sharing of multiple devices, multiple clients to communicate with the same device (locally or remote) in a controlled manner, and multiple clients to communicate with different devices. In other words, the command queue 104 permits the proper execution in the cases of: (1) one client to many devices, (2) many clients to one device, and (3) many clients to many devices.


[0039] The present inventor came to the realization that the digital command stations provided by the different vendors have at least three different techniques for communicating with the digital decoders of the model railroad set. The first technique, generally referred to as a transaction (one or more operations), is a synchronous communication where a command is transmitted, executed, and a response is received therefrom prior to the transmission of the next sequentially received command. The DCS may execute multiple commands in this transaction. The second technique is a cache with out of order execution where a command is executed and a response received therefrom prior to the execution of the next command, but the order of execution is not necessarily the same as the order that the commands were provided to the command station. The third technique is a local-area-network model where the commands are transmitted and received simultaneously. In the LAN model there is no requirement to wait until a response is received for a particular command prior to sending the next command. Accordingly, the LAN model may result in many commands being transmitted by the command station that have yet to be executed. In addition, some digital command stations use two or more of these techniques.


[0040] With all these different techniques used to communicate with the model railroad set and the system 10 providing an interface for each different type of command station, there exists a need for the capability of matching up the responses from each of the different types of command stations with the particular command issued for record keeping purposes. Without matching up the responses from the command stations, the databases can not be updated properly.


[0041] Validation functionality is included within the external device control logic 114 to accommodate all of the different types of command stations. Referring to FIG. 3, an external command processor 200 receives the validated command from the synchronous command processor 110. The external command processor 200 determines which device the command should be directed to, the particular type of command it is, and builds state information for the command. The state information includes, for example, the address, type, port, variables, and type of commands to be sent out. In other words, the state information includes a command set for a particular device on a particular port device. In addition, a copy of the original command is maintained for verification purposes. The constructed command is forwarded to the command sender 202 which is another queue, and preferably a circular queue. The command sender 202 receives the command and transmits commands within its queue in a repetitive nature until the command is removed from its queue. A command response processor 204 receives all the commands from the command stations and passes the commands to the validation function 206. The validation function 206 compares the received command against potential commands that are in the queue of the command sender 202 that could potentially provide such a result. The validation function 206 determines one of four potential results from the comparison. First, the results could be simply bad data that is discarded. Second, the results could be partially executed commands which are likewise normally discarded. Third, the results could be valid responses but not relevant to any command sent. Such a case could result from the operator manually changing the state of devices on the model railroad or from another external device, assuming a shared interface to the DCS. Accordingly, the results are validated and passed to the result processor 210. Fourth, the results could be valid responses relevant to a command sent. The corresponding command is removed from the command sender 202 and the results passed to the result processor 210. The commands in the queue of the command sender 202, as a result of the validation process 206, are retransmitted a predetermined number of times, then if error still occurs the digital command station is reset, which if the error still persists then the command is removed and the operator is notified of the error.



APPLICATION PROGRAMMING INTERFACE

[0042] Train Tools™ Interface Description


[0043] Building your own visual interface to a model railroad Copyright 1992-1998 KAM Industries.


[0044] Computer Dispatcher, Engine Commander, The Conductor, Train Server, and Train Tools are Trademarks of KAM Industries, all Rights Reserved.


[0045] Questions concerning the product can be EMAILED to:


[0046] traintools@kam.rain.com


[0047] You can also mail questions to:


[0048] KAM Industries


[0049] 2373 NW 185th Avenue Suite 416


[0050] Hillsboro, Oreg. 97124


[0051] FAX—(503) 291-1221
1Table of contents1.OVERVIEW1.1System Architecture2.TUTORIAL2.1Visual BASIC Throttle Example Application2.2Visual BASIC Throttle Example Source Code3.IDL COMMAND REPERENCE3.1Introduction3.2Data Types3.3Commands to access the server configuration variabledatabaseKamCVGetValueKamCVPutValueKamCVGetEnableKamCVPutEnableKamCVGetNameKamCVGetMinRegisterKamCVGetMaxRegister3.4Commands to program configuration variablesKamProgramKamProgramGetModeKamProgramGetStatusKamProgramReadCVKamProgramCVKamProgramReadDecoderToDataBaseKamProgramDecoderFromDataBase3.5Commands to control all decoder typesKamDecoderGetMaxModelsKamDecoderGetModelNameKamDecoderSetModelToObjKamDecoderGetMaxAddresKamDecoderChangeOldNewAddrKamDecoderMovePortKamDecoderGetPortKamDecoderCheckAddrInUseKamDecoderGetModelFromObjKamDecoderGetModelFacilityKamDecoderGetObjCountKamDecoderGetObjAtIndexKamDecoderputAddKamDecoderPutDelKamDecoderGetMfgNameKamDecoderGetPowerModeKamDecoderGetMaxSpeed3.6Commands to control locomotive decodersKamEngGetSpeedKamEngPutSpeedKamEngGetSpeedStepsKamEngPutSpeedStepsKamEngGetFunctionKamEngPutFunctionKamEngGetFunctionMaxKamEngGetNameKamEngPutNameKamEngGetFunctionNameKamEngPutFunctionNameKamEngGetConsistMaxKamEngPutConsistParentKamEngPutConsistChildKamEngPutConsistRemoveObj3.7Commands to control accessory decodersKamAccGetFunctionKamAccOetFunctionAllKamAccPutFunctionKamAccPutFunctionAllKamAccGetFunctionMaxKamAccGetNameKamAccPutNameKamAccGetFunctionNameKamAccPutFunctionNameKamAccRegFeedbackKamAccRegFeedbackAllKamAccDelFeedbackKamAccDelFeedbackAll3.8Commands to control the command stationKamOprPutTurnOnStationKamOprPutStartStationKamOprPutClearStationKamOprPutStopStationKamOprPutPowerOnKamOprPutPowerOffKamOprPutHardResetKamOprPutEmergencyStopKamOprGetStationStatus3.9Commands to configure the command stationcommunication portKamPortPutConfigKamPortGetConfigKamPortGetNameKamPortPutMapControllerKamPortGetMaxLogPortsKamPortGetMaxPhysical3.10Commands that control command flow to the commandstationKamCmdConnectKamCmdDisConnectKamCmdCommand3.11Cab Control CommandsKamCabGetMessageKamCabPutMessageKamCabGetCabAddrKamCabPutAddrToCab3.12Miscellaneous CommandsKamMiscGetErrorMsgKamMiscGetClockTimeKamMiscPutClockTimeKamMiscGetInterfaceversionKamMiscSaveDataKamMiscGetControllerNameKamMiscGetControllerNameAtPortKamMiscGetCommandStationValueKamMiscSetCommandStationValueKamMiscGetCommandStationIndexKamMiscMaxControllerIDKamMiscGetControllerFacility



I. OVERVIEW

[0052] This document is divided into two sections, the Tutorial, and the IDL Command Reference. The tutorial shows the complete code for a simple Visual BASIC program that controls all the major functions of a locomotive. This program makes use of many of the commands described in the reference section. The IDL Command Reference describes each command in detail.



I. TUTORIAL


A. Visual BASIC Throttle Example Application

[0053] The following application is created using the Visual BASIC source code in the next section. It controls all major locomotive functions such as speed, direction, and auxiliary functions.



A. Visual BASIC Throttle Example Source Code

[0054] Copyright 1998, KAM Industries. All rights reserved.


[0055] This is a demonstration program showing the integration of VisualBasic and Train Server(tm) interface. You may use this application for non commercial usage.


[0056] $Date: $


[0057] $Author: $


[0058] $Revision: $


[0059] $Log: $


[0060] Engine Commander, Computer Dispatcher, Train Server, Train Tools, The Conductor and kamind are registered Trademarks of KAM Industries. All rights reserved.


[0061] This first command adds the reference to the Train ServerT Interface object Dim EngCmd As New EngComIfc


[0062] Engine Commander uses the term Ports, Devices and Controllers


[0063] Ports → These are logical ids where Decoders are assigned to. Train ServerT Interface supports a limited number of logical ports. You can also think of ports as mapping to a command station type. This allows you to move decoders between command station without losing any information about the decoder


[0064] Devices → These are communications channels configured in your computer.


[0065] You may have a single device (com1) or multiple devices


[0066] (COM 1 -COM8, LPT1, Other). You are required to map a port to a device to access a command station.


[0067] Devices start from ID 0 → max id (FYI; devices do not necessarily have to be serial channel. Always check the name of the device before you use it as well as the maximum number of devices supported.


[0068] The Command EngCmd.KamPortGetMaxPhysical(lMaxPhysical, lSerial, lParallel) provides means that . . . lMaxPhysical=lSerial+lParallel+lOther


[0069] Controller—These are command the command station like LENZ, Digitrax Northcoast, EasyDCC, Marklin . . . It is recommend that you check the command station ID before you use it.


[0070] Errors—All commands return an error status. If the error value is non zero, then the other return arguments are invalid. In general, non zero errors means command was not executed. To get the error message, you need to call KamMiscErrorMessage and supply the error number


[0071] To Operate your layout you will need to perform a mapping between a Port (logical reference), Device (physical communications channel) and a Controller (command station) for the program to work. All references uses the logical device as the reference device for access.


[0072] Addresses used are an object reference. To use an address you must add the address to the command station using KamDecoderPutAdd . . . One of the return values from this operation is an object reference that is used for control.


[0073] We need certain variables as global objects; since the information is being used multiple times


[0074] Dim iLogicalPort, iController, iComPort


[0075] Dim iPortRate, iPortParity, iPortStop, iPortRetrans, iPortWatchdog, iPortFlow, iPortData


[0076] Dim lEngineObject As Long, iDecoderClass As Integer, iDecoderType As Integer


[0077] Dim lMaxController As Long


[0078] Dim lMaxLogical As Long, lMaxPhysical As Long, lMaxSerial As Long, lMaxParallel As Long


[0079] Form load function


[0080] —Turn of the initial buttons


[0081] —Set he interface information
2Private Sub Form_load( )Dim strVer As String, strCom As String, strCntrl AsStringDim iError As Integer′Get the interface version informationSetButtonState (False)iError = EngCmd.KamMiscGetInterfaceVersion (strVer)If (iError) ThenMsgBox ( (“Train Server not loaded. CheckDCOM-95”) )iLogicalPort = 0LogPort.Caption = iLogicalPortComPort.Caption = “???”Controller.Caption = “Unknown”ElseMsgBox ( (“Simulation (COM1) Train Server -- ” &strVer) ) ′************************************** ′Configuration information; Only need tochange these values to use a differentcontroller... ′************************************** ′ UNKNOWN0 // Unknown control type ′ SIMULAT1 // Interface simulator ′ LENZ_1x2 // Lenz serial support module ′ LENZ_2x3 // Lenz serial support module ′ DIGIT_DT2004 // Digitrax direct drive support using DT200 ′ DIGIT_DCS100 5 // Digitrax direct drive support using DCS100 ′ MASTERSERIES 6 // North Coast engineering master Series ′ SYSTEMONE 7 // System One ′ RAMFIX 8 // RAMFIxx system ′ DYNATROL 9 // Dynatrol system ′ Northcoast binary 10 // North Coast binary ′ SERIAL11 // NMRA Serialinterface ′ EASYDCC12 // NMRA Serial interface ′ MRK605013 // 6050 Marklin interface(AC and DC) ′ MRK602314 // 6023 Marklin hybridinterface (AC) ′ ZTC15 // ZTC Systems ltd ′ DIGIT_PR116 // Digitrax direct drivesupport using PR1 ′ DIRECT17 // Direct drive interfaceroutine′********************************************************iLogicalPort = 1 ′Select Logical port 1 forcommunicationsiController = 1 ′Select controller from the listabove.iComPort = 0 ′use COM1; 0 means com1 (Digitrax mustuse Com1 or Com2)′Digitrax Baud rate requires 16.4K!′Most COM ports above Com2 do not′support 16.4K. Check with the′manufacture of your smart com card′for the baud rate. Keep in mind that′Dumb com cards with serial port′support Com1-Com4 can only support′2 com ports (like com1/com2′or com3/com4)′If you change the controller, do not′forget to change the baud rate to′match the command station. See your′user manual for details′********************************************************′ 0:// Baud rate is 300′ 1:// Baud rate is 1200′ 2:// Baud rate is 2400′ 3:// Baud rate is 4800′ 4:// Baud rate is 9600′ 5:// Baud rate is 14.4′ 6:// Baud rate is 16.4′ 7:// Baud rate is 19.2iPortRate = 4Parity values 0-4 −> no, odd, even, mark,spaceiPortParity = 0Stop bits 0,1,2 −> 1, 1.5, 2iPortStop = 0iPortRetrans = 10iPortWatchdog = 2048iPortFlow = 0Data bits 0 − > 7 Bits, 1−> 8 bitsiPortData = 1′Display the port and controller informationiError =EngCmd.KamPortGetMaxLogPorts (lMaxLogical)iError =EngCmd.KamPortGetMaxPhysical (lMaxPhysical,lMaxSerial, lMaxParallel)′ Get the port name and do some checking...iError =EngCmd.KamPortGetName(iComPort, strCom)SetError (iError)If (iComPort > lMaxSerial) Then MsgBox (“Com portour of range”)iError =EngCmd.KamMiscGetControllerName (iController,strCntrl)If (iLogicalPort > lMaxLogical) Then MsgBox(“Logical port out of range”)SetError (iError)End If′Display values in Throttle..LogPort.Caption = iLogicalPortComPort.Caption = strComController.Caption = strCntrlEnd Sub′******************************′Send Command′Note:Please follow the command order. Order is importantfor the application to work!′******************************Private Sub Command_Click( )′Send the command from the interface to the commandstation, use the engineObjectDim iError, iSpeed As IntegerIf Not Connect.Enabled Then′TrainTools interface is a caching interface.′This means that you need to set up the CV's or′other operations first; then execute the′command.iSpeed = Speed.TextiError =EngCmd.KamEngPutFunction(lEngineObject, 0, F0.Value)iError =EngCmd.KamEngPutFunction (lEngineObject, 1,F1.Value)iError =EngCmd.KamEngPutFunction (lEngineObject, 2,F2.Value)iError =EngCmd.KamEngPutFunction (lEngineObject, 3,F3.Value)iError = EngCmd.KamEngPutSpeed (lEngineObject,iSpeed, Direction.Value)If iError = 0 Then iError =EngCmd.KamCmdCommand (lEngineObject)SetError (iError)End IfEnd Sub′******************************′Connect Controller′******************************Private Sub Connect_Click( )Dim iError As Integer′These are the index values for setting up the portfor use′ PORT_RETRANS 0 // Retrans index′ PORT_RATE1  // Retrans index′ PORT_PARITY2  // Retrans index′ PORT_STOP3  // Retrans index′ PORT_WATCHDOG4  // Retrans index′ PORT_FLOW5  // Retrans index′ PORT_DATABITS6  // Retrans index′ PORT_DEBUG7  // Retrans index′ PORT_PARALLEL8  // Retrans index′These are the index values for setting up theport for use′ PORT_RETRANS 0 // Retrans index′ PORT_RATE1  // Retrans index′ PORT_PARITY2  // Retrans index′ PORT_STOP3  // Retrans index′ PORT_WATCHDOG4  // Retrans index′ PORT_FLOW5  // Retrans index′ PORT_DATABITS6  // Retrans index′ PORT_DEBUG7  // Retrans index′ PORT_PARALLEL8  // Retrans indexiError = EngCmd.KamPortPutConfig(iLogicalPort, 0,iPortRetrans, 0) ′ setting PORT_RETRANSiError = EngCmd.KamPortPutConfig(iLogicalPort, 1,iPortRate, 0) ′ setting PORT_RATEiError = EngCmd.KamPortPutConfig(iLogicalPort, 2,iPortParity, 0) ′ setting PORT_PARITYiError = EngCmd.KamPortPutConfig(iLogicalPort, 3,iPortStop, 0) ′ setting PORT_STOPiError = EngCmd.KamPortPutConfig(iLogicalPort, 4,iPortWatchdog, 0) ′ setting PORT_WATCHDOGiError = EngCmd.KamPortPutConfig(iLogicalPort, 5iPortFlow, 0) ′ setting PORT_FLOWiError = EngCmd.KamPortPutConfig(iLogicalPort, 6,iPortData, 0) ′ setting PORT_DATABITS′ We need to set the appropriate debug mode for display..′ this command can only be sent if the following is true′ -Controller is not connected′ -port has not been mapped′ -Not share ware version of application (Sharewarealways set to 130)′ Write DisplayLogDebug′ FileWinLevelValue′ 1 + 2 + 4= 7−> LEVEL1-- put packets intoqueues′ 1+ 2 + 8= 11−> LEVEL2-- Status messagessend to window′ 1+ 2 + 16= 19−> LEVEL3--′ 1+ 2 + 32= 35−> LEVEL4-- All systemsemaphores/critical sections′ 1+ 2 + 64= 67−> LEVEL5-- detaileddebugging information′ 1+ 2 +128=131−> COMMONLY -- Read comm writecomm ports′You probably only want to use values of 130. This will′give you a display what is read or written to the′controller. If you want to write the information to′disk, use 131. The other information is not valid for′end users.′ Note:1.This does effect the performance of yousystem; 130 is a save value for debugdisplay. Always set the key to 1, a valueof 0 will disable debug2.The Digitrax control codes displayed areencrypted. The information that youdetermine from the control codes is thatinformation is sent (S) and a response isreceived (R)iDebugMode = 130iValue = Value.Text′ Display value for referenceiError = EngCmd.KamPortPutConfig(iLogicalPort, 7, iDebug,iValue) ′ setting PORT_DEBUG′Now map the Logical Port, Physical device, Commandstation and ControlleriError = EngCmd.KamPortPutMapController(iLogicalPort,iController, iComPort)iError = EngCmd.KamCmdConnect(iLogicalPort)iError = EngCmd.KamOprPutTurnOnStation(iLogicalPort)If (iError) ThenSetButtonState (False)ElseSetButtonState (True)End IfSetError (iError) ′Displays the error message and errornumberEnd Sub′******************************′Set the address button′******************************Private Sub DCCAddr_Click( )Dim iAddr, iStatus As Integer′ All addresses must be match to a logical port tooperateiDecoderType = 1′ Set the decoder type to an NMRAbaseline decoder ( 1 - 8 reg)iDecoderClass = 1′ Set the decoder class to Enginedecoder (there are only two classes of decoders;Engine and Accessory′Once we make a connection, we use the lEngineObject′as the reference object to send control informationIf (Address.Text > 1) TheniStatus = EngCmd.KamDecoderPutAdd(Address.Text,iLogicalPort, iLogicalPort, 0,iDecoderType, lEngineObject)SetError (iStatus)If(lEngineObject) ThenCommand.Enabled = True ′turn on the control(send) buttonThrottle.Enabled = True ′ Turn on the throttleElseMsgBox (“Address not set, check error message”)End IfElseMsgBox (“Address must be greater then 0 andless then 128”)End IfEnd Sub′*******************′Disconenct button′*******************Private Sub Disconnect_Click( )Dim iError As IntegeriError = EngCmd.KamCmdDisconnect (iLogicalPort)SetError (iError)SetButtonState (False)End Sub′**********************′Display error message′**********************Private Sub SetError(iError As Integer)Dim szError As StringDim iStatus′ This shows how to retrieve a sample error messagefrom the interface for the status received.iStatus = EngCmd.KamMiscGetErrorMsg (iError, szError)ErrorMsg.Caption = szErrorResult.Caption = Str(iStatus)End Sub′**************************′Set the Form button state′**************************Private Sub SetButtonState(iState As Boolean)′We set the state of the buttons; either connectedor disconnectedIf (iState) ThenConnect.Enabled = FalseDisconnect.Enabled = TrueONCmd.Enabled = TrueOffCmd.Enabled = TrueDCCAddr.Enabled = TrueUpDownAddress.Enabled = True′Now we check to see if the Engine Address has been′set; if it has we enable the send buttonIf (lEngineObject > 0) ThenCommand.Enabled = TrueThrottle.Enabled = TrueElseCommand.Enabled = FalseThrottle.Enabled = FalseEnd IfElseConnect.Enabled = TrueDisconnect.Enabled = FalseCommand.Enabled = FalseONCmd.Enabled = FalseOffCmd.Enabled = FalseDCCAddr.Enabled = FalseUpDownAddress.Enabled = FalseThrottle.Enabled = FalseEnd IfEnd Sub′*******************′Power Off function′*******************Private Sub OffCmd_Click( )Dim iError As IntegeriError = EngCmd.KamOprPutPowerOff(iLogicalPort)SetError (iError)End Sub′******************′Power On function′******************Private Sub ONCmd_Click( )Dim iError As IntegeriError = EngCmd.KamOprPutPowerOn(iLogicalPort)SetError (iError)End Sub′************************′Throttle slider control′************************Private Sub Throttle_Click( )If (lEngineObject) ThenIf (Throttle.value > 0) ThenSpeed.Text = Throttle.ValueEnd IfEnd IfEnd Sub



I. IDL COMMAND REFERENCE


A. Introduction

[0082] This document describes the IDL interface to the KAM Industries Engine Commander Train Server. The Train Server DCOM server may reside locally or on a network node This server handles all the background details of controlling your railroad. You write simple, front end programs in a variety of languages such as BASIC, Java, or C++ to provide the visual interface to the user while the server handles the details of communicating with the command station, etc.



A. Data Types

[0083] Data is passed to and from the IDL interface using a several primitive data types. Arrays of these simple types are also used. The exact type passed to and from your program depends on the programming language your are using.


[0084] The following primitive data types are used:
3IDL TypeBASICTypeC++ TypeJava TypeDescriptionshortshort shortshortShort signed integerintint intintSigned integerBSTRBSTR BSTRBSTRText stringlonglong longlongUnsigned 32 bit valueName ID CV Range Valid CV's Functions Address Range SpeedStepsNMRA Compatible0NoneNone21-9914Baseline11-81-891-12714Extended21-1061-9, 17, 18, 19, 23, 24, 29, 30,49, 66-95 91-1023914,28,128All Mobile 31-1061-10691-1023914,28,128Name IDCV RangeValid CV'sFunctionsAddress RangeAccessory4513-593513-59380-511All Stationary5513-1024513-102480-511A long /DecoderObject/D value is returned by theKamDecoderPutAdd call if the decoder is successfullyregistered with the server. This unique opaque ID shouldbe used for all subsequent calls to reference thisdecoder.



A. Commands to Access the Server Configuration Variable database

[0085] This section describes the commands that access the server configuration variables (CV) database. These CVs are stored in the decoder and control many of its characteristics such as its address. For efficiency, a copy of each CV value is also stored in the server database. Commands such as KamCVGetValue and KamCVPutValue communicate only with the server, not the actual decoder. You then use the programming commands in the next section to transfer CVs to and from the decoder.
40KamCVGetValueParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDiCVRegint1-10242InCV registerpCVValue  int *3OutPointer to CV value1Opaque object ID handle returned byKamDecoderPutAdd.2Range is 1-1024. Maximum CV for this decoder isgiven by KamCVGetMaxRegister.3CV Value pointed to has a range of 0 to 255.Return ValueTypeRangeDescriptioniError short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) . KamCVGetValue takes thedecoder object ID and configuration variable (CV) numberas parameters. It sets the memory pointed to by pCVValueto the value of the server copy of the configurationvariable.0KamCVPutValueParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDiCVRegint1-10242InCV registeriCVValueint0-255InCV value1Opaque object ID handle returned byKamDecoderPutAdd.2Maximum CV is 1024. Maximum CV for this decoder isgiven by KamCVGetMaxRegister.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamCVPutValue takes the decoder object ID, configurationvariable (CV) number, and a new CV value as parameters.It sets the server copy of the specified decoder CV toiCVValue.0KamCVGetEnableParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDiCVRegint1-10242InCV numberpEnableint *3OutPointer to CV bit mask1Opaque object ID handle returned byKamDecoderPutAdd.2Maximum CV is 1024. Maximum CV for this decoder isgiven by KamCVGetMaxRegister.30x0001 - SET_CV_INUSE  0x0002 - SET_CV_READ_DIRTY0x0004 - SET_CV_WRITE_DIRTY  0x0008 -SET_CV_ERROR_READ0x0010 - SET_CV_ERROR_WRITEReturn ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) . KamCVGetEnable takes thedecoder object ID, configuration variable (CV) number,and a pointer to store the enable flag as parameters. Itsets the location pointed to by pEnable.0KamCVPutEnableParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDiCVRegint1-10242InCV numberiEnableint3InCV bit mask1Opaque object ID handle returned byKamDecoderPutAdd.2Maximum CV is 1024. Maximum CV for this decoder isgiven by KamCVGetMaxRegister.30x0001 - SET_CV_INUSE  0x0002 - SET_CV_READ DIRTY0x0004 - SET_CV_WRITE_DIRTY  0x0008 -SET_CV_ERROR_READ0x0010 - SET_CV_ERROR_WRITEReturn ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamCVPutEnable takes the decoder object ID, configurationvariable (CV) number, and a new enable state asparameters. It sets the server copy of the CV bit maskto iEnable.0KamCVGetNameParameter ListTypeRangeDirection DescriptioniCVint1-1024InCV numberpbsCVNameStringBSTR * 1OutPointer to CVname string1Exact return type depends on language. It isCstring * for C++. Empty string on error.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamCVGetName takes a configuration variable (CV) numberas a parameter. It sets the memory pointed to bypbsCvNameString to the name of the CV as defined in NMRARecommended Practice RP 9.2.2.0KamCVGetMinRegisterParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDpMinRegisterint *2OutPointer to min CVregister number1Opaque object ID handle returned byKamDecoderPutAdd.2Normally 1-1024. 0 on error or if decoder does notsupport CVs.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamCVGetMinRegister takes a decoder object ID as aparameter. It sets the memory pointed to by pMinRegisterto the minimum possible CV register number for thespecified decoder.0KamCVGetMaxRegisterParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDpMaxRegisterint *2OutPointer to max CVregister number1Opaque object ID handle returned byKamDecoderPutAdd.2Normally 1-1024. 0 on error or if decoder does notsupport CVs.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamCVGetMaxRegister takes a decoder object ID as aparameter. It sets the memory pointed to by pMaxRegisterto the maximum possible CV register number for thespecified decoder.



A. Commands to Program Configuration Variables

[0086] This section describes the commands read and write decoder configuration variables (CVs). You should initially transfer a copy of the decoder CVs to the server using the KamProgramReadDecoderToDataBase command. You can then read and modify this server copy of the CVs. Finally, you can program one or more CVs into the decoder using the KamProgramCV or KamProgramDecoderFromDataBase command. Not that you must first enter programming mode by issuing the KamProgram command before any programming can be done.
50KamProgramParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDiProgLogPortint1-655352InLogicalprogrammingport IDiProgMode int3InProgramming mode1Opaque object ID handle returned byKamDecoderPutAdd.2Maximum value for this server given byKamPortGetMaxLogPorts.30-PROGRAM_MODE_NONE1-PROGRAM_MODE_ADDRESS2-PROGRAM_MODE_REGISTER3-PROGRAM_MODE_PAGE4-PROGRAM_MODE_DIRECT5-DCODE_PRGMODE_OPS_SHORT6-PROGRAM_MODE_OPS_LONGReturn ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamProgram take the decoder object ID, logicalprogramming port ID, and programming mode as parameters.It changes the command station mode from normal operation(PROGRAM_MODE_NONE) to the specified programming mode.Once in programming modes, any number of programmingcommands may be called. When done, you must callKamProgram with a parameter of PROGRAM MODE_NONE toreturn to normal operation.0KamProgramGetModeParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDiProgLogPortint1-655352InLogicalprogrammingport IDpiProgModeint * 3OutProgramming mode1Opaque object ID handle returned byKamDecoderPutAdd.2Maximum value for this server given byKamPortGetMaxLogPorts.30-PROGRAM_MODE_NONE1-PROGRAM_MODE_ADDRESS2-PROGRAM_MODE_REGISTER3- PROGRAM_MODE_PAGE4-PROGRAM_MODE_DIRECT5-DCODE_PRGMODE_OPS_SHORT6-PROGRAM_MODE_OPS_LONGReturn ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg)KamProgramGetMode take the decoder object ID, logicalprogramming port ID, and pointer to a place to storethe programming mode as parameters. It sets the memorypointed to by piProgMode to the present programming mode.0KamProgramGetStatusParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDiCVRegint0-10242InCV numberpiCVAllStatusint *3OutOr'd decoder programmingstatus1Opaque object ID handle returned byKamDecoderPutAdd.20 returns OR'd value for all CVs. Other valuesreturn status for just that Cv.30x0001 - SET_CV_INUSE0x0002 - SET_CV_READ_DIRTY0x0004 - SET_CV_WRITE_DIRTY0x0008 - SET_CV_ERROR_READ0x0010 - SET_CV_ERROR_WRITEReturn ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamProgramGetStatus take the decoder object ID andpointer to a place to store the OR'd decoder programmingstatus as parameters. It sets the memory pointed to bypiProgMode to the present programming mode.0KamProgramReadCVParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDiCVRegint2InCV number1Opaque object ID handle returned byKamDecoderPutAdd.2Maximum CV is 1024. Maximum CV for this decoder isgiven by KamCVGetMaxRegister.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamProgramCV takes the decoder object ID, configurationvariable (CV) number as parameters. It reads thespecified CV variable value to the server database.0KamProgramCVParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDiCVRegint2InCV numberiCVValueint0-255InCV value1Opaque object ID handle returned byKamDecoderPutAdd.2Maximum CV is 1024. Maximum CV for this decoder isgiven by KamCVGetMaxRegister.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamProgramCV takes the decoder object ID, configurationvariable (CV) number, and a new CV value as parameters.It programs (writes) a single decoder CV using thespecified value as source data.0KamProgramReadDecoderToDataBaseParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object ID1Opaque object ID handle returned byKamDecoderPutAdd.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamProgramReadDecoderToDataBase takes the decoder objectID as a parameter. It reads all enabled CV values fromthe decoder and stores them in the server database.0KamProgramDecoderFromDataBaseParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object ID1Opaque object ID handle returned byKamDecoderPutAdd.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamProgramDecoderFromDataBase takes the decoder object IDas a parameter. It programs (writes) all enabled decoderCV values using the server copy of the CVs as sourcedata.



A. Commands to Control all Decoder Types

[0087] This section describes the commands that all decoder types. These commands do things such getting the maximum address a given type of decoder supports, adding decoders to the database, etc.
60KamDecoderGetMaxModelsParameter ListTypeRangeDirection DescriptionpiMaxModelsint *1OutPointer to Maxmodel ID1Normally 1-65535. 0 on error.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamDecoderGetMaxModels takes no parameters. It sets thememory pointed to by piMaxModels to the maximum decodertype ID.0KamDecoderGetModelNameParameter ListTypeRangeDirection DescriptioniModel int 1-655351InDecoder type IDpbsModelName BSTR *  2OutDecoder namestring1Maximum value for this server given byKamDecoderGetMaxModels.2Exact return type depends on language. It isCstring * for C++. Empty string on error.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) . KamPortGetModelName takes adecoder type ID and a pointer to a string as parameters.It sets the memory pointed to by pbsModelName to a BSTRcontaining the decoder name.0KamDecoderSetModelToObjParameter ListTypeRangeDirection DescriptioniModel int1InDecoder model IDlDecoderObjectIDlong1InDecoder object ID1Maximum value for this server given byKamDecoderGetMaxModels.2Opaque object ID handle returned byKamDecoderPutAdd.Return ValueTypeRange DescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamDecoderSetModelToObj takes a decoder ID and decoderobject ID as parameters. It sets the decoder model typeof the decoder at address iDecoderObjectID to the typespecified by iModel.0KamDecoderGetMaxAddressParameter ListTypeRangeDirection DescriptioniModelint1InDecoder type IDpiMaxAddressint *2OutMaximum decoderaddress1Maximum value for this server given byKamDecoderGetMaxModels.2Model dependent. 0 returned on error.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamDecoderGetMaxAddress takes a decoder type ID and apointer to store the maximum address as parameters. Itsets the memory pointed to by piMaxAddress to the maximumaddress supported by the specified decoder.0KamDecoderChangeOldNewAddrParameter ListTypeRangeDirection DescriptionlOldObjIDlong1InOld decoder object IDiNewAddrint2InNew decoder addressplNewObjIDlong * 1OutNew decoder object ID1Opaque object ID handle returned byKamDecoderPutAdd.21-127 for short locomotive addresses. 1-10239 forlong locomotive decoders. 0-511 for accessory decoders.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamDecoderChangeOldNewAddr takes an old decoder object IDand a new decoder address as parameters. It moves thespecified locomotive or accessory decoder to iNewAddr andsets the memory pointed to by plNewObjID to the newobject ID. The old object ID is now invalid and shouldno longer be used.0KamDecoderMovePortParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong 1InDecoder object IDiLogicalPortIDint1-65535 2InLogical port ID1Opaque object ID handle returned byKamDecoderPutAdd.2Maximum value for this server given byKamPortGetMaxLogPorts.Return ValueTypeRange DescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamDecoderMovePort takes a decoder object ID and logicalport ID as parameters. It moves the decoder specified bylDecoderObjectID to the controller specified byiLogicalPortID.0KamDecoderGetPortParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDpiLogicalPortID int * 1-655352OutPointer tological port ID1Opaque object ID handle returned byKamDecoderPutAdd.2Maximum value for this server given byKamPortGetMaxLogPorts.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamDecoderMovePort takes a decoder object ID and pointerto a logical port ID as parameters. It sets the memorypointed to by piLogicalPortID to the logical port IDassociated with lDecoderObjectID.0KamDecoderCheckAddrInUseParameter ListTypeRangeDirection DescriptioniDecoderAddressint1InDecoder addressiLogicalPortlDint2InLogical Port IDiDecoderClassint3InClass of decoder1Opaque object ID handle returned byKamDecoderPutAdd.2Maximum value for this server given byKamPortGetMaxLogPorts.31 - DECODER_ENGINE_TYPE,2 - DECODER_SWITCH_TYPE,3 - DECODER_SENSOR_TYPE.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for successful call and address not inuse. Nonzero is an error number (seeKamMiscGetErrorMsg). IDS_ERR_ADDRESSEXIST returned ifcall succeeded but the address exists.KamDecoderCheckAddrInUse takes a decoder address, logicalport, and decoder class as parameters. It returns zeroif the address is not in use. It will returnIDS_ERR_ADDRESSEXIST if the call succeeds but the addressalready exists. It will return the appropriate non zeroerror number if the calls fails.0KamDecoderGetModelFromObjParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDpiModelint *1-65535 2OutPointer to decodertypeID1Opaque object ID handle returned byKamDecoderPutAdd.2Maximum value for this server given byKamDecoderGetMaxModels.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamDecoderGetModelFromObj takes a decoder object ID andpointer to a decoder type ID as parameters. It sets thememory pointed to by piModel to the decoder type IDassociated with iDCCAddr.0KamDecoderGetModelFacilityParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDpdwFacilitylong *2OutPointer to decoderfacility mask1Opaque object ID handle returned byKamDecoderPutAdd.2 0 - DCODE_PRGMODE_ADDR1 -DCODE_PRGMODE_REG2 - DCODE_PRGMODE_PAGE3 - DCODE_PRGMODE_DIR4 - DCODE_PRGMODE_FLYSHT5 - DCODE_PRGMODE_FLYLNG6 - Reserved7 - Reserved8 - Reserved9 - Reserved10 - Reserved11 - Reserved12 - Reserved13 - DCODE_FEAT_DIRLIGHT14 - DCODE_FEAT_LNGADDR15 - DCODE_FEAT_CVENABLE16 - DCODE_FEDMODE_ADDR17 - DCODE_FEDMODE_REG18 - DCODE_FEDMODE_PAGE19 - DCODE_FEDMODE_DIR20 - DCODE_FEDMODE_FLYSHT21 - DCODE_FEDMODE_FLYLNGReturn ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamDecoderGetModelFacility takes a decoder object ID andpointer to a decoder facility mask as parameters. Itsets the memory pointed to by pdwFacility to the decoderfacility mask associated with iDCCAddr.0KamDecoderGetObjCountParameter ListTypeRangeDirection DescriptioniDecoderClassint1InClass of decoderpiObjCountint *0-65535OutCount of activedecoders11 - DECODER_ENGINE_TYPE,2 - DECODER_SWITCH_TYPE,3 - DECODER_SENSOR_TYPE.Return ValueTypeRangeDescription&Circlesolid;iError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg)KamDecoderGetObjCount takes a decoder class and a pointerto an address count as parameters. It sets the memorypointed to by piObjCount to the count of active decodersof the type given by iDecoderClass.0KamDecoderGetObjAtIndexParameter ListTypeRangeDirection Description&Circlesolid;iIndex  int1InDecoder array indexiDecoderClassint2InClass of decoderplDecoderObjectIDlong * 3OutPointer to decoderobject ID10 to (KamDecoderGetAddressCount - 1).21 - DECODER_ENGINE_TYPE,2 - DECODER_SWITCH_TYPE,3 - DECODER_SENSOR_TYPE.3Opaque object ID handle returned byKamDecoderPutAdd.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamDecoderGetObjCount takes a decoder index, decoderclass, and a pointer to an object ID as parameters. Itsets the memory pointed to by plDecoderobjectID to theselected object ID.0KamDecoderPutAddParameter ListTypeRangeDirection DescriptioniDecoderAddressint1InDecoder addressiLogicalCmdPortIDint1-655352InLogicalcommandport IDiLogicalProgPortIDint1-655352InLogicalprogrammingport IDiClearStateint3InClear state flagiModel  int4InDecoder model type IDplDecoderObjectIDlong *5OutDecoderobject ID11-127 for short locomotive addresses. 1-10239 forlong locomotive decoders. 0-511 for accessory decoders.2Maximum value for this server given byKamPortGetMaxLogPorts.30 - retain state, 1 - clear state.4Maximum value for this server given byKamDecoderGetMaxModels.5Opaque object ID handle. The object ID is used toreference the decoder.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamDecoderPutAdd takes a decoder object ID, commandlogical port, programming logical port, clear flag,decoder model ID, and a pointer to a decoder object ID asparameters. It creates a new locomotive object in thelocomotive database and sets the memory pointed to byplDecoderObjectID to the decoder object ID used by theserver as a key.0KamDecoderPutDelParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDiClearStateint2InClear state flag1Opaque object ID handle returned byKamDecoderPutAdd.20 - retain state, 1 - clear state.Return ValueTypeRangeDescriptions&Circlesolid;iError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamDecoderPutDel takes a decoder object ID and clear flagas parameters. It deletes the locomotive object specifiedby lDecoderObjectID from the locomotive database.0KamDecoderGetMfgNameParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDpbsMfgName BSTR *2OutPointer tomanufacturer name1Opaque object ID handle returned byKamDecoderPutAdd.2Exact return type depends on language. It isCstring * for C++. Empty string on error.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamDecoderGetMfgName takes a decoder object ID andpointer to a manufacturer name string as parameters. Itsets the memory pointed to by pbsMfgName to the name ofthe decoder manufacturer.0KamDecoderGetPowerModeParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDpbsPowerMode BSTR * 2OutPointer todecoder powermode1Opaque object ID handle returned byKamDecoderPutAdd.2Exact return type depends on language. It isCstring * for C++. Empty string on error.Return ValueTypeRangeDescription&Circlesolid;iError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamDecoderGetPowerMode takes a decoder object ID and apointer to the power mode string as parameters. It setsthe memory pointed to by pbsPowerMode to the decoderpower mode.0KamDecoderGetMaxSpeedParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDpiSpeedStep  int *2OutPointer to maxspeed step1Opaque object ID handle returned byKamDecoderPutAdd.214, 28, 56, or 128 for locomotive decoders. 0 foraccessory decoders.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamDecoderGetMaxSpeed takes a decoder object ID and apointer to the maximum supported speed step asparameters. It sets the memory pointed to by piSpeedStepto the maximum speed step supported by the decoder.



A. Commands to Control Locomotive Decoders

[0088] This section describes the commands that control locomotive decoders. These commands control things such as locomotive speed and direction. For efficiency, a copy of all the engine variables such speed is stored in the server. Commands such as KamEngGetSpeed communicate only with the server, not the actual decoder. You should first make any changes to the server copy of the engine variables. You can send all changes to the engine using the KamCmdCommand command.
70KamEngGetSpeedParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDlpSpeedint *2OutPointer to locomotivespeedlpDirectionint * 3OutPointer to locomotivedirection1Opaque object ID handle returned byKamDecoderPutAdd.2Speed range is dependent on whether the decoder isset to 14,18, or 128 speed steps and matches the valuesdefined by NMRA S9.2 and RP 9.2.1. 0 is stop and 1 isemergency stop for all modes.3Forward is boolean TRUE and reverse is booleanFALSE.Return ValueTypeRangeDescriptioniErrorshort1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamEngGetSpeed takes the decoder object ID and pointersto locations to store the locomotive speed and directionas parameters. It sets the memory pointed to by lpSpeedto the locomotive speed and the memory pointed to bylpDirection to the locomotive direction.0KamEngPutSpeedParameter ListTypeRangeDirection Description&Circlesolid;lDecoderObjectIDlong1InDecoder object IDiSpeed int2InLocomotive speediDirectionint3InLocomotive direction1Opaque object ID handle returned byKamDecoderPutAdd.2Speed range is dependent on whether the decoder isset to 14,18, or 128 speed steps and matches the valuesdefined by NMRA S9.2 and RP 9.2.1. 0 is stop and 1 isemergency stop for all modes.3Forward is boolean TRUE and reverse is booleanFALSE.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamEngPutSpeed takes the decoder object ID, newlocomotive speed, and new locomotive direction asparameters. It sets the locomotive database speed toiSpeed and the locomotive database direction toiDirection. Note: This command only changes thelocomotive database. The data is not sent to the decoderuntil execution of the KamCmdCommand command. Speed isset to the maximum possible for the decoder if iSpeedexceeds the decoders range.0KamEngGetSpeedStepsParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDlpSpeedStepsint *14,28,128OutPointer to numberof speed steps1Opaque object ID handle returned byKamDecoderPutAdd.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamEngGetSpeedSteps takes the decoder object ID and apointer to a location to store the number of speed stepsas a parameter. It sets the memory pointed to bylpSpeedSteps to the number of speed steps.0KamEngPutSpeedStepsParameter ListTypeRangeDirection DescriptioniDecoderObjectIDlong1InDecoder object IDiSpeedSteps  int14,28,128InLocomotive speedsteps1Opaque object ID handle returned byKamDecoderPutAdd.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamEngPutSpeedSteps takes the decoder object ID and a newnumber of speed steps as a parameter. It sets the numberof speed steps in the locomotive database to iSpeedSteps.Note: This command only changes the locomotive database.The data is not sent to the decoder until execution ofthe KamCmdCommand command. KamDecoderGetMaxSpeed returnsthe maximum possible speed for the decoder. An error isgenerated if an attempt is made to set the speed stepsbeyond this value.0KamEngGetFunctionParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDiFunctionIDint0-8 2InFunction ID numberlpFunctionint *3OutPointer to functionvalue1Opaque object ID handle returned byKamDecoderPutAdd.2FL is 0. F1-F8 are 1-8 respectively. Maximum forthis decoder is given by KamEngGetFunctionNax. 3Function active is boolean TRUE and inactive is booleanFALSE.Return ValueTypeRangeDescriptioniErrorshort1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamEngGetFunction takes the decoder object ID, a functionID, and a pointer to the location to store the specifiedfunction state as parameters. It sets the memory pointedto by lpFunction to the specified function state.0KamEngPutFunctionParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDiFunctionIDint0-8 2InFunction ID numberiFunctionint3InFunction value1Opaque object ID handle returned byKamDecoderPutAdd.2FL is 0. F1-F8 are 1-8 respectively. Maximum forthis decoder is given by KamEngGetFunctionMax.3Function active is boolean TRUE and inactive isboolean FALSE.Return ValueTypeRangeDescription&Circlesolid;iError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamEngPutFunction takes the decoder object ID, a functionID, and a new function state as parameters. It sets thespecified locomotive database function state toiFunction. Note: This command only changes thelocomotive database. The data is not sent to the decoderuntil execution of the KamCmdCommand command.0KamEngGetFunctionMaxParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDpiMaxFunctionint *0-8OutPointer to maximumfunction number1Opaque object ID handle returned byKamDecoderPutAdd.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamEngGetFunctionMax takes a decoder object ID and apointer to the maximum function ID as parameters. Itsets the memory pointed to by piMaxFunction to themaximum possible function number for the specifieddecoder.0KamEngGetNameParameter ListTypeRangeDirection DescriptioniDecoderObjectIDlong1InDecoder object IDpbsEngNameBSTR *2OutPointer tolocomotive name1Opaque object ID handle returned byKamDecoderPutAdd.2Exact return type depends on language. It isCstring * for C++. Empty string on error.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamEngGetName takes a decoder object ID and a pointer tothe locomotive name as parameters. It sets the memorypointed to by pbsEngName to the name of the locomotive.0KamEngPutNameParameter ListTypeRangeDirection Description&Circlesolid;lDecoderObjectIDlong1InDecoder object IDbsEngNameBSTR2OutLocomotive name1Opaque object ID handle returned byKamDecoderPutAdd.2Exact parameter type depends on language. It isLPCSTR for C++.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamEngPutName takes a decoder object ID and a BSTR asparameters. It sets the symbolic locomotive name tobsEngName.0KamEngGetFunctionNameParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object IDiFunctionIDint0-8 2InFunction ID numberpbsFcnNameStringBSTR * 3OutPointer tofunction name1Opaque object ID handle returned byKamDecoderPutAdd.2FL is 0. F1-F8 are 1-8 respectively. Maximum forthis decoder is given by KamEngGetFunctionMax. 3 Exactreturn type depends on language. It is Cstring * forC++. Empty string on error.Return ValueTypeRangeDescriptioniError  short1Error flag1iError&Circlesolid; = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamEngGetFuncntionName takes a decoder object ID,function ID, and a pointer to the function name asparameters. It sets the memory pointed to bypbsFcnNameString to the symbolic name of the specifiedfunction.0KamEngPutFunctionNameParameter ListTypeRangeDirectionDescriptionlDecoderObjectIDlong1InDecoder object IDiFunctionIDint0-8 2InFunction ID numberbsFcnNameStringBSTR 3InFunction name1Opaque object ID handle returned byKamDecoderPutAdd.2FL is 0. F1-F8 are 1-8 respectively. Maximum forthis decoder is given by KamEngGetFunctionMax.3Exact parameter type depends on language. It isLPCSTR for C++.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamEngPutFunctionName takes a decoder object ID, functionID, and a BSTR as parameters. It sets the specifiedsymbolic function name to bsFcnNameString.0KamEngGetConsistMaxParameter ListTypeRangeDirectionDescriptionlDecoderObjectIDlong1InDecoder object IDpiMaxConsistint *2OutPointer to max consistnumber1Opaque object ID handle returned byKamDecoderPutAdd.2Command station dependent.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamEngGetConsistMax takes the decoder object ID and apointer to a location to store the maximum consist asparameters. It sets the location pointed to bypiMaxConsist to the maximum number of locomotives thatcan but placed in a command station controlled consist.Note that this command is designed for command stationconsisting. CV consisting is handled using the CVcommands.0KamEngPutConsistParentParameter ListTypeRangeDirection DescriptionlDCCParentObjIDlong1InParent decoderobject IDiDCCAliasAddr int2InAlias decoder address1Opaque object ID handle returned byKamDecoderPutAdd.21-127 for short locomotive addresses. 1-10239 forlong locomotive decoders.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamEngPutConsistParent takes the parent object ID and analias address as parameters. It makes the decoderspecified by lDCCParentObjID the consist parent referredto by iDCCAliasAddr. Note that this command is designedfor command station consisting. CV consisting is handledusing the CV commands. If a new parent is defined for aconsist; the old parent becomes a child in the consist.To delete a parent in a consist without deleting theconsist, you must add a new parent then delete the oldparent using KamEngPutConsistRemoveObj.0KamEngPutConsistChildParameter ListTypeRangeDirection DescriptionlDCCParentObjIDlong1InParent decoderobject IDlDCCObjID long1InDecoder object ID1Opaque object ID handle returned byKamDecoderPutAdd.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamEngPutConsistChild takes the decoder parent object IDand decoder object ID as parameters. It assigns thedecoder specified by lDCCObjID to the consist identifiedby lDCCParentObjID. Note that this command is designedfor command station consisting. CV consisting is handledusing the CV commands. Note: This command is invalid ifthe parent has not been set previously usingKamEngPutConsistParent.0KamEngPutConsistRemoveObjParameter ListTypeRangeDirection DescriptionlDecoderObjectIDlong1InDecoder object ID1Opaque object ID handle returned byKamDecoderPutAdd.Return ValueTypeRangeDescriptioniError  short1Error flag1iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg) .KamEngPutConsistRemoveObj takes the decoder object ID asa parameter. It removes the decoder specified bylDecoderObjectID from the consist. Note that thiscommand is designed for command station consisting. CVconsisting is handled using the CV commands. Note: Ifthe parent is removed, all children are removed also.



A. Commands to Control Accessory Decoders

[0089] This section describes the commands that control accessory decoders. These commands control things such as accessory decoder activation state. For efficiency, a copy of all the engine variables such speed is stored in the server. Commands such as KamAccGetFunction communicate only with the server, not the actual decoder. You should first make any changes to the server copy of the engine variables. You can send all changes to the engine using the KamCmdCommand command.
80KamAccGetFunctionParameter ListTypeRangeDirectionDescriptionlDecoderObjectIDlong1InDecoder objectIDiFunctionIDint0-31 2InFunction ID numberlpFunctionint *3OutPointer to functionvalue1   Opaque object ID handle returned byKamDecoderPutAdd.2   Maximum for this decoder is given byKamAccGetFunctionMax.3   Function active is boolean TRUE and inactive isboolean FALSE.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamAccGetFunction takes the decoder object ID, a functionID, and a pointer to the location to store the specifiedfunction state as parameters. It sets the memory pointedto by lpFunction to the specified function state.0KamAccGetFunctionAllParameter ListTypeRangeDirectionDescriptionlDecoderObjectIDlong1InDecoder objectIDpiValue int *2OutFunction bit mask1   Opaque object ID handle returned byKamDecoderPutAdd.2   Each bit represents a single function state.Maximum for this decoder is given byKamAccGetFunctionMax.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamAccGetFunctionAll takes the decoder object ID and apointer to a bit mask as parameters. It sets each bit inthe memory pointed to by piValue to the correspondingfunction state.0KamAccPutFunctionParameter ListTypeRangeDirectionDescriptionlDecoderObjectIDlong1InDecoder objectIDiFunctionIDint0-31 2InFunction ID numberiFunctionint3InFunction value1   Opaque object ID handle returned byKamDecoderPutAdd.2   Maximum for this decoder is given byKamAccGetFunctionMax.3   Function active is boolean TRUE and inactive isboolean FALSE.Return ValueTypeRangeDescription&Circlesolid;iError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamAccPutFunction takes the decoder object ID, a functionID, and a new function state as parameters. It sets thespecified accessory database function state to iFunction.Note: This command only changes the accessory database.The data is not sent to the decoder until execution ofthe KamCmdCommand command.0KamAccPutFunctionAllParameter ListTypeRangeDirectionDescriptionlDecoderObjectIDlong1InDecoder objectIDiValue int2InPointer to function statearray1   Opaque object ID handle returned byKamDecoderPutAdd.2   Each bit represents a single function state.Maximum for this decoder is given byKamAccGetFunctionMax.Return ValueTypeRangeDescription&Circlesolid;iError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamAccPutFunctionAll takes the decoder object ID and abit mask as parameters. It sets all decoder functionenable states to match the state bits in iValue. Thepossible enable states are TRUE and FALSE. The data isnot sent to the decoder until execution of theKamCmdCommand command.0KamAccGetFunctionMaxParameter ListTypeRangeDirectionDescriptionlDecoderObjectIDlong1InDecoder objectIDpiMaxFunctionint*0-31 2OutPointer to maximumfunction number1   Opaque object ID handle returned byKamDecoderPutAdd.2   Maximum for this decoder is given byKamAccGetFunctionMax.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamAccGetFunctionMax takes a decoder object ID andpointer to the maximum function number as parameters. Itsets the memory pointed to by piMaxFunction to themaximum possible function number for the specifieddecoder.0KamAccGetNameParameter ListTypeRangeDirectionDescriptionlDecoderObjectIDlong1InDecoder objectIDpbsAccNameStringBSTR * 2OutAccessory name1   Opaque object ID handle returned byKamDecoderPutAdd.2   Exact return type depends on language. It isCstring * for C++. Empty string on error.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamAccGetName takes a decoder object ID and a pointer toa string as parameters. It sets the memory pointed to bypbsAccNameString to the name of the accessory.0KamAccPutNameParameter ListTypeRangeDirectionDescriptionlDecoderObjectIDlong1InDecoder objectIDbsAccNameStringBSTR2InAccessory name1   Opaque object ID handle returned byKamDecoderPutAdd.2   Exact parameter type depends on language. It isLPCSTR for C++.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamAccPutName takes a decoder object ID and a BSTR asparameters. It sets the symbolic accessory name tobsAccName.0KamAccGetFunctionNameParameter ListTypeRangeDirectionDescriptionlDecoderObjectIDlong1InDecoder objectIDiFunctionIDint0-31 2InFunction ID numberpbsFcnNameStringBSTR * 3OutPointer tofunction name1   Opaque object ID handle returned byKamDecoderPutAdd.2   Maximum for this decoder is given byKamAccGetFunctionMax.3   Exact return type depends on language. It isCstring * for C++. Empty string on error.Return ValueTypeRangeDescription&Circlesolid;iError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamAccGetFuncntionName takes a decoder object ID,function ID, and a pointer to a string as parameters. Itsets the memory pointed to by pbsFcnNameString to thesymbolic name of the specified function.0KamAccPutFunctionNameParameter ListTypeRangeDirectionDescriptionlDecoderObjectIDlong1InDecoder objectIDiFunctionIDint0-31 2InFunction ID numberbsFcnNameStringBSTR3InFunction name1   Opaque object ID handle returned byKamDecoderPutAdd.2   Maximum for this decoder is given byKamAccGetFunctionMax.3   Exact parameter type depends on language. It isLPCSTR for C++.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamAccPutFunctionName takes a decoder object ID, functionID, and a BSTR as parameters. It sets the specifiedsymbolic function name to bsFcnNameString.0KamAccRegFeedbackParameter ListTypeRangeDirectionDescription&Circlesolid;lDecoderObjectIDlong1InDecoder objectIDbsAccNodeBSTR1InServer node nameiFunctionIDint0-31 3InFunction ID number1   Opaque object ID handle returned byKamDecoderPutAdd.2   Exact parameter type depends on language. It isLPCSTR for C++.3   Maximum for this decoder is given byKamAccGetFunctionMax.Return ValueTypeRangeDescriptioniError short1Error flag1   iError&Circlesolid; = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamAccRegFeedback takes a decoder object ID, node namestring, and function ID, as parameters. It registersinterest in the function given by iFunctionID by themethod given by the node name string bsAccNode.bsAccNode identifies the server application and method tocall if the function changes state. Its format is“\\{Server}\{App}.{Method}” where {Server} is the servername, {App} is the application name, and {Method} is themethod name.0KamAccRegFeedbackAllParameter ListTypeRangeDirectionDescriptionlDecoder ObjectIDlong1InDecoder objectIDbsAccNodeBSTR2InServer node name1   Opaque object ID handle returned byKamDecoderPutAdd.2   Exact parameter type depends on language. It isLPCSTR for C++.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamAccRegFeedbackAll takes a decoder object ID and nodename string as parameters. It registers interest in allfunctions by the method given by the node name stringbsAccNode. bsAccNode identifies the server applicationand method to call if the function changes state. Itsformat is “\\{Server}\{App}.{Method}” where {Server} isthe server name, {App} is the application name, and{Method} is the method name.0KamAccDelFeedbackParameter ListTypeRangeDirectionDescriptioniDecoderObjectIDlong1InDecoder objectIDbsAccNodeBSTR2InServer node nameiFunctionIDint0-31 3InFunction ID number1   Opaque object ID handle returned byKamDecoderPutAdd.2   Exact parameter type depends on language. It isLPCSTR for C++.3   Maximum for this decoder is given byKamAccGetFunctionMax.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamAccDelFeedback takes a decoder object ID, node namestring, and function ID, as parameters. It deletesinterest in the function given by iFunctionID by themethod given by the node name string bsAccNode.bsAccNode identifies the server application and method tocall if the function changes state. Its format is“\\{Server}\{App}.{Method}” where {Server} is the servername, {App} is the application name, and {Method} is themethod name.0KamAccDelFeedbackAllParameter ListTypeRangeDirectionDescription&Circlesolid;lDecoderObjectIDlong1InDecoder objectIDbsAccNodeBSTR 2InServer node name1   Opaque object ID handle returned byKamDecoderputAdd.2   Exact parameter type depends on language. It isLPCSTR for C++.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamAccDelFeedbackAll takes a decoder object ID and nodename string as parameters. It deletes interest in allfunctions by the method given by the node name stringbsAccNode. bsAccNode identifies the server applicationand method to call if the function changes state. Itsformat is “\\{Server}\{App}.{Method}” where {Server} isthe server name, {App} is the application name, and{Method} is the method name.



A. Commands to Control the Command Station

[0090] This section describes the commands that control the command station. These commands do things such as controlling command station power. The steps to control a given command station vary depending on the type of command station.
90KamOprPutTurnOnStationParameter ListTypeRangeDirectionDescriptioniLogicalPortIDint1-655351InLogical port ID1   Maximum value for this server given byKamPortGetMaxLogPorts.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamOprPutTurnOnStation takes a logical port ID as aparameter. It performs the steps necessary to turn onthe command station. This command performs a combinationof other commands such as KamOprPutStartStation,KamOprPutClearStation, and KamOprPutPowerOn.0KamOprPutStartStationParameter ListTypeRangeDirectionDescriptioniLogicalPortIDint1-655351InLogical port ID1   Maximum value for this server given byKamPortGetMaxLogPorts.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamOprPutStartStation takes a logical port ID as aparameter. It performs the steps necessary to start thecommand station.0KamOprPutClearStationParameter ListTypeRangeDirectionDescriptioniLogicalPortIDint1-655351InLogical port ID1   Maximum value for this server given byKamPortGetMaxLogPorts.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamOprPutClearStation takes a logical port ID as aparameter. It performs the steps necessary to clear thecommand station queue.0KamOprPutStopStationParameter ListTypeRangeDirectionDescriptioniLogicalPortIDint1-655351InLogical port ID1   Maximum value for this server given byKamPortGetMaxLogPorts.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamOprPutStopStation takes a logical port ID as aparameter. It performs the steps necessary to stop thecommand station.0KamOprPutPowerOnParameter ListTypeRangeDirectionDescriptioniLogicalPortIDint1-655351InLogical port ID1   Maximum value for this server given byKamPortGetMaxLogPorts.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamOprPutPowerOn takes a logical port ID as a parameter.It performs the steps necessary to apply power to thetrack.0KamOprPutPowerOffParameter ListTypeRangeDirectionDescriptioniLogicalPortIDint1-655351InLogical port ID1   Maximum value for this server given byKamPortGetMaxLogPorts.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamOprPutPowerOff takes a logical port ID as a parameter.It performs the steps necessary to remove power from thetrack.0KamOprPutHardResetParameter ListTypeRangeDirectionDescriptioniLogicalPortIDint1-655351InLogical port ID1   Maximum value for this server given byKamPortGetMaxLogPorts.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamOprPutHardReset takes a logical port ID as aparameter. It performs the steps necessary to perform ahard reset of the command station.0KamOprPutEmergencyStopParameter ListTypeRangeDirectionDescriptioniLogicalPortIDint1-655351InLogical port ID1   Maximum value for this server given byKamPortGetMaxLogPorts.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamOprPutEmergencyStop takes a logical port ID as aparameter. It performs the steps necessary to broadcastan emergency stop command to all decoders.0KamOprGetStationStatusParameter ListTypeRangeDirectionDescriptioniLogicalPortIDint1-655351InLogical port IDpbsCmdStatBSTR * 2OutCommand station statusstring1   Maximum value for this server given byKamPortGetMaxLogPorts.2   Exact return type depends on language. It isCstring * for C++.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamOprGetStationStatus takes a logical port ID and apointer to a string as parameters. It set the memorypointed to by pbsCmdStat to the command station status.The exact format of the status BSTR is vendor dependent.



A. Commands to Configure the Command Station Communication Port

[0091] This section describes the commands that configure the command station communication port. These commands do things such as setting BAUD rate. Several of the commands in this section use the numeric controller ID (iControllerID) to identify a specific type of command station controller. The following table shows the mapping between the controller ID (iControllerID) and controller name (bsControllerName) for a given type of command station controller.
10iControllerIDbsControllerNameDescription0UNKNOWNUnknown controller type1SIMULATInterface simulator2LENZ_1xLenz version 1 serial support module3LENZ_2xLenz version 2 serial support module4DIGIT_DT200Digitrax direct drive support usingDT2005DIGIT_DCS100Digitrax direct drive support usingDCS1006MASTERSERIESNorth coast engineering masterseries7SYSTEMONESystem one8RAMFIXRAMFIxx system9SERIALNMRA serial interface10EASYDCCCVP Easy DCC11MRK6050Marklin 6050 interface (AC and DC)12MRK6023Marklin 6023 interface (AC)13DIGIT_PR1Digitrax direct drive using PR114DIRECTDirect drive interface routine15ZTCZTC system ltd16TRIXTRIX controlleriIndexNameiValue Values0RETRANS 10-2551RATE 0-300 BAUD, 1-1200 BAUD, 2-2400 BAUD,3-4800 BAUD, 4-9600 BAUD, 5-14400 BAUD,6-16400 BAUD, 7-19200 BAUD2PARITY0 - NONE, 1 - ODD, 2 - EVEN, 3 - MARK,4 - SPACE3STOP0-1 bit, 1-1.5 bits, 2-2 bits4WATCHDOG 500-65535 milliseconds. Recommendedvalue 20485FLOW 0 - NONE, 1 - XON/XOFF, 2 - RTS/CTS, 3 BOTH6DATA 0-7 bits, 1-8 bits7DEBUGBit mask. Bit 1 sends messages to debug file.Bit 2 sends messages to the screen. Bit 3 showsqueue data. Bit 4 shows UI status. Bit 5 isreserved. Bit 6 shows semaphore and criticalsections. Bit 7 shows miscellaneous messages. Bit8 shows comm port activity. 130 decimal isrecommended for debugging.8PARALLEL0KamPortPutConfigParameter ListTypeRangeDirectionDescription&Circlesolid;iLogicalPortIDint1-655351InLogical port IDiIndexint2InConfiguration type indexiValueint2InConfiguration valueiKeyint3InDebug key1   Maximum value for this server given byKamPortGetMaxLogPorts.2   See FIG. 7: Controller configuration Index valuesfor a table of indexes and values.3   Used only for the DEBUG iIndex value. Should be setto 0.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamPortPutConfig takes a logical port ID, configurationindex, configuration value, and key as parameters. Itsets the port parameter specified by iIndex to the valuespecified by iValue. For the DEBUG iIndex value, thedebug file path is C:\Temp\Debug{PORT}.txt where {PORT}is the physical comm port ID.0KamPortGetConfigParameter ListTypeRangeDirectionDescriptioniLogicalPortIDint1-655351InLogical port IDiIndexint2InConfiguration type indexpiValueint *2OutPointer to configuration value1   Maximum value for this server given byKamPortGetMaxLogPorts.2   See FIG. 7: Controller configuration Index valuesfor a table of indexes and values.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamPortGetConfig takes a logical port ID, configurationindex, and a pointer to a configuration value asparameters. It sets the memory pointed to by piValue tothe specified configuration value.0KamPortGetNameParameter ListTypeRangeDirectionDescriptioniPhysicalPortIDint1-655351InPhysical portnumberpbsPortNameBSTR * 2OutPhysical port name1   Maximum value for this server given byKamPortGetMaxPhysical.2   Exact return type depends on language. It isCstring * for C++. Empty string on error.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamPortGetName takes a physical port ID number and apointer to a port name string as parameters. It sets thememory pointed to by pbsPortName to the physical portname such as “COMM1.”0KamPortPutMapControllerParameter ListTypeRangeDirectionDescriptioniLogicalPortIDint1-655351InLogical port IDiControllerIDint1-655352InCommand stationtype IDiCommPortIDint1-655353InPhysical commport ID1   Maximum value for this server given byKamPortGetMaxLogPorts.2   See FIG. 6: Controller ID to controller namemapping for values. Maximum value for this server isgiven by KamMiscMaxControllerID.3   Maximum value for this server given byKamPortGetMaxPhysical.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamPortPutMapController takes a logical port ID, acommand station type ID, and a physical communicationsport ID as parameters. It maps iLogicalPortID toiCommPortID for the type of command station specified byiControllerID.0KamPortGetMaxLogPortsParameter ListTypeRangeDirectionDescription&Circlesolid;piMaxLogicalPortsint *1OutMaximum logicalport ID1   Normally 1-65535.  0 returned on error.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 if or success. Nonzero is an error number(see KamMiscGetErrorMsg).KamPortGetMaxLogPorts takes a pointer to a logical portID as a parameter. It sets the memory pointed to bypiMaxLogicalPorts to the maximum logical port ID.0KamPortGetMaxPhysicalParameter ListTypeRangeDirectionDescriptionpMaxPhysicalint *1OutMaximumphysicalport IDpMaxSerialint *1OutMaximumserial port IDpMaxParallelint *1OutMaximumparallelport ID1   Normally 1-65535.  0 returned on error.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamPortGetMaxPhysical takes a pointer to the number ofphysical ports, the number of serial ports, and thenumber of parallel ports as parameters. It sets thememory pointed to by the parameters to the associatedvalues



A. Commands that Control Command Flow to the Command Station

[0092] This section describes the commands that control the command flow to the command station. These commands do things such as connecting and disconnecting from the command station.
110KamCmdConnectParameter ListTypeRangeDirectionDescription&Circlesolid;iLogicalPortIDint1-655351InLogical port ID1   Maximum value for this server given byKamPortGetMaxLogPorts.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamCmdConnect takes a logical port ID as a parameter. Itconnects the server to the specified command station.0KamCmdDisConnectParameter ListTypeRangeDirectionDescriptioniLogicalPortIDint1-655351InLogical port ID1   Maximum value for this server given byKamPortGetMaxLogPorts.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamCmdDisConnect takes a logical port ID as a parameter.It disconnects the server to the specified commandstation.0KamCmdCommandParameter ListTypeRangeDirectionDescriptionlDecoderObjectIDlong1InDecoder objectID1   Opaque object ID handle returned byKamDecoderPutAdd.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamCmdCommand takes the decoder object ID as a parameter.It sends all state changes from the server database tothe specified locomotive or accessory decoder.



A. Cab Control Commands

[0093] This section describes commands that control the cabs attached to a command station.
120KamCabGetMessageParameter ListTypeRangeDirectionDescriptioniCabAddressint1-655351InCab addresspbsMsg BSTR *2OutCab message string1   Maximum value is command station dependent.2   Exact return type depends on language. It isCstring * for C++. Empty string on error.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamCabGetMessage takes a cab address and a pointer to amessage string as parameters. It sets the memory pointedto by pbsMsg to the present cab message.0KamCabPutMessageParameter ListTypeRangeDirectionDescriptioniCabAddressint1InCab addressbsMsg  BSTR2OutCab message string1   Maximum value is command station dependent.2   Exact parameter type depends on language. It isLPCSTR for C++.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamCabPutMessage takes a cab address and a BSTR asparameters. It sets the cab message to bsMsg.0KamCabGetCabAddrParameter ListTypeRangeDirectionDescription&Circlesolid;lDecoderObjectIDlong1InDecoder objectIDpiCabAddressint *1-655352OutPointer to Cabaddress1   Opaque object ID handle returned byKamDecoderPutAdd.2   Maximum value is command station dependent.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamCabGetCabAddr takes a decoder object ID and a pointerto a cab address as parameters. It set the memorypointed to by piCabAddress to the address of the cabattached to the specified decoder.0KamCabPutAddrToCabParameter ListTypeRangeDirectionDescriptionlDecoderObjectIDlong1InDecoder objectIDiCabAddressint1-655352InCab address1   Opaque object ID handle returned byKamDecoderPutAdd.2   Maximum value is command station dependent.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamCabPutAddrToCab takes a decoder object ID and cabaddress as parameters. It attaches the decoder specifiedby iDCCAddr to the cab specified by iCabAddress.



A. Miscellaneous Commands

[0094] This section describes miscellaneous commands that do not fit into the other categories.
130KamMiscGetErrorMsgParameter ListTypeRangeDirectionDescriptioniError  int0-655351InError flag1   iError = 0 for success. Nonzero indicates an error.Return ValueTypeRangeDescriptionbsErrorStringBSTR1Error string1   Exact return type depends on language. It isCstring for C++. Empty string on error.KamMiscGetErrorMsg takes an error flag as a parameter.It returns a BSTR containing the descriptive errormessage associated with the specified error flag.0KamMiscGetClockTimeParameter ListTypeRangeDirectionDescriptioniLogicalPortIDint1-655351InLogical port IDiSelectTimeModeint2InClock sourcepiDayint *0-6OutDay of weekpiHoursint *0-23OutHourspiMinutesint *0-59OutMinutespiRatioint *3OutFast clock ratio1   Maximum value for this server given byKamPortGetMaxLogPorts.2   0 - Load from command station and sync server.1 - Load direct from server. 2 - Load from cached servercopy of command station time.3   Real time clock ratio.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamMiscGetClockTime takes the port ID, the time mode, andpointers to locations to store the day, hours, minutes,and fast clock ratio as parameters. It sets the memorypointed to by piDay to the fast clock day, sets pointedto by piHours to the fast clock hours, sets the memorypointed to by piMinutes to the fast clock minutes, andthe memory pointed to by piRatio to the fast clock ratio.The servers local time will be returned if the commandstation does not support a fast clock.0KamMiscPutClockTimeParameter ListTypeRangeDirectionDescriptioniLogicalPortIDint1-655351InLogical port IDiDay int0-6InDay of weekiHoursint0-23 InHoursiMinutesint0-59InMinutesiRatio  int2InFast clock ratio1   Maximum value for this server given byKamPortGetMaxLogPorts. 2 Real time clock ratio.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamMiscPutClockTime takes the fast clock logical port,the fast clock day, the fast clock hours, the fast clockminutes, and the fast clock ratio as parameters. It setsthe fast clock using specified parameters.0KamMiscGetInterfaceVersionParameter ListTypeRangeDirectionDescriptionpbsInterfaceVersion BSTR * 1OutPointer to interfaceversion string1   Exact return type depends on language. It isCstring * for C++. Empty string on error.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamMiscGetInterfaceVersion takes a pointer to aninterface version string as a parameter. It sets thememory pointed to by pbsInterfaceVersion to the interfaceversion string. The version string may contain multiplelines depending on the number of interfaces supported.0KamMiscSaveDataParameter ListTypeRangeDirectionDescriptionNONEReturn ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamMiscSaveData takes no parameters. It saves all serverdata to permanent storage. This command is runautomatically whenever the server stops running. Demoversions of the program cannot save data and this commandwill return an error in that case.0KamMiscGetControllerNameParameter ListTypeRangeDirectionDescriptioniControllerIDint1-655351InCommand stationtype IDpbsName  BSTR*2OutCommand station typename1   See FIG. 6: Controller ID to controller namemapping for values. Maximum value for this server isgiven by KamMiscMaxControllerID.2   Exact return type depends on language. It isCstring * for C++. Empty string on error.Return ValueTypeRangeDescriptionbsName  BSTR1Command station type nameReturn ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamMiscGetControllerName takes a command station type IDand a pointer to a type name string as parameters. Itsets the memory pointed to by pbsName to the commandstation type name.0KamMiscGetControllerNameAtPortParameter ListTypeRangeDirectionDescriptioniLogicalPortIDint1-655351InLogical port IDpbsName  BSTR*2OutCommand station typename1   Maximum value for this server given byKamPortGetMaxLogPorts.2   Exact return type depends on language. It isCstring * for C++. Empty string on error.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamMiscGetControllerName takes a logical port ID and apointer to a command station type name as parameters. Itsets the memory pointed to by pbsName to the commandstation type name for that logical port.0KamMiscGetCommandStationValueParameter ListTypeRangeDirectionDescriptioniControllerIDint1-655351InCommand stationtype IDiLogicalPortIDint1-655352InLogical port IDiIndexint3InCommand station array indexpiValueint *0-65535OutCommand station value1   See FIG. 6: Controller ID to controller namemapping for values. Maximum value for this server isgiven by KamMiscMaxControllerID.2   Maximum value for this server given byKamPortGetMaxLogPorts.3   0 to KamMiscGetCommandStationIndexReturn ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamMiscGetCommandStationValue takes the controller ID,logical port, value array index, and a pointer to thelocation to store the selected value. It sets the memorypointed to by piValue to the specified command stationmiscellaneous data value.0KamMiscSetCommandStationvalueParameter ListTypeRangeDirectionDescriptioniControllerIDint1-655351InCommand stationtype IDiLogicalPortIDint1-655352InLogical port IDiIndexint3InCommand station array indexiValueint0-65535InCommand station value1   See FIG. 6: Controller ID to controller namemapping for values. Maximum value for this server isgiven by KamMiscMaxControllerID.2   Maximum value for this server given byKamPortGetMaxLogPorts. 3 0 toKamMiscGetCommandStationIndex.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamMiscSetCommandStationValue takes the controller ID,logical port, value array index, and new miscellaneousdata value. It sets the specified command station datato the value given by piValue.0KamMiscGetCommandStationIndexParameter ListTypeRangeDirectionDescriptioniControllerIDint1-655351InCommand stationtype IDiLogicalPortIDint1-655352InLogical port TDpiIndex  int0-65535OutPointer to maximumindex1   See FIG. 6: Controller ID to controller namemapping for values. Maximum value for this server isgiven by KamMiscMaxControllerID.2   Maximum value for this server given byKamPortGetMaxLogPorts.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamMiscGetCommandStationIndex takes the controller ID,logical port, and a pointer to the location to store themaximum index. It sets the memory pointed to by piIndexto the specified command station maximum miscellaneousdata index.0KamMiscMaxControllerIDParameter ListTypeRangeDirectionDescriptionpiMaxControllerIDint *1-65535 1OutMaxi-mumcontroller type ID1   See FIG. 6: Controller ID to controller namemapping for a list of controller ID values. 0 returnedon error.Return ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamMiscMaxControllerID takes a pointer to the maximumcontroller ID as a parameter. It sets the memory pointedto by piMaxControllerID to the maximum controller typeID.0KamMiscGetControllerFacilityParameter ListTypeRangeDirectionDescriptioniControllerIDint1-655351InCommand stationtype IDpdwFacilitylong *2OutPointer to commandstation facility mask1   See FIG. 6: Controller ID to controller namemapping for values. Maximum value for this server isgiven by KamMiscMaxControllerID.2 0 - CMDSDTA_PRGMODE_ADDR 1 - CMDSDTA_PRGMODE_REG 2 - CMDSDTA_PRGMODE_PAGE 3 - CMDSDTA_PRGMODE_DIR 4 - CMDSDTA_PRGMODE_FLYSHT 5 - CMDSDTA_PRGMODE_FLYLNG 6 - Reserved 7 - Reserved 8 - Reserved 9 - Reserved10 - CMDSDTA_SUPPORT_CONSIST11 - CMDSDTA_SUPPORT_LONG12 - CMDSDTA_SUPPORT_FEED13 - CMDSDTA_SUPPORT_2TRK14 - CMDSDTA_PROGRAM_TRACK15 - CMDSDTA_PROGMAIN_POFF16 - CMDSDTA_FEDMODE_ADDR17 - CMDSDTA_FEDMODE_REG18 - CMDSDTA_FEDMODE_PAGE19 - CMDSDTA_FEDMODE_DIR20 - CMDSDTA_FEDMODE_FLYSHT21 - CMDSDTA_FEDMODE_FLYLNG30 - Reserved31 - CMDSDTA_SUPPORT_FASTCLKReturn ValueTypeRangeDescriptioniError short1Error flag1   iError = 0 for success. Nonzero is an error number(see KamMiscGetErrorMsg).KamMiscGetControllerFacility takes the controller ID anda pointer to the location to store the selectedcontroller facility mask. It sets the memory pointed toby pdwFacility to the specified command station facilitymask.


[0095] The digital command stations 18 program the digital devices, such as a locomotive and switches, of the railroad layout. For example, a locomotive may include several different registers that control the horn, how the light blinks, speed curves for operation, etc. In many such locomotives there are 106 or more programable values. Unfortunately, it may take 1-10 seconds per byte wide word if a valid register or control variable (generally referred to collectively as registers) and two to four minutes to error out if an invalid register to program such a locomotive or device, either of which may contain a decoder. With a large number of byte wide words in a locomotive its takes considerable time to fully program the locomotive. Further, with a railroad layout including many such locomotives and other programmable devices, it takes a substantial amount of time to completely program all the devices of the model railroad layout. During the programming of the railroad layout, the operator is sitting there not enjoying the operation of the railroad layout, is frustrated, loses operating enjoyment, and will not desire to use digital programmable devices. In addition, to reprogram the railroad layout the operator must reprogram all of the devices of the entire railroad layout which takes substantial time. Similarly, to determine the state of all the devices of the railroad layout the operator must read the registers of each device likewise taking substantial time. Moreover, to reprogram merely a few bytes of a particular device requires the operator to previously know the state of the registers of the device which is obtainable by reading the registers of the device taking substantial time, thereby still frustrating the operator.


[0096] The present inventor came to the realization that for the operation of a model railroad the anticipated state of the individual devices of the railroad, as programmed, should be maintained during the use of the model railroad and between different uses of the model railroad. By maintaining data representative of the current state of the device registers of the model railroad determinations may be made to efficiently program the devices. When the user designates a command to be executed by one or more of the digital command stations 18, the software may determine which commands need to be sent to one or more of the digital command stations 18 of the model railroad. By only updating those registers of particular devices that are necessary to implement the commands of a particular user, the time necessary to program the railroad layout is substantially reduced. For example, if the command would duplicate the current state of the device then no command needs to be forwarded to the digital command stations 18. This prevents redundantly programming the devices of the model railroad, thereby freeing up the operation of the model railroad for other activities.


[0097] Unlike a single-user single-railroad environment, the system of the present invention may encounter “conflicting” commands that attempt to write to and read from the devices of the model railroad. For example, the “conflicting” commands may inadvertently program the same device in an inappropriate manner, such as the locomotive to speed up to maximum and the locomotive to stop. In addition, a user that desires to read the status of the entire model railroad layout will monopolize the digital decoders and command stations for a substantial time, such as up to two hours, thereby preventing the enjoyment of the model railroad for the other users. Also, a user that programs an extensive number of devices will likewise monopolize the digital decoders and command stations for a substantial time thereby preventing the enjoyment of the model railroad for other users.


[0098] In order to implement a networked selective updating technique the present inventor determined that it is desirable to implement both a write cache and a read cache. The write cache contains those commands yet to be programmed by the digital command stations 18. Valid commands from each user are passed to a queue in the write cache. In the event of multiple commands from multiple users (depending on user permissions and security) or the same user for the same event or action, the write cache will concatenate the two commands into a single command to be programmed by the digital command stations 18. In the event of multiple commands from multiple users or the same user for different events or actions, the write cache will concatenate the two commands into a single command to be programmed by the digital command stations 18. The write cache may forward either of the commands, such as the last received command, to the digital command station. The users are updated with the actual command programmed by the digital command station, as necessary.


[0099] The read cache contains the state of the different devices of the model railroad. After a command has been written to a digital device and properly acknowledged, if necessary, the read cache is updated with the current state of the model railroad. In addition, the read cache is updated with the state of the model railroad when the registers of the devices of the model railroad are read. Prior to sending the commands to be executed by the digital command stations 18 the data in the write cache is compared against the data in the read cache. In the event that the data in the read cache indicates that the data in the write cache does not need to be programmed, the command is discarded. In contrast, if the data in the read cache indicates that the data in the write cache needs to be programmed, then the command is programmed by the digital command station. After programming the command by the digital command station the read cache is updated to reflect the change in the model railroad. As becomes apparent, the use of a write cache and a read cache permits a decrease in the number of registers that need to be programmed, thus speeding up the apparent operation of the model railroad to the operator.


[0100] The present inventor further determined that errors in the processing of the commands by the railroad and the initial unknown state of the model railroad should be taken into account for a robust system. In the event that an error is received in response to an attempt to program (or read) a device, then the state of the relevant data of the read cache is marked as unknown. The unknown state merely indicates that the state of the register has some ambiguity associated therewith. The unknown state may be removed by reading the current state of the relevant device or the data rewritten to the model railroad without an error occurring. In addition, if an error is received in response to an attempt to program (or read) a device, then the command may be retransmitted to the digital command station in an attempt to program the device properly. If desirable, multiple commands may be automatically provided to the digital command stations to increase the likelihood of programming the appropriate registers. In addition, the initial state of a register is likewise marked with an unknown state until data becomes available regarding its state.


[0101] When sending the commands to be executed by the digital command stations 18 they are preferably first checked against the read cache, as previously mentioned. In the event that the read cache indicates that the state is unknown, such as upon initialization or an error, then the command should be sent to the digital command station because the state is not known. In this manner the state will at least become known, even if the data in the registers is not actually changed.


[0102] The present inventor further determined a particular set of data that is useful for a complete representation of the state of the registers of the devices of the model railroad.


[0103] An invalid representation of a register indicates that the particular register is not valid for both a read and a write operation. This permits the system to avoid attempting to read from and write to particular registers of the model railroad. This avoids the exceptionally long error out when attempting to access invalid registers.


[0104] An in use representation of a register indicates that the particular register is valid for both a read and a write operation. This permits the system to read from and write to particular registers of the model railroad. This assists in accessing valid registers where the response time is relatively fast.


[0105] A read error (unknown state) representation of a register indicates that each time an attempt to read a particular register results in an error.


[0106] A read dirty representation of a register indicates that the data in the read cache has not been validated by reading its valid from the decoder. If both the read error and the read dirty representations are clear then a valid read from the read cache may be performed. A read dirty representation may be cleared by a successful write operation, if desired.


[0107] A read only representation indicates that the register may not be written to. If this flag is set then a write error may not occur.


[0108] A write error (unknown state) representation of a register indicates that each time an attempt to write to a particular register results in an error.


[0109] A write dirty representation of a register indicates that the data in the write cache has not been written to the decoder yet. For example, when programming the decoders the system programs the data indicated by the write dirty. If both the write error and the write dirty representations are clear then the state is represented by the write cache. This assists in keeping track of the programming without excess overhead.


[0110] A write only representation indicates that the register may not be read from. If this flag is set then a read error may not occur.


[0111] Over time the system constructs a set of representations of the model railroad devices and the model railroad itself indicating the invalid registers, read errors, and write errors which may increases the efficiently of programing and changing the states of the model railroad. This permits the system to avoid accessing particular registers where the result will likely be an error.


[0112] The present inventor came to the realization that the valid registers of particular devices is the same for the same device of the same or different model railroads. Further, the present inventor came to the realization that a template may be developed for each particular device that may be applied to the representations of the data to predetermine the valid registers. In addition, the template may also be used to set the read error and write error, if desired. The template may include any one or more of the following representations, such as invalid, in use, read error, write only, read dirty, read only, write error, and write dirty for the possible registers of the device. The predetermination of the state of each register of a particular device avoids the time consuming activity of receiving a significant number of errors and thus constructing the caches. It is to be noted that the actual read and write cache may be any suitable type of data structure.


[0113] Many model railroad systems include computer interfaces to attempt to mimic or otherwise emulate the operation of actual full-scale railroads. FIG. 4 illustrates the organization of train dispatching by “timetable and train order” (T&TO) techniques. Many of the rules governing T&TO operation are related to the superiority of trains which principally is which train will take siding at the meeting point. Any misinterpretation of these rules can be the source of either hazard or delay. For example, misinterpreting the rules may result in one train colliding with another train.


[0114] For trains following each other, T&TO operation must rely upon time spacing and flag protection to keep each train a sufficient distance apart. For example, a train may not leave a station less than five minutes after the preceding train has departed. Unfortunately, there is no assurance that such spacing will be retained as the trains move along the line, so the flagman (rear brakeman) of a train slowing down or stopping will light and throw off a five-minute red flare which may not be passed by the next train while lit. If a train has to stop, a flagman trots back along the line with a red flag or lantern a sufficient distance to protect the train, and remains there until the train is ready to move at which time he is called back to the train. A flare and two track torpedoes provide protection as the flagman scrambles back and the train resumes speed. While this type of system works, it depends upon a series of human activities.


[0115] It is perfectly possible to operate a railroad safely without signals. The purpose of signal systems is not so much to increase safety as it is to step up the efficiency and capacity of the line in handling traffic. Nevertheless, it's convenient to discuss signal system principals in terms of three types of collisions that signals are designed to prevent, namely, rear-end, side-on, and head-on.


[0116] Block signal systems prevent a train from ramming the train ahead of it by dividing the main line into segments, otherwise known as blocks, and allowing only one train in a block at a time, with block signals indicating whether or not the block ahead is occupied. In many blocks, the signals are set by a human operator. Before clearing the signal, he must verify that any train which has previously entered the block is now clear of it, a written record is kept of the status of each block, and a prescribed procedure is used in communicating with the next operator. The degree to which a block frees up operation depends on whether distant signals (as shown in FIG. 5) are provided and on the spacing of open stations, those in which an operator is on duty. If as is usually the case it is many miles to the next block station and thus trains must be equally spaced. Nevertheless, manual block does afford a high degree of safety.


[0117] The block signaling which does the most for increasing line capacity is automatic block signals (ABS), in which the signals are controlled by the trains themselves. The presence or absence of a train is determined by a track circuit. Invented by Dr. William Robinson in 1872, the track circuit's key feature is that it is fail-safe. As can be seen in FIG. 6, if the battery or any wire connection fails, or a rail is broken, the relay can't pick up, and a clear signal will not be displayed.


[0118] The track circuit is also an example of what is designated in railway signaling practice as a vital circuit, one which can give an unsafe indication if some of its components malfunction in certain ways. The track circuit is fail-safe, but it could still give a false clear indication should its relay stick in the closed or picked-up position. Vital circuit relays, therefore, are built to very stringent standards: they are large devices; rely on gravity (no springs) to drop their armature; and use special non-loading contacts which will not stick together if hit by a large surge of current (such as nearby lightning).


[0119] Getting a track circuit to be absolutely reliable is not a simple matter. The electrical leakage between the rails is considerable, and varies greatly with the seasons of the year and the weather. The joints and bolted-rail track are by-passed with bond wire to assure low resistance at all times, but the total resistance still varies. It is lower, for example, when cold weather shrinks the rails and they pull tightly on the track bolts or when hot weather expands to force the ends tightly together. Battery voltage is typically limited to one or two volts, requiring a fairly sensitive relay. Despite this, the direct current track circuit can be adjusted to do an excellent job and false-clears are extremely rare. The principal improvement in the basic circuit has been to use slowly-pulsed DC so that the relay drops out and must be picked up again continually when a block is unoccupied. This allows the use of a more sensitive relay which will detect a train, but additionally work in track circuits twice as long before leakage between the rails begins to threaten reliable relay operation. Referring to FIGS. 7A and 7B, the situations determining the minimum block length for the standard two-block, three-indication ABS system. Since the train may stop with its rear car just inside the rear boundary of a block, a following train will first receive warning just one block-length away. No allowance may be made for how far the signal indication may be seen by the engineer. Swivel block must be as long as the longest stopping distance for any train on the route, traveling at its maximum authorized speed.


[0120] From this standpoint, it is important to allow trains to move along without receiving any approach indications which will force them to slow down. This requires a train spacing of two block lengths, twice the stopping distance, since the signal can't clear until the train ahead is completely out of the second block. When fully loaded trains running at high speeds, with their stopping distances, block lengths must be long, and it is not possible to get enough trains over the line to produce appropriate revenue.


[0121] The three-block, four-indication signaling shown in FIG. 7 reduces the excess train spacing by 50% with warning two blocks to the rear and signal spacing need be only ½ the braking distance. In particularly congested areas such as downgrades where stopping distances are long and trains are likely to bunch up, four-block, four-indication signaling may be provided and advanced approach, approach medium, approach and stop indications give a minimum of three-block warning, allowing further block-shortening and keeps things moving.


[0122]
FIG. 8 uses aspects of upper quadrant semaphores to illustrate block signaling. These signals use the blade rising 90 degrees to give the clear indication.


[0123] Some of the systems that are currently developed by different railroads are shown in FIG. 8. With the general rules discussed below, a railroad is free to establish the simplest and most easily maintained system of aspects and indications that will keep traffic moving safely and meet any special requirements due to geography, traffic pattern, or equipment. Aspects such as flashing yellow for approach medium, for example, may be used to provide an extra indication without an extra signal head. This is safe because a stuck flasher will result in either a steady yellow approach or a more restrictive light-out aspect. In addition, there are provisions for interlocking so the trains may branch from one track to another.


[0124] To take care of junctions where trains are diverted from one route to another, the signals must control train speed. The train traveling straight through must be able to travel at full speed. Diverging routes will require some limit, depending on the turnout members and the track curvature, and the signals must control train speed to match. One approach is to have signals indicate which route has been set up and cleared for the train. In the American approach of speed signaling, in which the signal indicates not where the train is going but rather what speed is allowed through the interlocking. If this is less than normal speed, distant signals must also give warning so the train can be brought down to the speed in time. FIGS. 9A and 9B show typical signal aspects and indications as they would appear to an engineer. Once a route is established and the signal cleared, route locking is used to insure that nothing can be changed to reduce the route's speed capability from the time the train approaching it is admitted to enter until it has cleared the last switch. Additional refinements to the basic system to speed up handling trains in rapid sequence include sectional route locking which unlocks portions of the route as soon as the train has cleared so that other routes can be set up promptly. Interlocking signals also function as block signals to provide rear-end protection. In addition, at isolated crossings at grade, an automatic interlocking can respond to the approach of a train by clearing the route if there are no opposing movements cleared or in progress. Automatic interlocking returns everything to stop after the train has passed. As can be observed, the movement of multiple trains among the track potentially involves a series of interconnected activities and decisions which must be performed by a controller, such as a dispatcher. In essence, for a railroad the dispatcher controls the operation of the trains and permissions may be set by computer control, thereby controlling the railroad. Unfortunately, if the dispatcher fails to obey the rules as put in place, traffic collisions may occur.


[0125] In the context of a model railroad the controller is operating a model railroad layout including an extensive amount of track, several locomotives (trains), and additional functionality such as switches. The movement of different objects, such as locomotives and entire trains, may be monitored by a set of sensors. The operator issues control commands from his computer console, such as in the form of permissions and class warrants for the time and track used. In the existing monolithic computer systems for model railroads a single operator from a single terminal may control the system effectively. Unfortunately, the present inventor has observed that in a multi-user environment where several clients are attempting to simultaneously control the same model railroad layout using their terminals, collisions periodically nevertheless occur. In addition, significant delay is observed between the issuance of a command and its eventual execution. The present inventor has determined that unlike full scale railroads where the track is controlled by a single dispatcher, the use of multiple dispatchers each having a different dispatcher console may result in conflicting information being sent to the railroad layout. In essence, the system is designed as a computer control system to implement commands but in no manner can the dispatcher consoles control the actions of users. For example, a user input may command that an event occur resulting in a crash. In addition, a user may override the block permissions or class warrants for the time and track used thereby causing a collision. In addition, two users may inadvertently send conflicting commands to the same or different trains thereby causing a collision. In such a system, each user is not aware of the intent and actions of other users aside from any feedback that may be displayed on their terminal. Unfortunately, the feedback to their dispatcher console may be delayed as the execution of commands issued by one or more users may take several seconds to several minutes to be executed.


[0126] One potential solution to the dilemma of managing several users' attempt to simultaneously control a single model railroad layout is to develop a software program that is operating on the server which observes what is occurring. In the event that the software program determines that a collision is imminent, a stop command is issued to the train overriding all other commands to avoid such a collision. However, once the collision is avoided the user may, if desired, override such a command thereby restarting the train and causing a collision. Accordingly, a software program that merely oversees the operation of track apart from the validation of commands to avoid imminent collisions is not a suitable solution for operating a model railroad in a multi-user distributed environment. The present inventor determined that prior validation is important because of the delay in executing commands on the model railroad and the potential for conflicting commands. In addition, a hardware throttle directly connected to the model railroad layout may override all such computer based commands thereby resulting in the collision. Also, this implementation provides a suitable security model to use for validation of user actions.


[0127] Referring to FIG. 10, the client program 14 preferably includes a control panel 300 which provides a graphical interface (such as a personal computer with software thereon or a dedicated hardware source) for computerized control of the model railroad 302. The graphical interface may take the form of those illustrated in FIGS. 5-9, or any other suitable command interface to provide control commands to the model railroad 302. Commands are issued by the client program 14 to the controlling interface using the control panel 300. The commands are received from the different client programs 14 by the controlling interface 16. The commands control the operation of the model railroad 302, such as switches, direction, and locomotive throttle. Of particular importance is the throttle which is a state which persists for an indefinite period of time, potentially resulting in collisions if not accurately monitored. The controlling interface 16 accepts all of the commands and provides an acknowledgment to free up the communications transport for subsequent commands. The acknowledgment may take the form of a response indicating that the command was executed thereby updating the control panel 300. The response may be subject to updating if more data becomes available indicating the previous response is incorrect. In fact, the command may have yet to be executed or verified by the controlling interface 16. After a command is received by the controlling interface 16, the controlling interface 16 passes the command (in a modified manner, if desired) to a dispatcher controller 310. The dispatcher controller 310 includes a rule-based processor together with the layout of the railroad 302 and the status of objects thereon. The objects may include properties such as speed, location, direction, length of the train, etc. The dispatcher controller 310 processes each received command to determine if the execution of such a command would violate any of the rules together with the layout and status of objects thereon. If the command received is within the rules, then the command may be passed to the model railroad 302 for execution. If the received command violates the rules, then the command may be rejected and an appropriate response is provided to update the clients display. If desired, the invalid command may be modified in a suitable manner and still be provided to the model railroad 302. In addition, if the dispatcher controller 310 determines that an event should occur, such as stopping a model locomotive, it may issue the command and update the control panels 300 accordingly. If necessary, an update command is provided to the client program 14 to show the update that occurred.


[0128] The “asynchronous” receipt of commands together with a “synchronous” manner of validation and execution of commands from the multiple control panels 300 permits a simplified dispatcher controller 310 to be used together with a minimization of computer resources, such as com ports. In essence, commands are managed independently from the client program 14. Likewise, a centralized dispatcher controller 310 working in an “offline” mode increases the likelihood that a series of commands that are executed will not be conflicting resulting in an error. This permits multiple model railroad enthusiasts to control the same model railroad in a safe and efficient manner. Such concerns regarding the interrelationships between multiple dispatchers does not occur in a dedicated non-distributed environment. When the command is received or validated all of the control panels 300 of the client programs 14 may likewise be updated to reflect the change. Alternatively, the controlling interface 16 may accept the command, validate it quickly by the dispatcher controller, and provide an acknowledgment to the client program 14. In this manner, the client program 14 will not require updating if the command is not valid. In a likewise manner, when a command is valid the control panel 300 of all client programs 14 should be updated to show the status of the model railroad 302.


[0129] A manual throttle 320 may likewise provide control over devices, such as the locomotive, on the model railroad 302. The commands issued by the manual throttle 320 may be passed first to the dispatcher controller 310 for validation in a similar manner to that of the client programs 14. Alternatively, commands from the manual throttle 320 may be directly passed to the model railroad 302 without first being validated by the dispatcher controller 302. After execution of commands by the external devices 18, a response will be provided to the controlling interface 16 which in response may check the suitability of the command, if desired. If the command violates the layout rules then a suitable correctional command is issued to the model railroad 302. If the command is valid then no correctional command is necessary. In either case, the status of the model railroad 302 is passed to the client programs 14 (control panels 300).


[0130] As it can be observed, the event driven dispatcher controller 310 maintains the current status of the model railroad 302 so that accurate validation may be performed to minimize conflicting and potentially damaging commands. Depending on the particular implementation, the control panel 300 is updated in a suitable manner, but in most cases, the communication transport 12 is freed up prior to execution of the command by the model railroad 302.


[0131] The computer dispatcher may also be distributed across the network, if desired. In addition, the computer architecture described herein supports different computer interfaces at the client program 14.


[0132] The present inventor has observed that periodically the commands in the queue to the digital command stations or the buffer of the digital command station overflow resulting in a system crash or loss of data. In some cases, the queue fills up with commands and then no additional commands may be accepted. After further consideration of the slow real-time manner of operation of digital command stations, the apparent solution is to incorporate a buffer model in the interface 16 to provide commands to the digital command station at a rate no faster than the ability of the digital command station to execute the commands together with an exceptionally large computer buffer. For example, the command may take 5 ms to be transmitted from the interface 16 to the command station, 100 ms for processing by the command station, 3 ms to transfer to the digital device, such as a model train. The digital device may take 10 ms to execute the command, for example, and another 20 ms to transmit back to the digital command station which may again take 100 ms to process, and 5 ms to send the processed result to interface 16. In total, the delay may be on the order of 243 ms which is extremely long in comparison to the ability of the interface 16 to receive commands and transmit commands to the digital command station. After consideration of the timing issues and the potential solution of simply slowing down the transmission of commands to the digital command station and incorporating a large buffer, the present inventor came to the realization that a queue management system should be incorporated within the interface 16 to facilitate apparent increased responsiveness of the digital command station to the user. The particular implementation of a command queue is based on a further realization that many of the commands to operate a model railroad are “lossy” in nature which is highly unusual for a computer based queue system. In other words, if some of the commands in the command queue are never actually executed, are deleted from the command queue, or otherwise simply changed, the operation of the model railroad still functions properly. Normally a queuing system inherently requires that all commands are executed in some manner at some point in time, even if somewhat delayed.


[0133] Initially the present inventor came to the realization that when multiple users are attempting to control the same model railroad, each of them may provide the same command to the model railroad. In this event, the digital command station would receive both commands from the interface 16, process both commands, transmit both commands to the model railroad, receive both responses therefrom (typically), and provide two acknowledgments to the interface 16. In a system where the execution of commands occurs nearly instantaneously the re-execution of commands does not pose a significant problem and may be beneficial for ensuring that each user has the appropriate commands executed in the order requested. However, in the real-time environment of a model railroad all of this activity requires substantial time to complete thereby slowing down the responsiveness of the system. Commands tend to build up waiting for execution which decreases the user perceived responsiveness of control of the model railroad. The user perceiving no response continues to request commands be placed in the queue thereby exacerbating the perceived responsiveness problem. The responsiveness problem is more apparent as processor speeds of the client computer increase. Since there is but a single model railroad, the apparent speed with which commands are executed is important for user satisfaction.


[0134] Initially, the present inventor determined that duplicate commands residing in the command queue of the interface 16 should be removed. Accordingly, if different users issue the same command to the model railroad then the duplicate commands are not executed (execute one copy of the command). In addition, this alleviates the effects of a single user requesting that the same command is executed multiple times. The removal of duplicate commands will increase the apparent responsiveness of the model railroad because the time required to re-execute a command already executed will be avoided. In this manner, other commands that will change the state of the model railroad may be executed in a more timely manner thereby increasing user satisfaction. Also, the necessary size of the command queue on the computer is reduced.


[0135] After further consideration of the particular environment of a model railroad the present inventor also determined that many command sequences in the command queue result in no net state change to the model railroad, and thus should likewise be removed from the command queue. For example, a command in the command queue to increase the speed of the locomotive, followed by a command in the command queue to reduce the speed of the locomotive to the initial speed results in no net state change to the model railroad. Any perceived increase and decrease of the locomotive would merely be the result of the time differential. It is to be understood that the comparison may be between any two or more commands. Another example may include a command to open a switch followed by a command to close a switch, which likewise results in no net state change to the model railroad. Accordingly, it is desirable to eliminate commands from the command queue resulting in a net total state change of zero. This results in a reduction in the depth of the queue by removing elements from the queue thereby potentially avoiding overflow conditions increasing user satisfaction and decreasing the probability that the user will resend the command. This results in better overall system response.


[0136] In addition to simply removing redundant commands from the command queue, the present inventor further determined that particular sequences of commands in the command queue result in a net state change to the model railroad which may be provided to the digital command station as a single command. For example, if a command in the command queue increases the speed of the locomotive by 5 units, another command in the command queue decreases the speed of the locomotive by 3 units, the two commands may be replaced by a single command that increases the speed of the locomotive by 2 units. In this manner a reduction in the number of commands in the command queue is accomplished while at the same time effectuating the net result of the commands. This results in a reduction in the depth of the queue by removing elements from the queue thereby potentially avoiding overflow conditions. In addition, this decreases the time required to actually program the device to the net state thereby increasing user satisfaction.


[0137] With the potential of a large number of commands in the command queue taking several minutes or more to execute, the present inventor further determined that a priority based queue system should be implemented. Referring to FIG. 11, the command queue structure may include a stack of commands to be executed. Each of the commands may include a type indicator and control information as to what general type of command they are. For example, an A command may be speed commands, a B command may be switches, a C command may be lights, a D command may be query status, etc. As such, the commands may be sorted based on their type indicator for assisting the determination as to whether or not any redundancies may be eliminated or otherwise reduced.


[0138] Normally a first-in-first-out command queue provides a fair technique for the allocation of resources, such as execution of commands by the digital command station, but the present inventor determined that for slow-real-time model railroad devices such a command structure is not the most desirable. In addition, the present inventor realized that model railroads execute commands that are (1) not time sensitive, (2) only somewhat time sensitive, and (3) truly time sensitive. Non-time sensitive commands are merely query commands that inquire as to the status of certain devices. Somewhat time sensitive commands are generally related to the appearance of devices and do not directly impact other devices, such as turning on a light. Truly time sensitive commands need to be executed in a timely fashion, such as the speed of the locomotive or moving switches. These truly time sensitive commands directly impact the perceived performance of the model railroad and therefore should be done in an out-of-order fashion. In particular, commands with a type indicative of a level of time sensitiveness may be placed into the queue in a location ahead of those that have less time sensitiveness. In this manner, the time sensitive commands may be executed by the digital command station prior to those that are less time sensitive. This provides the appearance to the user that the model railroad is operating more efficiently and responsively.


[0139] Another technique that may be used to prioritize the commands in the command queue is to assign a priority to each command. As an example, a priority of 0 would be indicative of “don't care” with a priority of 255 “do immediately,” with the intermediate numbers in between being of numerical-related importance. The command queue would then place new commands in the command queue in the order of priority or otherwise provide the next command to the command station that has the highest priority within the command queue. In addition, if a particular number such as 255 is used only for emergency commands that must be executed next, then the computer may assign that value to the command so that it is next to be executed by the digital command station. Such emergency commands may include, for example, emergency stop and power off. In the event that the command queue still fills, then the system may remove commands from the command queue based on its order of priority, thereby alleviating an overflow condition in a manner less destructive to the model railroad.


[0140] In addition for multiple commands of the same type a different priority number may be assigned to each, so therefore when removing or deciding which to execute next, the priority number of each may be used to further classify commands within a given type. This provides a convenient technique of prioritizing commands.


[0141] An additional technique suitable for model railroads in combination with relatively slow real time devices is that when the system knows that there is an outstanding valid request made to the digital command station, then there is no point in making another request to the digital command station nor adding another such command to the command queue. This further removes a particular category of commands from the command queue.


[0142] It is to be understood that this queue system may be used in any system, such as, for example, one local machine without a network, COM, DCOM, COBRA, internet protocol, sockets, etc.


[0143] The terms and expressions which have been employed in the foregoing specification are used therein as terms of description and not of limitation, and there is no intention, in the use of such terms and expressions, of excluding equivalents of the features shown and described or portions thereof, it being recognized that the scope of the invention is defined and limited only by the claims which follow.


Claims
  • 1. A method of operating a digitally controlled model railroad comprising the steps of: (a) transmitting a first command from a first client program to an interface; (b) transmitting a second command from a second client program to said interface; (c) receiving said first command and said second command at said interface; (d) said interface queuing said first and second commands and deleting one of said first and second commands if they are the same; and (e) said interface sending a third command representative of said one of said first and second commands not deleted to a digital command station for execution on said digitally controlled model railroad.
  • 2. The method of claim 1, further comprising the steps of: (a) providing an acknowledgment to said first client program in response to receiving said first command by said interface that said first command was successfully validated against permissible actions regarding the interaction between a plurality of objects of said model railroad prior to validating said first command; and (b) providing an acknowledgment to said second client program in response to receiving said second command by said interface that said second command was successfully validated against permissible actions regarding the interaction between a plurality of objects of said model railroad prior to validating said second command.
  • 3. The method of claim 1, further comprising the steps of selectively sending said third command to one of a plurality of digital command stations.
  • 4. The method of claim 1, further comprising the step of receiving command station responses representative of the state of said digitally controlled model railroad from said digital command station and validating said responses regarding said interaction.
  • 5. The method of claim 1 wherein said first and second commands relate to the speed of locomotives.
  • 6. The method of claim 2, further comprising the step of updating said successful validation to at least one of said first and second client programs of at least one of said first and second commands with an indication that at least one of said first and second commands was unsuccessfully validated.
  • 7. The method of claim 1, further comprising the step of updating a database of the state of said digitally controlled model railroad based upon said receiving command station responses representative of said state of said digitally controlled model railroad.
  • 8. The method of claim 7 wherein said validation is performed by an event driven dispatcher.
  • 9. The method of claim 7 wherein said one of said first and second command, and said third command are the same command.
  • 10. A method of operating a digitally controlled model railroad comprising the steps of: (a) transmitting a first command from a first client program to an interface; (b) receiving said first command at said interface; (c) queuing said first command in a command queue if said first command is different than all other commands in said command queue; and (d) said interface selectively sending a second command representative of said first command to one of a plurality of digital command stations based upon information contained within at least one of said first and second commands.
  • 11. The method of claim 10, further comprising the steps of: (a) transmitting a third command from a second client program to said interface through a second communications transport; (b) receiving said third command at said interface; (c) queuing said third command in a command queue if said third command is different than all other commands in said command queue; and (d) said interface selectively sending a fourth command representative of said third command to one of said plurality of digital command stations based upon information contained within at least one of said third and fourth commands.
  • 12. The method of claim 11 wherein said first communications transport is at least one of a COM interface, a DCOM interface, and a COBRA interface.
  • 13. The method of claim 11 wherein said first communications transport and said second communications transport are DCOM interfaces.
  • 14. The method of claim 10 wherein said first client program and said interface are operating on the same computer.
  • 15. The method of claim 11 wherein said first client program, said second client program, and said interface are all operating on different computers.
  • 16. The method of claim 10, further comprising the step of providing an acknowledgment to said first client program in response to receiving said first command by said interface prior to validating said first command against permissible actions.
  • 17. The method of claim 16, further comprising the step of receiving command station responses from said of digital command station and validating said responses regarding said interaction.
  • 18. The method of claim 17, further comprising the step of comparing said command station responses to previous commands sent to said digital command station to determine which said previous commands it corresponds with.
  • 19. The method of claim 16, further comprising the step of updating validation of said first command based on data received from said digital command stations.
  • 20. The method of claim 19, further comprising the step of updating a database of the state of said digitally controlled model railroad based upon command station responses.
  • 21. The method of claim 20, further comprising the step of updating said successful validation to said first client program in response to receiving said first command by said interface together with state information from said database related to said first command.
  • 22. The method of claim 10 wherein said interface communicates in an asynchronous manner with said first client program while communicating in a synchronous manner with said plurality of digital command stations.
  • 23. A method of operating a digitally controlled model railroad comprising the steps of: (a) transmitting a first command from a first client program to an interface; (b) transmitting a second command from a second client program to said interface; (c) receiving said first command at said interface; (d) receiving said second command at said interface; (e) queuing said first and second commands, and deleting one of said first and second commands if they are the same; and (f) said interface sending a third and fourth command representative of said first command and said second command, respectively, to the same digital command station.
  • 24. The method of claim 23 wherein said interface communicates in an asynchronous manner with said first and second client programs while communicating in a synchronous manner with said digital command station.
  • 25. The method of claim 23 wherein said first communications transport is at least one of a COM interface and a DCOM interface.
  • 26. The method of claim 23 wherein said first communications transport and said second communications transport are DCOM interfaces.
  • 27. The method of claim 23 wherein said first client program and said interface are operating on the same computer.
  • 28. The method of claim 23 wherein said first client program, said second client program, and said interface are all operating on different computers.
  • 29. The method of claim 23, further comprising the step of providing an acknowledgment to said first client program in response to receiving said first command by said interface that said first command was successfully validated against permissible actions prior to validating said first command.
  • 30. The method of claim 29, further comprising the step of receiving command station responses representative of the state of said digitally controlled model railroad from said of digital command station.
  • 31. The method of claim 30, further comprising the step of comparing said command station responses to previous commands sent to said digital command station to determine which said previous commands it corresponds with.
  • 32. The method of claim 31, further comprising the step of updating a database of the state of said digitally controlled model railroad based upon said receiving command station responses.
  • 33. The method of claim 32, further comprising the step of updating said successful validation to said first client program in response to receiving said first command by said interface together with state information from said database related to said first command.
  • 34. The method of claim 23 wherein said validation is performed by an event driven dispatcher.
  • 35. A method of operating a digitally controlled model railroad comprising the steps of: (a) transmitting a first command from a first client program to a first processor; (b) receiving said first command at said first processor; (c) queuing said first command in a command queue that is not a first-in-first-out command queue; and (d) said first processor providing an acknowledgment to said first client program indicating that said first command has been validated against permissible actions regarding the interaction between a plurality of objects of said model railroad and properly executed prior to execution of commands related to said first command by said digitally controlled model railroad.
  • 36. The method of claim 35, further comprising the step of sending said first command to a second processor which processes said first command into a state suitable for a digital command station for execution on said digitally controlled model railroad.
  • 37. The method of claim 36, further comprising the step of said second process queuing a plurality of commands received.
  • 38. The method of claim 35, further comprising the steps of: (a) transmitting a second command from a second client program to said first processor through a second communications transport; (b) receiving said second command at said first processor; and (c) said first processor selectively providing an acknowledgment to said second client program through said second communications transport indicating that said second command has been validated against permissible actions regarding the interaction between a plurality of objects of said model railroad and properly executed prior to execution of commands related to said second command by said digitally controlled model railroad.
  • 39. The method of claim 38, further comprising the steps of: (a) sending a third command representative of said first command to one of a plurality of digital command stations for execution on said digitally controlled model railroad based upon information contained within at least one of said first and third commands; and (b) sending a fourth command representative of said second command to one of said plurality of digital command stations for execution on said digitally controlled model railroad based upon information contained within at least one of said second and fourth commands.
  • 40. The method of claim 35 wherein said first communications transport is at least one of a COM interface and a DCOM interface.
  • 41. The method of claim 38 wherein said first communications transport and said second communications transport are DCOM interfaces.
  • 42. The method of claim 35 wherein said first client program and said first processor are operating on the same computer.
  • 43. The method of claim 38 wherein said first client program, said second client program, and said first processor are all operating on different computers.
  • 44. The method of claim 35, further comprising the step of receiving command station responses representative of the state of said digitally controlled model railroad from said of digital command station.
  • 45. The method of claim 35, further comprising the step of updating a database of the state of said digitally controlled model railroad based upon said receiving command station responses representative of said state of said digitally controlled model railroad.
  • 46. The method of claim 45, further comprising the step of updating said successful validation to said first client program in response to receiving said first command by first processor together with state information from said database related to said first command.
  • 47. The method of claim 43 wherein said first processor communicates in an asynchronous manner with said first client program while communicating in a synchronous manner with said plurality of digital command stations.
  • 48. A method of operating a digitally controlled model railroad comprising the steps of: (a) transmitting a first command from a first client program to an interface; (b) transmitting a second command from a second client program to said interface; (c) receiving said first command and said second command at said interface; (d) said interface queuing said first and second commands; (e) comparing said first and second commands to one another to determine if the result of executing said first and second commands would result in no net state change of said model railroad and the execution of one of said first and second command would result in a net state change of said model railroad; and (f) said interface sending third and fourth commands representative of said first and second commands, respectively, to a digital command station if as a result of said comparing a net state change of said model railroad would result.
  • 49. The method of claim 48, further comprising the steps of: (a) providing an acknowledgment to said first client program in response to receiving said first command by said interface that said first command was successfully validated against permissible actions prior to validating said first command; and (b) providing an acknowledgment to said second client program in response to receiving said second command by said interface that said second command was successfully validated against permissible actions prior to validating said second command.
  • 50. The method of claim 48, further comprising the steps of selectively sending said third command to one of a plurality of digital command stations.
  • 51. The method of claim 48, further comprising the step of receiving command station responses representative of the state of said digitally controlled model railroad from said digital command station and validating said responses regarding said interaction.
  • 52. The method of claim 48 wherein said first and second commands relate to the speed of locomotives.
  • 53. The method of claim 49, further comprising the step of updating said successful validation to at least one of said first and second client programs of at least one of said first and second commands with an indication that at least one of said first and second commands was unsuccessfully validated.
  • 54. The method of claim 48, further comprising the step of updating a database of the state of said digitally controlled model railroad based upon said receiving command station responses representative of said state of said digitally controlled model railroad.
  • 55. The method of claim 54 wherein said validation is performed by an event driven dispatcher.
  • 56. The method of claim 54 wherein one of said first and second command and said third command are the same command, and said second command and said fourth command are the same command.
  • 57. A method of operating a digitally controlled model railroad comprising the steps of: (a) transmitting a first command from a first client program to an interface; (b) receiving said first command at said interface; (c) comparing said first command against other commands in a command queue to determine if the result of executing said first command and said other commands would result in no net state change of said model railroad; and (d) said interface selectively sending a second command representative of said first command to one of a plurality of digital command stations based upon information contained within at least one of said first and second commands.
  • 58. The method of claim 57, further comprising the steps of: (a) transmitting a third command from a second client program to said interface through a second communications transport; (b) receiving said third command at said interface; (c) comparing said third command against other commands in said command queue to determine if the result of executing said third command and said other commands would result in no net state change of said model railroad and the execution of said third command would result in a net state change of said model railroad; and (d) said interface selectively sending a fourth command representative of said third command to one of said plurality of digital command stations for execution on said digitally controlled model railroad based upon information contained within at least one of said third and fourth commands.
  • 59. The method of claim 58 wherein said first communications transport is at least one of a COM interface and a DCOM interface.
  • 60. The method of claim 58 wherein said first communications transport and said second communications transport are DCOM interfaces.
  • 61. The method of claim 57 wherein said first client program and said interface are operating on the same computer.
  • 62. The method of claim 58 wherein said first client program, said second client program, and said interface are all operating on different computers.
  • 63. The method of claim 57, further comprising the step of providing an acknowledgment to said first client program in response to receiving said first command by said interface prior to validating said first command against permissible actions regarding the interaction between a plurality of objects of said model railroad.
  • 64. The method of claim 63, further comprising the step of receiving command station responses representative of the state of said digitally controlled model railroad from said of digital command station and validating said responses regarding said interaction.
  • 65. The method of claim 64, further comprising the step of comparing said command station responses to previous commands sent to said digital command station to determine which said previous commands it corresponds with.
  • 66. The method of claim 63, further comprising the step of updating validation of said first command based on data received from said digital command stations.
  • 67. The method of claim 66, further comprising the step of updating a database of the state of said digitally controlled model railroad based upon command station responses representative of said state of said digitally controlled model railroad.
  • 68. The method of claim 67, further comprising the step of updating said successful validation to said first client program in response to receiving said first command by said interface together with state information from said database related to said first command.
  • 69. The method of claim 57 wherein said interface communicates in an asynchronous manner with said first client program while communicating in a synchronous manner with said plurality of digital command stations.
  • 70. A method of operating a digitally controlled model railroad comprising the steps of: (a) transmitting a first command from a first client program to an interface; (b) transmitting a second command from a second client program to said interface; (c) receiving said first command at said interface; (d) receiving said second command at said interface; (e) comparing said first and second commands to one another to determine if the result of executing said first and second commands would result in no net state change of said model railroad; and (f) said interface sending a third and fourth command representative of said first command and said second command, respectively, to the same digital command station if as a result of said comparing a net state change of said model railroad would result.
  • 71. The method of claim 70 wherein said interface communicates in an asynchronous manner with said first and second client programs while communicating in a synchronous manner with said digital command station.
  • 72. The method of claim 70 wherein said first communications transport is at least one of a COM interface and a DCOM interface.
  • 73. The method of claim 70 wherein said first communications transport and said second communications transport are DCOM interfaces.
  • 74. The method of claim 70 wherein said first client program and said interface are operating on the same computer.
  • 75. The method of claim 70 wherein said first client program, said second client program, and said interface are all operating on different computers.
  • 76. The method of claim 70, further comprising the step of providing an acknowledgment to said first client program in response to receiving said first command by said interface that said first command was successfully validated against permissible actions regarding the interaction between a plurality of objects of said model railroad prior to validating said first command.
  • 77. The method of claim 76, further comprising the step of receiving command station responses representative of the state of said digitally controlled model railroad from said of digital command station.
  • 78. The method of claim 77, further comprising the step of comparing said command station responses to previous commands sent to said digital command station to determine which said previous commands it corresponds with.
  • 79. The method of claim 78, further comprising the step of updating a database of the state of said digitally controlled model railroad based upon said receiving command station responses representative of said state of said digitally controlled model railroad.
  • 80. The method of claim 79, further comprising the step of updating said successful validation to said first client program in response to receiving said first command by said interface together with state information from said database related to said first command.
  • 81. The method of claim 70 wherein said validation is performed by an event driven dispatcher.
  • 82. A method of operating a digitally controlled model railroad comprising the steps of: (a) transmitting a first command from a first client program to a first processor; (b) receiving said first command at said first processor; (c) comparing said first command against other commands in a command queue to determine if the result of executing said first command and at least one of said other commands would result in no net state change of said model railroad; and (d) said first processor providing an acknowledgment to said first client program indicating that said first command has been executed.
  • 83. The method of claim 82, further comprising the step of sending said first command to a second processor which processes said first command into a state suitable for a digital command station for execution on said digitally controlled model railroad.
  • 84. The method of claim 83, further comprising the step of said second process queuing a plurality of commands received.
  • 85. The method of claim 82, further comprising the steps of: (a) transmitting a second command from a second client program to said first processor through a second communications transport; (b) receiving said second command at said first processor; and (c) said first processor selectively providing an acknowledgment to said second client program through said second communications transport indicating that said second command has been executed.
  • 86. The method of claim 85, further comprising the steps of: (a) sending a third command representative of said first command to one of a plurality of digital command stations for execution on said digitally controlled model railroad based upon information contained within at least one of said first and third commands; and (b) sending a fourth command representative of said second command to one of said plurality of digital command stations for execution on said digitally controlled model railroad based upon information contained within at least one of said second and fourth commands.
  • 87. The method of claim 82 wherein said first communications transport is at least one of a COM interface and a DCOM interface.
  • 88. The method of claim 85 wherein said first communications transport and said second communications transport are DCOM interfaces.
  • 89. The method of claim 82 wherein said first client program and said first processor are operating on the same computer.
  • 90. The method of claim 85 wherein said first client program, said second client program, and said first processor are all operating on different computers.
  • 91. The method of claim 82, further comprising the step of receiving command station responses representative of the state of said digitally controlled model railroad from said of digital command station.
  • 92. The method of claim 82, further comprising the step of updating a database of the state of said digitally controlled model railroad based upon said receiving command station responses representative of said state of said digitally controlled model railroad.
  • 93. The method of claim 92, further comprising the step of updating said successful validation to said first client program in response to receiving said first command by first processor together with state information from said database related to said first command.
  • 94. The method of claim 90 wherein said first processor communicates in an asynchronous manner with said first client program while communicating in a synchronous manner with said plurality of digital command stations.
  • 95. A method of operating a digitally controlled model railroad comprising the steps of: (a) transmitting a first command from a first client program to an interface; (b) transmitting a second command from a second client program to said interface; (c) receiving said first command and said second command at said interface; (d) said interface queuing said first and second commands; (e) comparing said first and second commands to one another to determine if the result of executing said first and second commands would result in a net state change of said model railroad that would also result from a single different command; and (f) said interface sending said single different command representative of the net state change of said first and second commands to a digital command station.
  • 96. The method of claim 95, further comprising the steps of: (a) providing an acknowledgment to said first client program in response to receiving said first command by said interface that said first command was successfully validated against permissible actions prior to validating said first command; and (b) providing an acknowledgment to said second client program in response to receiving said second command by said interface that said second command was successfully validated against permissible actions prior to validating said second command.
  • 97. The method of claim 95, further comprising the steps of selectively sending said single different command to one of a plurality of digital command stations.
  • 98. The method of claim 95, further comprising the step of receiving command station responses representative of the state of said digitally controlled model railroad from said digital command station and validating said responses regarding said interaction.
  • 99. The method of claim 95 wherein said first and second commands relate to the speed of locomotives.
  • 100. The method of claim 96, further comprising the step of updating said successful validation to at least one of said first and second client programs of at least one of said first and second commands with an indication that at least one of said first and second commands was unsuccessfully validated.
  • 101. The method of claim 95, further comprising the step of updating a database of the state of said digitally controlled model railroad based upon said receiving command station responses representative of said state of said digitally controlled model railroad.
  • 102. The method of claim 101 wherein said validation is performed by an event driven dispatcher.
  • 103. The method of claim 101 wherein said first command and said third command are the same command, and said second command and said fourth command are the same command.
  • 104. A method of operating a digitally controlled model railroad comprising the steps of: (a) transmitting a first command from a first client program to an interface; (b) receiving said first command at said interface; (c) comparing said first command against other commands in a command queue to determine if the result of executing said first and second commands would result in a net state change of said model railroad that would also result from a single different command; and (d) said interface selectively sending said single different command to one of a plurality of digital command stations.
  • 105. The method of claim 104, further comprising the steps of: (a) transmitting a third command from a second client program to said interface; (b) receiving said third command at said interface; (c) validating said third command against permissible actions; and (d) said interface selectively sending a fourth command representative of said third command to one of said plurality of digital command stations based upon information contained within at least one of said third and fourth commands.
  • 106. The method of claim 105 wherein said first communications transport is at least one of a COM interface and a DCOM interface.
  • 107. The method of claim 105 wherein said first communications transport and said second communications transport are DCOM interfaces.
  • 108. The method of claim 104 wherein said first client program and said interface are operating on the same computer.
  • 109. The method of claim 105 wherein said first client program, said second client program, and said interface are all operating on different computers.
  • 110. The method of claim 104, further comprising the step of providing an acknowledgment to said first client program in response to receiving said first command by said interface prior to validating said first command against permissible actions regarding the interaction between a plurality of objects of said model railroad.
  • 111. The method of claim 110, further comprising the step of receiving command station responses representative of the state of said digitally controlled model railroad from said of digital command station and validating said responses regarding said interaction.
  • 112. The method of claim 111, further comprising the step of comparing said command station responses to previous commands sent to said digital command station to determine which said previous commands it corresponds with.
  • 113. The method of claim 110, further comprising the step of updating validation of said first command based on data received from said digital command stations.
  • 114. The method of claim 113, further comprising the step of updating a database of the state of said digitally controlled model railroad based upon command station responses representative of said state of said digitally controlled model railroad.
  • 115. The method of claim 114, further comprising the step of updating said successful validation to said first client program in response to receiving said first command by said interface together with state information from said database related to said first command.
  • 116. The method of claim 104 wherein said interface communicates in an asynchronous manner with said first client program while communicating in a synchronous manner with said plurality of digital command stations.
  • 117. A method of operating a digitally controlled model railroad comprising the steps of: (a) transmitting a first command from a first client program to an interface; (b) transmitting a second command from a second client program to said interface; (c) receiving said first command at said interface; (d) receiving said second command at said interface; (e) comparing said first and second commands to one another to determine if the result of executing said first and second commands would result in a net state change of said model railroad that would also result from a single different command; and (f) said interface sending said single different command to a digital command station if as a result of said comparing such a single different command exists.
  • 118. The method of claim 117 wherein said resident external controlling interface communicates in an asynchronous manner with said first and second client programs while communicating in a synchronous manner with said digital command station.
  • 119. The method of claim 117 wherein said first communications transport is at least one of a COM interface and a DCOM interface.
  • 120. The method of claim 117 wherein said first communications transport and said second communications transport are DCOM interfaces.
  • 121. The method of claim 117 wherein said first client program and said resident external controlling interface are operating on the same computer.
  • 122. The method of claim 117 wherein said first client program, said second client program, and said interface are all operating on different computers.
  • 123. The method of claim 117, further comprising the step of providing an acknowledgment to said first client program in response to receiving said first command by said interface that said first command was successfully validated against permissible actions regarding the interaction between a plurality of objects of said model railroad prior to validating said first command.
  • 124. The method of claim 123, further comprising the step of receiving command station responses representative of the state of said digitally controlled model railroad from said of digital command station.
  • 125. The method of claim 124, further comprising the step of comparing said command station responses to previous commands sent to said digital command station to determine which said previous commands it corresponds with.
  • 126. The method of claim 125, further comprising the step of updating a database of the state of said digitally controlled model railroad based upon said receiving command station responses representative of said state of said digitally controlled model railroad.
  • 127. The method of claim 126, further comprising the step of updating said successful validation to said first client program in response to receiving said first command by said interface together with state information from said database related to said first command.
  • 128. The method of claim 117 wherein said validation is performed by an event driven dispatcher.
  • 129. A method of operating a digitally controlled model railroad comprising the steps of: (a) transmitting a first command from a first client program to a first processor through a first communications transport; (b) receiving said first command at said first processor; (c) comparing said first command against other commands in a command queue to determine if the result of executing said first command and at least one of said other commands would result in net state change of said model railroad that would also result from a single different command, and the execution of said first command would result in a net state change of said model railroad; and (d) said first processor providing an acknowledgment to said first client program through said first communications transport indicating that said first command has been executed.
  • 130. The method of claim 129, further comprising the step of sending said first command to a second processor which processes said first command into a state suitable for a digital command station for execution on said digitally controlled model railroad.
  • 131. The method of claim 130, further comprising the step of said second process queuing a plurality of commands received.
  • 132. The method of claim 129, further comprising the steps of: (a) transmitting a second command from a second client program to said first processor through a second communications transport; (b) receiving said second command at said first processor; and (c) said first processor selectively providing an acknowledgment to said second client program through said second communications transport indicating that said second command has been executed.
  • 133. The method of claim 132, further comprising the steps of: (a) sending a third command representative of said first command to one of a plurality of digital command stations for execution on said digitally controlled model railroad based upon information contained within at least one of said first and third commands; and (b) sending a fourth command representative of said second command to one of said plurality of digital command stations for execution on said digitally controlled model railroad based upon information contained within at least one of said second and fourth commands.
  • 134. The method of claim 129 wherein said first communications transport is at least one of a COM interface and a DCOM interface.
  • 135. The method of claim 132 wherein said first communications transport and said second communications transport are DCOM interfaces.
  • 136. The method of claim 129 wherein said first client program and said first processor are operating on the same computer.
  • 137. The method of claim 132 wherein said first client program, said second client program, and said first processor are all operating on different computers.
  • 138. The method of claim 129, further comprising the step of receiving command station responses representative of the state of said digitally controlled model railroad from said of digital command station.
  • 139. The method of claim 129, further comprising the step of updating a database of the state of said digitally controlled model railroad based upon said receiving command station responses representative of said state of said digitally controlled model railroad.
  • 140. The method of claim 139, further comprising the step of updating said successful validation to said first client program in response to receiving said first command by first processor together with state information from said database related to said first command.
  • 141. The method of claim 137 wherein said first processor communicates in an asynchronous manner with said first client program while communicating in a synchronous manner with said plurality of digital command stations.
  • 142. A method of operating a digitally controlled model railroad comprising the steps of: (a) transmitting a first command from a first client program to an interface; (b) transmitting a second command from a second client program to said interface; (c) receiving said first command and said second command at said interface; (d) said interface queuing said first and second commands; (e) queuing said first and second commands in a command queue based on a non-first-in-first-out prioritization; and (f) said interface sending third and fourth commands representative of said first and second commands, respectively, to a digital command station based upon said prioritization.
  • 143. The method of claim 142, further comprising the steps of: (a) providing an acknowledgment to said first client program in response to receiving said first command by said interface that said first command was successfully validated prior to validating said first command; and (b) providing an acknowledgment to said second client program in response to receiving said second command by said interface that said second command was successfully validated prior to validating said second command.
  • 144. The method of claim 142, further comprising the steps of selectively sending said third command to one of a plurality of digital command stations.
  • 145. The method of claim 142, further comprising the step of receiving command station responses representative of the state of said digitally controlled model railroad from said digital command station and validating said responses regarding said interaction.
  • 146. The method of claim 142 wherein said first and second commands relate to the speed of locomotives.
  • 147. The method of claim 143, further comprising the step of updating said successful validation to at least one of said first and second client programs of at least one of said first and second commands with an indication that at least one of said first and second commands was unsuccessfully validated.
  • 148. The method of claim 142, further comprising the step of updating a database of the state of said digitally controlled model railroad based upon said receiving command station responses representative of said state of said digitally controlled model railroad.
  • 149. The method of claim 148 wherein said validation is performed by an event driven dispatcher.
  • 150. The method of claim 148 wherein said first command and said third command are the same command, and said second command and said fourth command are the same command.
  • 151. A method of operating a digitally controlled model railroad comprising the steps of: (a) transmitting a first command from a first client program to a interface; (b) receiving said first command at said interface; (c) queuing said first command in a command queue based on a non-first-in-first-out prioritization; and (d) said resident external controlling interface selectively sending a second command representative of said first command to one of a plurality of digital command stations based upon information contained within at least one of said first and second commands and said prioritization.
  • 152. The method of claim 151, further comprising the steps of: (a) transmitting a third command from a second client program to said resident external controlling interface through a second communications transport; (b) receiving said third command at said resident external controlling interface; (c) queuing said third command in said command queue based on a non-first-in-first-out prioritization; and (d) said resident external controlling interface selectively sending a fourth command representative of said third command to one of said plurality of digital command stations for execution on said digitally controlled model railroad based upon information contained within at least one of said third and fourth commands and said prioritization.
  • 153. The method of claim 152 wherein said first communications transport is at least one of a COM interface and a DCOM interface.
  • 154. The method of claim 152 wherein said first communications transport and said second communications transport are DCOM interfaces.
  • 155. The method of claim 151 wherein said first client program and said interface are operating on the same computer.
  • 156. The method of claim 152 wherein said first client program, said second client program, and said interface are all operating on different computers.
  • 157. The method of claim 151, further comprising the step of providing an acknowledgment to said first client program in response to receiving said first command by said interface prior to validating said first command against permissible actions regarding the interaction between a plurality of objects of said model railroad.
  • 158. The method of claim 157, further comprising the step of receiving command station responses representative of the state of said digitally controlled model railroad from said of digital command station and validating said responses regarding said interaction.
  • 159. The method of claim 158, further comprising the step of comparing said command station responses to previous commands sent to said digital command station to determine which said previous commands it corresponds with.
  • 160. The method of claim 157, further comprising the step of updating validation of said first command based on data received from said digital command stations.
  • 161. The method of claim 160, further comprising the step of updating a database of the state of said digitally controlled model railroad based upon command station responses representative of said state of said digitally controlled model railroad.
  • 162. The method of claim 151, further comprising the step of updating said successful validation to said first client program in response to receiving said first command by said interface together with state information from said database related to said first command.
  • 163. The method of claim 151 wherein said interface communicates in an asynchronous manner with said first client program while communicating in a synchronous manner with said plurality of digital command stations.
  • 164. A method of operating a digitally controlled model railroad comprising the steps of: (a) transmitting a first command from a first client program to an interface; (b) transmitting a second command from a second client program to said interface; (c) receiving said first command at said interface; (d) receiving said second command at said interface; (e) queuing said first and second commands in a command queue based on a non-first-in-first-out prioritization; and (f) said interface sending a third and fourth command representative of said first command and said second command, respectively, to the same digital command station based upon said prioritization.
  • 165. The method of claim 164 wherein said interface communicates in an asynchronous manner with said first and second client programs while communicating in a synchronous manner with said digital command station.
  • 166. The method of claim 164 wherein said first communications transport is at least one of a COM interface and a DCOM interface.
  • 167. The method of claim 164 wherein said first communications transport and said second communications transport are DCOM interfaces.
  • 168. The method of claim 164 wherein said first client program and said interface are operating on the same computer.
  • 169. The method of claim 164 wherein said first client program, said second client program, and said interface are all operating on different computers.
  • 170. The method of claim 164, further comprising the step of providing an acknowledgment to said first client program in response to receiving said first command by said interface that said first command was successfully validated against permissible actions regarding the interaction between a plurality of objects of said model railroad prior to validating said first command.
  • 171. The method of claim 170, further comprising the step of receiving command station responses representative of the state of said digitally controlled model railroad from said of digital command station.
  • 172. The method of claim 171, further comprising the step of comparing said command station responses to previous commands sent to said digital command station to determine which said previous commands it corresponds with.
  • 173. The method of claim 172, further comprising the step of updating a database of the state of said digitally controlled model railroad based upon said receiving command station responses representative of said state of said digitally controlled model railroad.
  • 174. The method of claim 173, further comprising the step of updating said successful validation to said first client program in response to receiving said first command by said interface together with state information from said database related to said first command.
  • 175. The method of claim 164 wherein said validation is performed by an event driven dispatcher.
  • 176. A method of operating a digitally controlled model railroad comprising the steps of: (a) transmitting a first command from a first client program to a first processor; (b) receiving said first command at said first processor; (c) queuing said first command in a command queue based on a non-first-in-first-out prioritization; and (d) said first processor providing an acknowledgment to said first client program indicating that said first command has been executed.
  • 177. The method of claim 176, further comprising the step of sending said first command to a second processor which processes said first command into a state suitable for a digital command station for execution on said digitally controlled model railroad.
  • 178. The method of claim 177, further comprising the step of said second process queuing a plurality of commands received.
  • 179. The method of claim 176, further comprising the steps of: (a) transmitting a second command from a second client program to said first processor through a second communications transport; (b) receiving said second command at said first processor; and (c) said first processor selectively providing an acknowledgment to said second client program through said second communications transport indicating that said second command has been executed.
  • 180. The method of claim 179, further comprising the steps of: (a) sending a third command representative of said first command to one of a plurality of digital command stations for execution on said digitally controlled model railroad based upon information contained within at least one of said first and third commands; and (b) sending a fourth command representative of said second command to one of said plurality of digital command stations for execution on said digitally controlled model railroad based upon information contained within at least one of said second and fourth commands.
  • 181. The method of claim 176 wherein said first communications transport is at least one of a COM interface and a DCOM interface.
  • 182. The method of claim 179 wherein said first communications transport and said second communications transport are DCOM interfaces.
  • 183. The method of claim 176 wherein said first client program and said first processor are operating on the same computer.
  • 184. The method of claim 179 wherein said first client program, said second client program, and said first processor are all operating on different computers.
  • 185. The method of claim 176, further comprising the step of receiving command station responses representative of the state of said digitally controlled model railroad from said of digital command station.
  • 186. The method of claim 176, further comprising the step of updating a database of the state of said digitally controlled model railroad based upon said receiving command station responses representative of said state of said digitally controlled model railroad.
  • 187. The method of claim 186, further comprising the step of updating said successful validation to said first client program in response to receiving said first command by first processor together with state information from said database related to said first command.
  • 188. The method of claim 184 wherein said first processor communicates in an asynchronous manner with said first client program while communicating in a synchronous manner with said plurality of digital command stations.
  • 189. A method of operating a digitally controlled model railroad comprising the steps of: (a) transmitting a first command from a first client program to an interface; (b) transmitting a second command from a second client program to said interface; (c) receiving said first command and said second command at said interface; (d) said interface queuing said first and second commands; (e) queuing said first and second commands in a command queue having the characteristic that valid commands in said command queue are removed from said command queue without being executed by said model railroad; and (f) said interface sending third and fourth commands representative of said first and second commands, respectively, to a digital command station if not said removed.
  • 190. The method of claim 189, further comprising the steps of: (a) providing an acknowledgment to said first client program in response to receiving said first command by said interface that said first command was successfully validated against permissible actions regarding the interaction between a plurality of objects of said model railroad prior to validating said first command; and (b) providing an acknowledgment to said second client program in response to receiving said second command by said interface that said second command was successfully validated against permissible actions regarding the interaction between a plurality of objects of said model railroad prior to validating said second command.
  • 191. The method of claim 189, further comprising the steps of selectively sending said third command to one of a plurality of digital command stations.
  • 192. The method of claim 189, further comprising the step of receiving command station responses representative of the state of said digitally controlled model railroad from said digital command station and validating said responses regarding said interaction.
  • 193. The method of claim 189 wherein said first and second commands relate to the speed of locomotives.
  • 194. The method of claim 190, further comprising the step of updating said successful validation to at least one of said first and second client programs of at least one of said first and second commands with an indication that at least one of said first and second commands was unsuccessfully validated.
  • 195. The method of claim 189, further comprising the step of updating a database of the state of said digitally controlled model railroad based upon said receiving command station responses representative of said state of said digitally controlled model railroad.
  • 196. The method of claim 195 wherein said validation is performed by an event driven dispatcher.
  • 197. The method of claim 195 wherein said first command and said third command are the same command, and said second command and said fourth command are the same command.
  • 198. A method of operating a digitally controlled model railroad comprising the steps of: (a) transmitting a first command from a first client program to an interface; (b) receiving said first command at said interface; (c) queuing said first command in a command queue having the characteristics that valid commands in said command queue are removed from said command queue without being executed by said model railroad; and (d) said resident external controlling interface selectively sending a second command representative of said first command to one of a plurality of digital command stations based upon information contained within at least one of said first and second commands if not said removed.
  • 199. The method of claim 198, further comprising the steps of: (a) transmitting a third command from a second client program to said interface through a second communications transport; (b) receiving said third command at said interface; (c) queuing said third command in said command queue; and (d) said interface selectively sending a fourth command representative of said third command to one of said plurality of digital command stations for execution on said digitally controlled model railroad based upon information contained within at least one of said third and fourth commands if not said removed.
  • 200. The method of claim 199 wherein said first communications transport is at least one of a COM interface and a DCOM interface.
  • 201. The method of claim 199 wherein said first communications transport and said second communications transport are DCOM interfaces.
  • 202. The method of claim 198 wherein said first client program and said interface are operating on the same computer.
  • 203. The method of claim 199 wherein said first client program, said second client program, and said interface are all operating on different computers.
  • 204. The method of claim 198, further comprising the step of providing an acknowledgment to said first client program in response to receiving said first command by said interface prior to validating said first command against permissible actions regarding the interaction between a plurality of objects of said model railroad.
  • 205. The method of claim 204, further comprising the step of receiving command station responses representative of the state of said digitally controlled model railroad from said of digital command station and validating said responses regarding said interaction.
  • 206. The method of claim 205, further comprising the step of comparing said command station responses to previous commands sent to said digital command station to determine which said previous commands it corresponds with.
  • 207. The method of claim 204, further comprising the step of updating validation of said first command based on data received from said digital command stations.
  • 208. The method of claim 207, further comprising the step of updating a database of the state of said digitally controlled model railroad based upon command station responses representative of said state of said digitally controlled model railroad.
  • 209. The method of claim 208, further comprising the step of updating said successful validation to said first client program in response to receiving said first command by said interface together with state information from said database related to said first command.
  • 210. The method of claim 204 wherein said interface communicates in an asynchronous manner with said first client program while communicating in a synchronous manner with said plurality of digital command stations.
  • 211. A method of operating a digitally controlled model railroad comprising the steps of: (a) transmitting a first command from a first client program to an interface; (b) transmitting a second command from a second client program to said interface; (c) receiving said first command at said interface; (d) receiving said second command at said interface; (e) queuing said first and second commands in a command queue having the characteristic that valid commands in said command queue are removed from said command queue without being executed by said model railroad; and (f) said resident external controlling interface sending a third and fourth command representative of said first command and said second command, respectively, to the same digital command station for execution on said digitally controlled model railroad if not said removed.
  • 212. The method of claim 211 wherein said interface communicates in an asynchronous manner with said first and second client programs while communicating in a synchronous manner with said digital command station.
  • 213. The method of claim 211 wherein said first communications transport is at least one of a COM interface and a DCOM interface.
  • 214. The method of claim 211 wherein said first communications transport and said second communications transport are DCOM interfaces.
  • 215. The method of claim 211 wherein said first client program and said interface are operating on the same computer.
  • 216. The method of claim 211 wherein said first client program, said second client program, and said interface are all operating on different computers.
  • 217. The method of claim 211, further comprising the step of providing an acknowledgment to said first client program in response to receiving said first command by said interface that said first command was successfully validated prior to validating said first command against permissible actions regarding the interaction between a plurality of objects of said model railroad.
  • 218. The method of claim 217, further comprising the step of receiving command station responses representative of the state of said digitally controlled model railroad from said of digital command station.
  • 219. The method of claim 218, further comprising the step of comparing said command station responses to previous commands sent to said digital command station to determine which said previous commands it corresponds with.
  • 220. The method of claim 219, further comprising the step of updating a database of the state of said digitally controlled model railroad based upon said receiving command station responses representative of said state of said digitally controlled model railroad.
  • 221. The method of claim 220, further comprising the step of updating said successful validation to said first client program in response to receiving said first command by said interface together with state information from said database related to said first command.
  • 222. The method of claim 211 wherein said validation is performed by an event driven dispatcher.
  • 223. A method of operating a digitally controlled model railroad comprising the steps of: (a) transmitting a first command from a first client program to a first processor; (b) receiving said first command at said first processor; (c) queuing said first command in a command queue having the characteristic that valid commands in said command queue are removed from said command queue without being executed by said model railroad; and (d) said first processor providing an acknowledgment to said first client program indicating that said first command has been executed if not said removed.
  • 224. The method of claim 223, further comprising the step of sending said first command to a second processor which processes said first command into a state suitable for a digital command station for execution on said digitally controlled model railroad.
  • 225. The method of claim 224, further comprising the step of said second process queuing a plurality of commands received.
  • 226. The method of claim 223, further comprising the steps of: (a) transmitting a second command from a second client program to said first processor through a second communications transport; (b) receiving said second command at said first processor; and (c) said first processor selectively providing an acknowledgment to said second client program through said second communications transport indicating that said second command has been executed if not said removed.
  • 227. The method of claim 226, further comprising the steps of: (a) sending a third command representative of said first command to one of a plurality of digital command stations for execution on said digitally controlled model railroad based upon information contained within at least one of said first and third commands if not said removed; and (b) sending a fourth command representative of said second command to one of said plurality of digital command stations for execution on said digitally controlled model railroad based upon information contained within at least one of said second and fourth commands if not said removed.
  • 228. The method of claim 223 wherein said first communications transport is at least one of a COM interface and a DCOM interface.
  • 229. The method of claim 226 wherein said first communications transport and said second communications transport are DCOM interfaces.
  • 230. The method of claim 223 wherein said first client program and said first processor are operating on the same computer.
  • 231. The method of claim 226 wherein said first client program, said second client program, and said first processor are all operating on different computers.
  • 232. The method of claim 223, further comprising the step of receiving command station responses representative of the state of said digitally controlled model railroad from said of digital command station.
  • 233. The method of claim 223, further comprising the step of updating a database of the state of said digitally controlled model railroad based upon said receiving command station responses representative of said state of said digitally controlled model railroad.
  • 234. The method of claim 233, further comprising the step of updating said successful validation to said first client program in response to receiving said first command by first processor together with state information from said database related to said first command.
  • 235. The method of claim 231 wherein said first processor communicates in an asynchronous manner with said first client program while communicating in a synchronous manner with said plurality of digital command stations.
Continuations (1)
Number Date Country
Parent 09541926 Apr 2000 US
Child 09858297 May 2001 US