Hand in assignment 4

This task is not mandatory but gives points for higher grades.

Downloads

If limitations are in some of the components in model are not fulfilled the simulation stops. To get information about if the simulation is completed or not, the following code may be added in your model at ‘File -> Model Proerties -> Callbacks -> Stop function’ (it is allready included in OrdinaryVehicle.mdl):

if t(end)==str2num(get_param(char(bdroot(gcb)),'StopTime'))
msgbox('Simulation completed.')
elseif exist('engine_limit') && engine_limit(end)==1
msgbox('Simulation aborted due to limitation in the engine.','','error')
elseif exist('em_limit') && em_limit(end)==1
msgbox('Simulation aborted due to limitation in the electric machine.','','error')
elseif exist('gen_limit') && gen_limit(end)==1
msgbox('Simulation aborted due to limitation in the generator.','','error')
elseif exist('sc_limit') && sc_limit(end)==1
msgbox('Simulation aborted due to limitation in the super capacitor.','','error')
elseif exist('batt_limit') && batt_limit(end)==1
msgbox('Simulation aborted due to limitation in the battery.','','error')
else
msgbox('Simulation aborted due to limitation in one of the components.','','error')
end

FAQ