Cancel
Showing results for 
Search instead for 
Did you mean: 

variable global Parameters?

Experimenter
Experimenter

Hi everybody,

I have a problem with the global parameters.

I'm using the TR1DVEH01A submodel to simulate my vehicle's speed and acceleration.

In the submodel I have to set the rolling resistance coefficient. I have done this with a global parameter. But now I have the problem, that this rolling resistance coefficient changes during the simulation because my vehicle drives on different grounds.

I can't change the submodel, I only want to change the rolling resistance coefficient as a function of time.

Is there any possibility to change a global parameter during the simulation?
Or has anybody an idea how I can solve my problem?

 

Thank you in advance!

 

Greets

 

Pultibus

7 REPLIES

Re: variable global Parameters?

Experimenter
Experimenter

for better understanding I attach a picture of the submodel

Re: variable global Parameters?

Siemens Phenom Siemens Phenom
Siemens Phenom
Hi @Pultibus,

A way to vary this parameter with time is to drive its value with an input port instead of the real parameter as it is today (which, here, is constant for the whole simulation).
This means that you have to open this submodel with Ameset, add a signal input port for the rolling friction and remove the existing real parameter. If you tell me which version of Amesim you are using I can do this for you.

Re: variable global Parameters?

Experimenter
Experimenter

Hi Emmanuel,

this would be great.

 

I'm using version 14.2 (50706-45698) 2015.

 

Thank you very much for your help!

 

 

Re: variable global Parameters?

Siemens Phenom Siemens Phenom
Siemens Phenom

Here you go. I have created a mini library which contains the modified vehicle. Port 8 allows you to drive the rolling resistance externally so you can now change its value dynamically. I quickly checked that it behaved correctly.

Unpack the archive in a location you will remember, something  like an Amelib folder.

Then in Amesim add this path to your category path list (Modeling/Category path list...) so you can see the new vehicle. You can also change its default black colour with Tools/Options/Color preferences...

Re: variable global Parameters?

Experimenter
Experimenter

Thank you very much! 

It works just like I want it.

 

Did you write some information in C-code just like it is said in the ameset help?
Or are this changes possible without changing the C-code.

If it is possible in an easy way, I would like to change the mass parameter as well like you did it.

Re: variable global Parameters?

Siemens Phenom Siemens Phenom
Siemens Phenom

You're welcome, I'm glad it's useful.
There was a minor change in the c code; by deleting the original real parameter (Rroll) and creating the new input (also named Rroll) I just had to change any reference to Rroll in the original code into *Rroll in the new one (Rroll is now an input to the function instead of being a local parameter). So, it's not that difficult code-wise, it's more tedious to change the component icon and its ports to be honest!

For the mass, theoretically you should be careful as the rate of mass change should also be taken into account in some equations. I suppose you wouldn't really care and just apply new mass at specific instants.
Same modification in the code: change mvehi into *mvehi when used in expression.

I attach the updated library, feel free to private message me for the c code of submodel.

Re: variable global Parameters?

Experimenter
Experimenter

It's really usefull!

 

I checked the new submodel and it works as well, thank you very much!

 

I tried to look at the c-code but I can't find the right one.

 

But because everything works, it doesn't matter...