James
unread,Sep 17, 2014, 11:04:06 AM9/17/14You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hi guys I am attempting to model a very simple fuel tank with a pump taking fuel out at a constant rate in Simscape with custom components. The volume in each tank is calculated at each time step with a table lookup of height volume tables which are taken from the geometry of the tank, here I am simply using a cube geometry, so depending on what height the fuel is, the lookup table will give the volume of fuel for that height. When I run the simscape model I receive the error "Number of equations exceeds the number of variables". My code for the components are below;
component HVTable
nodes
Q=TRIAL.domainFuel; %Q:right
end
parameters (Size=variable)
InitialVolume = {20000,'l'}; %Initial Tank Volume
Height = {[0,500,1000,1500,2000,2500,3000,3500,4000,4500,5000],'mm'}; %Fuel Height
Volume = {[0,12500,25000,37500,50000,62500,75000,87500,100000,112500,125000],'l'}; %Fuel Volume
end
outputs
h = {0,'mm'}; %h:left
end
variables
V = {0,'l'};
flow_out={0,'l/s'};
end
function setup
V=InitialVolume;
through(flow_out,Q.Q_jet,[]);
end
equations
V.der == -flow_out;
h == tablelookup(Volume,Height,V,interpolation=linear);
end
end
component BayAMBA
parameters
V={1000,'l'}; % Initial Fuel Volume
TankSize={8000,'l'}; % Tank Size
end
parameters (Size=variable)
Volume = {[1, 2, 4, 8, 10],'l'};
Height = {[0.1, 0.2, 0.4, 0.8, 1],'mm'};
end
nodes
I=TRIAL.domainFuel; % I:left
O=TRIAL.domainFuel; % O:right
end
inputs
H={0,'mm'}; %H:left
end
variables
VolumeFluid={0,'l'};
VolumeUll={0,'l'};
P={0,'Pa'};
end
function setup
if V<0
error ('Volume cannot be negative.')
end
if TankSize<V
error ('Fuel Volume cannot exceed Tank Size.')
end
across(P,I.P,[]);
across(P,O.P,[]);
end
equations
VolumeFluid==tablelookup(Height,Volume,H,interpolation=linear,extrapolation=nearest);
VolumeUll==TankSize-VolumeFluid;
P==0;
end
end
component FixedRate_Pump
nodes
T = TRIAL.domainFuel; % T:left
X = TRIAL.domainFuel; % X:right
end
parameters
commanded_pump_rate = {0.7, 'l/s'}; % Source flow rate
end
variables
P={0,'Pa'};
flow_rate={0,'l/s'}; %flow rate
end
function setup
across(P, T.P, X.P);
through(flow_rate, T.Q_jet, X.Q_jet);
end
equations
flow_rate == commanded_pump_rate;
end
end
Can anyone give me help to find what may be causing this error? Any comments would be greatly appreciated.