Using a model with several sources

Moderators: Frank, paul, Hiwot, Chris, peter

Post Reply
bendesarts
Posts: 49
Joined: Thu Mar 07, 2013 10:10 am

Using a model with several sources

Post by bendesarts » Mon May 05, 2014 10:47 am

Hello,

I often need to test my models with different kind of sources.
As i didn't know how to define a model with several possibilities of sources, i define a model for each source input.
I want to improve my models on that point.

Consequently,

1) how is it possible to define a model with different kind of sources that i can select before simulating ? For example, i would like to have on my model the possibility to select the source that i want for my input (constant source, sinusoidal source or sweep source.

2) Is "SetResetFlipFlop" function can do this function ? Is there a simple example of the libraries showing how one can select one sources among several sources in the same model ?

Thank you for your help.

paul
Posts: 152
Joined: Mon Sep 19, 2005 2:00 pm
Location: Controllab Products B.V.

Re: Using a model with several sources

Post by paul » Tue May 06, 2014 2:48 pm

Thanks for the question.

First of all, all submodels in 20-sim are fully open, so you are free to change the contents of any submodel and save it as your own submodel. This allows you for instance with a switch-case construct, to change profiles during runtime, based on a parameter value or even the value of a signal input.

It is also possible to use a different approach. You can quickly change a submodel in a different manner, without the need to delete it, place a different one, and reconnect it. This is done by making a new implementation of the submodel.

Suppose that you would like to have a submodel with an implementation for a sine wave and a square wave. You could place both submodels on the canvas, and select the sine wave. Then you could use Add Implementation from the right mouse menu on this submodel, and name it something like block wave. Now change the equations (like copy/paste the contents from the block submodel). Now you can quickly change between the original sine wave, and the new block wave submodel using Edit Implementation in the right mouse menu.

Also when you select your submodel and use File -> Save Submodel then you can reuse it quickly in other models as well. When you place it on the canvas, 20-sim will ask you which implementation you would like to have. Note that all implementations are always available in the submodel.

We use this a lot to try out and compare different modeling approaches for a submodel, different control strategies, to include all kind of physical phenomena that can be switched off easily as well (like thermal influences, non-linear saturation effects, etc).

Here's more information on multiple implementations: http://www.20sim.com/webhelp/editor_usi ... ations.php
member 20-sim development team

bendesarts
Posts: 49
Joined: Thu Mar 07, 2013 10:10 am

Re: Using a model with several sources

Post by bendesarts » Thu Jun 12, 2014 5:05 pm

Thank you Paul for these advices. This will be useful for me.

I was able to try the 2 techniques that you have explained me :
- the swith-case solution. I have seen for that point the active suspension example.
- the implementation method thanks to a short example.

Post Reply