Server
Introduction
The server can either run stand-alone or as part of the ApisHive application through the ApisJavaBee-module. The ModFrame server will perform the actual computations and communicate with I/O systems for instance through the ApisHive framework. It runs independently of whether one or more clients are connected. It can be configured to load an application file and start performing computations when the it starts both as a stand-alone server and when it runs as a part of the ApisHive framework.
Stand-alone server
When the server runs as stand-alone, it can be started by selecting the following entry All Programs->Apis->ModFrame->ModFrame server.
Server settings
The server settings will be read from the serverstart.ini file in the ModFrame installation directory. This is a text file where one line can contain one setting. The default value column indicates the value of the setting if it is not present in the file.
Server setting | Description | |
---|---|---|
Servername | The name of the ModFrame server. | ModFrameServer |
StartFile | The application file to load when the ModFrame server starts. | |
MaxClients | The maximum number of clients. If the value is negative the number of clients is unlimited. | Unlimited |
maxConfigMode | The maximum number of clients that can be in configuration mode simultaneously. | 1 |
StartOnLoad | The application will start running computations automatically when the ModFrame server is started. | False |
WindowVisible | If false the server window will not visible. | True |
ApplicationPath | The path to where the application files are stored. | The home directory of the user. |
LibraryPath | The path to where library files are stored. | The home directory of the user. |
StateFilesPath | The path to where the state files are stored. | The home directory of the user. |
XMLEncoding | The encoding used on the (xml) application files. | UTF-8 |
LoginManagement | If true, enables authentication when clients try to connect to the server. | False |
SampleTime | The initial time interval [ms] between computations. | 1000 |
RedirectStandardOut | If true, there will be a window in the server window displaying the standard out messages. | True |
RedirectStandardErr | If true, there will be a window in the server window displaying the standard err messages. | True |
InitialRMIPort | The port on which the RMI registry accepts requests. If the port is taken, the next port is attempted. | 1099 |
RemoteObjectPort | The port number on which the remote object receives calls (if zero, an anonymous port is chosen). | 0 |
ShutdownAction | The action which will be performed when the application is shut down. (None, Save) | None |
TransactionLockTimeout | The time [ms] an external transaction can take before being timed out. (E.g. when a Tracker transaction is performed from a web page.) | 25000 |
Batch file
It is possible to create a batch file which starts the server with custom settings. Below is an example of the contents of a batch file. This must be altered to fit the installation. Using batch files it is possible to set all java options as well as the ini-file containing the elements described above.
Batch file | Copy Code |
---|---|
C:\\\Program Files\Java\jdk1.6.0_03\bin\javaw.exe -Xmx768m -XX:+UseConcMarkSweepGC -verbose:gc -Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel -Djava.security.policy=java.policy -classpath C:\\\Apis\ModFrame\ModFrame.jar;C:\\\Apis\ModFrame\xml.jar;C:\\\Apis\ModFrame\jtds-1.2.2.jar;C:\\\Apis\ModFrame\ClickAndTrace.jar; com.modframe.server.MFServer "C:\\\Apis\ModFrame\serverstart.ini" |
Part of the ApisHive Framework
The ModFrame application can run inside the ApisHive process through the ApisJavaBee-module. In this case the settings described for the stand-alone server will be exposed as properties in the ApisJavaBee-module, and the class-path and java options are set in registry.
ApisJavaBee
This module will load a java-application. Items can be created and connected to ports in ModFrame.
Properties
Property | Description | Default value | ||
---|---|---|---|---|
ExchangeRate | The exchange rate in milliseconds when retrieving values from external items | 0 (Turned off) | ||
Run | States whether the ModFrame is performing computations. | False | ||
JavaAppVisible | Specifies if the ModFrame server window is visible or not. (If ApisHive is run as a windows server, the window is always invisible.) | True. | ||
JavaAppStartfile | The application file which will be opened when ApisHive is started. | |||
ApplicationFilePath | The path to where the application files are stored. | The ApisHive config folder | ||
LibraryFilePath | The path to where the library files are stored. | The ApisHive config folder | ||
TimeStep | The computational time interval [ms] between the computations. | 1000 | ||
Timer | The time interval [ms] of the timer trigging the computations. This interval is the real-time interval between computations, whereas TimeStep is the simulated time interval. If the system is to be run real-time these two properties should be equal. | 1000 | ||
MaxItemBufferStrategy | Specifies the size of the item buffer. The item buffer will be used when a computation cycle has not finished within its time slot. A snapshot of the current item values will be put in the item buffer. When the computation cycle has finished it will read the item values from the buffer and performing computations with those values. This is useful when a sudden CPU load of the computer running ApisHive makes the computations take longer than anticipated. If the CPU load persists the item buffer will be filled to its maximum size, and warnings will be issued. If this situation is recurring either the timer interval should be increased or the CPU usage must be decreased.
| 20 | ||
EventReportLevel | The level of the reported events from the java application. (E.g. if Warning is chosen, Warning and Alarm events will be reported, but the Information events will not.) |
Expert properties
Property | Description | Default value |
---|---|---|
TimeReferenceItem | An item whose value will be used as a time reference for this module instead of the system time. This means that the sample time in ModFrame will vary depending on the value of this item. | |
StartupJavaClass | The java class which contains the startup method (StartupMethod). The default value points to the correct ModFrame class, and should not be changed when using ModFrame. | com/modframe/server/MFServer |
StartupJavaMethod | The static java method in the StartupJavaClass run when the module is started. The default value points to the correct ModFrame method, and should not be changed when using ModFrame. | main |
NativeJavaClass | The java class which contains the defintion of the native C-functions. The default value points to the correct ModFrame class, and should not be changed when using ModFrame. | com/modframe/server/ApisConnector |
SaveAction | The action to be performed when the application shutsdown (None, Save) | None |
ItemWriteMasking | Set the quality level of items that will be written to the Java application from this module | Write all qualities |
PersistedValToInitVal | Choose strategy for copying and persisting current value to the InitValue. | Never |
PersistedStateDestination | The destination of the state files. If the destination is not specified the states will not be persisted. The destination can either be to a file or to items. If the destination is a file the StateFileFolder property must be set to a valid folder where the files will be stored. If the destination is Items the StateLoggers property must be set to valid logger(s) to log the state of the application in Apis Honeystore. | None |
StateLoggers | The loggers which will log the state if PersistedStatesDestination is Items. | |
AutoDeletePersistenceItems | If PersistedStateDestination is Items (or Both files and items) items will be created behind the scenes in which the states will be stored. An item of this type will be removed if the last persistence action did not include the state which corresponds to this certain item and this property is set to true. The reason why one might to turn off this option is to reduce the time spent on persisting the states. | |
StateFileFolder | The folder in which the state files are stored. |
Items
There are different types of items in the ApisJavaBee. Scalar, Vector and Matrix items can be connected to ports in ModFrame.
Scalar
The Scalar item type represents a scalar value of boolean, string or double precision floating point value. The value type is controlled with the ItemType attribute. It can only be chosen when creating an item and not be altered later on. The InputValue attribute specifies if the value is an input value to ModFrame or not.
ItemType | Port equivalent |
---|---|
Bool | Digital port |
Double | Analog port |
String | String port |
Vector
The Vector item type represents a vector/array value of boolean, string or double precision floating point value. The value type is controlled with the ItemType attribute. It can only be chosen when creating an item and not be altered later on. The InputValue attribute specifies if the value is an input value to ModFrame or not.
ItemType | Port equivalent |
---|---|
Bool | N/A |
Double | Analog vector port |
String | String vector port |
Matrix
The Matrix item type represents a matrix value of boolean, string or double precision floating point value. The value type is controlled with the ItemType attribute. It can only be chosen when creating an item and not be altered later on. The InputValue attribute specifies if the value is an input value to ModFrame or not.
ItemType | Port equivalent |
---|---|
Bool | N/A |
Double | Analog matrix port |
String | N/A |
StateFileItem
An item for setting the state file name. The folder which it will be stored in or read from is specified in the StateFileFolder property. The PersistedStateDestination property must also be set to File(s).
Attributes
Attribute | Description |
---|---|
FileAccess | Decides whether the file specified in the item is in read, write or read/write mode. |
TriggerOnChange | If true the state file will be read/written to when the item changes |
IncludeStateFileFolder | If true the state file will be put in the StateFileFolder, otherwise it will be stored in the current directory |
ForceStopBeforeRead | Will force the application to go to the STOPPED state before starting to load the state file. If this attribute is false, the application must be put in the STOPPED state manually. |
StateTriggerItem
An it for trigging state reading or writing.
Attribute | Description |
---|---|
ReadStates | If true triggers reading of states, if false triggers writing. All files specified in the StateFileItems with the FileAccess set to Read will be read when this value is true and the ReadStates is true. If ReadStates is false all files specified in the StateFileItems with the FileAccess set to Write will be writtent o when this value is true. |
CommandItem
The command button can start and stop computations in ModFrame.
Attribute | Description |
---|---|
CommandType | The type of command performed when the item's value is set to true. (Run/Stop) |
Reset | Will perform a reset in the ModFrame at the next iteration after the command has been executed if true |
StatusItem
The status items show the current status of the server.
Attribute | Description |
---|---|
StatusAsString | Displays the current status as a string instead of an integer |
Advanced
Class path
The class path is stored in the default value of the registry key:
HKEY_CLASSES_ROOT\Prediktor.ApisJava\CLASSPATH
ModFrame may stop working if this value is altered. Do not change the value unless you know what you are doing! |
Java options
The java options are stored in the default value of the registry key:
HKEY_CLASSES_ROOT\Prediktor.ApisJava\JAVAOPTIONS
Altering this value may cause ModFrame to stop working properly. |
The -Xrs property should always be present as the absence of this value will force ModFrame to terminate when a user logs off. |