Documentation

sscprintzcs

Print zero crossing information for logged simulation data

Syntax

sscprintzcs(node)
sscprintzcs(node,verbosity)

Description

example

sscprintzcs(node) prints information about zero crossings detected during simulation, based on logged simulation data specified by node. Before you call this function, you must have the simulation log variable, which includes simulation statistics data, in your current workspace. Create the workspace variable by simulating the model with simulation statistics logging turned on, or load a previously saved variable from a file.

example

sscprintzcs(node,verbosity) prints detailed information about zero crossings. The verbosity argument controls the level of detail.

Examples

collapse all

Open the Mechanical System with Translational Hard Stop example model:

ssc_mechanical_system_translational_hardstop

This example model has data logging and simulation statistics logging enabled, with the Workspace variable name parameter set to simlog_ssc_mechanical_system_translational_hardstop.

Simulate the model to log the simulation data:

sim('ssc_mechanical_system_translational_hardstop');

Get the zero crossing information at the block level:

sscprintzcs(simlog_ssc_mechanical_system_translational_hardstop)
ssc_mechanical_system_translational_hardstop (2 signals, 28 crossings)
  +-Translational_Hard_Stop (2 signals, 28 crossings)

The results show that the only block that can produce zero crossings is the Translational Hard Stop block. It has two signals that can produce zero crossings, and 28 actual zero crossings are detected.

Open the Mechanical System with Translational Hard Stop example model:

ssc_mechanical_system_translational_hardstop

This example model has data logging and simulation statistics logging enabled, with the Workspace variable name parameter set to simlog_ssc_mechanical_system_translational_hardstop.

Simulate the model to log the simulation data:

sim('ssc_mechanical_system_translational_hardstop');

Get the zero crossing information at the signal level:

sscprintzcs(simlog_ssc_mechanical_system_translational_hardstop,1)
ssc_mechanical_system_translational_hardstop (2 signals, 28 crossings)
  +-Translational_Hard_Stop (2 signals, 28 crossings)
    -zc_1 	 16
    -zc_2 	 12

The results show that the only block that can produce zero crossings is the Translational Hard Stop block. It has two signals that can produce zero crossings, zc_1 and zc_2. A total of 28 actual zero crossings are detected. Signal zc_1 produced 16 zero crossings during simulation, and signal zc_2 produced 12.

Use the sscexplore function to further explore the zero crossing data for signal zc_1.

sscexplore(simlog_ssc_mechanical_system_translational_hardstop,...
'Translational_Hard_Stop.SimulationStatistics.zc_1')

Input Arguments

collapse all

Simulation log workspace variable that contains the logged model simulation data, including simulation statistics, specified as a Node object. You specify the name of the simulation log variable by using the Workspace variable name parameter on the Simscape pane of the Configuration Parameters dialog box. You can also specify a node within the simulation log variable by providing the complete path to that node through the simulation data tree. In this case, the function prints information only about zero crossings found in that particular node.

Example: simlog.DC_Motor

Level of detail in printed information about zero crossings, specified as a number:

  • 0 — Block-level information

  • 1 — Signal-level information

  • 2 — Signal-level information, including location

Data Types: double

Introduced in R2015a

Was this topic helpful?