MATRIXx

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I set the first output on a procedure block inside a condition block, when a transition occurs?

I create a schema for an automatic control system: all the block in the control are dicrete with the same period. The system model I have to control is also dicrete with a smaller period.
I make the autocode of the control schema and upload it to a control PC (digital control).
Inside the control schema there are some condition blocks: some procedures linked to these condition blocks have another condition block.
During the simulations in matrixx (I use the sim funtion with 'initmode=3' and 'cdelay=1' options) there are some spikes in their outputs if I don't use a trick: the problems turn up when I switch among different control laws inside the condition blocks.
The firs
t outputs of these blocks are wrong (-sqrt(eps)): so I must use the starting value of the inside states (like those of resettable integrators, delays and so on) and force them to outputs by datapathswitch block.
This is a trick. Is there a better way to do this, maybe setting the skew period in the right way?

I'm using Matrixx from less more than a year therefore I'm not an expert: I don't know all the functionality of the tools.

I hope the question is clear, because of my not good english.

Hi,
Francesco
0 Kudos
Message 1 of 2
(6,841 Views)
Francesco,
Maybe a small model that illustrates the issue would be good. I tried to build up a very simple model according to what you described, but with this model I do not see what you describe. I have attached the model. It has a condition block with two procedure blocks, each one just has a integrator. I ran the simulation with:
y=sim("cond",{time=[0:12]',input=[[0:12]'>6,ones([0:12]')],ialg="RK4",cdelay=1,extend=1})

Carl L
National Instruments
www.ni.com/matrixx
0 Kudos
Message 2 of 2
(6,841 Views)