function y = odedev(diff,GP0,GPP,h,tspan,x0)
%ODEDEV Calculates the output of a device
% 
% Y = ODEDEV(DIFF,P0,H,TSPAN,X0) calculates the output of the device with
% state equations defined by DIFF and output given by Y=H*X, for input
% contained in structures P0 or PP (possibly along with additional
% parameters used by DIFF). For parallel execution, P0 contains parameters
% that are not specific to each parallel instance, while PP contains
% specific parameters.

%   CBVK Toolbox
%   JHMG, PMSB 2016

global P0 PP;


P0=GP0;
PP=GPP;

options = odeset('RelTol',1e-5,'MaxStep',1e-6);

[~,x] = ode113(eval(['@' diff]),tspan,x0,options);
y = real(h*(x.'));
