Simulation 2 Driver
Simulation 2 Driver
Simulation 2 Driver
Version 6.1
JANUARY 2020
Disclaimer of Warranties and Liability
The information contained in this publication is believed to be accurate and reliable. However, General Electric
Company assumes no responsibilities for any errors, omissions or inaccuracies. Information contained in the pub-
lication is subject to change without notice.
No part of this publication may be reproduced in any form, or stored in a database or retrieval system, or trans-
mitted or distributed in any form by any means, electronic, mechanical photocopying, recording or otherwise,
without the prior written permission of General Electric Company. Information contained herein is subject to
change without notice.
Trademark Notices
© 2020, General Electric Company. All rights reserved.
* Indicates a trademark of General Electric Company and/or its subsidiaries.
All other product names and marks identified throughout this book are trademarks or registered trademarks of
their respective companies. They are used throughout this book in editorial fashion only. No such use, or the use
of any trade name, is intended to convey endorsement or affiliation.
No part of this publication may be reproduced in any form, or stored in a database or retrieval system, or trans-
mitted or distributed in any form by any means, electronic, mechanical photocopying, recording or otherwise,
without the prior written permission of GE. Information contained herein is subject to change without notice.
We want to hear from you. If you have any comments, questions, or suggestions about our documentation, send
them to the following email address:
[email protected]
Table of Contents
Simulation 2 Driver 2
Example 7
Index 13
The Simulation 2 (SM2) driver provides a matrix of addresses that lets you test your process database to
learn how its block and chains respond to different conditions. You can also use the SM2 driver with a C
application to extract data from legacy systems and store it in a process database.
The SM2 driver has no driver configuration program so no configuration of the driver is required. Instead,
you specify the SM2 address you want to use in a database block's I/O Address field and then place the
block on scan. To learn more about using SM2 addresses, refer to Accessing SM2 Registers.
The SM2 driver is similar to the SIM driver supplied with your FIX and iFIX software. Both drivers:
l Provide a matrix of addresses that database blocks can read from and write to.
l Support analog and digital database blocks.
l Support text blocks.
However, the SM2 driver differs from the SIM driver in several important ways:
Obviously, you can use the SIM driver for many of the same tasks as the SM2 driver. However, you
may prefer to use the SM2 driver when one or more of the following conditions occur:
l You have more test data than the SIM driver can hold.
l You want to determine how the database responds to 32-bit values.
l You need to access the driver from a C program.
The SM2 driver matrix consists of three independent sets of registers: one for analog values, one for
digital values, and one for text values. Analog database blocks read from and write to analog registers
only. Once a block writes a value, other analog blocks can read the value from the register written to.
Digital database blocks work the same way, reading and writing from the digital registers. FIX (or iFIX)
clears all SM2 values when FIX or iFIX starts.
The SM2 driver does not use the Hardware Options or Signal Conditioning fields.
The SM2 driver provides an S register to simulate a communication error. Using this register, all analog
and digital reads return an error as if communication to the process hardware has been lost.
NOTE: You must have the iFIX Integration (EDA) Toolkit installed to use the C API.
You can access SM2 analog, digital, and text values through the C API that the driver supplies. The file
SM2API.H describes the API and the functions reside in the file SM2API.LIB. You can link this library
file to your C application to access the API's functions. You can find both files in your Base path. By
default, this path is C:\Program Files (x86)\GE\iFIX, C:\IFIX, or C:\Dynamics depending where you
installed iFIX.
Example
Suppose you are using the SM2 driver to store data from a legacy system. Using the C API and a num-
ber of preconfigured analog blocks, you can extract your data from the legacy system and store it in your
process database.
C API Functions
Syntax Values read, written, and returned
UINT16 GetAn- GetAnalog reads an analog value (32-bit float) to the register indicated by 'index'.
alog(UINT16
FE_OK is returned if the operation succeeds.
index, FLOAT
*data); FE_IO_ADDR is returned if the register index is out of range.
FE_RANGE is returned if the analog value exceeds the range of a 32-bit float.
NOTE: GetAnalog and GetDouble access the same table in the SM2.
UINT16 SetAn- SetAnalog writes an analog value (32-bit float) to the register indicated by 'index' and
alog(UINT16 causes an exception for the specified register even if the data has not changed.
index, FLOAT
FE_OK is returned if the operation succeeds.
data);
FE_IO_ADDR is returned if the register index is out of range.
NOTE: SetAnalog and SetDouble access the same table in the SM2.
UINT16 GetDouble reads an analog value (64-bit float) to the register indicated by 'index.'
GetDouble
FE_OK is returned if the operation succeeds.
(UINT16 index,
DOUBLE FE_IO_ADDR is returned if the register index is out of range.
*data);
NOTE: GetAnalog and GetDouble access the same table in the SM2.
UINT16 SetDouble writes an analog value (64-bit float) to the register indicated by 'index' and
SetDouble causes an exception for the specified register even if the data has not changed.
(UINT16 index,
FE_OK is returned if the operation succeeds.
DOUBLE data);
FE_IO_ADDR is returned if the register index is out of range.
NOTE: SetAnalog and SetDouble access the same table in the SM2.
UINT16 GetDi- GetDigital reads 16 digital values (all 16 bits in one of the 20,000 digital registers) to
gital(UINT16 the register indicated by 'index'.
index, UINT16
FE_OK is returned if the operation succeeds.
NOTE: The API can only read and write the entire 16 bit digital register at one time. If
you want to change 1 bit, you can read the register, modify the desired bit and write
the register. However, when you modify a single bit, ensure that only one thread in
one application is accessing a digital register at one time.
UINT16 SetDi- SetDigital writes 16 digital values (all 16 bits in one of the 20,000 digital registers) to
gital(UINT16 the register indicated by 'index' and causes an exception for all 16 bits of the spe-
index, UINT16 cified register even if the data has not changed.
data);
FE_OK is returned if the operation succeeds.
NOTE: The API can only read and write the entire 16 bit digital register at one time. If
you want to change 1 bit, you can read the register, modify the desired bit and write
the register. However, when you modify a single bit, ensure that only one thread in
one application is accessing a digital register at one time.
UINT16 SetDi- SetDigitalEx writes 16 digital values (all 16 bits in one of the 20,000 digital registers)
gitalEx(UINT to the register indicated by 'index' and causes an exception for specific bits selected
index, UINT16 from a mask. An exception is triggered for the bits set in the mask even if the data
data, UINT16 has not changed.
mask)
FE_OK is returned if the operation succeeds.
NOTE: The API can only read and write the entire 16 bit digital register at one time. If
you want to change 1 bit, you can read the register, modify the desired bit and write
the register. However, when you modify a single bit, ensure that only one thread in
one application is accessing a digital register at one time.
UINT16 GetText reads the text specified by `data' from text registers starting at the register
GetText indicated by `index'. The number of characters to read is indicated by `size'. GetText
(UINT16 index, does not automatically add a null terminator to the text being read. If you require null-
char *data, int terminated strings, make sure your program adds a null terminator after reading text.
size)
FE_OK is returned if the operation succeeds.
NOTE: As of iFIX 4.5, only the alarm statuses IA_OK and IA_COMM are supported
for use through the SM2 driver.
NOTE: As of iFIX 4.5, only the alarm statuses IA_OK and IA_COMM are supported
for use through the SM2 driver.
NOTE: As of iFIX 4.5, only the alarm statuses IA_OK and IA_COMM are supported
for use through the SM2 driver.
iFIX and FIX can process alarm status information from I/O drivers. This information complements the
alarms generated by iFIX and FIX database blocks. When an alarm is returned from a driver, iFIX and
FIX compares the driver alarm against the block alarm. The alarm with the higher severity is used as the
block alarm and the other alarm is ignored.
NOTE: As of iFIX 4.5, only the alarm statuses IA_OK and IA_COMM are supported for use through the SM2
driver.
Using the preceding tables, you can see that if a driver returns a HIHI alarm to a block that is in HI alarm,
iFIX or FIX changes the alarm state to HIHI because the driver alarm is more severe. However, if the
alarms are of equal severity, iFIX or FIX does not change the alarm state of the block. For example, if
the block is in HI alarm and the driver returns a LO alarm, the block's alarm state does not change
because both alarms have equal severity. Once an operator acknowledges the HI alarm, iFIX or FIX
changes the block's alarm state.
NOTE: If you set a communication error to the S register with the SetCommError function, then all SM2
registers show a COMM alarm status. When examining the alarm status of text, only the status of the first char-
acter (byte) is read. You can control the alarm status functions of the SM2 driver using its C API only. Refer
more information about this API, refer to the Using the SM2 C API section.
addresses 4
digital blocks 3, 6
exception-based processing 3
features 3
S register 6
SIM driver 3