Interpolation in Modeling Toolkit

Hello everyone,
I’m gradually getting into the Julia ecosystem and I find it fascinating. I’m experimenting with developing models using ModelingToolkit.jl and I’ve come across a challenge that I haven’t been able to solve. I would like to create a system that, based on the simulation time, outputs data according to values stored in a CSV file.

The documentation shows how to do this using an interpolation block via functions, but I’m wondering if the same can be achieved using the @mtkmodel ecosystem.

I’m attaching a diagram of the model I want to implement (which currently isn’t working) to see if anyone could help me figure it out.

#datos.value and datos.time are columns of a dataframe.
begin

	@mtkmodel CSVSource begin
		@parameters begin
		data=datos.value
		time=datos.time
		end
		@components begin
			clock = ContinuousClock(offset = 0, start_time = 0)
			inter = Interpolation(LinearInterpolation, u= data , x = time)
			transfer = TransferFunction(b=[1 2], a=[1 3 2])
		end
		@equations begin
			connect(clock.output,inter.input)
			connect(inter.output,transfer.input)
		end
	end

	
end

Best regards.

@SebastianM-C

The issue here is that the model macro does not currently support positional arguments. I’ll try to define a fallback that’s compatible with the macro, but that makes it harder (or impossible) to pass both an arbitrary number of positional and keyword arguments to the underlying interpolation.