Than you !  Radu 

在2024年3月20日星期三 UTC+8 21:48:25<Radu Serban> 写道:

> Yupeng – you can do this by implementing your own custom force callback 
> for a ChLinkTSDA. 
>
> See demo_MBS_spring.cpp 
> <https://github.com/projectchrono/chrono/blob/aad5e16bf2c585fca6d00655879bba3c550a9c9e/src/demos/mbs/demo_MBS_spring.cpp#L57>
>  
> which illustrates the use of such a callback mechanism.  While that example 
> is very simple and for demonstration only, you can implement whatever 
> function you want for the force produced by the spring. Within the 
> Evaluate() function, you have access to the ChLinkTSDA element itself which 
> means you can access the current positions of the connected bodies and use 
> that in the force evaluation if you so desire.
>
>  
>
> --Radu
>
>  
>
> *From:* 'Yupeng Duan' via ProjectChrono <[email protected]> 
> *Sent:* Wednesday, March 20, 2024 2:18 PM
> *To:* ProjectChrono <[email protected]>
> *Subject:* [chrono] How to set a spring whose stiffness changes with 
> body's displacement
>
>  
>
> Hi 
>
> I am a beginer in using ProjectChrono, I want to calculate a body with a 
> spring linked with the ground but the stiffness changes with the 
> displacement of the body. I tryed give a if() i during the runtime ,but it 
> seems nothing has changed, what should I do for this purpose.
>
>  
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "ProjectChrono" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/projectchrono/0de81a94-f565-4993-bf28-9853a53571c1n%40googlegroups.com
>  
> <https://urldefense.com/v3/__https:/groups.google.com/d/msgid/projectchrono/0de81a94-f565-4993-bf28-9853a53571c1n*40googlegroups.com?utm_medium=email&utm_source=footer__;JQ!!Mak6IKo!NBkSFrWmlAAPg-xoaBVErDHmki5R00tSKi_2t3jbHlQh76lcbf6qIgnRaXTJ0JjwSiL0TSwi864ChkYhIj7OMBAskqg$>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/cbbbc151-791a-4b7d-921d-46c1d0c19372n%40googlegroups.com.

Reply via email to