Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TcNumericType

Class representing all numeric Types in the Target PLC

Hierarchy

Index

Constructors

Protected constructor

Accessors

adst

  • get adst(): number

context

defaultBuffer

  • get defaultBuffer(): Buffer | undefined
  • set defaultBuffer(val: Buffer | undefined): void

defaultValue

  • get defaultValue(): number | bigint

ignored

  • get ignored(): boolean
  • set ignored(val: boolean): void

lowerBorder

  • get lowerBorder(): number | bigint
  • set lowerBorder(val: number | bigint): void
  • Minimum value of this Numeric Type

    Returns number | bigint

  • Minimum value of this Numeric Type

    Parameters

    • val: number | bigint

    Returns void

name

  • get name(): string

offset

  • get offset(): number
  • set offset(val: number): void
  • The memory offset, relative to its parent, if the TcType is a child

    Returns number

  • The memory offset, relative to its parent, if the TcType is a child

    Parameters

    • val: number

    Returns void

onChange

  • get onChange(): string
  • set onChange(val: string): void
  • Alias to use, in place of the default 'changed' event, when a TcSymbol of this type is constructed

    Returns string

  • Alias to use, in place of the default 'changed' event, when a TcSymbol of this type is constructed

    Parameters

    • val: string

    Returns void

onClear

  • get onClear(): string
  • set onClear(val: string): void
  • Alias to use, in place of the default 'cleared' event, when a TcSymbol of this type is constructed

    Returns string

  • Alias to use, in place of the default 'cleared' event, when a TcSymbol of this type is constructed

    Parameters

    • val: string

    Returns void

onGet

  • get onGet(): string
  • set onGet(val: string): void
  • Alias to use, in place of the default 'get' event, when a TcSymbol of this type is constructed

    Returns string

  • Alias to use, in place of the default 'get' event, when a TcSymbol of this type is constructed

    Parameters

    • val: string

    Returns void

onSet

  • get onSet(): string
  • set onSet(val: string): void
  • Alias to use, in place of the default 'set' event, when a TcSymbol of this type is constructed

    Returns string

  • Alias to use, in place of the default 'set' event, when a TcSymbol of this type is constructed

    Parameters

    • val: string

    Returns void

readOnly

  • get readOnly(): boolean
  • set readOnly(val: boolean): void

size

  • get size(): number
  • set size(val: number): void

upperBorder

  • get upperBorder(): number | bigint
  • set upperBorder(val: number | bigint): void
  • Maximum value of this Numeric Type

    Returns number | bigint

  • Maximum value of this Numeric Type

    Parameters

    • val: number | bigint

    Returns void

Methods

Protected __clone

  • Internal function for applying mutations to the created clone. Used for code reduction

    throws

    TcComIsInvalidException - Attempting to use an invalidated TcCom Object

    throws

    TcComToRawException - Error occurred when transforming value to raw data

    Parameters

    • type: TcType

      the TcType, which can be potentially mutated

    • Optional mutator: TcTypeBase

      The mutator which can be applied to the TcType

    Returns Promise<TcType | undefined>

    • Either the clone TcType or undefined if cloning failed

Protected __getParameter

  • __getParameter(name: string, value: string): void
  • Internal function, which analyses attribute data from the Type ADS Data and adjusts aspects of this TcType

    Mutations supported :

    • ReadOnly
    • Ignored
    • OnSet
    • OnGet
    • OnClear
    • OnChange
    • Default
    • UpperBorder
    • LowerBorder

    Parameters

    • name: string

      name of the Attribute

    • value: string

      value of the Attribute

    Returns void

clone

  • Creates a clone with an optional mutation of this TcType

    throws

    TcComIsInvalidException - Attempting to use an invalidated TcCom Object

    throws

    TcComToRawException - Error occurred when transforming value to raw data

    Parameters

    • Optional mutator: TcTypeBase

      Optional mutator, which can be applied to the clone

    Returns Promise<TcType | undefined>

    • Either the clone TcType or undefined if cloning failed

extend

  • Extends the current TcType with the provided TcTypeInfo. Can be extended either to an array of TcNumericType or TcEnumType. Otherwise, creates a mutate clone

    Parameters

    • adsTypeData: TcTypeInfo

      Data with which to extends the TcType

    Returns Promise<TcType | undefined>

    • Either the extends TcType or undefined if extension failed

instance

  • Creates an instance of a numeric Type PLC Symbol, based on this `TcType

    Parameters

    • path: string

      Path of the created TcSymbol

    • parent: TcSymbol

      Parent of the created TcSymbol

    • pointer: TcSymbolPointer

      Memory location of created TcSymbol in the Target PLC

    • Default value debug: boolean = false

      If enabled, will produce debug information

    Returns TcSymbol

    • An TcSymbol instance of a Symbol of a numeric type

mutate

  • Clones this TcType and mutates it, with additional attributes from the mutator

    Parameters

    • mutator: TcTypeBase

      Will use the Attributes and Offset to create a mutation of this TcType

    Returns void

Static create

  • Creates an instance of TcNumericType with default values transformed to raw data

    throws

    TcComIsInvalidException - Attempting to use an invalidated TcCom Object

    throws

    TcComToRawException - Error occurred when transforming value to raw data

    Parameters

    • context: TcContext

      The TcContext, to which this Type belongs

    • typeData: TcTypeInfo | TcNumericType

      The information, from which the TcType is build

    • Default value debug: boolean = false

      If enabled, will produce debug information

    Returns Promise<TcNumericType | undefined>

    • An initialized instance of TcNumericType if it is not ignored

Object literals

Static ranges

ranges: object

Default Ranges for all the Numeric Types possible in a TwinCAT PLC. If not explicitly specified, will be used for upperBorder and lowerBorder definitions

[ADST.INT16]

[ADST.INT16]: object

max

max: number = 32767

min

min: number = -32768

[ADST.INT32]

[ADST.INT32]: object

max

max: number = 2147483647

min

min: number = -2147483648

[ADST.INT64]

[ADST.INT64]: object

max

max: bigint = BigInt(9223372036854775807)

min

min: bigint = BigInt(-9223372036854775808)

[ADST.INT8]

[ADST.INT8]: object

max

max: number = 127

min

min: number = -128

[ADST.REAL32]

[ADST.REAL32]: object

max

max: number = 3.402823e+38

min

min: number = -3.402823e+38

[ADST.REAL64]

[ADST.REAL64]: object

max

max: number = 1.7976931348623157e+308

min

min: number = -1.7976931348623158e+308

[ADST.UINT16]

[ADST.UINT16]: object

max

max: number = 65535

min

min: number = 0

[ADST.UINT32]

[ADST.UINT32]: object

max

max: number = 4294967295

min

min: number = 0

[ADST.UINT64]

[ADST.UINT64]: object

max

max: bigint = BigInt(18446744073709551615)

min

min: bigint = BigInt(0)

[ADST.UINT8]

[ADST.UINT8]: object

max

max: number = 255

min

min: number = 0

Generated using TypeDoc