A list of servers for a specific Device may be added by right clicking on the Device name and using Import Excel. Some things to keep in mind when setting up and using your spreadsheet to add device servers:

1. There must be a tab (“sheet”) called “devices” in your spreadsheet. The Import Excel operation will only read from this sheet with this name.

2. Tag names (the ServerName property) cannot start with a number and do not put spaces or other non-alphanumeric characters in this field. Do not re-use any names already used as server names for any other item in the devices node.

3. Cells can be empty. You do not need to enter the default values. Empty cells will use the default when adding new servers or will not change values you have set manually if you re-import the spreadsheet (values will not be overwritten unless you have a non empty value in the cell).

4. Use the minimal number of columns in your spreadsheet. In other words, do not add columns for parameters you are not going to use or if you only use the defaults for the parameter value. For example, all servers have a timebase and the default is 1.0 second. Do not add a column for timebase unless you plan to change the defaults on one or more of your servers.

5. You can define severs in more than one spreadsheet and import them separately. For example, if you want to separate your tags into servers for alarms, servers for data values, and servers for events, you can make three spreadsheets. This is not mandatory but might help with organization.

6. Re-importing the spreadsheet will override any values in the server. A blank entry in the cell will result in the default value for that property.

The “Demo” Servers (DemoServer Device) provide a set of useful data simulators and manipulators which can be used and accessed in your Devices scripting.

Each of the servers listed when you right click on the Devices node to add a Demo Server are available as simulators or data manipulators. The best way to understand how these are configured is to look at the javadoc (api) documentation for the server of interest. The scripting API is at ErgoTech Scripting API. Specific javadocs for the servers will be noted below.

In the spreadsheet example for the DemoServers, you will see these required columns:

The Name is an arbitrary unique identifier for the server. Use only alphanumeric characters for the Name and it must start with a character.

The TimeBase is 0 for a write-only server or manipulator, and is non-zero for a data generator and represents the time interval in seconds between updates.

The ServerType is one of the names in the DemoServers list: Wave,Ramp,ClockTrigger,RandomWalk,RandomNumber,RandomBoolean,RandomArray,RandomString,Variable,RandomTableData,StartupTrigger, or Thread, which are these server and manipulator java classes (with links to the online API documentation for these classes), SineServer,IncrementServer,SynchronizedClockTick,FloatFluxServer,RandomData,RandomBoolean,ArrayDataSource,RandomStringServer,BroadcastServer,TwoDimensionalDataSource,StartupTrigger, and PassOnThread.

For each server there may be one or more methods which affect the generated data. For example, for the RandomWalk (FloatFluxServer) there are methods to set the Rate, the Level, and the StartLevel. For the Ramp server (IncrementServer) there is method to set the Increment. For each kind of server (ServerType) these method names are listed as column names in the spreadsheet. For each ServerType, method names (column names) which are not used by that server are ignored.

The spreadsheet for the DemoServers uses a variety of servers as examples.

Example DemoServers Spreadsheet

Spreadsheet header example (order of column headers does not matter). The “note” heading is not used, so you can put text in that cell for your own reference.

ServerName: The unique tag name for this server. This will be the tag name you select when assigning this server to a SECS/GEM ID or using by name in a script.

Reg: The register for the server, one based. See Modbus Addressing

ServerType: the class of the server. One of: Modbus 0x Reg, Modbus Word, Modbus Double Word, Modbus Float, Modbus String, Modbus 1x Reg, Modbus Array, or Modbus String Array. These are entered as a whole string in the spreadsheet cell, i.e., “Modbus Word”.

Enter the type into the cell exactly as shown below:

Modbus Word
Modbus Double Word
Modbus Float
Modbus String
Modbus Array
Modbus String Array
Modbus 0x Reg
Modbus 1x Reg
Modbus Preset Word

Each server type may need optional parameters (not used for other server types, for example SwapStyle for ModbusFloat is only used for ModbusFloat and no other server type). If you want to use an optional parameter (and not use its default value), then add an additional column to the spreadsheet and enter the parameter value for this specific server. All other rows (for other server types) should be left empty.

other parameters with defaults

Timebase: the timebase should be the same for all servers (all servers in a block will use the smallest timebase of the servers in that block), and is the time in seconds between the PLC block reads, for example 1.0 for 1 second time interval. Use a zero timebase, “0.0”, for servers you only write to. This defaults to 1.0 if not set.

StationAddress: the slave node address (station address). This defaults to 0 if not set to a different value such as 1.

RegisterType: the register type defaults to 4X (holding register, read/write) but can be changed to 3X (input register, read only). This defaults to “4” but can be set to “3” for 3X register types. This is only used for all Modbus Server Types except Modbus 0X Reg and Modbus 1X Reg. If not set (blank in the spreadsheet cell) the default 4X will be used.

Special Parameters (not commonly changed from defaults)

OptimizeReads: This defaults to “true” so that registers are read in blocks. If OptimizeReads is set to false for this server then this register will be read individually at the set timebase interval.

TriggerOnThread: This defaults to true and only effectively applies to timebase=0 servers that are being triggered for a read if set to false. Otherwise the server value will be updated on the block read “thread”.

Signed: Signed is used for Modbus Word and Modbus Double Word register types. This defaults to false (unsigned) but can be set to true.

SwapStyle: SwapStyle is only used for Modbus Double Word (and Modbus Float). The default is Word Swap. Other choices are No Swap,Byte Swap, and Both Swap.

0 = Word Swap (the default)
1 = No Swap
2 = Byte Swap
3 = Both Swap

SwapStyle: see description for Modbus Double Word above.

These are also used in the Modbus String Array

Length: The length of the string (must be multiple of 2)

ByteSwapString: This defaults to false but can be set to true

RegisterCount: The length of the array (how many array elements)

RegisterType: (not used for Modbus String Array). This parameter has no default so must be set. All available types are in the list below:

1 = Unsigned Word
2 = Signed Word
3 = Unsigned Double Word
4 = Signed Double Word
5 = Float
6 = Coil (0x)
7 = Discrete (1x)

Advice on defining arrays in the spreadsheet

Since arrays add extra columns to the spreadsheet not used by regular modbus register types such as Word, Floats, and Double Words, it is recommended that you make a separate spreadsheet with a devices sheet (tab) to set up just arrays or if not too many arrays are used in your project you can add these manually to the project. The purpose of this recommendation is to keep the regular register rows cleaner without the extra sparely populated parameters only used for arrays.

see also: EtherNet/IP Addressing

Spreadsheet header example (order of column headers does not matter)

ServerName: The unique tag name for this server. This will be the tag name you select when assigning this server to a VID.

LogixTagName: The EtherNet/IP tag name

ServerType: The type of the address, either Integer, Real, String, or Array

Timebase: the timebase should be the same for all servers, time in seconds between the PLC reads, for example 1.0 for 1 second time interval. Use a zero timebase, “0.0”, for servers you only write to. This defaults to 1.0 if not set.

ValueType: Used only for Array and Integer ServerTypes. This is a code used internally by the EtherNet/IP driver to indicate what kind of value should be read (if ambiguous) or especially if this server will be writing a value. The default, if left blank will be Int.

ValueType Code

-50: String
-55: ULInt
-59: LInt
-56: UDInt
-57: UInt
-58: USInt
-54: Real
-60: DInt
-61: Int
-62: SInt
-63: Boolean

Size: Used only for Array tags, the size of the array. This must be set for arrays and match the value set for the base tag in the PLC.

Slot: The PLC slot (defaults to 0)

Signed: Used only for Integer types, whether or not the value is signed, defaults to 0 (false), unsigned

Example EtherNet/IP Devices Spreadsheet

Spreadsheet header example (order of column headers does not matter)

ServerName: The unique tag name for this server. This will be the tag name you select in the VID for this server.

Address: The Melsec Address, for example D200 or S10

ServerType: The type of the address: Word, DoubleWord, Float, Binary, or String

Timebase: the timebase should be the same for all servers, time in seconds between the PLC reads, for example 1.0 for 1 second time interval

SwapStyle: Used for DoubleWord addresses only, this is a number 0,1,2, or 3. 0=Word Swap, 1=No Swap, 2=Byte Swap, 3=Both Swap.

ByteSwapString: Used only for String addresses, entered as a 0 or a 1. This is a boolean, 0=FALSE (do not swap) and 1=TRUE (swap)

Length : Used for String and Binary addresses, the length of the string or the size in bytes of the Binary data

  • importing_device_servers_with_a_spreadsheet.txt
  • Last modified: 2023/02/02 22:34
  • by wikiadmin