implementation of two different time domain

6 views (last 30 days)
Problem:
  • two different time domain where I have sample and hold and, unit delay, and Ccaller code which automatically use a specific time domain and not the one from the "system";
  • for "sample and hold" is quite easy: exist a triggerable sample and hold, but not for unit delay and if I place an "m-function" or a Ccaller with a specific time samplig it is synchronized to the system time.
  • I am not talking about creating two different sampling time, but creating two "countinuos time" with nested a sampling time.
  • In the matter of fact I would like to recrated the "local" time of two different processors with slidly different clock.
Any ideas?
Thanks in advance
  4 Comments
Davide
Davide on 25 Aug 2025
Concerning Simscape, with hydrostatic systems (only fundamental; the more complex devices like three ways valves have been built by coding in simscape ssc) the time step for backward euler was ts = 1e-3... but I am talking about device with 24000kg of mass... so "outer" dynamics was aroung 1Hz. Accuracy was quinte fine once compressibility of the fluid had been well managed... again: adding state variables the simulation getting faster and in particular more accurate.
Yifeng Tang
Yifeng Tang on 26 Aug 2025
Indeed, fluid systems (hydraulic, thermal liquid, gas, etc.) usually operates at much lower frequencies than power electronics, or they only need to be simulated at such lower frequencies. If you are able to separate the model into two separate Simscape networks, two local solvers at different time steps should work fine.

Sign in to comment.

Accepted Answer

Ayush
Ayush on 2 Sep 2025
Hi Davide,
I understand you are trying to simulate two subsystems in Simulink/Simscape, each with its own local continuous time base, like modelling two processors with slightly different clocks. Here are some possible workarounds:
  • Atomic Subsystems: By making a subsystem atomic, you can assign it a specific sample time that is different from the rest of the model. This allows you to run certain parts of your model (such as control algorithms) at a unique and fixed rate, independent of the global simulation step size.
  • Model Reference with Local Solver: Using Model Reference blocks, you can encapsulate each subsystem as a separate referenced model and assign a local solver (continuous or discrete) to each one. This enables each referenced model to operate with its own solver settings and time base, providing true independence between subsystems.
  • Simscape Local Solvers: In Simscape, independent physical networks can each be assigned their own local solver settings, including different integration methods and step sizes. This is particularly useful when you have physical subsystems (e.g., electrical and hydraulic) that require different simulation time steps due to their dynamics.
Helpful Documentation:
  1. For subsystem/atomic subsystem: Sample Time in Systems and Subsystems - MATLAB & Simulink
  2. For referenced models: Use Local Solvers in Referenced Models - MATLAB & Simulink
Hope this helps clarify your options.

More Answers (0)

Categories

Find more on Simscape Electrical in Help Center and File Exchange

Products


Release

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!