Main Content

sscprintzcs

Print zero crossing information for logged simulation data

Description

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.

example

Examples

collapse all

Open the Mechanical System with Translational Hard Stop example model:

openExample('simscape/MechanicalSystemWithTranslationalHardStopExample')

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

Simulate the model to log the simulation data:

sim('MechanicalSystemWithTranslationalHardStop');

Get the zero crossing information at the block level:

sscprintzcs(simlog_MechanicalSystemWithTranslationalHardStop)
MechanicalSystemWithTranslationalHardStop (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:

openExample('simscape/MechanicalSystemWithTranslationalHardStopExample')

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

Simulate the model to log the simulation data:

sim('MechanicalSystemWithTranslationalHardStop');

Get the zero crossing information at the signal level:

sscprintzcs(simlog_MechanicalSystemWithTranslationalHardStop,1)
MechanicalSystemWithTranslationalHardStop (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_MechanicalSystemWithTranslationalHardStop)

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

Version History

Introduced in R2015a