saahm Posted April 8, 2021 Report Share Posted April 8, 2021 Hello I started learning SystemC AMS recently, and I am getting familiar with this as it reminds me of using Matlab/Simulink (aside from having to write out my signal flow graph in code, which is fine to me). I tried playing around with LSF models for now to get more familiar. I tried to build a model representing a duffing-oscillator (https://en.wikipedia.org/wiki/Duffing_equation). Now I have trouble building the x(t)^3 term of the differential equation. As far as I understood I cannot simply apply the C++-Multiplication to sca_signal nor can I synthesize a cube (or other operations like square, squareroot, multiplying two or more signals) operation from the few available LSF blocks. Is there a template to write custom LSF blocks to expand the available operations or any other way to accomplish modeling non-linear behavior in ODEs for LSF? I have not found the *.cpp files for the predefined moc yet (only the header that define the classes). Having some more mathematical operations would expand the expressibility of LSF (or more general SystemC AMS in general) models. I appreciate any help and comments that might point me to something i have overlooked maybe. Thanks in advance Quote Link to comment Share on other sites More sharing options...

maehne Posted April 12, 2021 Report Share Posted April 12, 2021 The LSF and ELN MoCs are limited to modeling (switched) linear dynamic behaviour. The underlying solver cannot cope with non-linearity. This limitation was done on purpose to enable higher simulation performance for the abstract models required on system level at the cost of precision. There is no possibility to write your own LSF/ELN primitives. That said, LSF and ELN MoCs offer modulated LSF/ELN primitives (e.g., sca_lsf::sca_tdf::sca_source or sca_lsf::sca_tdf::sca_gain), which parameters are controlled by either a Discrete Event (DE) SystemC signal or a TDF signal. If you want to continuously modify a parameter, I would recommend modulating it through a TDF signal. Be aware that you usually need to considerably oversample your signals, i.e., choose a considerably smaller time step than the speed at which your modulated signal with change to ensure good simulation results, which causes a penalty in simulation performance. The Timed Data Flow (TDF) MoC gives you more modeling freedom also allowing you to define your own primitive TDF modules with arbitrary non-linear behaviour. Since SystemC-AMS 2.0, it is also possible to change the time step used by a cluster of TDF modules for simulation on the fly by overloading the corresponding simulation callbacks. For details, I recommend you to have a look into the SystemC AMS User's Guide and IEEE Std 1666.1-2016. Quote Link to comment Share on other sites More sharing options...

saahm Posted April 13, 2021 Author Report Share Posted April 13, 2021 19 hours ago, maehne said: The LSF and ELN MoCs are limited to modeling (switched) linear dynamic behaviour. The underlying solver cannot cope with non-linearity. This limitation was done on purpose to enable higher simulation performance for the abstract models required on system level at the cost of precision. There is no possibility to write your own LSF/ELN primitives. That said, LSF and ELN MoCs offer modulated LSF/ELN primitives (e.g., sca_lsf::sca_tdf::sca_source or sca_lsf::sca_tdf::sca_gain), which parameters are controlled by either a Discrete Event (DE) SystemC signal or a TDF signal. If you want to continuously modify a parameter, I would recommend modulating it through a TDF signal. Be aware that you usually need to considerably oversample your signals, i.e., choose a considerably smaller time step than the speed at which your modulated signal with change to ensure good simulation results, which causes a penalty in simulation performance. The Timed Data Flow (TDF) MoC gives you more modeling freedom also allowing you to define your own primitive TDF modules with arbitrary non-linear behaviour. Since SystemC-AMS 2.0, it is also possible to change the time step used by a cluster of TDF modules for simulation on the fly by overloading the corresponding simulation callbacks. For details, I recommend you to have a look into the SystemC AMS User's Guide and IEEE Std 1666.1-2016. Thanks for your reply. This answer gives me a good idea what is possible with LSF and ELN then, everything that I can linearize I can have in such models. I might have some further questions. Is there a simulation performance hierarchy for the three modelling abstractions (TDF, LSF, ELN)? If I have some more modelling freedom in TDF, would models based on discretized non-linear differential equations be impacting the simulation performance? I see that there are plently of blocks that allow for s-Domain representations (for TDF and LSF), is the simulation performance similar on LSF and TDF for these? I hope you dont mind these further questions. Thanks Quote Link to comment Share on other sites More sharing options...

maehne Posted April 13, 2021 Report Share Posted April 13, 2021 You are welcome! In general, simulation performance improves with increasing the level of abstraction of your system model. Also the choice of the model(s) of computation, i.e., the solver(s), which execute(s) your model. For DSP applications, the TDF MoC is particularly well suited. The static scheduling employed for calling the processing() member functions of the connected TDF modules in the right order ensures a high performance. Due to its multi-rate capability, it is also easy to, e.g., use coarser time steps for processing the samples in the base band part than for the samples in the HF part of a transceiver model. Inside the TDF modules also Laplace transfer functions and state space equations can be embedded for continuous-time filtering of samples. Each equation system is solved by its own solver instance ensuring optimum performance. On the other hand, LSF and ELN MoCs are best suited to model continuos-time non-conservative and conservative behaviour, respectively. Clusters of connected LSF and ELN primitives will form one equation system, which will be solved by a linear solver. Performance will depend on the size of the equation system and the resulting time constants, which constrain the maximum time step for solving with still acceptable precision. So, prefer LSF for continuous-time signal processing over ELN unless you need to actually model a conservative system with across and through quantities. You can certainly model with TDF non-linear differential equations. Their dynamic properties will usually impose a maximum to the usable time step for simulation. The worst case scenario is that you need to simulate your whole system with a very small time step for the whole simulation duration due to some highly dynamic non-linear behaviour requiring it for convergence in certain operation regions, which are entered relatively seldomly, while in other operation regions a considerably bigger time step would be sufficient. Depending on your system topology, you might be able to optimize overall performance by employing the Dynamic TDF features in such a cluster of TDF modules modeling the non-linear part of your system, which allow to modify the time steps and sample rates on the fly during simulation. However, I would always first try with a simple modelling approach and integrate advanced features only when they are really needed because simulation performance is an actual problem. Quote Link to comment Share on other sites More sharing options...

saahm Posted April 13, 2021 Author Report Share Posted April 13, 2021 Thank you for your answer, that is very elaborate and concise at the same time. Maybe I could have provided some more background on the purpose of these questions, as I planned to model some interaction between physical/electrical systems (usually represented by some ODE or system of ODEs) and some computing system (in SystemC TLM) -- maybe even a sensor abstraction layer. Being able to model some parts of the electro-physical system in System AMS and interconnect them with the TLM model. I thought through SystemC AMS I might be able to easily model the physical and electrical systems similarly to the way in Matlab/Simulink. But as I understood from your answers now, the LSF/ELN provide partial support for these ways of modeling. But being able to build approximate and optimizable versions with TDF (talking about the non-linear DE) it should be more than good enough to generate sensor inputs other than fixed curves or recorded scenarios. Quote Link to comment Share on other sites More sharing options...

maehne Posted April 13, 2021 Report Share Posted April 13, 2021 The application, which you want to model, will certainly profit from using the AMS extensions in the right places. In fact, there have been several attempts to enhance even further the modeling capabilities of the SystemC AMS extensions to more directly support the modeling of multiphysyical systems including non-linear behaviour. It was the topic of my PhD thesis and work continued in the European H-INCEPTION project. Publications regarding SystemC-AMS can be found, e.g., here, here, and here. Also, COSEDA Technologies provides some solutions in their commercial offerings. If you should require further consulting in this area, feel free to contact me directly. Quote Link to comment Share on other sites More sharing options...

saahm Posted April 13, 2021 Author Report Share Posted April 13, 2021 Thank you very much again for your response and these additional links. I will take a look and think the resources will fill the gap in some of my understand around SystemC AMS. In the meantime I also managed to create a small TDF model that contains a simple discretized ODE. That gave me a good initial idea on how to approach using TDF for these purposes. I will play around with that knowledge and see where I land again 🙂 Quote Link to comment Share on other sites More sharing options...

## Recommended Posts

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Note:Your post will require moderator approval before it will be visible.