VID SCADA Plant Monitoring and Control from the CodeMachine







File Menu

Edit Menu

View Menu

Options Menu





VID Events

Rem. Events



Client VID


VID Overview (V1.172)

Screen Dump

VID stands for "Virtual Instrument Desktop" alternatively "VID", the Sanskrit root of Vidya, meaning "to know".

The VID software allows low cost industry standard Modbus or NetCommander hardware to be used in distributed control and monitoring SCADA systems. The Software combines a customisable virtual instrument display with a "behind the scenes" event monitoring, logging, alerting and control systems, to provide a full and customisable HMI to your application. VID is used in data acquisition, SCADA, HMI, process control, plant monitoring, data logging, environmental monitoring, power monitoring, BMS, and virtual instrument systems.

The virtual instrument panel can comprise a variety of meters, dials, digital displays, graph plotters, thermometers, LED indicators, control knobs, sliders, buttons and switches. These can be "connected" to a Netcommander monitoring point anywhere on the local or World Wide network allowing data sources, temperature, pressure, voltages etc. to be visualised in seconds.

The instruments are viewed in multiple virtual screens; the current screen can be selected by using the toolbar forward, backward, and page cycle buttons or from the drop down list of configured pages.

The system is equally "at home" with a local LAN or RS232/RS485 connected system or a globally distributed system using the Internet or Corporate VPN.

Each NetCommander monitoring unit can provide up to 16 analogue input and outputs, 16 switch (relay) control outputs and inputs. The VID software will control up to fifty monitoring units. Logs can be maintained and analysed for trends and compared week on week.

The events system provides a configurable cause and effect system, several "causes" can be combined using AND/OR/NOT logic to produce an event that can have several "effects". An "effect" can be a control output, raise an alarm, make a log entry send an e-mail or SMS, run a control script etc. An almost unlimited number of events can be processed by the VID software, and a more limited number can be processed by the NetCommander nodes natively, this will allow some basic control to be maintained autonomously, in the event of network or PC failure.

VID is available for free download,

VID has been tested using windows 95/98/2000/XP/Vista and Windows 7 the system will work identically, however, the forms may be rendered slightly differently to those illustrated below, which were mostly recorded on Windows XP.
please report any problems to


VID Download

Click to download the latest VID installer and Release notes.

Unregistered, VID is fully functional but will only run for half an hour at a time before closing down, also the registration dialogue box will pop-up every few minutes, just to annoy you! Use with the supplied configuration file "examples.vid", check the [options][use virtual Netcommanders] setting to simulate connection to real monitoring nodes. The unregistered software will allow you to explore all aspects of the system and to design your own instrument panels, and control regimes and save the files for future use. The downloaded file is a self extracting installer, an un installer is also provided.

VID has been tested using windows 95/98/2000/XP/Vista/7/8/10, please report any problems to


Installing VID

Double click on the file Setup.exe which can be found on either the Installation CD (this should auto-start) or downloaded from the Internet from /VID/Setup/VID_Full.
You will almost certainly want all the default settings, keep clicking "Next" and finally "Install" to install VID on your computer.
You can follow the same procedure to upgrade an existing installation, any configuration files and scripts you have produced will be preserved.
The latest version is maintained on the web site, this can be downloaded free of charge, and will not require re-registration.
VID can be set to periodically check for a newer version.
The downloaded file is a self extracting installer, an un installer is also provided.
A Microsoft Installer file "Setup.msi" is also available for remote unattended bulk installations.

Un-Installing VID

VID may be removed from the system by navigating to "Uninstall VID" from the Start Menu or using the "Add/Remove Programs" dialogue from the Control Panel. Any configuration files generated after the installation will not be deleted, if you want to remove these as well simply delete the installation directory after the un-install completes.


How to Register VID

About Dialogue

The "About" and Program Registration box is accessed from the [Help][About] menu. Alternatively this will pop-up by itself every five minutes until registered. The Licence Key/Serial number is printed on the VID installation CD. VID (Lite) only supports one Netcommander and the licence box will be grayed out. In the absence of a valid license, the system will be fully functional, but will only operate for 30 minutes at a time, before shutting down, the run-time remaining is displayed on the caption bar of the main screen.


Operators & Logons

To ensure the security of the controlled plant, operators of the system must login to VID, operators are assigned various privilege levels

Basic Viewer

Can only view the screen(s).

Advanced Viewer

Can also view messages, logs, raw data etc. and instrument configurations.


In addition to the above can operate switches and control knobs.


In addition to the above can make changes to instrument and event etc. configurations.


Can do anything!

The "Lite" version of VID does not require logins, and the privilege mechanism is not active.
If there are no operators defined then the system will use the default operator at Administrator privilege level. Configuring one or more operators should, therefore be one of your first actions. All the configured users are presented in a drop-down list.

Login Dialogue

Login form

Login & Operator configuration form

Login Dialogue

The extended Login form left appears when the Modify/Add button is clicked on the simple form (above). To change the password of an existing user the new password must be typed into both the "New Password" and "Repeat Password" boxes. The logged on operator is timed out after "Timeout" minutes of operator inactivity.

The "Lite" version of VID does not require logins, and the privilege mechanism is not active.


File Menu (ALT+F)

File Menu
[File][Save] Cause the complete desktop arrangement to be saved to the current config (.vid) file. This can also be achieved by clicking the icon which will become high-lighted if the configuration requires saving.
The [File][Save as] option allows the name and location of the saved file to be specified. Configuration (.vid) files are saved in a standard Windows .ini file format so may be edited directly (e.g. NotePad) which may be easier in certain circumstances, for example, when working with multiple similar sites. If you associate .vid files with the VID program double clicking on a .vid file will open VID with that data. The default file to load is stored in the vid.ini file and is initially examples.vid, from the program installation directory and subsequently the last .vid file used.
[File][Open] opens a file dialogue to open the selected config file, this can also be achieved by clicking on the icon.
[file][close] unloads the current config, the VID display will be blanked to start work on a new config.
[File][Run Script] is an advanced option that allows running of a script file, these files will be familiar to any 'C' or Pascal programmer, this feature is described here.
[File][ReOpen] re-opens the current configuration file, this is useful to re-start all scripts.


Options Menu (ALT+O)

Options MenuVarious options reside under this menu heading, these are not saved on a per config basis, but will alter the functioning of VID for all loaded configs.
[Options][Check Updates] controls whether VID will periodically check for a newer version on the web, this can then be downloaded.
The [Options][Exit Form] controls whether VID displays a confirmation dialogue on exit "Are You Sure?".
The [Options][Spoof Data] will permit "spoofed" data to be entered on the Instrument Properties to be displayed, this is useful for "hacking" demonstrations, for safety reasons this option is NOT saved, after a restart VID will always display live data.
The [Options][Transparent Forms] will cause forms to be displayed with some transparency, underlying instruments are then not completely obscured by a form.
The [Options][Log TCP errors] causes TCP errors to be logged into the system log file, if this causes too much clutter, uncheck this option.
The [Options][PrePopulate Charts] causes VID to pre-populate charts on start-up with data from the specified log-file.
The [Options][BaseLine on Comms Fail] causes chart traces to go to the baseline in the event of communication failure with the monitoring node instead of flat-lining at the last known value.
The [Options][Multilevel Backups] causes multilevel time stamped back-ups of the .vid configuration files rather than a single level ie. MyConfig.~vid.
The [Options][Change Page on Alarm] causes the displayed screen to change to the one containing an alarming instrument.
The [Options][Start in FullScreen] this causes VID to start in fullscreen mode on start-up, this gives maximum space for instruments, the escape key will restore task bar and menus.
The [Options][Start With Windows] checking this will cause VID to automatically start when the computer is (re)started, this is useful for automatic recovery from a power failure or reboot. This may not work with all versions of Windows especially Windows 10, where VID may need to start in Windows 7 mode and as Administrator you may need to create a task using the Task Scheduler
The [Options][Debug Log] Enables the logging of certain debug information, this should generally be left unchecked unless CodeMachine support request the information.
The [Options][Use Virtual Netcommanders] checking this will cause VID to use a web based Netcommander(s), to be used when no Netcommander hardware is available, to experiment with instrument scaling etc. perhaps during product evaluation ..


Edit Menu (ALT+E)

Edit Menu The basic system configuration is achieved using two forms. One concerns the local configuration and one for configuring individual NetCommander nodes. The System configuration is accessed from the Edit menu, and allows setting up of the system wide defaults.

Basic Dialogue


Compatibility If specified, the system log will be used to record all potentially hazardous operations, stamped by time and user. The log can be cycled daily, weekly, monthly or continuous. The path specified in "System Log" is used for all logs by default, chart log data etc. The default path is "logfiles" under the installation folder, so typically all logs will be stored in C:\Program Files\VID\Logfiles. Note: in Windows Vista and Windows 7 writes to the program files folder are not allowed and your logs will typically end up at:
C:\Users\%username%\AppData\VirtualStore\Program Files (x86)\VID\logfiles
It may be better to change the log path to something like C:\VID_Logs or to change VID.exe compatibility mode to Windows XP, by right clicking on VID.exe and checking the XP compatibility box as seen on the left.

The "Use Standard Time" checkbox causes Standard Time to be used, i.e. GMT+/- your geographic offset without any reference to daylight saving time, this setting is recommended as the time will then not go forwards and backwards with the seasons. The clocks going backwards would effectively loose an hours' data from the log as the times would be duplicated, and the clocks going forward would cause an hours gap in the data, using Standard Time avoids this and avoids any confusion. Un checking the box will use local time including any daylight saving time.

Compatibility The Server Configuration section controls the built in web server, this allows remote viewing and control of the VID program from another remote computer using an ordinary web browser or the VID Client software. Choose a Port other than the standard HTTP port of 80 if there is already a web server running on this PC (requires restart of VID, after saving config), the same port number must be supplied in the VID Client configuration or web server URL eg. for port 4321. You may need to use port forwarding in your router to direct the chosen port to the VID machine. Choosing a lower Quality setting will result in smaller file transfers, but the image quality will suffer. You can remotely operate VID from your browser, on later versions of Windows you will need to uncheck "Enable desktop composition" in the "Performance Options/Visual Effects Tab " of the Windows "Control Panel" otherwise drop-down menus are not rendered (no idea why!).
Note the VID Client software provides multiple in dependant views i.e. you can have several Clients looking at different VID pages all sharing the same Netcommander data, whereas with browser option, all browser clients (up to 10) all see the same page, although any one of them can change the view, the changes will be seen by all, the browser merely sees a screen image of the main VID application.

SMTP IP,User, Pass and Dflt. From set up the SMTP mail server, this is the SMTP server for the VID location, which may or may not be the same as the SMTP server specified for individual NetCommanders. You may force a port address other than than the SMTP standard of 25 by adding ":port" to the SMTP IP address, e.g. User and Pass Word may not be needed and can be left blank. Dflt. From is the default "from address", your ISP or SMTP server may impose restrictions on the From Address which are usually of the form
Checking the WebService simplifies things significantly, all the above fields apart from Dflt. From will be grayed out, and VID will use a web page to generate the emails, this will work from any internet connected system that can browse the web.

The SMS section is used where a GSM/GPRS modem (or mobile phone) is connected to the computer to allow sending of SMS alerts, nb. the phone number here "SMSC #" is that of the service provider, Vodafone, Orange etc. Not the telephone to be alerted. The destination 'phone number is set-up in the events configuration.

Alarm Sound sets the default for local alarm sounding, for convenience the Browse button bring up a file browse dialogue to locate sound (.wav) files.

Default background sets the default background image for all pages, for convenience the Browse button bring up a file browse dialogue to locate image(.jpg, .gif) files.

Page Cycle Time is the time (in seconds) between page views when using the cycle pages feature.
Get Config from Netcommander and Send Config to Netcommander downloads or uploads configuration data to the configured Netcommander. It is recommended however, that the native Netcommander web based configuration tool is used to maintain Netcommander configurations, this can be accessed using the Native Web Manager. button on the Netcommander Configuration dialogue below.

Start up script specifies a script file to be run when the current configuration is (re)loaded. The script would typically set control outputs to an initial state, for example.

Target Size is the screen resolution of the target system, this is particularly handy when developing a configuration on a machine with a higher screen resolution than the target system, setting a target size smaller than the development machines will prevent you resizing the VID main window greater than specified here.

Node Configuration

NetCommander Configuration

Node Dialogue

This form allows configuration of the various node types accessible from VID.
The field contents of the form vary according to the selected Protocol.
All are accessible from the [Edit][Monitoring Node Configuration] menu.
On clicking OK the config is updated locally and at the Netcommander (if it is online).

The Netcommander node configuration accessed from the Edit Menu,
and is used to set the communication parameters for individual NetCommander nodes.
The "Lite" version of VID only supports a single Netcommander.

The node IP address is entered in dotted quad format e.g.."", to use a TCP port number other than the default HTTP port 80 specify this after the IP address separated by a colon e.g. "" this allows the use of port address translation to reach Netcommanders on private address ranges. Symbolic names can be used, for example,"". The "Internet" button launches the Windows Control Panel Internet Options Dialogue. The LED indicated the Netcommander is online if green.

The NetCommander "full access" Password must be specified here.

Configuration Upload and Download
NetCommander Configurations may be sent/retrieved from the NetCommander (if Online) using these buttons. The configuration is stored/retrieved from the current VID configuration file. The NetCommander Native Web Interface can be invoked from here opening in your default browser. The Native Web Interface allows full configuration of the Netcommander for autonomous operation. Not all of Netcommander configuration is directly visible to, or modifiable from, VID, however the entire config. can be downloaded and stored in VID's current configuration file for back-up purposes.

Miscellaneous Stuff
The SMTP field only needs configuring if the NetCommander is to autonomously send e-mails, this is the IP address of the SMTP server which must be accessible from the NetCommander's location. NTP is used to specify the IP address of a Time Server to set the Netcommanders internal clock, when used with VID the Netcommander is automatically synchronized to VID's time after applying Time Zone (see below). The FTP boxes are used to configure the the Netcommander FTP system for retrieving Logs.
Time Zone is the number of hours +/- relative to the VID computer's internal clock to allow local time to be configured on the NetCommander. The NetCommander time is synchronized with the VID PC time at startup and subsequently every hour. If the controlling PC is in England and the NetCommander in, say, France the Time Zone would be set to 1 to ADD one hour to the Netcommander time relative to VID.

Poll Period specifies how often VID polls this NetCommander, each Poll retrieves about 100 bytes of data across the Network. The time is specified in seconds. Some Internet connected nodes may require a slower poll to allow for network delays, local and time critical applications can have shorter poll periods. The shortest practical poll period is 0.3 Seconds. With many connected NetCommanders, consideration should be given to the available bandwidth.

Port scale conversions

Conversions Dialogue

This dialogue allows scaling functions to be assigned to one or more NetCommander ports. This scaling will be reflected in the native NetCommander web interface above, and will also be used as the default scaling function for any Virtual Instrument that specifies the port. Typically one scaling factor is used on several ports, the array of check boxes allows assigning the function to multiple ports. The "inputs" and "outputs" checkboxes specify whether the function is applicable to input ports or output ports (or both).


Modbus Nodes

Modbus Dialogue Modbus Dialogue

Modbus nodes can be defined or edited from the [Edit][Monitoring Node Configuration] menu selection. "Modbus Address" is the node address in the range 1..255. "Protocol" selects between RTU (Binary), ASCII (printable Hexadecimal) and TCP flavours of the Modbus protocol. "COM" is the PC "COM" Serial port to used, and the associated physical port setting of baud rate and parity etc. If ModBus TCP is selected the Serial port configuration area changes to the LAN IP settings, ModBus TCP usually operates on TCP Port 502, however, this can be changed using the [:Port] mechanism as for the Netcommander, above, eg. "".

The "FSD" settings, are used when referring to values by voltage, if the Modbus device has a 12bit ADC that is 2.4 Volts full scale, then the theoretical FSD of the 16bit Modbus register would be 2.5*16=38.4V. Note that in Modbus speak an analogue output is termed a "holding register" and a digital output a "coil". VID tracks which Modbus registers are in use and only requests data from those registers using the "read multiple" Modbus commands. A "port" on a digital VID instrument represents a binary bit, therefore the associated Modbus register would be (port/16) the remainder being the bit number. ie port 35 would be register 2 bit 3. Modbus is not supported by VID (Lite).

Modbus Dialogue

MyPClab photo

Modbus modules come in all shapes and sizes, most are for industrial use and have RS485 interfaces which will require the use of a RS485 to USB (or RS232) converter. A convenient small device with a USB interface is the Novus "myPCLab" device (left) which can be configured to use two thermocouples, DC voltage or 4-20mA inputs or a combination thereof. It also has a built in temperature monitor and a single digital input. A more extensible DIN rail mounted solution using an RS485 interface is shown right. Modbus modules can be supplied by the Codemachine. Another good source in the U.K. is Audon Ltd.




RS485 networks only require two wire signaling and can support up to 128 monitoring nodes. The signaling range is greater than 1Km. An RS485 converter will be required to interface with the PC, this will present either a COM port interface or USB, VID can handle either.

Modbus Simulation

ModSim ScreenShot VID Modbus installations can be verified using the FreeWare utility ModBus_RSim2.
This utility can simulate a ModBus slave node and is useful for developing ModBus system configurations in the absence of the ModBus slave hardware. It is most convenient to use the ModBus/TCP protocol, that way you do not need a NULL Modem cable to connect to serial ports together. In TCP mode the utility is listening on port 502 and if running on the same machine as VID you should configure the local host IP address of, otherwise use the IP address of the PC it is running on. Multiple instances of the utility can be used to simulate more than one ModBus Node. After developing with the utility remember to reconfigure VID Modbus node configuration for the target hardware.
A null modem cable can be simulated in software using Com0Com
Detailed instructions for the use of this tool can be found on the author's web site.


Instrument Pages

Page Dialogue

The system may have several pages of displayed instruments, these are selected by the forward, backward and cycle page buttons on the toolbar or from the drop-down list of configured pages. The screens can be named and the background colour and image changed by right clicking on a blank area of the selected page, the simple dialogue box (left) will appear, click Apply to transfer the settings to the screen. The current page can also be deleted or duplicated to another page for editing. The background image can be stretched by width and/or height to fit changing screen sizes. VID (Lite) does not support multiple pages.


Virtual Instruments

Analogue Instruments  Labels  Dynamic Graphics  Static Graphics  Web Window
Analogue Controls  Switches  VI Configuration  Charts  Instrument Scaling

Virtual Instrumentation provides a visualization of the monitored system. A variety of instruments may be included on the display, a selection of round, horizontal and vertical analogue meters, thermometers, bar indicators, Oscillograph, digital displays and LEDs. For analogue control there are rotary mouse adjustable knobs, and slider controls and for switch outputs clickable toggle and slide switches and push buttons.

Adding a Virtual Instrument to the display

Instrument DialogueTo add a new instrument or control to the display left click on a blank area of the screen, the "instrument chooser" box (left) appears. Clicking on one of the instrument icons will place the instrument on the display. The instrument will appear near to the original cursor position. The instrument types in the chooser box are ordered top left to bottom right, by type, starting with analogue displays, through binary displays, analogue controls, binary controls (switches) and finally static graphics.


An instrument may be moved on the screen using the [Shift][Right Click][Drag] mouse action. Move the instrument slowly to keep the mouse pointer inside the instrument or it may "loose focus" and something else might start moving


An instrument may be resized on the screen using the [CTRL][Right Click][Drag] mouse action.


Simply Right clicking on the instrument will allow various properties to be changed, such as instrument type, monitoring point, scaling factors, caption etc. (see more below).


Analogue Instruments

The available instruments are 270, 180 and 120 degree meters, horizontal and vertical meters, thermometers, horizontal and vertical bar indicators, a representation of various tanks with varying liquid levels, thermometer, a numeric value indicator and a graph plotter. All these instruments have configurable sector colours, this allows the configuration of three ranges of values Low, Mid & High sectors. An alarm can be associated with one of the sectors. The Caption text can be made to change according to which sector the current value lies, the sector caption texts are separated by semi-colons eg. "Voltage Under Range;Voltage;Voltage Over Range" and are associated with the low,mid and high sectors respectively.


Graph Plotter

The Graph Plotter is a type of analogue instrument but has a few more options. The Graph Plotter can display more than one input value on the Y axis, against time, the Y values are specified by a start port and range. For example if "port" is set to 3 and "num ports" to 4 then the values of Netcommander ports 3,4,5 & 6 will be displayed. The same scaling is applied to all ports. A typical use would be to measure the power consumption in a three phase supply, and with this in mind the first three channels are coloured Blue, Yellow and Red (these can be changed). By specifying a "log file" in the configuration, chart data is logged to a disk file. There are 60 plotted points to a graph division, so if an hour per division is specified each point represents one minute and an entry is logged every minute. The log scale can be specified from one day per division down to five minutes. Right clicking on a graph brings up the usual properties selection panel with the addition of "logger" this produces an historical log analyses tool, this will open with the log file and scaling associated with the graph plotter instrument. These values can be subsequently changed in the analyses tool, and the new settings will be remembered for the next time.

Graph Operating point

Graph Operating point The Operating point is analogue instrument similar to the graph above, but in this case one value is plotted against another, for example temperature vs power consumption, or in the case of a generator, MVar vs MWatts as in the picture. The chart background is supplied by a image file (.bmp or .jpg) The min and max scaled values take the plotted point right to the edges of the image, (a green bezel as been specified, so the edges can be seen) in the example the Y axis scaled values would be minus 300 to plus 450 MVar and the X axis minus 100 to plus 700 MWatts to align with the image scale. If a scaling script is used this acts on the Y axis only.


Labels can either display a fixed text and a dynamic numeric value or a dynamic text which changes according to value. The font size, text and text colour can be changed from the properties dialogue. The text of the caption can be made to vary with the integer value of the scaled value, if this feature is required, the caption texts are separated by semi-colons, the first text will be associated with values 0.0 .. 0.999, the second text with 1.0 .. 1.9999 etc.

A dynamic numeric value and fixed text is displayed if units are specified in the properties dialogue. This example has the units value set to "kW" i.e. Kilo-Watts. Dynamic Label example
As a special case, if "units" is set to !HH:MM:SS or !MM:SS the instrument value (in seconds) is displayed time formatted. Dynamic Label example
If the units field in the properties dialogue is blank then labels can be considered as a binary (or multi-state) instruments as the text can change according to the monitored value.
If a Caption is specified containing semi-colons, then these will be treated as a list of captions which will be selected by the integer value of the scaled result. Up to 16 texts separated by ";" are allowed giving 16 captions, selected by the scaled values say, 0.0 to 15.99, for example, a scaled value of 0.35 would select the first, and say 1.68, the second caption in the list. If the semi-colon is omitted then the same text will appear for all values. A '|' (pipe) symbol in the caption dialogue appears as a new line in the label.
Label Example


Dynamic Graphics

Graphics can be considered as a binary (or multi-state) instruments as picture can change according to the monitored value. Up to 100 pictures are allowed are allowed selected by the scaled values 0.00 through to 99.99. The "base" picture for the graphic should have a name ending in "00" e.g."PipeValve00.jpg" that could represent (for example) a closed valve, "PipeValve01.jpg", "PipeValve02.jpg" could then represent the same valve in various degrees of flow. The are some example picture in the "VID/Media" folder, the user can add some more if desired. If "Bevel" is selected the colour of the bevel will track the sector colour as specified in the instrument properties dialogue.

Static Graphics

Static Graphics are primarily for displaying a fixed background picture, they can be re-sized and the picture file changed at run-time. Also you can specify a "refresh" interval from approximately one second upwards, this is useful for monitoring the image file generated by a locally connected "web cam". For internet connected web Cameras use the "Web Graphic" option below. If "Bevel" is selected the colour of the bevel will track the sector colour as specified in the instrument properties dialogue.


Web Graphics

Web Window

Web Windows are instances of Internet Explorer® and can display any web page Internet Explorer can, the window can be re-sized and re-positioned and will be displayed in a captioned box. The instrument can only be "picked up" using the bottom edge border, as obviously all clicks on the main area are directed to Internet Explorer. For multiple images to be displayed for example multiple web cameras, then consider creating a local html file to format the multiple images in, say, a table and configure the instrument do display it, this creates a single instance of Internet Explorer rather than one per image, and uses considerably less memory and is more configurable as regards formatting the images. For locally connected web cams, with an image file located on the host computer's files system, use the "Static Graphic" option above.

Analogue Controls

Analogue Controls include two knobs, one is a single turn with a digital readout, the other is a 10 turn "pot" called a Gear Dial, horizontal and vertical sliders are also supplied, also numeric controls in edit box and spin button styles. Right clicking on the control will allow various properties to be changed. VID (Lite) does not support analogue controls.


There are Toggle and Rocker switches which remember their state (just like a light switch) and a "momentary action" switch called a Bit Button. The Bit Button will only change state whilst the mouse button is held down. Right clicking on the switch will allow various properties to be changed, such as control point, caption etc. Rocker and toggle switch styles are available. The text on the face of the switch can be made to change according to state using the dynamic caption described in Labels above The caption could be of the form "Lights|Off;Lights|On". The "Bit Button" is a momentary contact push-button, it is only "On" whilst it is being "pressed". The Bit Button is unique in that it can also be associated with a control script which will run when the button is clicked for more about control scripts see this. The state of the control will reflect the last update message received from the Netcommander, if there is more than one instance of VID controlling the system the switches and controls may change position by themselves, all VID displays will be kept consistent. VID (Lite) does not support switches.


Pinger Image

The Pinger instrument is a departure from the norm, it does not reflect the state of an I/O port but uses either ICMP Echo (Ping) or an HTTP request to check that an IP connected host is contactable. This is useful for monitoring the availability of a web site or server. The "LED" is green if all is well, red if contact failed, and black while waiting for e reply. You will probably need to run VID as "Administrator" to use the ping function, as Windows does not generally allow the creation of RAW sockets. A failure action can be specified in the instrument's configuration that will be actioned in the event of three consecutive contact failures, the rate of contact requests can be varied between once every 5 seconds to once an hour.


Moving Instruments

Moving Instruments form Right clicking on the empty space on a page and selecting Move Instruments will bring up the form on the right, by default all instruments are moved together on a page, however you can select to move only those instruments contained within a selection box. To select instruments for moving, check the Move Selected radio button and then the Top Left button, next click on the instrument page to select the top left corner of the selection box, move the mouse and click again to define the bottom right of the selection box which will then be drawn around the selected instruments. The default shift per click on one of the up, down, left or right buttons is 4 pixels, this can be changed using the Offset box. The Height, Width, horizontal position or vertical postion of the selected instruments can all be made the same (the boxes are pre-populated with the aveage value) this is handy for pixel perfect alligning of multiple similar instruments.

Instrument Configuration

Instrument properties Instrument properties selectionRight clicking on any instrument will bring up a popup menu with options to change instrument properties, Nudge (make fine adjustments to size and position), clone (duplicate), delete, and change the type of instrument preserving all applicable settings. The history chart generator tool can also be launched from here, for graph type instruments. Only a subset of the above options will appear depending on instrument type.


The Instrument properties form is similar for all instrument types, some fields will be missing if not applicable. The form on the left contains all possible fields, they will never all be present, the fields visible will depend on the type of instrument being configured.

Caption Area

Caption will appear on the face of the instrument, special symbols from the Extended ASCII character set can be added using the &#nnn; syntax, nnn being the character code e.g. ° would display °C. Caption text can change according to the current instrument/ switch value see Labels above for full explanation.
Font sets the font attributes to be used.
Colour allows non-standard Font colours to be used.

Node Selection Area

Node/Type/Port dialogue set the monitoring or control point.
Value box in the node selection area shows the current raw value.

Ping Area

Rate Sets the Ping interval from 1 Second to every 12 hours.
An alarm may be configured which will trigger if three consecutive pings fail. HTTP Check box selects either an HTTP GET of the configured URL, or if unchecked a standard ICMP Echo request (Ping).

Scaling Area

Dig. min/max and Scaled min/max boxes are used to define the scaling function.
Volts check box determines whether the Digital range boxes contain the digital value (checked) ie 0..4095 or an analogue value 0..5.0 Volts at the NetCommander input.
Sc. Default button will pre-load the scaling boxes with the NetCommander port defaults. The raw input value can be pre-processed by a Script (written in a simplified "c" programming language) to provide extra data processing, averaging or calibration etc.
Value in the scaling area gives a real time display of the current scaled value.
Units will appear on the face of the instrument, special symbols from the Extended ASCII character set can be added using the &#nnn; syntax, nnn being the character code e.g. ° would display °C.
Browse button is used to locate the desired script, more about this below.

Graph Area

Log file Selects a log file to record the graph.
Log Cycle determines whether the a new log file is started every day/week/month runs continuously.
Zoom provides a, usually temporary) mechanism for altering the Y axis scale without changing the scaling.
Channels determines the number of contiguous ports (up to 8) to chart.
Alternate modifies Channels to use not contiguous but alternate channels say 2,4,8 rather than 2,3,4 this is helpful for Netcommander use where 2 channels are brought out per rear DIN connector.
X Interval is only applicable to the graphs and ranges from one minutes per division to one day per division.
Colours configures the colour of each plot line.
Fill allows one channel to be colour filled below the plot line.

Odds and Ends Area :-)

Glyph File and associated Browse button appears for certain switches and allows an image to be overlaid on the switch.
Image File this is a local image (.jpg) for a static image or a URL for a web image (usually a web cam).
Web Refresh this controls the refresh frequency for a web image (usually a web cam).
Click Page Page to change to if the instrument is clicked (for alarm drill downs or general navigation), zero disables.
Needle Colour Changes the colour of the needle on round meters.
Needle Shape Changes the shape of the needle on round meters 1..7.
Sector Offset Changes the distance between the scale and the sector ring on round meters
Sector Width Changes the width of the sector ring on round meters.

Sector Area

Show Shows or hides the sector ring on round meters.
Sec Low & Sec Hi sliders control the size of the coloured sectors on the instrument face, or in the case of thermometers the "mercury" colour and in value indicators the colour of the value text. Only the Mid sector is controlled, the upper and lower sectors extend to the extremities of the scale.
SetColourH/M/L buttons select the colours for the High, Mid and Low Sectors.
LED colours are also selected by the same means, this allows for a tri-colour LED.
The instrument values including sector ranges can be imported into the Events Cause form by left clicking on an instrument whilst a cause dialogue is open.

Alarm Area

Action allows an action to be performed when the instrument enters a certain scale sector (selected by the radio buttons), the actions are the same as described in the Events section.

Bottom area

Background tracks Sector Colour appears for meters and thermometers and does what it says!
Caption tracks LED Colour obviously only appears for LEDs and does what it says!
LED Flash on Alarm makes an LED flash when in the Alarm sector (see above).
Page allows the instrument to be "sent to" another page, this can be used in conjunction with cloning (below) to duplicate an instrument onto another page with identical settings.
Click Page is available on certain instruments to change to the specified page view on a left click, this is used, for example, to drill down from a high level alarm to a more detailed screen.
Beveled controls whether the instrument bezel is displayed. Inner Colour & Set Colour set the background and inner colours, these buttons are renamed "On colour" and "Off Colour" when processing binary instruments such as Switches.
Vid Src This button invokes the Web Camera con figuration dialogue
Select the video source and and Device Settings or Camera Controls required.

if the camera is displaying all black, try changing the compression from MPGP to YUY2 or vice versa !

Change Face

This option brings up the Change Face Dialogue, the instrument face type can be change (within reason!). It is not possible to change a switch to an analogue meter for example, but all analogue instruments are interchangeable, likewise binary displays, and switch types.


This option retrieves a web based image from a server and refreshes the instrument on the display.

Nudging Instrument Position


Nudge Instrument form

This option allows the position and size of the selected instrument to be nudged as it is difficult to drag a instrument to the nearest pixel or two.


This option creates an identical instrument on the display, useful when there a lot of only slightly differently configured instruments.

Delete Instrument

The Instrument will removed from the display and from the active configuration.


This option opens the instrument logging and charting tool.

Delete Instrument

The Instrument will removed from the display and the active configuration. Top


Tool Bar

Page Selection

The drop-down menu selects the page of instruments to be displayed.

Web Server activity LED

Is to the right of the page selection box, and indicates activity on the internal web server (or Web Client for Client versions of VID)

Monitoring node Status Bar

The row of bars to the right of the Web server activity LED indicate the status of the monitoring nodes.
Hovering the mouse over an individual indicator opens a hint box indicating the monitoring node number.
Left clicking on a bar brings up the raw data viewer for that node, right clicking displays the message viewer.
The colours are as follows:

ToolBar Icons

Most of functions available from the toolbar icons are available from the menus (above). The page control Icons will not be present in VID (Lite).


Open File Dialogue (same as [File][Open])


Save File (same as [File][Save]) (high-lighted when save reqd.)


Log Annotation tool


Take a snapshot of the VID screen, and open in default browser


Expand to full screen (ESC cancels)


Display the Help file in web browser (same as [Help][Help])


Display the VID Web site (same as [Help][Web site])


Open Login/Logoff Dialogue


Move one page to the left (lower page index number)


Move one page to the right (higher page index number)


Continuously cycle through the pages (configurable delay)

All the above Icons are self explanatory or have functions described in the relevant menu section. With the exception of:-
Full Screen, this button hides the menu and tool bars and expands the main form to fill the screen, pressing the Escape (ESC) key cancels this.
Log Annotation (see below).

Chart Log Annotation

Annotation Dialogue

Log Annotation allows comments to be inserted into the chart data. By right clicking on a chart (graph) instrument, the form on the left can be accessed, this will annotate the data for that chart only.
Accessing the same dialogue from the tool icon (above) will annotate ALL charts simultaneously (the "Log File" field will be empty). VID will remember the fields from the last use, so only those changed need filling in, Shift and Product fields are optional and intended for industrial users. The Annotations will subsequently be displayed in the chart plot information box (see below). Annotations within +/-1 time division, the number of arrows e.g. ">>>>>" indicate the closeness of the annotation to the current cursor position.

Log Analyses Tool

Chart Dialogue

This form allows the configuration and display of a historical chart of instrument data over time. The start time of the chart can be adjusted with the slider. The graph window is re-sizeable, and multiple graphs can be on-screen at once. An instrument chart can be accessed from the right click instrument properties menu. Two log files can be compared, for example two logs from different weeks, only one channel of the (up to eight channels) in the log files can be compared at once, selected by "Cmp Ch.", "Fill Ch." specifies which channel is made into a solid colour (channel 2, yellow, is selected above), you can also use the "fill Ch." to remind yourself which channel colour is associated with which channel. The dates on the X axis represent the dates for "Log File", the comparison log file data will be synchronized to the same time, but typically a different date. When comparing Weekly logs as above the comparison data will be aligned to the same day of the week, and in the case of Monthly logs, the same day of the Month. Comparing files with no log cycling is fairly meaningless, but will be aligned by time of day. information about a particular plot can be had by left clicking on the chart and a hint box will pop-up as shown above. The X-Axis time resolution can be changed, if the time period is longer than the recorder time period data will be averaged between plots, where the specified time resolution is shorter, the data will be interpolated between plots. the chart can be dragged to the left or right to change the time period (sufficient data permitting) use the down arrows to access the ca lender for dates, highlight the hours/minutes and use the up and down arrows or directly edit the time. "Excel Chart" and "Excel Log" allow the export of .csv Microsoft Excel spreadsheet data for the chart or the entire log respectively. Note the Chart Plot Information box, this pops up when clicking on any chart whether live or recorded and displays the values and any annotations at the cursor position (highlighted vertical yellow line). The log files must be of .clg file extension or a zipped log file in which case the ".clg" is replaced by ".zip", by their nature log files contain many repeated elements and are so eminently compressible! The "Zip?" buttons allow a outdated log to be converted to compressed zip format, you cannot zip an "in date"active log file.
The "Histogram" checkbox, when checked, causes the chart to be displayed as a histogram, averaging the values over each division as in the clip (right), (hint) set 1 hour per div, then the Histogram bar heights will be "units"/Hour. The chart total "units"/Hour is also displayed top left, this only has a meaning for charts showing consumption rates ie. power, gas flow etc.


Histogram Mode


Instrument Scaling

The Instrument Scale factors require a little more explanation. Analogue input and outputs have raw digital values expressed as a scaler number between 0 and 4095 (for A 12bit resolution A/D). Scaling functions are required to convert this range to a floating point representation of a "real world" value e.g. degrees Centigrade or Volts.
The standard NetCommander monitoring board provides 16 analogue inputs and 8 outputs, and monitors/controls voltages in the range 0.0 to 5.0 Volts. This scaling is performed by a simple raw to scaled value mapping by specify the upper and lower limits of both the raw input range in use and the required floating point "real world" value.
The basic scale function is defined by the raw min & max values and scaled min & max values in the instrument properties dialogue. This can be preset to the NetCommander port default. Additional scaling and data processing can be provided by a script which is written in a simplified "C" language. The simplest scripts is below :-


This will be familiar to any 'C' programmer. The above script does nothing, the input value is simply conveyed un-altered to the auto-defined double precision variable "result".
The script below takes a running average of the last ten readings. The script is applied to the raw A/D value BEFORE the scaling function.


VID Internals

Vidvar No. Monitored Resource
10001 Page Faults
10002 Memory usage
10003 Virtual memory usage
10004 Peak Memory usage
10005 Peak Virtual memory usage
10011 GDI Objects in use by VID
10012 User Objects in use by VID
10013 Kernel Time used: 100nS ticks/Second
10014 User Time used: 100nS ticks/Second
10015 Total Time used: 100nS ticks/Second
10016 mainloop execution time in uS
10021 command queue length
10022 HTTP threads in use
10023 Async TX bytes per minute
10024 Async RX bytes per minute
10025 NetCommander TX bytes per minute
10026 NetCommander RX bytes per minute
VID maintains a set of VID variables monitoring VID internal performance, memory usage, CPU usage etc. these may be displayed on instruments or monitored by logs and charts.
double Av[size];

int c,count=0,size=10;

if (count>=size) {
  while (c<size) {
  result = result/size;
} else {
  while (c<count) {
  result = result/count;

The important thing to note here is that variables are "static", each time the script is called the values are remembered from the last run, "count" is incremented from one call to the next, the variables assigned a value in declaration statements "int" or "double" are set to that value on the first run only, and then may subsequently be updated (or left the same). Each instruments' scaling function has its own set of variable values, even though the same script may be in use by several different instruments.
More about Scaling Algorithms and Control Scripts in the Scripts section. You can create your own scripts using "NotePad" or similar editor and place them in the scripts folder. Scripts may be tested using the Scriptor utility.


VID Control Scripts

Scriptor Window  Variables  Arithmetic  Built in Functions  VID Software


The Virtual Instrument Desktop (VID) plant monitoring and control system can execute script files to perform sophisticated control and monitoring tasks. The scripts are used to perform sequenced actions for example to shut down a system in an orderly fashion. The script language has built in functions to monitor and control NetCommander I/O ports. Delays and "time of day" functions can also be programmed. Emails and alerts can be generated in a similar way to the VID events system.
The language itself is a subset of 'C' so will be familiar to any 'C' programmer.
Only the for, while, switch and if flow control constructs are implemented, there are no do .. while loops. All variables, constants and functions are integers (int), character (char), boolean (bool or boolean) or double precision floating point. Strings can also be defined using char[]; pointer types can also be specified by using the '*' modifier. The constant (const) and signed and unsigned modifiers are also handled.
VID can invoke a script from either a push button on the virtual display panel, or as an "effect" from the event handler, or can be run from the [File][Run Script] Menu.
The script will open in a window as above, but can be subsequently hidden and revealed under control of the script itself.
several scripts can run concurrently, and may run continuously in a loop, waiting for various conditions to occur in the monitored system.
On a Pentium class 1Ghz PC the script interpreter should exceed one million lines of code per second.
The scripts are interpreted rather than compiled, this means that the system only "sees" the code as it is executed, any areas of your script that only execute under exceptional conditions e.g. alarm handling may contain errors that will only become evident when the alarm condition occurs, be careful coding these areas and test thoroughly before putting on a live system.

Script Types

There are two types of scripts, their syntax is identical, but they are used for different purposes within the system, these are "Scaling Algorithms" and "Control Scripts".

Scaling Algorithms

Scaling Algorithms are used to process the raw values into a suitable range for display by an instrument see Virtual Instruments or Scaling inputs into the Events system. In addition to simple scaling they may calculate, for example, averaging functions, and non-linear conversions for instruments like thermo-couples etc. These scripts have the ".vsa" (VID Scaling Algorithm) file extension. These scripts should be kept as simple as possible to reduce execution time and CPU overhead to a minimum, as they may be being called hundreds of times a second. Scaling algorithms are run "blind" they do not run in a Scriptor Window

Control Scripts

Control Scripts can use the full functionality of the scripting engine including writing information to a Console Window these scripts run asynchronously to the main code, in a separate thread, and so can run for a long time without disturbing the main functionality of the program. In fact, a control script may run continuously in a loop monitoring inputs etc. Control Scripts have the ".vcs" (VID Control Script) filename extension. The system can run eight scripts concurrently. The scripts may be launched from the [File][Run Script] menu or from a virtual on-screen Button, or as an event action. If invoked from the [File][Run Script] menu the Console Window will be visible otherwise it is minimized, the running script may force a minimized window open by a call to the visible() function, the window opens automatically in the event of an error.


The Scriptor Window

Scripts Dialogue

MiniMizedControl Scripts are usually run minimized (left), however the Scriptor Window, as above, is available, and can be used to start,stop,resume and edit the scripts. The File button opens the file dialogue to select a control script file, this will run automatically. Start is used to re-load from disk and run the previously selected file name, this is useful for reloading the script if it has been edited, Halt will halt the running script, Continue will cause the script to resume at the same point. This will otherwise, generally, not effect the operation of the script, however, events in the monitored plant may be missed or functions that rely on time differences (as read by the get_time() function) may malfunction. Exit will exit from the running script. Edit will open the "NotePad" editor (on a Microsoft Windows system) and open the current script for editing. This is a convenient way to achieve a fast edit/run/debug cycle for scripts. Close will exit from the current script and close the scriptor window. Any outputs made from the running script (using the print(...) command) will appear in the main window. The eight boxes at the bottom of the window, give a display of what the Script Engines are doing, the first box is reserved for Scaling Algorithms, as these always run in the same thread there can only be one of them! The other seven are the general control scripts, the number following the file name is the "program counter", the current position in the script file. The file associated with the current window is coloured red. The screen shot above is showing the execution of the test.vcs syntax and performance test script.

Instrument Scaling

The Instrument Scale factors were introduced in the Virtual Instruments topic. These have the same syntax as control scripts but have the specific function of processing raw input values to engineering units, Volts, Litres etc. for display on virtual instruments or for processing in the event handler. The basic anatomy of a VID Scaling Algorithm (.vsa) file is:-

double scale_max=5,scale_min=0;

This will be familiar to any 'C' programmer, the two double precision variables "scale_min" and "scale_max" set the upper and lower bounds of the instrument scale, "result" will represent the value to be sent to the instrument in the scaled units. The raw value is retrieved by a call to the "input_rel(0)" function, which returns the raw value from the port specified in the Instrument or event Cause, this is a value in the range 0 .. 4095 for an analogue signal. The calculation in the script coverts this to a value in the range (in this case) 0.0..5.0 for display this value must be stored in a variable called "result" which is pre-declared by the system. The same script can be used for many instruments, each instrument will maintain its own copies of all variable values. The scripts should be designed to drop "straight through" without excessive looping, these scripts may be called hundreds of times a second, so keep them simple! The above script is stored in the scripts folder as "electrical5V.vsa" a slightly more complex script "average10.vsa" used for calculating the average of the last 10 values is reproduced below.

double Av=0,scale_max=5;
Av *= 0.9;
Av += (input_rel(0)*scale_max*0.1)/4095;
result = Av;

Building on this is a script to calculate domestic power consumption, it uses averaging as above and also time functions.

// KWH.vsa : script to tot up power consumption in KW/hours
// The input value is 0..2400 Watts @ FSD

double power;
double background=150;          // make an initial guess at background consumption (watts)
int iv, Watt_secs;

iv = input_rel(0);
if (iv==4095) {
  // FSD on current transformer, make a guess at what is happening!
  double tod = get_time();
  if (tod<50) {
    Watt_secs=0;                        // reset total at midnight

  if (tod<730000) {
    // before 7:30
    if (tod>100000) {
      // Time between 1am, and 7:30am
      power=2700+background;    // assume this is the immersion heater 2.7kW + background
  } else {
    // after 7:30 am
    if (tod<905000) {
      // Time between 7:30am, and 9:05am
      power=7000+background;    // assume this is the shower 7kW + background
} else {
  power = iv*2400/4095;         // 2400 Watts FSD
  background*= 0.9;
  background+= (power/10);

Watt_secs += (power/10);        // come here every 100mS hence /10
result = Watt_secs;             // Watt/Seconds
result = result/3600;           // Watt/Hours
result = result/1000;           // KWH

The important thing to note here is that variables are "static", each time the script is called the values are remembered from the last run, the variables assigned a value in declaration statements "int" or "double" are set to that value on the first run only, and then may subsequently be updated (or left the same) and their current value remembered from one call to the next see "background" above. More about Scaling Algorithms and Control Scripts in the Scripts section. If the same script is running on several instruments each will have its own set of variables. You can create your own scripts using "NotePad" or similar editor and place them in the scripts folder. The Scripts may be indented and commented freely, this will make them easier to maintain and be understood by others, this will not effect the speed of execution as all "white space" and comments will be discarded when the file is first loaded. Scaling Algorithms are only loaded from disk once (or when the instrument properties are changed) so changing the files will not effect the running system until restarted. Scripts can be tested and debugged using the [File][Run Script] launching the Scriptor mechanism.


Variable Declarations

Variables must be declared before first use, this is usual in most programming languages, this allows memory to be allocated for storage and allows the type of variable to be defined so the appropriateness of subsequent assignment statements can be assessed.
The variables can be assigned an initial value in the declaration statement, In the case of scaling algorithms, this value is set on the first pass only, and the current value remembered from one run to the next for that instrument, in that way counters (for example) can be initialised and subsequently incremented. The following variable types and associated declaration syntax are available.






2.23  10^-308 < X < 1.79  10^308

double <name[=expression]>;

double fred=1.234;


-2,147,483,648 <= X <= 2,147,483,647

int <name[=expression]>;

int count=0,output;


-127 <= X <= 127

char <name[=expression]>;

char ch='X';


0 <= X <= 1

bool (or boolean) <name[=expression]>;

bool flag=TRUE;

More than one variable can be declared per statement by separating with a comma. All variable types can be declared as arrays by adding an array dimension in square brackets to the end of the name e.g.

int results[40];


All variable types can be declared "constant" by prefixing with the keyword "const" the run time system will then check that the variable has not been modified. this is useful in making code more readable e.g.

const int server_room_netcommander=1;
const int boiler_room_netcommander=2;
if (get_input(server_room_netcommander,rack3_temp)>45) {
  // Server cabinet 3 is overheating
Non Volatiles

All outer block variables can be prefixed "nonvolatile" the system will then remember the variables value, if VID is restarted, the PC crashes etc. this is useful for scripts that keep running totals eg kWh counters. The keyword "volatile" can also be used for clarity but this is the default.
Note: the data is stored keyed on Node,Port,Port Type and Script Name. If the same script is running on the identical port configuration on a second instrument there will be a clash in the variable store, resulting in unpredictable behaviour!

volatile int RunTimeHourCounter,TickCount;
if (++TickCount==36000) {
  // The 0.1S counter has reached one hour, reset it and increment hour counter

Character arrays can be assigned strings, and subsequently used in place of quoted strings, the blank dimension "[]" will allocate just sufficient space for the assigned string. eg.

char email_boiler_faults[]="";
char email_my_address[]="";
           email_my_address, "Alarm,
           feedwater low",
           "Feedwater header tank boiler room 2 level low");



All the usual arithmetic and comparison operators are provided. Processing of an expression is from left to right. Multiplication and division are processed before addition and subtraction. bracketed expressions are resolved first, brackets can be used to prevent any ambiguity.


Built in Functions

Monitoring Node Interface

The following functions are available for monitoring and control of the Monitoring Node inputs and outputs. All variables are double precision types, most of these functions return and integer or boolean (1 or 0) value as a double precision quantity.
This function is used to get raw input values into a scaling algorithm script 0.0 .. 4095. The node, port number and port type are specified by the configuration of the instrument that invoked the script the parameter "offset" specifies an offset from the configured port number, useful for processing (for example) three phase power calculations. e.g.

iv =  input_rel(0);   // Red Phase current
iv += input_rel(1);   // + Yellow phase
iv += input_rel(2);   // + Blue phase

As above; the node and port type are specified by the instrument configuration, "port" specifies the port number.
Returns the scaled result from the attached instrument, there are no parameters.
This function waits until the next NetCommander Poll response has been received.
event_set(node, id)
Check to see if a VID event has been triggered, returns 1 if triggered otherwise 0.
get_InputPortName(Name, node, port)
Get the specified analogue input port name into the buffer "Name"
get_OutputPortName(Name, node, port)
Get the specified analogue output port name into the buffer "Name"
get_BinaryPortName(Name, node, port)
Get the specified digital input port name into the buffer "Name"
get_SwitchPortName(Name, node, port)
Get the specified digital output port name into the buffer "Name"
get_input(node, port)
Get the value from an A/D converter input 0 .. FSD.
get_switch(node, port)
Get the value from a switch (binary) input returns 0 or 1.
get_output(node, port)
Get the value from an D/A converter output 0 .. FSD.
get_state(node, port)
Get the value from a NetCommander state variable.
get_node_vidvar(node, port)
Get the value from a VID node variable 0..65535 associated with node "node".
Get the value from a VID variable 0..4294967295.
set_output(node, port, value)
Set the value of a D/A converter output 0 .. FSD.
set_switch(node, port, value)
Set the value of a boolean switch output (1 or 0).
set_state(node, port, value)
Set the value of a NetCommander state variable.
set_node_vidvar(node, port, value)
Set the value of a VID node variable 0..65535 associated with node "node".
Set the value of a VID variable 0..4294967295.

In all the functions above, "node" refers to a monitoring unit, this can either be the index number from the VID node configuration dialogue or more usefully (from the point of view of portability of the script between VID files) either an IP address or node name e.g.

value = get_input(3,4);
value = get_input("Turbo Generator 3",4);
value = get_input("",4);

These examples all equally validly access port 4 of the node at IP address
the "node", "port" and "value" parameters can be any constant, variable or expression that resolves to a valid number.
"node" (if numeric) and "port" are both based from 1.

e.g. set_output("Turbo Generator 3", exciter_drive, 200);

Scan Instruments Interface

bool get_instruments(screen, data [,caption] [,units] [,remark])
This function returns data from an instrument, by filling in the double array data[6], instruments will be returned in a loop, until the function returns false. If "screen" is <=0 all the screens will be scanned. Only instruments matching the optional "caption", "units" and "remark" texts will be returned, the string "" will match all instances.
double ViData[6];
// look for instruments on this screen with caption of "Rack Kw" and units of "Kw"
while (get_instruments(get_vi_screen(),ViData,"Rack Kw","Kw","")) {
  Kw+=ViData[5];   // tot up Kw totals

ViData[0] is Screen Index 1..
ViData[1] is Instrument type meter270
ViData[2] is Box 1..
ViData[3] is Port 1..
ViData[5] is Scaled Value

set_instrument_caption(char *txt)
This sets the caption of the selected instruments, useful for script driven values in labels

Calling Instrument Interface

This function returns the screen number (1..n) on which the instrument that invoked the .vsa script resides. The function returns 0 if the script was not invoked by an instrument.

This function returns the monitoring node index number (1..n of the instrument that invoked the .vsa script. The function returns 0 if the script was not invoked by an instrument.

This function returns the monitoring node port number of the instrument that invoked the .vsa script. The function returns 0 if the script was not invoked by an instrument.

This function returns the monitoring node port type of the instrument that invoked the .vsa script. The returned type will be one of the following
ANALOGUE_IN (0), ANALOGUE_OUT, STATE, DIGITAL_OUT, DIGITAL_IN, NODE_VAR or VIDVAR. The function returns -1 if the script was not invoked by an instrument.

get_vi_caption(char *buffer)
This function loads the specified buffer array the caption field of the instrument that invoked the .vsa script.
Returns true if succesful.

get_vi_units(char *buffer)
This function loads the specified buffer array the units field of the instrument that invoked the .vsa script.
Returns true if succesful.

get_vi_remark(char *buffer)
This function loads the specified buffer array the remark field of the instrument that invoked the .vsa script.
Returns true if succesful.

Date and Time Functions

The time functions (below) use a floating point number to express date and time. The integer part of the value is the number of days that have passed since 30/12/1899. The fractional part of a time value is the time of day in fractions of a day (from midnight), negative dates are before 30/12/1899 but are unlikely to be of any concern to us!
Following are some example values and their corresponding dates and times:

0.00000  30/12/1899 12:00 am (mid-night)
2.75000  1/1/1900    6:00 pm
-1.25    29/12/1899  6:00 am
35065.50 1/1/1996   12:00 pm (mid-day)

The time has a resolution of about 10mS

Gets the current date and time as a double precision floating point number in days elapsed since 00:00:00 UTC, January 1st. 1970.
The fractional part represents the time of day. This is a useful format as for instance adding 1.0 to the date is the same time tomorrow, or adding say, (1.0/24.0), is the time in an hour hence.
Gets the current time of day expressed as the number of mS after midnight.
Gets the current day Sunday is 0, Monday is 1 .. Saturday is 6.
Gets the current day of the month 1..31.
Gets the current month of year 1..12.
Gets the current year eg. 2010.
Gets the current day of the month 1..31.
Gets the current time of day in a decimal representation.
i.e. 0 .. 2359599 i.e. 13210437 represents 1:21:04.7 pm. with one tenth of a second resolution.
Hours, minutes, seconds can easily be extracted using div and mod operators.

 int hour = int(get_time()/10000);
 if (get_time()==1200000) {
        // reset total at mid-day

All instrument scaling scripts are called 10 times per second, so get_time() will return a unique incrementing value on every call in a particular script, so lines like "if (get_time()==1200000)" will be safe, the value eg. 1200000 will never be skipped.

Returns a string representation of the date, omitting the the argument i.e. data() returns the current date.

print(date()); // print the current time and date

convert_date("DD/MM/YY HH:MM:SS")
converts a date/time string to the internal date format
The following Snippet of code illustrates the operation of the time functions

  double switch_off_time = convert_time("3/7/2004 17:30:00");   // switch off at this time
  while(1) {    // loop "forever"               
    while (get_date()<=switch_off_time) {
      sleep(60000); // sleep for a minute
    print("Plant Shutdown initiated at ");
    switch_off_time += 1.0;             // add one to do the same thing at this time TOMORROW!
    plant_shutdown();                           // call the plant shutdown procedure
  or ...

  while(1) {    // loop "forever"
    int t = get_time();         
    while (t<=1730) {                           // switch off at 5:30pm
      sleep(60000); // sleep for a minute
    print("Plant Shutdown initiated at ", t/100, ":", t%100 );
    plant_shutdown();                           // call the plant shutdown procedure

Arithmetic Functions

All the arithmetic functions use double precision arithmetic and have 15 digit resolution.

Returns the absolute value of a floating point expression

Returns the integer part of a floating point expression

Returns the fractional part of a floating point expression

Returns the exponential e to the power <expression>, used in infinite series averaging etc.

Returns the natural logarithm of <expression>, ie. the inverse of exp(x) above.

System Functions

Sleep for "duration" milliSeconds, this should be used in loops whilst waiting for a condition to occur, to avoid excessive CPU utilisation. e.g.

// wait for steam pressure to reach 6 Bar before opening turbine valve
while (get_input("Boiler Room", steam_pressure)<600) {
  if (++mins>60) {
    generate_alarm("Failed to raise steam after one hour!");
    exit;       // run-up sequence failed exit script
  Sleep(60000); // wait for 60 Seconds (60,000 mS)
set_switch("Boiler Room",tubine_valve,1); // Open the turbine steam valve

void *malloc(size)
Allocates space of "size" bytes for array storage etc. eg.

          char *p = (char*)malloc(128);  // allcate space for char array

void *calloc(number,size)
Allocates zeroed out space of "number*size" bytes for array storage etc. eg.

          int *p = (int*)calloc(128,4);  // allcate space for integer array

void free(pointer)
returns the previously allocated space to the free memory pool eg.

          char *p = malloc(32);

new spec[size]
Allocates an array of type "spec" which can be char,int or double (or the unsigned variants thereof) of "size" elements eg.

          char *p = new char[32];  // allcate space for char array
          delete [] p;

delete pointer
returns the space previously allocated by "new" to the free memory pool as above.
The [] between delete and the pointer is optional for c++compatibility and has no effect. It signifies an array deletion.

print(format_string, ....)
Prints uses a format string and expressions to print to the output window e.g.

print("Flour Silo %d is %d%%", silo_num, level);

This could possibly print:- "Flour Silo 3 is 27% full"
The format string syntax is described here for those not familiar with the 'C' standard library functions.

syslog(format_string, ....)
Prints to the system log (if specified), the parameters are the same as for print() above,

 if (get_time()==0) {
   // Log Kwh at midnight
   syslog("Yesterdays total power consumption: %f Kwh", Kwatt_hours);

will create a log entry similar to:

22/06/2006 00:00:00:0  user: Mike          > Yesterdays total power consumption: 145.47 Kwh

syscommand(file[, arguments])
Invokes, a system command, most usefully a DOS batch (.bat) file with optional arguments. The file path can be relative to the VID installation folder or absolute ie. proceeded by the drive letter.


Where (in this case) "delete_logs.bat" could be a batch file to delete the VID log files in folder "site3logs", however, a batch file or other DOS command could be invoked to achieve just about anything.

com(port, format_string, ....)
Prints to the specified serial (COM) port, the parameters following the port number are the same as for print() above,

This function forces the script window open, this is useful to bring to an operator attention some text in the console window, which is of insufficient urgency to warrant an alarm condition (below). Scripts invoked from a button or event action usually run minimized. If an error occurs in the script, parameter out-of-range or syntax, error for example, the window will automatically open and the script halted.

if (bunker_level[num]<33) {
  print("Heavy Fuel Oil bunker ", num, " level below 33% consider arranging delivery");
  visible();    // reveal console window

alarm( format_string, ....) This function will display a warning box on the screen. The box is non-modal, i.e. processing of the script will continue, the cancel button on the box merely dismisses the form. The function takes a single string parameters "alarm text" which will be displayed along with the time in a similar fashion to VID event alarms.

eg. using a string array to reference an alarm text by number ...


This function will send an email via the SMTP server configured by the current .vid file. The function takes four string parameters "to" and "from" addresses followed by "subject" and "body" texts.


          "Alarm, feedwater low",
          "Feedwater header tank boiler room 2 level low");

Programmatically set the current on-screen page (1..10).

"rev"is the minimum VID revision level that will run this script, as a floting point number, eg. revision(1.148);
will throw an error box, and not run the script if the VID revision level is below 1.148

This function is typically placed at the end of the script, it will wait with the screen visible, until it is manually closed. This allows printouts to be read before the window is closed. Normally the window is automatically closed on reaching the end of the script or an explicit exit(); function call.

Returns a bit mask representing the priveledges associated with the current login in user, this can be used to control access to certain functions of the script.

if ((get_priv() & LOGIN_ADMIN_BIT)==0) {
  alert("Admin Login required!");

Exit the script and close the script window.


Libraries of useful functions can be built up over time, this can be included into your script using the #include directive
#include ""
The file name extension is is up to you, I have made it .inc here to indicate an include file, the file by itself may not be executable as it may lack some vital variable declarations etc. to function, so it is a good idea not to give the code fragments and libraries .vcs or .vsa extensions. See the PID (Proportional, Integral, Derivative) controller example below

// pid_test.vcs PID Controller
// All values used by the PID refer to 0..5V at the A/D inputs

double Proportional_Gain=1.3;
double Integral_Gain=1.2;
double Derivative_Gain=0.025;
double Acceleration_Feed_Forward=0.0;
double Friction_Feed_Forward=0.0;
double Velocity_Feed_Forward=0.0;
double Bias=0.0;
double Acceleration_Rate=3.0;
double Set_Point=3.5;            // Volts at A/D 
double Min_Output=0.0;           // minimum output value allowed
double Max_Output=5.0;           // maximum output value allowed
double Slew=0.0;                 // maximum output slew rate V/Cycle
int    Output_Hold=0;            // in Cycles
int    Cycles=0;                 // terminate script after this no. of cycles (or never)
char   NC_Input_Node[]  = "Temp controller 2";
int    NC_Input_Port    = 3;
char   NC_Output_Node[] = "Temp controller 2";
int    NC_Output_Port   = 3;

#include "scripts\";             // include the standard PID algorithm

The control script above just declares and initialises variables for the PID controller, and then includes the main body of the PID logic from the file "". In this way if the PID control algorithm is modified the modifications are automatically inherited by all the scripts that use it.


Join Lines

Lines may be drawn on the screen to join or box instruments into logical groups. Lines are drawn using <ALT><Right Click> ... Drag mouse movements. Lines that are very nearly vertical or horizontal will snap to the relevant axis to avoid "jaggies". Lines ending very close to another line end will be automatically joined up. An existing line can be moved by dragging in the usual way, only one end can be dragged at once, the end nearest to the mouse on left-clicking will be selected. If the a moved line is joined to another line both lines will move together. This allows the easy drawing of boxes around instrument groups.

Lines Dialogue

<ALT><Right Click> on a line brings up a properties box allowing change of width and colour as well as deletion. Lines that are very nearly vertical or horizontal will be automatically aligned with the axis. Lines starting very close to the end of another line will be automatically joined up. The Snap button will attempt to tidy the lines on the screen.


The Events System

There are essentially two events system, one handled locally in the VID software and one remotely in the NetCommander nodes. The remote event system is more limited in scope, one advantage is the remote system will operate autonomously of the VID software in the event of a communication failure, and will respond better to transitory events that may fall between VID poll periods. We shall describe the local system first as it is more comprehensive, the remote system has a subset of the functionality.

Local Events system

The system combines several "causes" to produce one or more "effects". In this example the event indicates that a server room door is open AND an intruder is present. This is further qualified by time to only occur outside office hours. In the example an Email is sent, an alarm will display and an output is made which could for example switch on an alarm bell.

Events Dialogue

The Events Dialogue, left, provides an overview of the event being configured, the event is selected by the select event drop down. Delete deletes the event. Un-checking Enable will allow the event to be saved but prevents it from being used, this can be used to disable an event if, for example, some maintenance operation is in progress.

The "LEDs" to left of the cause names indicate if the cause is currently on or triggered these LEDs will be refreshed every second whilst the form is on the screen. The "LED" by the Event ID box indicates if the event as a whole has been triggered and the "effects" actioned.

The Check Boxes labeled Sunday, Monday-&gt;Saturday select which day(s) of the week the event is active, by default the event is active every day but typically may be disabled at weekends. The day selection is disabled if the "on date" timer is selected.


Cause Dialogue The Cause dialogue is invoked by the Edit/View button to the right of the cause name boxes.The best way to configure a cause is to click on the virtual instrument monitoring the desired property, at least it will give you a starting point and the value can be changed to suite, the set points can be changed on the VI using the VI [Right Click]-&gt;[Properties] dialogue and adjusting the sector colour ranges with the sliders, the new values will be imported into the cause form on exiting the properties dialogue.

In this example the cause is set to trigger within a monitored range of 3185 to 5000 (Gallons). The Re-trigger values define a slightly larger range and the cause will not be re-activated until the monitored value leaves both the trigger range AND the re-trigger range, this provides some hysteresis, preventing floods of alarms when a cause condition is bouncing around the trigger value. The re trigger values can be set using the hysteresis buttons or directly edited. The event can combine cause inputs from different NetCommander nodes. The Scaler box and associated Browse button is used to select a Scaling Algorithm see Instrument Scaling.The Type will usually be an analogue input, however outputs and switch (boolean) inputs and outputs can also be monitored as well as Internal and NetCommander State values which can be used to link events together. One of Effects of an event can be to modify the value of a state variable. A remote event running on the Netcommander node could increments a state variable, say monitoring the pulsed output of a turn-stile. This variable could be monitored by a local event to raise an alarm after a certain number of people had been counted. Causes are AND ed together by default but can be OR ed and also negated to produce NOR and NOT logical combinations, also precedence is from top to bottom so combination like "(Cause1 AND Cause2) OR (Cause3 AND Cause4) AND NOT Cause5" can be built up. The Log check box will cause a time stamped entry in the system log to be made on each event state transition.

The Timer buttons allow a timer to be added as an extra "And ed" condition to the event. Using the dialogue box (right), the timer can be either a "one shot" at a certain date and time or at a certain time of day, every day or periodically down to every second. The TOn "LED" illuminates whilst the timer is "On". If an an "Off" timer is specified, this starts running when the "On" timer condition is met, this allows operations like, "enable the event at 8:30 am and disable at 17:30", or "enable the event every hour for ten minutes". The box between the two timer config buttons shows which timer is running and the remaining time to change state. The date box can be edited directly or using the drop down arrow a subsidiary calendar dialogue is opened.
Times are stored as an absolute value not a "delay to next event" form so any change to the PC clock setting e.g. for DayLight Saving Time will not generally effect the operation of the timer.
Events Timer Dialogue


The effects are actioned when the logical combination of the event causes becomes true.
There may be up to four effects for each event.
Alarm Dialogue

This is the basic action for drawing a local operators' attention to an event, a red pop-up box will appear on screen, with the requested message, and (optionally) a sound file will play, a browse button is provided to locate suitable files, the Windows Media directory is a good source of bells and whistles! A count is incremented on the pop-up display if the same alarm condition occurs more than once to avoid duplication and clutter of pop-up boxes. The pop-up boxes will cascade across the screen from top-left. Operator acknowledgement of the alarm will be recorded in the system log. Alarms will be cleared from the screen after an hour.

Alarm pop-up
Email effect Dialogue

The Email option can be used to call out a service engineer, for example. The SMTP server is specified in the Basic Configuration section.

SMS (Mobile Phone Text) messages can be made by sending an e-mail to a suitably configured SMS gateway. There are numerous such services on the Internet, typically the To address will contain an account ID for the SMS gateway account and the SMS Phone number to contact, the body of the message will be sent as the SMS Text.

Output effect Dialogue This option allows a control output to be made in response to the event, for example turn on a cooling fan in the case of an over temperature condition.
The three buttons control whether the output is incremented or decremented by, or set to, the specified value. In the case of a switch (that has only on and off, 1or 0 values) if either Inc or Dec is set the switch will be toggled.
Inc and Dec are usually used to count events, with type set to a state variable. The output effect can (optionally) change the output value when the event transitions from on to off, the Off value is then used. If inc or dec is set the the opposite action occurs on the "to off" transition, in this way the event can be used to hunt for a set point. The On and Off Values are in units of Volts at the D/A outputs of the Netcommander.
Script Dialogue This option allows a control script to be run in response to the event. The script files will be familiar to the 'C' or Pascal programmer, these are interpreted by VID to perform sequenced tasks. This is an advanced topic and is explained here.
Enable/Disable Dialogue This option causes another event to be enabled or disabled. For example if one event causes a fire alarm to sound, this could simultaneously disable another event that monitors the unauthorized opening of emergency fire doors, thus preventing intruder alarms on top of the fire alarm!
Serial DialogueThe serial option allows a message to be sent out of the specified serial COM port. This can be used to control any serially connected device, an X.10 controller, for example, or could be used for logging purposes to a serial printer. The message can be provided in plain text or ASCII Hex for binary outputs. Both views are always displayed. Only NetCommander text strings have names, and only VID effects require a COM port to be configured.

SMS DialogueThe SMS option allows a message to be sent on SMS. The SMS service provider needs selecting, VodaFone, Orange etc. and the destination phone number as well as the text to send, as above, this can be specified in ASCII Hex. Only NetCommander SMS messages have names.


Remote Events system

Netcommander Events Dialogue The Remote Events system (accessed from the [Edit][Remote Events] Menu) has a more limited functionality than the local system, but as the events are processed on the NetCommander node, they can react to more transitory signals that may otherwise fall between the VID software polls which are typically once a second. The effects are limited to "output", "email", "EvDis" and "Serial", these have already been described above in the Local Events Section. Again the causes are very similar to those described Local Events but are limited to four causes per event.

System Logs

The System log records all actions and conditions that effect the monitored system, All the operator's actions are logged, switch settings, control knob movements, configuration changes etc. System events (are optionally) logged. All log entries are time stamped and in chronological order.
The log file name is selected from the Basic Configuration form. A log cycling scheme can also be selected, the following assumes a selected log file name of "sys.log".

Log Cycling

None file sys.log, the file may be deleted or moved while VID is running.
Daily files of the form sys_<year>_M<month>_D<day>.log eg. sys_2004_M05_D17.log 17th May log
Weekly files of the form sys_<year>_W<week number>.log eg. sys_2004_W13.log ie. Week 13 log
Monthly files of the form sys_<year>_M<month>.log eg. sys_2004_M07.log ie September's log

With the log folder's contents listed in MicroSoft Explorer, clicking the "Name" tab will sort the files in alphabetic (and as the name structures are chosen to do so) Chronological order.
VID also maintains chart data logs with a similar naming convention for time-cycled logs. Top

Views Menu (ALT+V)

Views Menu
A number of viewing options are available mainly for debugging and setting up an operational configuration.

System Log

System Log This option (available from the [View][System Log] menu) gives a real time view of the system log file, the log view will update as new log entries are added to the log file. The view is "Read Only" to prevent inadvertant changes to the log file.

Debug Log

This option (available from the [View][Debug Log] menu) gives a real time view of the system debug log file (as above), the log view will update as new log entries are added to the log file. The view is "Read Only" to prevent inadvertant changes to the log file.

Raw Data Window

Raw Data Viewer This option (available from the [View][Raw Data Window] menu) gives an overview of the data output from any one NetCommander. Input data, output data, switch settings and State variables may be viewed by checking the appropriate radio button. Several views can be on-screen at once and all are updated at the polling frequency (typically every second). Switch values are reported as "On" (contact closed) or "Off". Analogue values are scaled to 0.0 to 5.0 Volts, State variables are integers in the range 0 to 1023. This is useful for debugging in determining which probes are connected to which inputs. Checking the "Names" box will display the Names associated with the Netcommander ports.


Comms Window

Comms Window This option available from the [View] [Comms Window] menu, gives a view of the messages between VID and the selected node, The Console checkbox alters the display to handle Wireless UMON console messages. Checking "All Nodes" will show All messages into and out of VID, the Stop button will freeze the display, but data will be lost while the screen is frozen. The TXQLen box shows the number of message pending on the transmit queue for to the node, it will generally be zero.


Configuration Summary Viewer

The Summary is an HTML document generated from the running configuration when [view][configuration summary] is executed.
The Summary lists the main points of the configuration and is useful as an overview of the system or printed record for study, the file is generated with the same name and in the same directory as the VID files (/configs in the installation directory, by default) but will have the .html filename extension [view][configuration summary] also launches the Web browser to enable viewing/printing the file.
An example summary file can be seen here, this is the summary for the example VID file examples.vid.


Client VID

Client VID Screenshot

Client config form

The client version of VID is a remote or slave viewer for a VID master installation. The client will display the same configuration file as the master, but not necessarily the same page. The config form (left) is used to specify the IP parameters to contact the master. The master is effectively a web server, which servers all the images and logs to the client and periodically monitoring data. The IP port specified must not clash with any existing server on the master machine. The Client version is predominantly "read only" and is meant for viewing rather than control. Instrument logs are maintained locally by the client once downloaded from the master but may not be as accurate as the master copy due to a (potentially) lower data polling rate. The Master is used as a proxy server to the Netcommanders which may or may not be visible from the client location. The client is designed to run without any installation, and does not modify the windows registry, the executable may be run from a memory stick for example in an internet cafe or guest PC.