• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

subroutine in adams

  • Thread starter Thread starter Dani84
  • Start date Start date

Dani84

Guest
Hello everyone,
I'm an engineering student and I'm using adams to create impact patterns between two solid bodies.
what I would like to do is to insert different types of contact through a subroutine, but I can't come out of it: how do you put in a model of force from me created?
thanks for the attention, greetings

 
Hello, dani84,

can you use user written subroutines like vfosub (also vtosub possibly)?

I don't understand what you want to do specifically, but usually with this you can define forces (contacts generate forces) that your subroutine calculates as best you think.

Hi.

 
first of all thanks for the answer.
the vfosub I have already used it, the disadvantage is that I can not control the generated force: the strength between the two bodies should cease at the time when the same are detached, but I do not know how to set this condition (I should insert a "if" in the formula but I did not understand how to do again).
In fact, I went to use simulink to create impact models, because I know how to handle myself better.
If I wanted to suggest how to control the force, I'd be grateful.
I also used the application control (the interface for matlab) of adams view, but with little results.
Thank you.
 
Hello, dani84,

to switch to 0 the force, in addition to using if, which can create instability given the discontinuity of the function, I recommend you to use the impact function.

But if you ask me these questions, I don't understand why you use subroutines.

for controls, what do I mean poor results? did the simulink tutorial?
What is not clear?

Hi.

 
the impact function I used it, but it uses a formulation to calculate the damping that I don't like.
what I want to do in adams would be to insert a force model created by me, for example the hertzdamp model that uses a nonlinear spring and damp, whose function is well different from that implemented by adams.
I hope I explained.
 
Hello, dani84,

I would say that with vfosub you should have no problem, but have you tried more simply to use forces with functions in which you use splines, to characterize not linearly what you want?

in any case you can use the impact function even with arguments that are not linear, otherwise use the if functions, I recommend only to verify the continuity of such functions, at least on the independent variable, better also on its first derivative, great if you can give continuity even to the secondary derivative.
otherwise you may have convergence problems, which however through the solver phase, you could solve (also sensors, local balances etc.), because physically maybe it is not exactly what happens in nature.

Hi.

 
I bring back the simple case of straight impact between 2 spheres:
1 ball firmly and bound along the impact axis;
ball 2 bound along the axis and with initial speed different from zero;
impact modeled as a simple spring: f=k*x (x=penetration, k= contact stiffness).

syntax inserted in function, at the time when I change force (single force applied to 2 bodies):






question: how do I insert the if in function condition, which is the syntax to use?

other thing: with the impact function in this case I would have no problem (I put the damping equal to zero and I am in place). However, in case you want to add the depreciation contribution, but by calculating it differently from how it does adams, I would only use the "single force" function mentioned at the beginning. the problem arises when the bodies that impat are not regular: in this case as I define penetration (in the case of 2 spheres it was simple: pongo x=dx(ball mass center 1, sphere mass center 2)-r1-r2, with r1 and r2 the rays of the 2 spheres)?
 
Hello, dani84,

the function to do what you want is simply:

if(x:0,0,k*x)

see the help to understand.

If the solids are not regular, you must use the contact function, which according to the geometries you use, calculates the center of the compnetrated surface or the compnetrated volume, its projection on the edge or surface of the solid interconnector (to identify the direction of the contact forces), then the compnetration itself, the velocity of compnetration and therefore all falls into the impact function.
you can also use this function, simply to calculate the geometric contact parameters (baricentre, speed, derection) and use them in a different force function.

I suggest you use the support once you have defined the function you want.

Hi.

 
Thank you for your answers and patience.
the point is that I don't know how to change the force: where should I go?
I create contact between the two bodies, open "modify contact", and then?
as you see I miss the basics: I don't know how to change the impact function to my liking.
 
Let's put the case that he's using an applied force at one point.
apro "modify force".define using" > subroutine... and in "routine" > sosub (to try)....all don't go...where is the error?
He says he doesn't find the blush...
 
Sorry, dani84.

but if you want to use subroutines, did you create and link the subroutine you developed (in fortran or c++)?

I suggest you read the help. you find a whole chapter, within the adams/solver manual that talks about subroutines, what they are, how they are created and used and a lot of examples (from which I recommend you to leave after you understand what they are).

Hi.

 
Hi.
I tried to carefully follow the help online.
the problem is that I am losing a lot of time due to errors due to the compiler (perhaps the compiler I have is not okay).
If you still want to create my function with the use of the "function builder", which is much simpler, when I call the "impact" function I have to insert the position and speed variable.
the question is: how do I insert these 2 variables if in my case objects that scare are not regular?
the "dm" function that calculates the distance between 2 markers would not be good in this case because I could not indicate the impact points that reside on the surfaces of the respective objects.

Thanks again
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top