Open Niimaa opened 3 years ago
Hi there, seems like the step function code in the tutorial has some mistakes as it gives me the following error:
ModelException: Invalid control function for var: 0. Control functions should be of the form: 0 = f(t, x, dx/dt)
from BondGraphTools import * #%% model = new(name= 'RC') #%% C = new("C", value= 1) R = new("R", value= 1) KCL = new("0") #%% add(model, R, C, KCL) connect(R, KCL) connect(KCL, C) #%% Sf = new("Sf") add(model, Sf) connect(Sf, KCL) draw(model) #%% timespan = [0, 5] x0 = {'x_0':1} step_fn = {'u_0': 't < 1 ? 1 : 0'} # if t < 0 then 1 else 0 t, x = simulate(model, timespan=timespan, x0=x0, control_vars= step_fn) plot(t,x)
Thanks
Hi there, seems like the step function code in the tutorial has some mistakes as it gives me the following error:
ModelException: Invalid control function for var: 0. Control functions should be of the form: 0 = f(t, x, dx/dt)
Thanks