LocationStrategy Property

General info

Label

Strategy

Description

Definition of the location strategy.

Data type

UInt32

Default value

1 (syslib.model.codes.LocationStrategy.LOC_STRAT_NONE)

Type

CodingGroup

Code

261

Symbolic name

MODEL_PROP_LOCATIONSTRATEGY

Lua access code

syslib.model.properties.LocationStrategy

Available since

1.0

Parent properties

Location

Attributes

Name Tooltip
PROP_CONFIGURABLE The property is configurable and can be changed with DataStudio and the various inmation APIs.
PROP_VISIBLE The property is visible in DataStudio and can be read by the inmation APIs.
PROP_HAS_DEFAULT The property has a default value as standard.

Codings

Coding group: LocationStrategy

Name Code Label Tooltip

LOC_STRAT_NONE

1

No location

This object is not interpreted in a location context.

LOC_STRAT_STATIC

2

Static (or manually changed) location

You may set the location data manually, by Engineering Script or by selecting the location visually using the Location Finder feature.

LOC_STRAT_INHERIT

3

Inherited location

The object inherits the location from the owning object in the system hierarchy.

LOC_STRAT_DYNAMIC

4

Dynamic location

The object location is supplied by other I/O Items. You may drop other I/O items into the location fields of this object.

LOC_STRAT_PROPERTY

5

Location properties

The endpoint server has distinct properties for I/O item location data. Please note, that this option works only for I/O items .

Examples

Read from or write to the LocationStrategy property.

  • Lua

  • C#

-- Read from the LocationStrategy
syslib.getvalue("<OBJECT FULL PATH>.Location.LocationStrategy")

-- Write to the LocationStrategy
syslib.setvalue("<OBJECT FULL PATH>.Location.LocationStrategy",
    syslib.model.codes.LocationStrategy.LOC_STRAT_NONE)
TcpConfig tcpcfg = new TcpConfig() { HostNameOrIp = "localhost", Port = 6512 };
SecurityCredentials sc = new SecurityCredentials() { ProfileName = "<username>", Password = "<password>" };
StatelessInterface sli = new StatelessInterface(tcpcfg);

// Read from the LocationStrategy
Result result = sli.ReadValue(sc, new ReadItem("<OBJECT FULL PATH>.Location.LocationStrategy"));
// Write to the LocationStrategy
Result result = sli.WriteValue(sc, new WriteItem(LocationStrategy.LOC_STRAT_NONE, "<OBJECT FULL PATH>.Location.LocationStrategy"));

A switch-like function of the codings.

function get_coding_name(code)
    local _ls = syslib.model.codes.LocationStrategy
    if _ls.LOC_STRAT_NONE==code then return 'LOC_STRAT_NONE'
    elseif _ls.LOC_STRAT_STATIC==code then return 'LOC_STRAT_STATIC'
    elseif _ls.LOC_STRAT_INHERIT==code then return 'LOC_STRAT_INHERIT'
    elseif _ls.LOC_STRAT_DYNAMIC==code then return 'LOC_STRAT_DYNAMIC'
    elseif _ls.LOC_STRAT_PROPERTY==code then return 'LOC_STRAT_PROPERTY'
    end
end
return get_coding_name(syslib.model.codes.LocationStrategy.LOC_STRAT_NONE)