Something is odd.clearance max (0.9) and clearance min (0.522) are supposed to be constant throughout my simulation, so they should be straight lines, which they are. The strange thing is when plotting them, the y axis are much larger than they need to be.
I am using Julia 1.4.2 and Plots.jl and all my other graphs look normal. Is it possible to have non-recorded (invisible) values of clearance max and clearance min that confuse Julia (now I sound like a conspiracy theorist)? This occurs even if I restart Julia and it is the first plot I make.
I can’t provide a MWE but I suspect the problem may lie with this nested part of my differential equation. Even though it is designed to prevent the clearance rate from going over clearance max, it still does.
if clearance_V_type == 4
if (revenue - cost_F) > 0.0
limit = clearance_max
effect = abs(max(0.0, (limit - clearance_V)))
else
limit = clearance_min
effect = abs(min(0.0, (limit - clearance_V)))
end
dB[num_nutrient+num_plant+num_animal+num_vessel_types+1] = 365.25*µ*(revenue - cost_F)*effect
clearance_V = bioS[num_nutrient+num_plant+num_animal+num_vessel_types+1]
global db_clearance = dB[num_nutrient+num_plant+num_animal+num_vessel_types+1] # this is global because unfortunately I need it in the global scope so I can save the value
end
