%% Vehicle Electrical System
% This example shows how to simulate the electrical system of a vehicle 
% using Simulink(R) and Simscape Electrical(TM).

% Copyright 1990-2020 The MathWorks, Inc.

%% 
%
open_system('sldemo_auto_carelec')
%% System Components
%
% The system simulated consists of a few components. The main power source
% is the internal combustion (IC) engine that drives the shaft of the
% alternator. The alternator produces the AC power. The diode trio rectifies
% the AC current generated from the alternator to DC current that is
% applied to the alternator field. The indicator lamp lights when the system
% is turned on and the alternator is not producing power. The rectifier
% bridge converts the AC power into DC power. The smoothing capacitor,
% voltage sensor, battery, and vehicle loads are connected to the DC bus.
%
% The alternator is a three-phase synchronous machine with its field current
% regulated to give control over the DC bus voltage. This is simulated by
% using the Synchronous Machine Round Rotor block.
%
% The three-phase AC output of the alternator is fed into the 6-pulse rectifier
% bridge to give the DC voltage required to charge the car battery and to
% supply the balance of the electrical system of the car.
%

%% Operation of the System
%
% When the IC engine is off, the battery supplies the current to the
% alternator field winding. The indicator lamp is turned on.
%
% When the IC engine runs, the alternator will start to produce voltage and
% the diode trio will conduct and let the current flow to the alternator
% field winding. The indicator lamp is then turned off.
%
% When the DC bus voltage reaches the upper voltage limit (which is 14.5 V in
% the model), the current flowing to the alternator field is bypassed. As a
% result, the DC bus voltage decreases. If it reaches the lower voltage
% limit (which is 13.5 V in the model), the diode trio is reconnected to the
% field winding.
%
bdclose all