NetCommander |
Download |
Overview |
Installing |
Operators |
File Menu |
Edit Menu |
View Menu |
Options Menu |
Pages |
Instruments |
Scripts |
Lines |
VID Events |
Rem. Events |
Charts |
Logs |
Client VID |
Register |
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
support@thecodemachine.co.uk.
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 support@thecodemachine.co.uk.
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.
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.
Top
![]() |
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 & LogonsTo ensure the security of the controlled plant, operators of the system must login to VID, operators are assigned various privilege levels
|
Login form |
||||||||||
Login & Operator configuration form |
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][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][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 .. |
![]() |
|
Node ConfigurationNetCommander ConfigurationThe 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).
|
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). |
![]() |
![]() |
Support for Velleman K8055 USB experimenters boards has been added by popular demand from home experimenters. K8055 nodes can be defined or edited from the [Edit][Monitoring Node Configuration] menu selection, by selecting Velleman K8055 as the protocol. "Addr" is the card address in the range 0..3, and selects one of 4 cards attached to a USB port, The card address is set by jumpers on the K8055 card. Apart from the common items of name and polling rate, this is the only configurable option for the K8055 card. Each K8055 card provides 8 digital outputs, 5 digital inputs and 2 each of analogue inputs and outputs. The analogue I/O has only 8 bits of resolution but is adequate for many home automation projects. These cards are very cheap and can be bought easily on the internet, built or in kit form. The screenshot, right, is a test example for the card. | ![]() |
![]() |
![]() |
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. "192.168.100.23:600". 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 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. |
![]() |
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 127.0.0.1, 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. |
![]() |
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. |
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
MovingAn 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 Re-SizingAn instrument may be resized on the screen using the [CTRL][Right Click][Drag] mouse action. PropertiesSimply 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). |
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.
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.
![]() |
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. | ![]() |
As a special case, if "units" is set to !HH:MM:SS or !MM:SS the instrument value (in seconds) is displayed time formatted. | ![]() |
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. |
![]() |
![]() |
Web WindowWeb 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 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.
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. |
|
Right 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 AreaCaption 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 AreaNode/Type/Port dialogue set the monitoring or control point.Value box in the node selection area shows the current raw value. |
Ping AreaRate 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 AreaDig. 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 AreaLog 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 AreaShow 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 AreaAction 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 areaBackground tracks Sector Colour appears for meters and thermometers and does what it says! |
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.
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.
The Instrument will removed from the display and from the active configuration.
This option opens the instrument logging and charting tool.
The Instrument will removed from the display and the active configuration. Top
The drop-down menu selects the page of instruments to be displayed.
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)
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:
Blue VID Transmitting to Node
Green VID Receiving from Node
Red Node/response in Fault
Gray Node Configured but idle
Black Node not configured
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).
Top
Chart Log Annotation |
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. |
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. |
Histogram Mode |
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 :-
result=input_rel(0);
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 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; Av[count%size]=input_rel(0); result=0; count++; if (count>=size) { c=0; while (c<size) { result+=Av[c]; c++; } result = result/size; } else { c=0; while (c<count) { result+=Av[c]; c++; } 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.
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.
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 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 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.
Top
Control 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.
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; result=input_rel(0)*scale_max/4095; result+=scale_min;
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.
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.
Type |
Range |
Syntax |
Example |
double |
2.23 10^-308 < X < 1.79 10^308 |
double <name[=expression]>; |
double fred=1.234; |
int |
-2,147,483,648 <= X <= 2,147,483,647 |
int <name[=expression]>; |
int count=0,output; |
char |
-127 <= X <= 127 |
char <name[=expression]>; |
char ch='X'; |
boolean |
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 .... }
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 TickCount=0; RunTimeHourCounter++; }
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[]="fixit@boilersRus.co.uk"; char email_my_address[]="sysmon@bigfactory.com"; ... ... send_email(email_boiler_faults, 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.
Top
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.
input_rel(offset)
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
input_abs(port)
As above; the node and port type are specified by the instrument configuration, "port" specifies the port number.
input_scaled()
Returns the scaled result from the attached instrument, there are no parameters.
sync(node)
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_vidvar(port)
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_vidvar(port)
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("192.168.33.74",4);
These examples all equally validly access port 4 of the node at IP address 192.168.33.74
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);
double ViData[6]; Kw=0; // 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 }
Where:
ViData[0] is Screen Index 1..
ViData[1] is Instrument type meter270
ViData[2] is Box 1..
ViData[3] is Port 1..
ViData[4] is Port type: one of ANALOGUE_IN, ANALOGUE_OUT, STATE, DIGITAL_OUT, DIGITAL_IN, NODE_VAR or VIDVAR.
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
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
get_date()
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.
get_ms()
Gets the current time of day expressed as the number of mS after midnight.
get_day()
Gets the current day Sunday is 0, Monday is 1 .. Saturday is 6.
get_month_day()
Gets the current day of the month 1..31.
get_month()
Gets the current month of year 1..12.
get_year()
Gets the current year eg. 2010.
get_month_day()
Gets the current day of the month 1..31.
get_time()
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.
eg. int hour = int(get_time()/10000); eg. if (get_time()==1200000) { // reset total at mid-day total=0; }
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.
date(date)
Returns a string representation of the date, omitting the the argument i.e. data() returns the current 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 "); print_time(switch_off_time); 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 }
All the arithmetic functions use double precision arithmetic and have 15 digit resolution.
abs(expression)
Returns the absolute value of a floating point expression
int(expression)
Returns the integer part of a floating point expression
fraction(expression)
Returns the fractional part of a floating point expression
exp(expression)
Returns the exponential e to the power <expression>, used in infinite series averaging etc.
logn(expression)
Returns the natural logarithm of <expression>, ie. the inverse of exp(x) above.
Sleep(duration)
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 mins=0; 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 p[0]=3;
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 p[0]=3;
void free(pointer)
returns the previously allocated space to the free memory pool eg.
char *p = malloc(32); .. .. free(p);
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 p[0]=3; .. .. 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,
eg. 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.
eg. syscommand("scripts/delete_logs.bat","site3logs");
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,
visible()
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 ...
alarm_popup(alarm_texts[alarm_no]);
send_email(to,from,subject,body)
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.
eg.
send_email("fixit@boilersRus.co.uk", "sysmon@bigfactory.com", "Alarm, feedwater low", "Feedwater header tank boiler room 2 level low");
set_page(page)
Programmatically set the current on-screen page (1..10).
revision(rev)
"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
hold()
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.
get_priv()
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.
The following bits are defined :- LOGIN_ADVANCE_BIT , LOGIN_CONTROL_BIT , LOGIN_CONFIGURE_BIT , LOGIN_ADMIN_BIT
Libraries of useful functions can be built up over time, this can be included into your script using the #include directive
#include "file.inc"
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\pid.inc"; // 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 "pid.inc". In this way if the PID control algorithm is modified the modifications are automatically inherited by all the scripts that use it.
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.
<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. |
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.
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.
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, MondaySaturday 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.
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. |
![]() |
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.
![]() |
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. |
![]() 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. |
![]() |
![]() |
![]() |
|
Remote Events system![]() |
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".
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 |
A number of viewing options are available mainly for debugging and setting up an operational configuration.
System Log
|
Debug LogThis 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
|
Comms Window
|
Configuration Summary ViewerThe Summary is an HTML document generated from the running configuration when [view][configuration summary] is executed. |
Top Client VID![]() ![]() 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. |