Unit 1 Modeling
Unit 1 Modeling
complex systems and phenomena. They are widely used across various fields, including
engineering, science, economics, and social sciences.
Modeling
Types of Models:
• Physical Models:
• Scale Models: Replicas of objects, like architectural models or prototypes.
• Analog Models: Systems that mimic behavior, such as hydraulic models
representing river flow.
• Conceptual Models:
• Diagrams and Flowcharts: Visual representations like organizational charts
or software design diagrams.
• Theoretical Models: Abstract frameworks describing relationships, such as
supply and demand models.
• Mathematical Models:
• Deterministic Models: Fixed outcomes based on initial conditions, like in
classical mechanics.
• Stochastic Models: Incorporate randomness, used in areas like finance and
population dynamics.
Modeling Process:
Simulation involves using a model to imitate the behavior of a system over time. It allows
for experimentation and analysis without impacting the real world.
Types of Simulations:
Simulation Process:
Applications
• Engineering: Designing and testing systems like bridges, aircraft, and electronics.
• Healthcare: Modeling the spread of diseases, simulating surgeries, and developing
treatment plans.
• Finance: Risk assessment, portfolio optimization, and market behavior analysis.
• Environmental Science: Predicting climate change impacts and managing natural
resources.
• Social Sciences: Studying human behavior, social dynamics, and policy impacts.
Modeling and simulation are powerful tools that help in understanding, predicting, and
optimizing the behavior of complex systems, providing valuable insights and aiding
decision-making processes.
Modeling dynamic systems involves creating representations of systems that change over
time. These systems can be found in various fields, including engineering, biology,
economics, and environmental science. The goal is to understand, predict, and sometimes
control the behavior of the system.
• State Variables:
• These are the variables that represent the system's state at any given time.
For example, in a mechanical system, state variables could include position
and velocity.
• Input Variables:
• Inputs are external factors that affect the system. In an electrical circuit,
inputs could be voltage sources.
• Output Variables:
• Outputs are the variables that are of interest and can be measured from the
system. For a heating system, the output might be the temperature of a
room.
• Parameters:
• Parameters are constants that define the system's behavior. These could
include physical constants like resistance in an electrical circuit or growth
rates in population models.
• Dynamics:
• Dynamics refer to the rules or equations that describe how the state
variables evolve over time. These rules are often given by differential or
difference equations.
• Deterministic Models:
• These models provide a precise prediction given initial conditions and
inputs. They are often described by ordinary differential equations (ODEs) or
partial differential equations (PDEs).
• Stochastic Models:
• These models incorporate randomness and uncertainty. They are often
described by stochastic differential equations (SDEs).
• Discrete Models:
• These models describe systems that change at discrete time intervals and
are often represented by difference equations.
• Continuous Models:
• These models describe systems that change continuously over time and are
represented by differential equations.
Steps in Modeling Dynamic Systems
• Engineering:
• Design and analysis of control systems, mechanical systems, electrical
circuits, and aerospace systems.
• Biology and Medicine:
• Modeling population dynamics, disease spread, and physiological
processes.
• Economics:
• Analyzing market dynamics, economic growth, and financial systems.
• Environmental Science:
• Predicting climate change impacts, managing natural resources, and
modeling ecological systems.
Example: Modeling a Simple Harmonic Oscillator
A classic example of a dynamic system is the simple harmonic oscillator, such as a mass-
spring system.
Modeling dynamic systems is essential for understanding and predicting the behavior of
complex systems over time, enabling better decision-making and system design.
MATLAB is a powerful simulation tool widely used in various fields, including engineering,
science, economics, and finance. It provides an extensive range of capabilities for
modeling, simulating, and analyzing dynamic systems. Here are some key features and
uses of MATLAB as a simulation tool:
• Mathematical Functions:
• MATLAB offers a comprehensive library of mathematical functions for linear
algebra, statistics, Fourier analysis, filtering, optimization, and numerical
integration.
• Visualization:
• Powerful plotting functions for 2D and 3D graphics help visualize data and
simulation results.
• Simulink:
• Simulink is a graphical environment for modeling and simulating dynamic
systems. It allows users to build block diagrams, integrate with MATLAB, and
use a wide range of pre-built blocks for different applications.
• Toolboxes:
• MATLAB provides specialized toolboxes for different applications, such as
Control System Toolbox, Signal Processing Toolbox, Optimization Toolbox,
and more.
• Interfacing with Hardware:
• MATLAB supports interfacing with hardware for real-time simulation and
testing.
• Ease of Use:
• MATLAB's high-level language and interactive environment make it easy to
use for both beginners and advanced users.
• Integration:
• Seamless integration between MATLAB and Simulink allows for combined
scripting and graphical modeling.
• Extensive Documentation and Support:
• MATLAB provides extensive documentation, tutorials, and community
support, making it easier to learn and troubleshoot.
• Versatility:
• MATLAB's wide range of functions and toolboxes make it suitable for various
applications, from simple calculations to complex simulations.
% Parameters
g = 9.81; % acceleration due to gravity (m/s^2)
L = 1; % length of the pendulum (m)
theta0 = pi/4; % initial angle (rad)
omega0 = 0; % initial angular velocity (rad/s)
% Time span
tspan = [0 10];
% Differential equation
pendulumODE = @(t, y) [y(2); -(g/L)*sin(y(1))];
% Initial conditions
initial_conditions = [theta0; omega0];
Bond graph modeling is a powerful method used to represent and analyze the dynamics of
physical systems. It is particularly useful for systems that involve multiple energy domains,
such as mechanical, electrical, hydraulic, and thermal systems. The bond graph approach
provides a unified framework to model and simulate the energy exchange within these
systems.
• Energy Domains:
• Bond graphs can represent various physical domains, including mechanical
(translational and rotational), electrical, hydraulic, and thermal systems.
• Power Variables:
• Power is the product of two variables: effort and flow.
• Effort: Represents forces such as voltage, force, pressure, and temperature
difference.
• Flow: Represents rates such as current, velocity, volumetric flow rate, and
heat flow rate.
• Bonds:
• Bonds are lines connecting different components in a bond graph,
representing the flow of power. Each bond carries two power variables: effort
(e) and flow (f).
• Basic Elements:
• 0-Junction (Common Effort): Represents a node where the effort is the
same across all connected bonds, but the flows sum to zero.
• 1-Junction (Common Flow): Represents a node where the flow is the same
across all connected bonds, but the efforts sum to zero.
• C (Capacitor): Stores energy and represents elements like capacitors,
springs, and accumulators.
• I (Inductor): Stores energy and represents elements like inductors, masses,
and inertias.
• R (Resistor): Dissipates energy and represents elements like resistors,
dampers, and friction.
• Se (Effort Source): Provides a specified effort, such as a voltage source or a
force.
• Sf (Flow Source): Provides a specified flow, such as a current source or a
velocity source.
• TF (Transformer): Converts effort and flow variables while preserving power,
representing gear ratios or electrical transformers.
• GY (Gyrator): Converts effort to flow and vice versa, representing elements
like motors and generators.
• System Analysis:
• Identify the different energy domains involved and the components that
interact within the system.
• Define Power Variables:
• Determine the appropriate effort and flow variables for each component and
energy domain.
• Construct the Bond Graph:
• Use bonds to connect the components, representing the flow of power.
Apply the appropriate basic elements (0-junctions, 1-junctions, C, I, R, etc.)
to construct the graph.
• Assign Causality:
• Determine the direction of causality (the cause-effect relationship) for each
bond. This helps in deriving the system's differential equations.
• Derive System Equations:
• Using the bond graph, derive the mathematical equations that govern the
system's behavior.
• Simulate and Analyze:
• Implement the model in a simulation tool, such as MATLAB/Simulink, to
simulate and analyze the system's dynamic behavior.
In bond graph modeling, causality is explicitly represented by assigning causal strokes (or
causality marks) to bonds. These marks indicate the direction of power flow and the
dependent and independent variables in the system. Proper causality assignment is
essential for deriving the correct system equations.
The derived differential equations can be solved using analytical methods for simple
systems or numerical methods for more complex systems.
Analytical Solutions:
For simple linear systems, analytical solutions can be found using standard techniques
such as:
• Separation of Variables
• Laplace Transforms
• Characteristic Equations
Numerical Solutions:
For more complex or nonlinear systems, numerical methods are typically used:
• Euler’s Method
• Runge-Kutta Methods
• Finite Difference Methods