Introduction

The purpose
The main purpose of this program is to provide a friendly environment to Delphi programmers for developing data acquisition program. The general idea of the software is to have some virtual instruments (called devices) manipulated by scrip generated by "procedures" as well as visual presentation (2D or 3D). The script is the principal mean of communication between "procedures" and the devices, even there are some exceptions (shortcuts) as data-channels for the speed sake. The structure of the program has been developed before the software design patterns came to light, so main concept is object oriented with some elements of design patterns.

Spectrion is a complete program by itself, but you have to write the virtual devices within Spectrion specifications to your "external" real devices (e.g. AD/DA board, pulse generator, multimeter, step-motor controller). The extendibility and versatility of the program plus some of your programming skills (even moderate ones) to cope with Delphi will give amazing results. Practically it means that you will spend between couple of hours and couple of days to "plug-in" your devices into the Spectrion and you'll have a complete data acquisition system. Of course to adapt the program to every your requirements you will needs more time, depending of what you want. But even then you will have the strong support provided from the existing "skeleton" of the program.

Spectrion structure is “transparent”, object oriented and easily extendable. As it is Spectrion is suitable for visualization of mass-specs, some data processing and PCA/MD classification (one-class classifier kind). Spectrion original aim was to be used for data acquisition and instrument control in mass spectrometry (hence the name - SPECTRoscopy of IONs). Although its main application area is still MS, it can be used for wide variety of data acquisition/automation purposes.

The users
I can think about two types of potential users of Spectrion:
First type is individuals with certain Delphi skills, which need to control the experiment they conduct within sophisticated and versatile software framework.
Second type would be any company which manufactures computer-controlled devices or plug-in boards and wants to provide to the users a complete data-acquisition system plus open environment for further development.

Spectrion is open source freeware under the Apache License version 2.0

Spectrion accepts '-R' as command line parameter, which will switch Device Rack off, so the user can use Spectrion for data visualization/processing.


Real devices

Text Box: Real devices Text Box: Spectrion  structure Text Box: Device rack with virtual devices Text Box: Command Center - Script Interpreter Text Box: Script Text Box: Multi-page Theo-Plot Text Box: Procedures Text Box: COM- server interface


The device layer

The device rack

The devices rack is lowest (deepest) layer from the final (graphical) presentation point of view. This layer is shown on the right of your screen where each virtual device is presented as separated "child" window into the device container window (device rack). The user can control each device manually and see the results from measurements. There are three types of devices – measurement (MD), control (CD) and synchro types. Synchro (short from synchronization) device is only one, but another two types could be as many as needed. One could say that measurement device is input device and control device is output one and that would be no far from the truth (see Glossary for definitions). Each type provides standard set of commands called by the interpreter. Your real (external) devices are presented by these "logical" devices the same way as in "good old" DOS you can assign a directory to logical drive. One real device could be presented by more than one logical device. If the external device is really complex and has both measurement and control functions, the only way to "plug" it into the Spectrion is to present it as two logical devices - one for the control functions and one for measurement ones. Each logical device (device for short) is presented in Spectrion in two ways. First way is visual, in separate window (form in Delphi) with visual components, which represent different device features. There, the user can operate manually with these features, setting for example the most appropriate parameters for the next measurement.

Each device has in four states:

  • off-line (white-cream banner) – before initialization (connection)
  • standby (grey banner) – after initialization, but not running yet
  • running (teal banner) – working state
  • warning (yellow banner)– as running but with warning that one or more of controlled parameter are out of range.
  • danger - the device goes in standby state due to a dangerous conditions

To understand better what measurement or control devices are follow the three lists of commands which define internal interface between interpreter and device in Appendix B.

Each device has three pages (tabs) –

  • Normal page for minimised presentation of device functionality - minimum space, without lost of control or information.
  • The purpose of extended page is visual comfort. Each functionality of a device is presented by full colour visual components, for easy manipulation (e.g dials, sliders) and nicer signal visualization (e.g. charts, progress bars).
  • Third page is for opening/saving or some adjustments of the device setting. Each saved device setting file has an extension of the device name (three charatcters). When initialized the device (e.g. DVC) would look for Defaults.DVC file to load its setting from.

On the top of device rack there are some buttons to operate it. The green long button on the right is the main switch (of the device rack). On the left next is lock/unlock button to enable/disable user control to the devices, next two buttons are for loading/saving the device rack setting (complete set of all devices settings), and the last three buttons allows the user to turn all the device pages simultaneously.

There are two modes of synchronization synchro mode and asynchro mode. In the synchro mode the pointer of the data buffer is transferred into the measurement device and then that device is taking care for synchronization – usually immediately after the measurement is done the buffer is updated. That is so called Data stream mode, (fastest possible) with sacrifice of control – nothing else could be changed synchronically. Visually it is presented by redish small panel under the synchro device. In asynchro mode the synchronization of the measurement is done by synchro device, each time the measurement needs synchronization the procedure takes it from there. The possible ways to synchronization are: by button, delay or external event.


Procedures

Procedures layer communicate with the interpreter and such way with the devices only through text type of commands and one spectral buffer and with Plot by limited set of functions. The procedures contains usually a dialog box where the user specify what exactly he wants (e.g. Scan from...to...). The procedure generates a sequence of text commands to the interpreter and usually sends the result to TheoPlot for visual presentation.

Remotely the procedures are called by method Procedur:

Procedur(const WhichProc: WideString; var PrmList: WideString; var Suc: WordBool)

WhichProc - name of the procedure

PrmList - IN - either setting file (in this case the parameter should start with "file:\\") or individual parameter(s) in style "param1=12, param2=tre"

OUT - result either as file name "file:\\path\filename" or as string with the results themselves.

Suc - true in case of success and vice versa


Command centre

Command centre accommodates the interpreter and procedure frames.

The interpreter is the next layer, which communicates with procedure layer by text type commands and one spectrum buffer and with devices through the commands described.

Any command can be send manually from the command box by pressing triangle button on the right.

In the case of success, what is written in the script panel is NOT exactly what is send back internally, but more descriptive. If the command does not succeed the error message is sent back.

The general command structure is:

DVC.COMMAND(PARAM)

where

DVC is three letters name of device. There are two reserved names ITR and SHN for the interpreter and synchronisation device.

COMMAND is six letters string. Can be any from listed below commands plus some commands directed to the interpreter. AS common rule the first three letters are associated with the object and second half of the command - with action (e.g. CHNGET – ChaNnel GET, AMVSET – Absolute MoVe SET, etc).

PARAM is parameter according the particular command syntax. String type is text bracketed in inverted commas - ". Boolean parameter is either true or false.

The syntax of Spectrion script language is of JavaScript kind.

Another important feature you have to deal with is the interpreter/device setting file. Each device has its own setting file and the user can save/load each setting file individually or as group thru Itr.SetSav(Filename) command.

Purpose

The purpose of this window is to enable the user to run script commands. These commands can be run manually or from a script file.

Open Script File button

Open a script file and run it.

Run From Clipboard button

Run the commands that have been copied to the clipboard.

Save Script button

Save the command in the command log edit box into a script file. Only the commands (and not program’s outputs) will be saved.

Copy Selection button

Copy the selection into the clipboard.

Run button

Run the command in the command combo box.

Command combo box

Write and store manual commands.

Command Log edit box

Shows command and program's outputs in a chronological sequence.


SpecPlot

TheoPlot

The purpose of TheoPlot is to present data in visual way and feedback information to the procedures layer. TheoPlot provides features for visualization and some simple data processing of the data.

TheoPlot has two panels, top one for TIC (total ion current) chromatographic data and bottom one for MS (mass-spectrum) spectrum they both have similar control. The three long button on the right side are for opening additional tabbed menus for Chrom, Mass or common. If the user presses Chrom or Mass Button with the right mouse button the respective panel becomes hidden, but all the data are intact.

The principal features are available through the toolbar on the left and include:

  • Unzoom button – retrieve full view of the spectrum
  • AutoY – if on, when the user zoom the Y scale is adjusted automatically.
  • Zoom – Zoom and Range to button are alternative. Zoom mode is for zooming the spectrum by press and drop mouse routine. With the right mouse user can move the spec by drag&drop.
  • The range mode allows the user to select one or more regions (ranges) which will be presented in the other panel. When the user press the left mouse button and drag along the spec the respective area is selected. If user press and release the left mouse button, only single mass is selected, if during single mass selection the user hold Shift button the value under round green marker is selected. If the user double click within a peak the whole peak is selected. If the user hold Ctrl button when selected the new range list is set (the old one is deleted).
  • Table button – shows the values of the spectrum (and peaks if the option is on) in a table(s), On the top of the tables there are two pairs of buttons for saving / copying tables in file / clipboard.
  • Smoothing button provides smoothing of the spectrum with desired factor. Standard method is similar to that used in GRAMS, first derivative method is fast and versatile, but gives no peak boundaries, the last one (adaptive) readjust peaking by the mass scale.
  • Baseline correction subtracts a baseline replacing the value under the threshold with value 1. The auto option is trying to calculate the baseline level using simplified GIFTS algorithm (linear, two-steps)
  • Peaking button labels the peak value of the spectrum; there are three different modes of peaking – standard (similar to GRAMS), first derivative and adaptive. The last one is adaptive to the X-scale of the chart and shows different number of peak when the user zooms.

The user can adjust range, smoothing, baseline and peaking parameters from a secondary tabbed panel which appears when the right long button is pressed. Any change of any parameter is immediately takes effect, so the user can adjust them following the changes they cause. The tabbed options on the right appear when the user presses smoothing, baseline or peaking with the right mouse button.

TheoPlot component is based on TeeChart graphics component by Steema Software SL.


File menu

Menu

File menu

New

Create a new empty spectrum plot. (MS or GC/MS type)

Open…

Open file in a new spec-plot (TheoPlot) .

Save

Save active spec-plot into a file.

Save As…

Save active spec-plot under a new file name.

Close

Close the active spec-plot window/tab.

Close All

Close all spec-plot windows/tabs.

Exit

Exits program

Edit menu

Cut,Copy and Paste work a text only.

Cut

Standard Cut operation.

Copy

Standard Copy operation.

Paste

Standard Paste operation.

Options…

Set program’s options.

View Menu

Command Centre

Always visible

Set the Command Centre always visible on program startup.

Docked

Set the Command Centre docked/undocked to the main window.

Left

Place the command centre at the right side of the main window.

Right

Place the command centre at the left side of the main window.

Paged

Set the Command Centre as a paged component.

Tiled

Set the Command Centre as a tiled component.

Plots submenu

Tabbed Pages

Set the spectrum plot windows as tabbed to the main window.

Floated Windows

Set the spectrum plot windows as floating windows in the main window.

Tile

Standard window tile operation.

Cascade

Standard window cascade operation.

Devices/Docked

Sets device rack window racked or not to the main window.

Run (procedures)

Help menu

Contents

View help file’s contents.

About

Program version related information.


Options

Save options radio buttons

The user can choose between not saving (NO), saving now (NOW) or saving on program exit (On Exit).

On Start tab

Switch devices to On/Off modes.

On start Spectrion will try to establish connection the the devices checked here. All unchecked devices will be leave Off-line until the user try to connect them manually from right-top button of each device.

Auto Run Script

The script selected runs automatically on program startup.

The script appearing in the edit box runs automatically on program startup.

Spectra Path edit box

Default store data acquisition files in the directory shown in the edit box.

Interpreter tab

Text in Interpreter panel radio buttons

The user can choose between the following choices:

· Only the manual commands

· And the remote commands

· And the replies from the measurement devices

· And the replies from control devices

· And all other replies

Allow commands/replies visibility to be controlled by remote command check box

Templates tab

Template for New plot, click on Browse button

Template for Open plot, click on Browse button

Template for Data Acquisition, click on Browse button

Measuring Devices for Oscilo and Acquire utilities (the default channel is used)

User device tab

From this tab you can configure additional to the default (Msr; Ctrl and All Dvcs) tabs of the device rack.

Customized (user) tabs show some and hide other devices. The hiding can be complete or just minimizing (option - Only Minimize Dvcs).

You can Add or Delete tabs from there and configure the tab when it's active.


Run menu

Run menu (procedures)

Autotune

Before you start your measurements you probably would like to estimate the quality of your signal and optimize it along the way.

This procedure will optimize/find your signal using three different methods depending on the initial conditions (do you have a signal and if you do how good?).

Simple scan

If you would like to measure your signal (serial mode) as a function of one parameter (or time) here is the place to go.

Uni-scan

In case you need more complicated measurements as measuring the one or two signals as function of 0, 1 or 2 parameters (control device channels) use uni-scan. The versatility of the procedure will fit most of your scanning needs.

PCA classification

If you need to classify your samples by their mass spectra against a training set (created in PCA detective - included here). The classification type is one-class classifier (the unknown is tested against each class consecutively) and the method is Principal Component Analysis / Mahalanobis Distance.

The procedures are complemented by two utilities which are simplified scans and are attached to two button on the main tool bar. See options to how set measuring devices for them.

These two utilities are:

Oscilo - simulating oscilloscope showing in high speed spectra from measurement device in package mode.

Acquire - similar to Oscilo but keeping the signal in memory, show it as GC/MS and offer a possibility to save it later.


Autotune

Autotune procedure

Purpose

The purpose of this procedure is to provide the user with auto-tuning functionalities.

Optimization page

Optimization method radio button

The user can choose between the following methods:

  1. Initial seek (in blind). Conditions: There is no signal visible, so the autotune will try all combinations of the set control device parameter/channel values.
  2. Consecutive scanning. Conditions: The signal is visible, but the noise is more than 5% of the signal.
  3. Simplex optimization. Conditions: The signal is visible and the noise is less than 5% of the signal. Simplex is much faster than consecutive scanning, but require stable signal (good S/N ratio)

Control device combo box

Selects the control device which will be tuned for signal optimization.

Control device’s Channel number control

Sets the control device’s channel number. For the correspondence channel -> device parameter, see the help for each particular device.

From control field

Set the starting value for the device parameter/channel to be tuned.

To control field

Sets the finishing value for the device parameter/channel to be tuned.

Step control field

Sets the step value between value in From to To.

Number of control devices radio button

Sets the number of control devices to be tuned. Depending of the autotune method the device's parameters are used in combination (first and third methods) or consecutively (second method).

Measurement device combo box

Selects the measurement device where the signal will be taken from.

Measurement device’s Channel number control

Set’s the measurement device’s channel number.

Before each measurement the synchro device is advised for synchronization, so the user can cancel the procedure from there. The setting of synchro device should be about Delay 500 to assure the new parameter value is established before the next measurement is taken.

Intensity radio button

The user can choose between total and peak intensity for signal to be optimized upon. If peak is chosen the peak in the peak limits is fit with gauss function and the amplitude is used for intensity optimization and peak width - for resolution optimization.

Peak controls

Set the interval within the peak will be searched for. These are required when the resolution is optimized or peak intensity is selected.

Intensity/Resolution control

Sets the intensity/resolution weight. Mathematically only one value can be optimized at the time, so if the user wish to optimize the sensitivity and resolution at the same time he must specify the ratio of importance between these two.

Verification page

At verification page the quality of the signal is verified using as reference previous measured best quality possible mass-spec.

From the button on the top the user can choose reference mass-spec. From the group bellow the measurement device is set. After the execution of the procedure the "distance" between measured and reference mass-spec is calculated by the same formula used in NIST'98 library search.

On the bottom of the autotune window there is a utility for saving / reloading the setting of the procedure.

Remote call: Autotune


Simple Scan

Simple scan works with one control and one single channel measurement device.

Other useful feature of this procedure is that the developer can call simple scan procedure from within the program charging scanning parameters beforehand – records CDScan and MDScan of type tCDScan and tMDScan respectivelly.


Universal Scan

Uni-scan

I tried to make universal scan as universal as it could be one scan.

The user has a choice of making change one or two control parameters of control devices and take data from one or two / single or multi channel measurement devices. Always choose the number of control and measurement devices first. All the scanning parameters can be saved in file for later use. All the scanning parameters can be saved in a file '*.scn' extension and retrieved from the disk using the list and two button on the bottom of the uni-scan frame.

Typical tasks are optimizing ion-optics voltages or following long-term stability of the instrument.

The developer can call this procedure using a scan file name as parameter into Execute call and so execute a scan saved beforehand.

~~~~~~~~~~~~~~

Remote call: UniScan


PCA classification

If you need to classify your samples by their mass spectra against a training set (created in PCA detective - included here). The classification type is one-class classifier (the unknown is tested against each class consecutively) and the method is Principal Component Analysis / Mahalanobis Distance.

PCA detective is a freeware chemometrics software for classification of substances using their mass-spectra. The used multivariate analysis is based on Principal Component Analysis with Mahalanobis Distance (PCA-MD) and it is of one class classifier category. PCA detective has been tested using mass-spectra, but there is no limitation to be used with any other kind of characteristic spectra (e.g. VIS, IR, NMR). The only twist is to find appropriate channel (bin) size, which in case of mass-spec is naturally the mass number.

PCA detective is quick, provides variety of tools to optimize your PCA training and it can do classification by itself.

PCA detective is a nice project, but Classifion (freeware) is more mature product with more optimization options and automation.


Interpreter commands syntax

Interpreter commands

The developer will need the following to write procedures, which call the devices through the interpreter.

The syntax is NOT case sensitive.

The names of devices - three characters beginning with letter (e.g. PRL, CT0)

without reserved names 'Snh' ; 'Itr' and ‘SP#’

  • R : floating point number
  • N : integer number
  • LN : long integer
  • B : boolean
  • Filename, mode, Text : string
  • # : * or alphanumerical symbol (in 1..9,A..Z order)

if Filename does not include a path then configuration path (application path + \User\Config\) is assumed

if Filename is empty then the "Defaults.<DeviceName>" device name is assumed.

Remote use:

In case of success the executed command returns either 'OK' or measured/set value , otherwise it returns 'Error:' with optional error description.


General

General commands

Commands to the interpreter "Itr" - fixed (reserved) name

Itr.ScrRun(FileName)

Execute Spectrion script from Filename. Returns 'OK' or 'Error'.

Itr.LckSet(B)

Lock/unlock (B=TRUE/FALSE) the device rack. Returns 'OK' or 'Error'.

Itr.SetLod(FileName)

Load all the devices settings from FileName with extension - devices names. Returns 'OK' or 'Error'.

Itr.SetSav(FileName)

Save all the devices settings into FileName with extension devices names. Returns 'OK' or 'Error'.

Itr.ShwSet(B)

if B then show commands and replays in interpreter window

else stop show commands and replays in interpreter window

Useful for time critical parts of data acquisition.

Returns 'OK' or 'Error'.

Itr.VerGet

Gets back Spectrion version number as integer (e.g. 100 -> v1.00)

Itr.MsrGet

Returns comma separated list of measurement devices

Itr.CtrGet

Returns comma separated list of control devices

Itr.EnbGet

Check if the device rack is enabled (is it connected and switched on). Returns 'True' / 'False'

Itr.EnbSet(B)

Switch device rack to Running / StandBy state . Returns 'OK' or 'Error'.

Itr.DvRSet(B)

The same as EnbSet but switches (visually) device rack ON/OFF. Returns 'OK' or 'Error'. Intended for data processing visualization only.

// Text

Output Text in interpreter window (comment).

Plot commands (SP) - avoid devices names starting with SP (to avoid confusion)

The symbol after SP is '*' for general plot command and $ - alphanumerical symbol (in order 1..9, A..Z) for particular plot.

SP*.NewSet(Template)

Create new plot using Template for plot setting. Returns the order number of created plot.

SP*.ClrAll

Clear all plots . Returns 'OK' or 'Error'.

In next commands $ is the number of the plot (1..35), if $=’#’ then active plot is used.

SP$.Delete

Delete $ plot . Returns 'OK' or 'Error'.

SP$.VieSet(Mode)

Set view mode of $ plot to

  • M: only mass spec
  • C: only chromatogram spec
  • B: both

Returns 'OK' or 'Error'.

SP$.FilOpn(Filename)

Opens PL$ under Filename (full path included), the plot must exist. Returns 'OK' or 'Error'.

SP$.FilSav(Filename)

Saves PL$ under Filename (full path included) - works with HDT files only (*.R##). Returns 'OK' or 'Error'.


Measurement Device

Measurement Device [MD]

The MD could be one of two kinds: 2D (or serial mode) – e.g. multi-channel ADC or single-channel oscilloscope; or 3D (or package mode)– e.g. multi-channel oscilloscope. ChnIdx (channel index) has different meaning for 2D and 3D MDs.

MD.IniSet

(re)Initiate the device using loaded in advance setting or hard setting otherwise, the device state after command IniSet is in state "OffLine" . Returns 'OK' or 'Error'.

MD.EnbGet

Checks if the device enabled (is it connected and switched on). Return "True" / "False"

MD.EnbSet(B)

Switches device to Running / StandBy state (B true/false). Returns 'OK' or 'Error'.

MD.DftSet(ChnIdx)

Sets default channel of MD to ChnIdx. Returns 'OK' or 'Error'.

MD.ChnGet(ChnIdx) - 2D (serial mode) MD only

Measures and returns the value of ChnIdx channel, if ChnIdx is omitted then default channel is assumed.

MD.SpcGet(ChnIdx)

Measures and puts measured spectrum in the spectrum buffer (package). Returns 'OK' or 'Error'.

ChnIdx specifies z-channel and it is valid only for 3D (package mode) MD, otherwise (in 2D) ChnIdx is ignored and all 2D channels are transferred into the buffer (the package).

MD.DSmGet

Sends next spectrum thru open data stream to its plot. Returns 'OK' or 'Error'.

MD.SetLod(FileName)

Loads from FileName MD's settings if FileName is empty the device will be read for the setting or internal defaults will be loaded. Returns the loaded filename or 'Error'.

MD.SetSav(FileName)

Saves into FileName MD's settings, if FileName is empty the the last loaded or default setting will be written. Returns the saved filename or 'Error'.

MD.SetGet(FileName)

Gets back the current setting filename

MD.DimGet(Dim)

Returns units of measurement, for multi-channel device and you input Dim="Abs” the command returns for abscissa units (along the spectrum). For multi-channel device N is zChn, otherwise N is a channel number.

That is one way to check if certain MD is multi-channel, when you ask the device for abscise units, multi-channel device will return something, but single-channel one will reply with error message.

MD.CmdExe(Command)

The device interprets this text Command and returns the result as text


Control Device

Control Device [CD]

Control device is abstract presentation of real device which control some parameters of your setup. Typical examples could be high voltage controller, waveform generator, or step-motor controller. In any case the principal function of the device would be to set some parameter(s), even reading back the set parameter should lead to actual measuring of the real thing. Each channel has absolute (integer) and relative (float) after calibration position. The calibration should be implemented either by external utility or within Setting tab of the device.

Common parameter: ChnIdx - channel number, the normal channels have positive numbers, '0' is switchable and correspond to the default channel. The negative numbers correspond to Boolean channels 1-true/ 0-false

CD.IniSet

(re)Initiate the device using setting in file "Defaults.CD" (if the file exists) or hard setting otherwise, the device state after IniSet is OffLine. Returns 'OK' or 'Error'.

CD.EnbGet

Check if the device is enabled (is it connected and switched on). Returns 'True' / 'False'

CD.EnbSet(B)

Switch device to Running / StandBy state ( B is true/false). Returns 'OK' or 'Error'.

CD.DftSet(ChnIdx)

Set default control channel index to N,

Get back the default channel number, if N=0 it does not change default channel just gives it back.

Returns 'OK' or 'Error'.

If ChnIdx is omitted default channel index is assumed for the next commands.

CD.AbsGet([ChnIdx])

Gets back the last demander absolute position or returns 'Error'

CD.RelGet( [ChnIdx])

Gets back the last demander relative position or returns 'Error'

CD.MsrGet( [ChnIdx])

Measure and gets back relative position or returns 'Error'

Next four commands control the channels of CD by absolute/ relative jumps (without or with calibration) to new absolute (jump) or relative (move) position.

Returns:

  • true for successful jump and in LN/R is the new absolute/relative position
  • false if it is out of rande and R as min/max value of desired direction

CD.AJpSet(A: integer , [ChnIdx: integer])

Jump on position A in absolute units. Gets back the set absolute position or 'Error'

CD.RJpSet(R: float, [ChnIdx: integer])

Jump on position R in relative units. Gets back the set relative position or 'Error'

CD.AMvSet(A: integer, [ChnIdx: integer])

Move A absolute units forwards(+)/backwards(-). Gets back the set absolute position or 'Error'

CD.RMvSet(R: float, [ChnIdx: integer])

Move R relative units forwards(+)/backwards(-). Gets back the set relative position or 'Error'

CD.DvcLck(B)

if B then lock current manual device change,

else unlock current manual device change

Returns 'OK' or 'Error'.

CD.SetLod(FileName)

Load from FileName CD's settings if FileName is empty the device will be read for the setting or internal defaults will be loaded. Returns the loaded filename or 'Error'.

CD.SetSav(FileName)

Save into FileName CD's settings, if FileName is empty the the last loaded or default setting will be written. Returns the saved filename or 'Error'.

CD.SetGet(FileName)

Gets back the current setting filename or 'Error'

CD.DimGet(ChnIdx: integer)

Returns the name and respective units of the control device channel in format NAM[unit], only informative.

CD.CmdSet(Command)

The device interprets this text Command and returns the result as text. That is open text command which allows you to extend the above command set with some very specific function you cannot fit in the standard command set.


Synchronization Device

Synchro Device

Fixed (reserved) name "Snh"

Snh.ModSet(mode)

  • mode='Pass' return synchronization unconditionally
  • mode='Dly=#' return synchro after # [ms]
  • mode='Ext[=#]' return synchro after event number # happened, if '=#' is omitted then last used event is used
  • mode='Btn' return synchro after pressing the synchro button

Snh.ModGet

Return currently active mode

Snh.SnhGet(md)

  • md<0 synchro with event #md
  • md>0 synchro after md [ms]
  • md=0 synchro according default mode

Return control after synchronization

Snh.SDSOpn(md,pl)

  • Md – name of measurement device
  • Pl – designation plot for data display, if empty then new one is created

Open synchro data stream (SDS) and start the acquisition (self-synchronization) gets back the number of the opened channel

Snh.ADSOpn(md,pl)

  • Md – name of measurement device
  • Pl – designation plot for data display, if empty then new one is created

Open asynchro data stream (ADS) and wait for DChGet command for the next cycle of acquisition gets back the number of the opened channel

Snh.DSmGet(Idx)

Get next spectrum thru an open Idx asynchro data stream

Snh.DSmCls(Idx)

Close data steam with Idx number


Spectrion as COM server

The connection to Spectrion is thru COM standard of Windows. The properties and methods should be visible immediately after importing "Spectrion.tlb" into your program environment, in some program languages special care for event handling should be taken.

The example project SpcnClient (source included) demonstrates the abilities of Spectrion as COM server. Notice that for Command and Procedur methods separate threads are created to keep user interface free for user access and especially for Abort button (and method).

Properties

ExePath: WideString, read-only

Get back the full path to Spectrion.exe, usually needed to find the directory for scans, tunes etc.

The version number of Spectrion should be checked as well - Itr.ShwVer

Methods

Command(var InOutText: WideString; out Success: WordBool);

Execute one command from Spectrion script

InOutText contents the command (including the parameters) according Spectrion script syntax and gets back the result from execution of the command. Success is true when the execution is successful and vice verce.

Procedur(const WhichProc, PrmList: WideString);

Execute a specific procedure with parameters list in a setting file with name in "PrmList".

Possible procedures:

UniScan, setting file extension -> '.scn', directory -> RootPath+'Scan\'

AutoTune, setting file extension -> '.tun', directory -> RootPath+'Scan\'

Abort

Closes all the data streams and simulates pressing Stop button on Synchro device

GetSpec(Num: Integer; var SpecX, SpecY: OleVariant);

returns the mass-spec of Num plot as two arrays of double (0-based);

if Num<0 then the active plot is returned

Events

EventCommand(const Cmd: WideString; const Reply: WideString); dispid 1;

Spectrion fires that event when the command from Spectrion script has been executed, "Cmd" is the command itself and "Reply" is the answer.

EventDvcState(const DvcName: WideString; OldSt: Integer; NewSt: Integer); dispid 2;

Spectrion fires that event, if any of the devices has been changed its state. "DvcName" is the name of the device

and OldSt (old state)/ NewSt (new state) are coded as follow:

0 - None: blue caption, undefined initial state
1 - OffLine: white caption, initialization did not pass either because device has been switched Off from Options or there is no connection to the real device
2 - Standby: inactive caption, all tensions '0' and NO remotely access
3 - Running: active caption, normal state
4 - Warning: yellow caption, as Running but with warning
5 - Danger: red caption, switches to Standby internal state due to dangerous conditions


Glossary

Measurement device – external device which is presented as Delphi frame in the program and communicate through standard set of commands with interpreter. Only for measurement purposes. Two types – 2D (or serial mode) and 3D (or package mode), as in multi channel ADC card vs oscilloscope. Names – three characters.

2D (or serial mode) measurement device – offers separate channels (one or more). Typically – ADC card or one channel of oscilloscope. Each ADC /measurement channel is responsible for different external parameter.

3D measurement device – offers an array of values which can be proceed as ensemble. 3D type of multi-channel device means that you can have more than one spectrum at one shot (e.g. different channels of the oscilloscope).

Control device – offers typically one channel; optionally multi-channels control over some external parameter(s). Calibration for using absolute and relative units can be set. Names – three letters.

Synchronisation (sinchro) device – all the measurements are synchronised optionally with this device. Could be used for temporally pause or abort of measurement sequence (scanning). Reserved script name -"Snh".

Interpreter – part of the program, which interprets the script, commands coming from the procedures or elsewhere, call the respective device functions and send back the result. For general commands - reserved script name "Itr".

Procedures – usually dialog boxes with options for later execution of sequences of commands to the devices with results typically presented in TheoPlot.

TheoPlot – chart component presenting GC/MS or MS, with some options for data processing.


Under development

The Spectrion project is under development, no promises about any of the planned tasks deadlines (in some cases I really have no idea).

I would appreciate any involvement from your part: coding, advice, or just an opinion.

Using Spectrion or any part of it is allowed for any purposes (commercial or non-commercial), just give me some credit in your about box & help and let me know at http://sicyon.com/spectrion and click on my name at the bottom of the page.

The development is going in a few directions:

1. Multitasking. The present implementation of multitasking is far from optimal, there is no proper multithreading, just workaround. So next task in that direction would be to implement view-model-controller design pattern with proper multithreading.

2. TheoPlot:

  • TheoPlot is accepting limited number of file formats and the most popular one (mzML) is on the dev pipe-line. Next step would be to integrate MS file format converter from any file format to mzML.
  • Next would be to make both panes (Chrom and Mass) to accept many series - in three modes (1) one chart - many series (2) multi-tabs, one chart/series per tab (3) stacked (piled) charts one series per chart.
  • New filters and peaking methods including ones taking into an account the whole 3D picture (GC/MS).
  • Extract and save a subset of GC/MS by ret.time and/or mass ranges.

3. Develop utilities plug-in system, as Oscilo and Aqcuire but extendable and dynamic. Small plug-ins into Uni-scan for extracting on fly of spectrum meta parameter (as certain peak width) and put it into another plot.

4. New procedures, like:

  • GC/MS deconvolution
  • improving on autotune by using some modern algorithms of collective intelligence like PSO (Particle Swarm Optimization)

...feel free to send me your development suggestions.