I am learning to debug the modelica model in dymola, I could see that dymola divides all the equations into different groups. For example, in the dslog.txt file, there is information about the iteration variables used to solve 7th equation set, but where could I find the equations used in the 7th group?
Here is the setting I used currently
Check the dsmodel.mof file, which Dymola creates when the corresponding translation flag is activated in the simulation setup window:
Now you will get the file dsmodel.mof in your working directory. This file contains the horizontally and vertically sorted equations. If nonlinear systems of equations occur, you find them grouped in that file, along with a tag, which should correspond to the system of equation number.
Related
I tried getting out the BLT matrix of the Modelica>Thermal>Fluidflow>Onemass using the bltmatrixdump flag.
I see the BLT matrix with two axes. Equations and Variables. Equations are numbered 1 to 35 and also variables.
But I am not able to find out the actual variable name from the numbers.
I tried looking at the OneMass_info.json file but the number of variables and equations there are much higher than the BLT matrix and somehow the numbers do not match with the numbers found on the BLT matrix.
is there any way to fish out only those equations and variables shown in the BLT matrix?
I would suggest to use the Transformational Debugger from OMEdit to analyze the matching instead. In the Variables Browser you can select model variables and see in which equation the variable is defined. So the information is the same as in the BLT dump, but actually readable. I'm not sure if the indices correspond to the html dump produced by -d=bltmatrixdump.
If you need something machine readable it is also possible to parse the MODELNAME_info.json yourself. That is basically what the Debugger is doing.
If you really need the BLT matrix itself you can use debug flag
-d=dumpeqninorder to get the equations in order and which variable is solved in that equation.
If I build a model in Dymola, but in translation, there is a warning about incompatible units of equations, but just according to the warning message, I can't find which components that the wrong equations belong to. So how could I find it in Dymola?
I agree that Dymola should include more information about equations in unit-checking.
However, we can see that:
It doesn't seem to be in a function, as it is an equation for a derivative.
It doesn't seem to be in heatExchangerFixedTemperature as all variables do not start with that prefix (unless T_amb is a package constant). It would thus seem that the equation is directly in the current model, or in one of its base-classes.
I am relatively new to writing my own code for Matlab though I have used the program a decent amount. Right now I am attempting to code a series of first order non-linear differential equations. They are all in one of two forms like the equations here:
Eventually I will need a set of 30 differential equations.
What I was hoping to do was create a function that could make the differential equation for each component of a certain form, combine them into a single system (essentially a matrix with 1 column and a row for each component), and then solve using a Matlab solver like ODE45, the dsolve function, or something like that to solve the system.
I have not yet found a way to make a function set up this large of a system that works with either dsolve or ODE45. The results always either gave me an empty sym or an error that the initial conditions were not compatible with the system or some other error. So what I am wondering is if there is another way to go about setting up a system that is this large and has nonlinear differential equations.
I do not want someone else's code; I just want an idea for how to go about setting this up in Matlab because nothing I have tried has worked so far.
Inputs in my multibody model are road unevennes as function of distance the model is working fine for time simulation but when I linearize the system, then i get error saying no inputs or outputs defined.As In the picture:
https://drive.google.com/file/d/0B8AmxzbhEQ_FczFuaDNhQjlqVUE/view?usp=sharing
I defined combitable as a input and parameter then I get the error:
Translation of TRyViertalMbsa:
Component type specifier CombiTimeTable is a block, this cannot be combined with the prefix input .
Component declared as CombiTimeTable combiTimeTable in Modelica.Blocks.Sources
Conflicting causality for combiTimeTable (input ) and its element y(output )
How can I define inputs and outputs for the state spac system?
I think the problem is that you are asking Dymola to linearize the model including the boundary values (the input time series). What you really want is to linearize the model only and let Dymola perturbate the inputs in order to determine the linear model. See example model:
https://drive.google.com/file/d/0B8ojPn4YxnI9a1FFa0ozY2tlT1U/view?usp=sharing
So, you must replace the two CombiTimeTable with two input connectors (Modelica.Blocks.Interfaces.RealInput).
Also, you would probably want to add one or more output connectors (Modelica.Blocks.Interfaces.RealInput) via mechanical sensors - angle, position or whatever.
Operating points
If you want to linearize your model around a specific operating point different from zero, you should add these (constant) values to the inputs and subtract them from your outputs. I don't know if there is a smarter way to handle the operating points in Dymola's linearization function.
Best regards
Rene Just Nielsen
I have know that the ode45 solver has adaptive step size controlled by Matlab program itself. The description below is given by Matlab website:
Specifying tspan with more than two elements does not affect the internal time steps that >the solver uses to traverse the interval from tspan(1) to tspan(end). All solvers in the ODE >suite obtain output values by means of continuous extensions of the basic formulas. Although >a solver does not necessarily step precisely to a time point specified in tspan, the >solutions produced at the specified time points are of the same order of accuracy as the >solutions computed at the internal time points.
However, if I specify very_small_step in tspan=[to:very_small_step:tf], will this affect program controlled step size. Will this force step size less than the value of very_small_step? OR matlab will make interpolation calculation to get the corresponding result at specified time point?
From your quote
Specifying tspan with more than two elements does not affect the internal time steps
Also there exists the MaxStep property to configure the maximum step size.
For steps in between the solvers use continuous extension formulas as described here.
Why are you asking anyway? What problem do you encounter?