Hi Andras,
There a couple of options here. Since it seems you want to fully move your setup to System Modeler, you can relay on CreateSystemModel and CreateDataSystemModel to create models from your equations and data, respectively. To see this, let's pick this information from your notebook:
qtab = Import[FileNameJoin[{NotebookDirectory[], "SourceIntensity.xlsx"}], {"Data", 1}];
t12 = 23.1481 ;
t21 = 5.4537 ;
t23 = 9.752 ;
t32 = 14.9007 ;
t34 = 8.8235 ;
t43 = 363.7255 ;
odesys = {
D[l1[t], t] == (l2[t]/t21) - (l1[t]/t12),(*L1*)
D[l2[t], t] == (l1[t]/t12) - (l2[t]/t21) + (l3[t]/t32) - (l2[t]/t23) + u[t],(*L2*)
D[l3[t], t] == (l2[t]/t23) - (l3[t]/t32) + (l4[t]/t43) - (l3[t]/t34),(*L3*)
D[l4[t], t] == (l3[t]/t34) - (l4[t]/t43),(*L4*)
l1[0] == 2500.,
l2[0] == 589.,
l3[0] == 900.,
l4[0] == 37100. (*Initial conditions.*)
};
, where I have only modified your system of equations odesys replacing qinterp[t] for a generic input u[t]. Now you can do:
CreateDataSystemModel["SourceIntensity", qtab]
to directly pick your data and create a model with the name "SourceIntensity" that performs an interpolation of your data. Then you can do
CreateSystemModel["LinearSystem", odesys, t, {"u" \[Element] "RealInput"}]
to create a model with the name "LinearSystem" from your linear system, specifying that u is an input. Finally, with
ConnectSystemModelComponents["ConnectedSystem", {"si" \[Element] "SourceIntensity", "ln" \[Element] "LinearSystem"}, {"si.y[1]" \[UndirectedEdge] "ln.u"}]
you create a model called "ConnectedSystem" that connects the model with interpolated data to the model with the system of equations. These 3 models are now available in System Modeler for you to simulate, save or interact with them.
You can simulate and plot in the Wolfram Language to check that your results match your expectations:
sim = SystemModelSimulate["ConnectedSystem", 400];
SystemModelPlot[sim, {"ln.u"}]
SystemModelPlot[sim, {"ln.l1", "ln.l2", "ln.l3", "ln.l4"}]
You can use the same plot formatting specifications that you have in your notebook in SystemModelPlot, to match your preffered style:
SystemModelPlot[sim, {"ln.u"}, PlotStyle -> Magenta ,
PlotLabel -> "Source" , Frame -> True ,
FrameLabel -> { "Elapsed time" , "Source" } ,
PlotRange -> { 0. , 22. } , GridLines -> Automatic,
ImageSize -> Large ]
SystemModelPlot[sim, {"ln.l1", "ln.l2", "ln.l3", "ln.l4"},
PlotLabel -> "All Four Compartments" , Frame -> True ,
FrameLabel -> { "Elapsed time" , "L1, L2, L3, L4" } ,
GridLines -> Automatic,
PlotLegends -> { "L1" , "L2" , "L3" , "L4" } ,
PlotStyle -> { Red , Green , Blue , Black } , ImageSize -> Large ]