TRACE

Concept Link IconSee also

To generate a trace in SCADA BASIC and output as part of PcVue's event log.

WebVue support - Yes.

Mode

Mnemonic

Syntax

0 OFF 1
1 ON 1
3 LOG 2
6 FILE 2

Use of additional traces can affect PcVue performances and they may cause display and storage of sensitive information. If you enable any of the optional traces, they should be disabled once the issue has been diagnosed and resolved. And you must make sure diagnostics trace files are deleted securely if need be.

Syntax 1

TRACE(Mode, ManagerId, HexFlag);

Argument

Meaning

ManagerId

The Id of an sv32.exe manager. Type INTEGER.

  • 3 - LAN manager
  • 5 - VAR manager
  • 6 - UI manager
  • 8 - HIS manager
  • 11 - Id of the first SV Manager extension. If more than one SV Manager are loaded, they are identified as managers 11, 12, 13, etc. by order of appearance in the file UsrMgr.dat.
HexFlag An weighted-bit hexadecimal value that is the trace level to activate or deactivate. Type STR.
Each manager proposes a variety of trace levels.
The possible values of the HexFlag argument for built-in managers are described in the topic Troubleshooting.
The possible values of the HexFlag argument for extensions based on the SV Manager are described in the topic corresponding to the extension. Extras and Add-ons based on an SV Manager extension propose such additional traces, including KNX, MQTT, OCPP, ICCP, etc.

Execution

Mode

Mnemonic

Action

0

OFF

Deactivate traces for the manager identified by ManagerId.

1

ON

Activate traces corresponding to HexFlag for the manager identified by ManagerId.

In addition, feature-specific traces can be activated and deactivated with the Application Explorer or with the SCADA Basic instruction of the feature.

Example:

Copy
Sub ActivateTraces()
    TRACE(1,11,"1");
    TRACE(1,11,"2");
    TRACE(1,11,"4");
    TRACE(1,11,"8");
    TRACE(1,11,"10");
End Sub

Sub DeactivateTraces()
    TRACE(0,11,"1");
    TRACE(0,11,"2");
    TRACE(0,11,"4");
    TRACE(0,11,"8");
    TRACE(0,11,"10");
End Sub

Syntax 2

TRACE(Mode, String);

There is no return type.

Argument

Meaning

String

The message to be logged. Type STR.

Execution

Mode

Mnemonic

Action

3

LOG

To send a message to the Event Viewer and Bin\Log Files\Trace.log file.
If executed in a WebVue session context this instruction is processed by the computer that hosts the web back end and the trace is generated on that computer.

6

FILE

To send a message to the Bin\Log Files\MacroTrace.log file.

If executed in a WebVue session context this instruction is processed by the computer that hosts the web back end and the trace is generated on that computer.

This instruction is provided as a facility to generate a system event log comprising both PcVue's traces and project level activity traces. Generating too many traces makes it impossible to use the event log for post-mortem analysis. It is strongly recommended that application designers refrain themselves from using this instruction as a debugging facility for project scripts with the consequence of polluting the event log.