spnLogBlock {spectrino}R Documentation

Log to a blocks log or in the console

Description

Log some text and/or values in the blocks log or in the console. The user can send some text, or use some special syntax for listing one or all properties.
Alernative to that command you can use a log template (set from block's menu) which contains text and $property.name$ the last one will be replaced by that property value. The log template will ber used at each iteration.

Usage

spnLogBlock(Block, text)

Arguments

Block

- the name(character string) of the target block; if cannot be found (e.g. "") the main log (console) is used.

text

- message character string to be logged. Usually it's a some text message, but there are some special cases:
– <property.name> wil log the name and the value of that property
– <ALL> will log all the properties (name=value) of that block
– <CLEAR> will clear the log
– <SAVE>[full filename] will save the log into the specified filename or (if missing) under date-time stamp in Block folder

Value

spnLogBlock returns TRUE if successful, FALSE - if the log of that block is disabled (not Enabled).

Author(s)

Teodor Krastev

See Also

spnChartBlock , spnIteration

Examples

# Initialization of Spectrino
spnNew() 

# generate test group of blocks
spnOpenGroupOfBlocks("<test>")

# write into the console
spnLogBlock("","some text")

# intialize the iteration to expected 20 count
spnIteration(20)

for(i in 1:20) { 
  spnSetProperty("test1", "objective.0", sin(i/2))
  spnLogBlock("test1","<objective.0>")
  spnSetProperty("test1", "sug.epsilon", cos(i/2))
  spnLogBlock("test1","<sug.epsilon>")
  spnLogBlock("test1","===================")
  
  spnIteration(); Sys.sleep(0.1);
  }

# Release of Spectrino
spnFree(TRUE)

[Package spectrino version 2.0.0 Index]