  # Mr Alfabet

Members

13

• #### Days Won

1

Mr Alfabet had the most liked content!

• Gender
Not Telling

## Mr Alfabet's Achievements 1

### Reputation

1. Basically the question stated in the title, I'm particularly interested in: Does the solver make smaller steps internally than the TDF module time step? If so: are these steps fixed (like 1/100th of the TDF module time step) or variable? Is there a way to find out how many steps the solver actually did? What kind of solver algorithm is used? If anyone has an answer to one of these questions or can point me to a document that answers them, please tell me. I was not able to find this information in the LRM or through Google.
2. I think I need a small timestep before the change, not after. Also, the changes are not scheduled, so I can't do a small timestep before the change.
3. The problem I'm running into can be explained by the following simple example: I have a SystemC module sending a speed over a signal to a TDF module that integrates that speed to get a position (with sca_ss). The SystemC module will send out a speed of v=1 at t=0,1,2,3, then it will start sending out a speed of v=0 after that (t=4,5,6,.....). Now the TDF module will calculate the correct position for the first few seconds: t=0 ---> x=0 t=1 ---> x=1 t=2 ---> x=2 t=3 ---> x=3 but after that, the TDF module will interpolate the value for the speed between t=3 and t=4, and thus result in x=3.5 for t=4 (where v=0). I realize I can circumvent this by setting very small timesteps, and setting the speed v=1 at t=3.999, but I was wondering if there is a less 'hacky' way of doing this. (Also setting small time steps will drastically slow down my simulation.) I'm trying to compare the SystemC-AMS output to the output from the same model in MATLAB, which does not have this problem, and the difference is way off due to this.
4. I've tried simply assigning values to the variables instead of calling a SS equation, but I got results that made no sense at all. variables kept drifting away or had a completely different value right after 'resetting' the state variable.
5. I'm modelling a heating system with objects (paper sheets actually) moving in and out of the system. While in the system I want the objects' temperature and position to be governed by a (or multiple) state space equation. When the objects leave the system I'd like the equations to be disabled so that they are not taking up computing time. However, the internal state variable seems to be computed at every activation of the module. What I have right now: sca_tdf::sca_ss paper_pos_ss[paper_array_size], paper_temp_ss[paper_array_size]; // state-space equation sca_util::sca_matrix<double> zero, a_pos, b_pos, c_pos, d_pos, a_temp, b_temp, c_temp, d_temp; // state-space matrices sca_util::sca_vector<double> pos_int[paper_array_size], temp_int[paper_array_size]; // state vector for ( int i = 0; i < paper_array_size; i++) { // If the paper is not on the path, keep variables constant if (pos_int[i](0) < 0.0) { v(0) = 0.0; paper_position[i] = paper_pos_ss[i](zero, zero, zero, zero, pos_int[i], v); x(0) = 0.0; x(1) = 0.0; x(2) = 0.0; paper_temp[i] = paper_temp_ss[i](zero, zero, zero, zero, temp_int[i], x); }else // If the paper is on the path, calculate position and temperature with the DE's {// Read speed and calculate position v(0) = v_in.read();paper_position[i] = paper_pos_ss[i](a_pos, b_pos, c_pos, d_pos, pos_int[i], v); // Construct input vector x(0) = T_ttb_in.read(); x(1) = T_ph_in.read(); x(2) = T_hx_in.read(); x(3) = T_amb; // Calculate temperature paper_temp[i] = paper_temp_ss[i](a_temp, b_temp, c_temp, d_temp, temp_int[i], x); // Check if the paper has left the paper path if (pos_int[i](0) > path_size + paper_width) { // Reset position and temperature if paper has left the paper path pos_int[i](0) = -1.0; paper_position[i] = paper_pos_ss[i](zero, zero, zero, zero, pos_int[i], v); paper_out = true; temp_int[i](0) = 0.0; paper_temp[i] = paper_temp_ss[i](zero, zero, zero, zero, temp_int[i], x); }} I created the part where the temperature and position are governed by the state space equation with 'zero' matrices to prevent the internal state variable from 'drifting away' due to the equation still being active in the background it seems. Is there a way to dynamically create state space equations as objects enter the system or at least a way to halt calculation while I don't need it to update? I hope I've been able to explain myself enough. If not, please ask. Marijn
7. I reduced my timestep to 1 second, and now it seems to compile. Apparently the delay I put on the cyclic dependency (1) was too small for this timestep.
8. I'm not using dynamic TDF. I have a timestep of 2.0 seconds. I believe I'm using version 1.0, the download link for version 2.0 beta 2 results in a 404 error, and i had some problems installing version 2.0 beta1. Maybe I better try that first. I've been trying to recreate the problem with a small example, but it doesn't result in the same error. I'll post back when I've got more.
9. I'm getting this error when I'm trying to compile: + msg 0x0098ce50 "The current timestep becomes zero due the time distance between the time reached by the last execution has been reached the time of the current module activation (see LRM) for: pp_1.sca_ss_0 ltf time ... char * This refers to the LRM for explanation, but I can't seem to find any. Can someone point me in the right direction what I should be looking at to solve this problem? From what I understand from the error message itself: The module is activated twice in the same point in simulation time, causing my state space equations to go haywire due to a timestep of 0. Am I correct in thinking this? A bit of background: I have two modules with state space equation systems depending on each other. I solved a previous 'unschedulable' problem by using void set_attributes() { T_out.set_delay(1); } in one of the modules. equation for module 1: dA/dt = f(A, equation for module 2: dB/dt = f(A,
10. Isn't there something like onSignalChange for TDF?
11. I suspect the answer is quite simple, but I can't seem to figure it out: I have a TDF module that calculates the position of an array of elements with state space equations. I want to create an 'element generator' module that sends a signal to the 'calculation module' that a new element has arrived every 5 seconds'. How do I go about doing that? I've come up with the following, but it seems a difficult way to do something simple: The generator module sends 'true' through a boolean port for 1 second every 5 seconds (i've made this with a sine signal), the calculator module picks it up, and if no elements have been created in the last second, it adds one. Could someone point me in the correct direction to do this the correct/easy way? regards, Marijn
12. Thank you for the explanation. I'll be trying to implement it with TDF in state space form. I've been having some problems with the syntax, but I'll try to figure it out on my own before asking stupid questions
13. I'm new to SystemC and AMS, so please forgive me for any stupid questions. I'm trying to get started in SystemC AMS by modeling a heat flow example i came up with. From what I've learned so far by reading the manual is that it's best to use LSF for this purpose. Am I correct in thinking this? Reason why I think LSF is most suitable: I want to use ODE to calculate the temperature of objects: dT/dt = c*P - k*(T - Toutside), where c is a constant, P is added heat [Watt], T is temperature of the object and Toutside is the outside temperature. P and Toutside would be signals coming into the module. Apart from the question of "Is LSF best"; would it be possible to model something like this (with integrators and the like) in TDF? I haven't been able to find any functions in the TDF set that would be able to model this, but I might be wrong. Kind regards, Marijn
×