Reading Simulation Step Time in SIMIT Component Type Editor (CTE): Numerical Integration and Differentiation Techniques

Reading Simulation Step Time in SIMIT Component Type Editor (CTE): Numerical Integration and Differentiation Techniques

In the SIMIT Component Type Editor (CTE), you can obtain the simulation cycle time and step size using the built-in simulation environment variable DELTA_TIME (or by evaluating the time slice execution period dt). SIMIT provides native environment variables that reflect the active time slice frequency (e.g. 100 ms for Slice 2). In CTE behavioral code, you use DELTA_TIME to perform discrete numerical integration (e.g., Forward Euler: y = y_old + x * DELTA_TIME) or numerical differentiation (e.g., dy_dt = (x - x_old) / DELTA_TIME) directly within your custom simulation component.

Table of Contents

Component Type Editor (CTE) Modeling Architecture in SIMIT

SIMIT Simulation Platform allows automation engineers to validate PCS 7 control logic against dynamic virtual process models prior to site commissioning. While the standard SIMIT library provides ready-to-use valves, drives, and transmitters, specialized chemical reactors, conveyors, or thermodynamics frequently require proprietary behavioral equations created in the Component Type Editor (CTE).

In CTE, components are modeled using high-level behavioral programming that defines inputs, outputs, state variables, and topological links. To model physical phenomena like liquid level accumulation, temperature heating curves, or acceleration, the component algorithm must know the exact physical elapsed time per calculation step.

Accessing Simulation Step Time: DELTA_TIME and Simulation Time

SIMIT provides predefined, implicit system variables accessible within the behavioral section of any CTE component:

  • DELTA_TIME: Represents the duration of the current calculation cycle (step size) expressed in seconds (Data Type: DOUBLE). If the component executes in Time Slice 2 configured for 100 ms, DELTA_TIME evaluates to 0.100.

  • SIMULATION_TIME: Represents the total continuous simulated elapsed time since simulation start in seconds.

  • CYCLE_COUNT: An integer incrementing by 1 on every executed simulation slice step.

By querying DELTA_TIME, mathematical equations automatically scale accurately even if the user speeds up, slows down, or freezes the simulation clock.

Time Slices and Execution Frequencies in SIMIT

SIMIT organizes model execution into up to eight discrete Time Slices:

  • Time Slice 1: High-speed dynamics (typically 10 ms to 20 ms), suitable for fast electrical drives or pressure surges.
  • Time Slice 2: Standard process dynamics (typically 100 ms), matching standard PCS 7 cyclic interrupt OB35.
  • Time Slice 3 to 8: Slow thermal dynamics or mass balancing (typically 500 ms to 2000 ms).

When a CTE component is placed into a simulation chart, its execution time slice dictates the value populated into DELTA_TIME.

Numerical Integration and Differentiation Algorithms in SIMIT CTE

Implementing discrete calculus in CTE is straightforward:

  • Euler Integration (Accumulation):
    Output = Output + Input * DELTA_TIME;
    With upper/lower clamping: Output = MAX(MinLimit, MIN(MaxLimit, Output));

  • First-Order Lag (PT1 Filter):
    Output = Output + (Input - Output) * (DELTA_TIME / TimeConstant);

  • Numerical Differentiation (Rate of Change):
    Derivative = (Input - Previous_Input) / DELTA_TIME;
    Previous_Input = Input;

SIMIT CTE Environment Variables and Execution Characteristic Matrix

The following table summarizes SIMIT CTE environment parameters and their operational specifications:

Variable NameData TypeEngineering UnitsUpdate FrequencyTechnological UsageDELTA_TIMEDOUBLESeconds (s)Every step of assigned Time SliceDiscrete integration, differentiation, velocity calculationsSIMULATION_TIMEDOUBLESeconds (s)Continuous simulation clockTotal elapsed run-time, time-based event schedulingCYCLE_COUNTINTEGERInteger pulsesIncrements every cyclePeriodic sampling, alternating state triggersINITIAL_RUNBOOLEANBoolean flagTrue only on cycle 0Initializing state variables, setting starting temperatures

Step-by-Step Implementation of a Custom Integrator Component

Follow this procedure to build an integrator component in SIMIT CTE:

  1. Launch Component Type Editor: In SIMIT, open CTE from the Tools menu.
  2. Define Interface: Create a new component Custom_Integrator. In the interface table, define:
    - Input In (DOUBLE)
    - Input Reset (BOOLEAN)
    - Output Out (DOUBLE)
    - State Variable Accumulator (DOUBLE)
  3. Write Behavioral Equations: In the Behavior tab, write:
    text if (Reset) { Accumulator = 0.0; } else { Accumulator = Accumulator + In * DELTA_TIME; } Out = Accumulator;
  4. Build Component: Click Build Component. Verify 0 syntax errors.
  5. Instantiate in Simulation Chart: Drag Custom_Integrator onto a SIMIT diagram and assign it to Time Slice 2 (100 ms).
  6. Execute and Validate: Start SIMIT simulation; feed a constant rate of 10.0 and verify Out rises by exactly 10.0 every second.

Verification

Verify component timing accuracy using these steps:

  1. Trend Recording: In SIMIT, attach a Trend recorder to Out and SIMULATION_TIME.
  2. Time Base Audit: Ensure that with an input of 1.0, the accumulator reaches 60.0 after exactly 60 seconds of simulation time.
  3. Slice Independence: Change the component's Time Slice from 100 ms to 50 ms. Confirm that the integration slope remains identical because DELTA_TIME halved automatically.
  4. Freeze / Pause Test: Pause simulation and verify integration ceases instantly without numerical drift.

Limitations and Operational Precautions

Keep these numerical limitations in mind:

  • Division by Zero in Differentiators: Always guard against zero DELTA_TIME during simulation initialization: if (DELTA_TIME > 0.0) { ... }.

  • Euler Integration Instability: For stiff differential equations with very small time constants, simple Euler integration can become unstable if the time slice is too large. Reduce the slice period or use Runge-Kutta formulations.

  • Commercial Accuracy Disclaimer: Software order numbers (MLFBs), package structures, and hardware capacity prerequisites vary across PCS 7 versions and hardware platforms. System integrators must confirm exact software entitlements and licensing requirements against the official Siemens Catalog CA 01 and obtain an authorized Siemens distributor quotation prior to purchasing.

Engineer FAQ

What unit of measurement does DELTA_TIME use in CTE?

DELTA_TIME is strictly evaluated in floating-point seconds (e.g., 0.100 s for 100 ms).

Can CTE components access variables from other components directly?

CTE components communicate via topological connectors and input/output pins, preserving modularity and avoiding memory pointer dependencies.

Is a separate license required to use the Component Type Editor in SIMIT?

Yes. The Component Type Editor (CTE) requires the SIMIT CTE license option or SIMIT Professional/Ultimate package.

Technical References

Related Articles

Related Tags

  • SIMIT
  • Component Type Editor
  • CTE
  • DELTA_TIME
  • Simulation Step
  • Virtual Commissioning
  • Numerical Integration
6 respuestas