From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Edit Simulink transfer function using Simulation Interface Toolkit

Hello

 

I am testing the LV Simulation Interface Toolkit and I want to edit a transfer function from a Simulink model.

 

Mapping a control (scalar) to the nominator or the denominator works, but anything else having a higher order fails.

 

How can I change the denominator of a transfer function to "3s+1" (corresponding to the following array: [3 1] ) from the LabView Front Panel ?

 

Thanks

0 Kudos
Message 1 of 8
(3,051 Views)

I noticed that Numeric Arrays work, but Simulink gets the string as [3 ; 1] instead of [3 1]

 

I also noticed that when I set a value from a control, it is represented in Simulink with trailing zeros (eg. 3.00000000...0), even though I set the representation to 8-bit unsigned.

 

How can these issues be solved?

 

 

0 Kudos
Message 2 of 8
(3,018 Views)

Hi George,

 

Have you tried using a matrix instead of a numeric array. I think this will give you the functionality you're looking for if you use a matrix row to represent the coefficients of the numerator or denominator.

 

As for the trailing zeroes, I'm not sure that there's a solution for that. What problems are you running into because of the trailing zeroes?

Message 3 of 8
(2,989 Views)

Thanks Alisha, the Real Matrix works, but a 2-D Array also works. I didn't notice any issue with the trailing zeros besides the aesthetic one.

 

If I wanted to edit the transfer function's numerator programmatically (generated by a Sine Wave vi), how could this be done using the 2-D Array or Real Matrix ?

I tried to update the local variable of the array outside that auto-generated loop, but the code doesn't seem to execute.

0 Kudos
Message 4 of 8
(2,983 Views)

ok - a 2d array is probably better then a matrix actually.

 

As long as you're not interfering with code in the auto-generated loop, you should be good to do programmatic edits outside the loop using either local variables or the Value property node (just be aware that both these options are a little on the slow side and this isn't exactly what the toolkit was designed to do). The trick here is making sure the code runs at the correct time to be useful. You'd probably want to run it in a loop of it's own. What are these coefficients dependent on? (a hardware input, a user input, etc?)

0 Kudos
Message 5 of 8
(2,980 Views)

The coefficients should be generated continuously by the Sine Waveform vi, but 100 updates per second should be fine.

0 Kudos
Message 6 of 8
(2,978 Views)

I just did some experimentation with this concept. You'll need to use the Value(Signaling) property node rather then the Value property node (or local variable). Otherwise, the control on the front panel changes but it doesn't send the new data to simulink.

 

You'll have to benchmark the speeds. This really isn't quite the right use case for the toolkit so it might be a little rough.

Message 7 of 8
(2,974 Views)

The local variable method doesn't seem to update the values on the simulink model.

What it works though is the Value Signaling Property Node, as the control value change event is handled by the auto-generated Event Structure, case <Param Ctl Refs> : Value Change.

 

upd: i was one minute late :d

0 Kudos
Message 8 of 8
(2,973 Views)