UNIT 5: SIMULATION & MODELING – SHORT NOTES
1. Fundamentals of Simulation and Modeling
Simulation is the process of creating a computational model of a real-world system and experimenting with it to understand its behavior or evaluate strategies.
Purpose & Need:
-
Analyze complex systems where analytical solutions are infeasible.
-
Test "what-if" scenarios without disrupting real operations.
-
Train personnel in risk-free virtual environments.
-
Optimize performance (e.g., reduce wait times, increase throughput).
Simulation Process Steps:
-
Problem Identification: Define objectives and system boundaries.
-
Model Formulation: Develop conceptual/logical model.
-
Data Collection: Gather input data (arrival rates, service times).
-
Model Translation: Code the model in software (e.g., Arena, SimPy).
-
Verification & Validation: Ensure model is built correctly & accurately represents reality.
-
Experimentation: Run simulations, analyze output.
-
Documentation: Report findings and recommendations.
[!TIP] Exam Focus: The 7-step process flow is a very common 7-mark question. Memorize the sequence.
Types of Simulation:
| Type | Basis | Example |
|---|---|---|
| Continuous | State changes continuously over time. | Simulating fluid dynamics, temperature change. |
| Discrete-Event | State changes at distinct points in time (events). | Bank queue, manufacturing line. |
| Analog | Uses physical models (scale models). | Wind tunnel for aircraft design. |
| Digital | Uses computer-based mathematical models. | Any software-based simulation. |
System Classification:
-
Stochastic: Contains random variables (e.g., customer arrival times).
-
Deterministic: No randomness; outcomes are predictable.
-
Static: Time is not a factor (e.g., Monte Carlo integration).
-
Dynamic: Behavior changes over time (most simulations).
-
Linear: Output proportional to input.
-
Nonlinear: Output not proportional to input (most real systems).
Limitations:
-
High computational cost for complex models.
-
Model complexity can lead to difficulty in interpretation.
-
Input data may be uncertain or scarce ("garbage in, garbage out").
-
Results are statistical estimates, not exact predictions.
2. Probability and Statistics for Simulation
Random Variables (RVs):
-
Discrete RV: Takes countable values (e.g., number of customers).
-
Bernoulli: Single trial (success=1, fail=0). $$\displaystyle P(X=1)=p $$.
-
Binomial: $n$ independent Bernoulli trials. $$\displaystyle P(X=k) = \binom{n}{k} p^k (1-p)^{n-k} $$.
Mean: $$\displaystyle \mu = np $$, Variance: $$\displaystyle \sigma^2 = np(1-p) $$.
-
-
Continuous RV: Takes any value in an interval (e.g., service time).
-
Uniform: $$\displaystyle P(a \le X \le b) = \frac{1}{b-a} $$. PDF: $$\displaystyle f(x)=\frac{1}{b-a} $$.
-
Exponential: Models inter-arrival/service times. PDF: $$\displaystyle f(x)=\lambda e^{-\lambda x} $$, CDF: $$\displaystyle F(x)=1-e^{-\lambda x} $$. Mean: $1/\lambda$.
-
Normal: Bell curve. PDF: $$\displaystyle f(x)=\frac{1}{\sigma\sqrt{2\pi}} e^{-\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2} $$. Standard Normal: $Z \sim N(0,1)$.
-
Key Distributions for Queues:
-
Poisson Distribution: Models number of events in fixed interval.
PMF: $$\displaystyle P(X=k) = \frac{e^{-\lambda} \lambda^k}{k!} $$.
Mean = Variance = $\lambda$.
Property: If inter-arrival times are exponential with rate $\lambda$, then the number of arrivals in time $t$ follows Poisson($\lambda t$).
Binomial Approximation by Poisson:
When $n$ is large and $p$ is small such that $$\displaystyle \lambda = np $$ is moderate (typically $$\displaystyle n>20, p<0.05, np<5 $$), $Bin(n,p) \approx Pois(\lambda)$.
Density Function (PDF) vs. Cumulative Distribution Function (CDF):
-
PDF ($f(x)$): Height gives relative likelihood; area under curve = 1. $$\displaystyle P(a \le X \le b) = \int_a^b f(x)dx $$.
-
CDF ($F(x)$): $$\displaystyle F(x) = P(X \le x) $$. Non-decreasing, $$\displaystyle F(-\infty)=0 $$, $$\displaystyle F(\infty)=1 $$. $$\displaystyle f(x) = \frac{d}{dx}F(x) $$.
Stochastic Process & Variables:
-
Stochastic Process: Collection of random variables indexed by time (e.g., number of customers in queue at time $t$, $Q(t)$).
-
Stochastic Variable: A single RV whose value is determined by chance.
Arrival Patterns:
-
Poisson Arrivals: Number of arrivals in interval $t$ ~ Poisson($\lambda t$). Implies exponential inter-arrival times with mean $1/\lambda$. Memoryless property.
-
Non-Poisson: Could be scheduled, batch arrivals, or general distributions.
Sampling Techniques for Input Data:
| Technique | Method | Use Case |
|---|---|---|
| Simple Random | Every item has equal chance. | Small, homogeneous populations. |
| Stratified | Divide population into strata, sample each. | Improve precision for known subgroups. |
| Systematic | Select every $$\displaystyle k^{th} $$ item. | Easy to implement, ordered lists. |
Data Cleaning for Simulation Input:
-
Handle missing values: Imputation (mean/median), deletion, or model as separate state.
-
Detect and treat outliers: Using box plots, z-scores ($$\displaystyle |z|>3 $$), or domain knowledge.
-
Ensure consistency (e.g., service time cannot be negative).
3. Queuing Theory and Simulation
Queuing System Components ( Kendall Notation A/B/c : K/N/D ):
-
A (Arrival Process): Distribution of inter-arrival times (M=Markovian/Exponential, D=Deterministic, G=General).
-
B (Service Time): Distribution of service times (M, D, G).
-
c (Servers): Number of parallel servers.
-
K (System Capacity): Max number of customers in system (queue+service). $\infty$ if unlimited.
-
N (Population Size): Size of calling population (finite/infinite).
-
D (Queue Discipline): FIFO (FCFS), LIFO, Priority, SIRO.
Example: M/M/1: Poisson arrivals, exponential service, 1 server, infinite capacity/population, FIFO.
Characteristics (Birth-Death Process):
-
Birth rate ($$\displaystyle \lambda_n $$): Arrival rate when $n$ customers in system. For Poisson, $$\displaystyle \lambda_n = \lambda $$ (constant).
-
Death rate ($$\displaystyle \mu_n $$): Service completion rate. For $c$ servers, $$\displaystyle \mu_n = n\mu $$ if $n \le c$, else $c\mu$.
-
Steady-State: Exists if arrival rate < total service rate ($$\displaystyle \rho = \lambda/(c\mu) < 1 $$).
Common Models:
-
M/M/1: $$\displaystyle L = \frac{\rho}{1-\rho} $$, $$\displaystyle W = \frac{1}{\mu-\lambda} $$, $$\displaystyle L_q = \frac{\rho^2}{1-\rho} $$, $$\displaystyle W_q = \frac{\rho}{\mu-\lambda} $$.
Where $L$=avg # in system, $$\displaystyle L_q $$=avg # in queue, $W$=avg time in system, $$\displaystyle W_q $$=avg wait in queue, $\rho$=utilization.
-
M/M/c: More complex formulas; use Erlang C formula for $$\displaystyle W_q $$.
Simulation of Queuing Systems (Event-Scheduling Approach):
-
Initialize: Clock=0, schedule first arrival.
-
Event Routine:
-
ARRIVAL: Schedule next arrival. If server free, start service (schedule departure); else join queue.
-
DEPARTURE: If queue not empty, remove first customer, start service (schedule next departure).
-
-
Advance Clock: To time of next scheduled event.
-
Terminate: After specified time or number of customers.
-
Collect Statistics: Avg. wait, server utilization, max queue length.
[!TIP] Exam Focus: Be prepared to trace a single-server queue simulation for a given sequence of inter-arrival/service times. Draw a timeline table.
Applications: Telephony, computer networks, manufacturing, customer service centers, traffic lights.
4. Model Development and Analysis
Verification vs. Validation:
| Verification | Validation |
|---|---|
| "Building the model right" | "Building the right model" |
| Is the model implemented correctly? | Does the model accurately represent reality? |
| Techniques: Code walkthrough, debugging, testing sub-models. | Techniques: Face validity (expert review), sensitivity analysis, historical validation (compare with past data), calibration. |
Model Calibration & Testing:
-
Calibration: Adjust model parameters to match real-world data.
-
Testing: Use extreme input values to check for unreasonable outputs (sanity checks).
Input Data Analysis:
-
Collection: Identify source (historical records, interviews, experiments).
-
Distribution Identification: Use histograms, Q-Q plots, goodness-of-fit tests (Chi-square, KS test).
-
Transformation: If data doesn't fit standard distributions, use transformations or empirical distributions.
Output Analysis:
- Terminating Simulations: Run multiple independent replications. Use confidence intervals for mean performance measure.
$$CI = \bar{X} \pm t_{\alpha/2, n-1} \frac{S}{\sqrt{n}}$$
where $\bar{X}$=mean of replication means, $S$=std dev of replication means, $n$=number of replications.
- Steady-State Simulations: Use batch means method. Ensure sufficient warm-up period (initial transient).
Determining Simulation Run Length:
-
Terminating: Fixed simulation end time or number of customers.
-
Steady-State: Run until relative error of output mean is below threshold, or until confidence interval width stabilizes.
5. Simulation in Big Data Analytics
Big Data 3Vs:
-
Volume: Massive scale (TB, PB). Challenge: Storage & processing.
-
Variety: Structured, semi-structured (XML), unstructured (text, images, video). Challenge: Integration & analysis.
-
Velocity: High-speed generation/need for processing (real-time streams). Challenge: Low-latency analysis.
Big Data Challenges: Storage, processing, analytics, security, talent gap.
Analytics Lifecycle: Capture → Store → Process/Analyze → Visualize → Act.
Data Cleaning & Sampling for Big Data:
-
Cleaning: Handle noise, inconsistency, missing values at scale (using MapReduce/Spark).
-
Sampling: Crucial for exploratory analysis. Techniques:
-
Random Sampling: Simple random from huge dataset.
-
Stratified Sampling: Maintain proportion of key subgroups.
-
Reservoir Sampling: For streaming data where total size unknown.
-
Classification Techniques:
-
Decision Trees:
-
Algorithms: ID3 (entropy), C4.5 (gain ratio), CART (Gini index).
-
Splitting Criteria:
-
Entropy: $$\displaystyle H(S) = -\sum p_i \log_2 p_i $$. Information Gain = $$\displaystyle H(S) - \sum \frac{|S_v|}{|S|} H(S_v) $$.
-
Gini Index: $$\displaystyle Gini(S) = 1 - \sum p_i^2 $$. Choose split minimizing weighted Gini.
-
-
Pruning: To avoid overfitting (pre/post-pruning).
-
-
Naive Bayes Classification:
Based on Bayes' Theorem with conditional independence assumption.
$$P(Y|X_1,...,X_n) \propto P(Y) \prod_{i=1}^n P(X_i|Y)$$
Predict class $Y$ with highest posterior probability.
**Laplace Smoothing:** Add-1 smoothing to handle zero probabilities.
$$P(X_i|Y) = \frac{count(X_i, Y) + 1}{count(Y) + |V|}$$
where $|V|$ is number of possible values for $$\displaystyle X_i $$.
Association Rule Mining:
-
Measures:
-
Support: $P(A \cup B)$. Fraction of transactions containing both.
-
Confidence: $$\displaystyle P(B|A) = \frac{support(A \cup B)}{support(A)} $$.
-
Lift: $$\displaystyle \frac{confidence(A \rightarrow B)}{support(B)} $$. >1 indicates positive correlation.
-
-
Algorithms:
-
Apriori: Uses "downward closure" (all subsets of frequent itemset must be frequent). Candidate generation & pruning.
-
FP-Growth: Uses frequent pattern tree (FP-tree) without candidate generation. Faster.
-
-
Applications: Market basket analysis, recommendation systems, cross-selling.
Hadoop Ecosystem:
-
HDFS Architecture:
-
NameNode: Master; manages metadata (file names, permissions, block locations).
-
DataNode: Slave; stores actual data blocks, serves read/write requests.
-
Files split into blocks (default 128MB), replicated (default 3).
-
-
MapReduce Programming Model:
-
Map: Processes input key-value pairs, emits intermediate key-value pairs.
-
Shuffle & Sort: Groups all values for same intermediate key.
-
Reduce: Aggregates values for each key, emits final output.
Example: WordCount.
Map: (docID, text) → (word, 1) Reduce: (word, [1,1,...]) → (word, sum) -
-
YARN: Yet Another Resource Negotiator. Separates resource management (RM) from job scheduling (AM). Enables multiple processing engines (MapReduce, Spark).
Hive:
-
Architecture: HiveServer2 (JDBC/ODBC interface), Metastore (schema storage), HDFS (storage). Compiles HiveQL to MapReduce/Tez/Spark jobs.
-
HiveQL vs SQL: HiveQL is declarative, operates on HDFS, has limited ACID, schema-on-read. SQL is on relational DBs, schema-on-write.
-
User-Defined Functions (UDFs):
-
Write Java class extending
UDForUDFTF. -
Implement
evaluate()method. -
Package into JAR, add to Hive session (
ADD JAR). -
Create temporary/permanent function (
CREATE TEMPORARY FUNCTION). -
Use in HiveQL queries.
-
Pig:
-
Architecture: Pig Latin script → Parser → Logical Plan → Logical Optimizer → Physical Plan → Physical Optimizer → MapReduce/Tez.
-
Pig Latin Scripting:
A = LOAD 'data' USING PigStorage(',') AS (x:int, y:chararray); B = FILTER A BY x > 10; C = GROUP B BY y; D = FOREACH C GENERATE group, COUNT(B); STORE D INTO 'output' USING PigStorage('\t'); -
Data Flow: Script → Logical Plan (data flow graph) → Physical Plan (execution on cluster).
R Programming for Data Analysis:
-
Features: Open-source, extensive packages (
ggplot2,dplyr), vectorized operations (fast), powerful graphics. -
R Environment:
-
Console: Interactive command line.
-
Workspace: Current objects (
.RData). -
Packages: Collections of functions (from CRAN/Bioconductor).
-
CRAN: Comprehensive R Archive Network.
-
-
Vector Operations:
-
Indexing:
x[1],x[c(1,3)],x[-2],x[x>5]. -
Arithmetic: Element-wise (
x+y,x*2). -
Recycling Rule: Shorter vector recycled to match longer (e.g.,
1:4 + 1:2→(1+1,2+2,3+1,4+2)). -
Subsetting: Logical (
x[x>0]), character (x[c("a","b")]).
-
6. Simulation in Cloud Computing
Cloud Service Models:
| Model | Provides | Example |
|---|---|---|
| IaaS | Virtualized compute, storage, network. | AWS EC2, Azure VMs. |
| PaaS | Runtime, dev tools, DB management. | Google App Engine, Heroku. |
| SaaS | Complete applications over internet. | Gmail, Salesforce. |
Essential Characteristics of PaaS:
-
Built-in runtime environment (e.g., Java, Python, Node.js).
-
Development, testing, deployment tools.
-
Integrated database services (SQL/NoSQL).
-
Auto-scaling, load balancing, middleware.
-
Example Problem Solved: Rapid web/mobile app development without managing OS/servers.
Virtualization in Cloud:
-
Hypervisor (VMM):
-
Type 1 (Bare-metal): Runs directly on hardware (e.g., VMware ESXi, Microsoft Hyper-V, Xen).
-
Type 2 (Hosted): Runs on OS (e.g., VirtualBox, VMware Workstation).
-
-
Azure VMs: Uses Hyper-V. Scale Sets: Group of identical VMs with auto-scaling rules.
MapReduce in Cloud: Implemented in Google App Engine (now Dataflow for stream/batch), AWS EMR (Elastic MapReduce).
Cloud Security Challenges:
-
Data breaches.
-
Account hijacking.
-
Insecure APIs.
-
Shared technology vulnerabilities (hypervisor, multi-tenancy).
-
Denial-of-service attacks.
-
Malicious insiders.
Cloud Security Architecture (Layered):
[Application Layer] → Encryption, IAM, AppSec
[Host Layer] → HIDS, VM hardening
[Network Layer] → Firewalls, VPNs, IDS/IPS
[Physical Layer] → Biometrics, surveillance
-
Encryption: Data-at-rest (AES), in-transit (TLS/SSL).
-
IAM (Identity & Access Mgmt): Centralized user/authz (e.g., AWS IAM, Azure AD).
Quality of Service (QoS) in Cloud:
-
Parameters: Response time, throughput, availability (%), reliability (MTBF), scalability.
-
Example: For a web app, SLA may guarantee 99.9% availability and <200ms response time for 95% of requests.
Cloud Platforms:
-
Google App Engine (GAE):
-
Features: Autoscaling, managed runtimes (Java, Python, Go, PHP), traffic splitting (A/B testing), no-ops maintenance.
-
Use Cases: Web apps, mobile backends, APIs.
-
-
Eucalyptus:
-
Features: AWS-compatible API (EC2, S3, IAM). Can run on commodity hardware.
-
Modes: Node (single machine), Cluster (multiple nodes), Cloud (multiple clusters).
-
-
AWS S3 / Azure Blob: Object storage (unstructured data), REST API, high durability.
Deployment Models:
| Feature | Public Cloud | Community Cloud |
|---|---|---|
| Ownership | Third-party provider (AWS, Azure). | Shared by specific community (govt, universities). |
| Access | General public. | Restricted to community members. |
| Cost | Pay-as-you-go (OpEx). | Shared cost among members. |
| Security | Provider-managed, multi-tenant. | More control, often compliant with community standards. |
Trusted Cloud Computing:
-
Trust Models: Establish trust between cloud user and provider (e.g., via SLAs, attestation).
-
SLAs (Service Level Agreements): Legally binding performance guarantees (uptime, support).
-
Auditing: Third-party verification of compliance (security, privacy).
Elastic Computing:
-
Auto-scaling: Dynamically adjust compute resources (VMs, containers) based on metrics (CPU load, request rate).
-
Example: AWS Auto Scaling Groups, Azure Scale Sets.
Cloud for Social Networking:
- Advantages: Elastic scalability for viral growth, cost-effective (no upfront CapEx), global reach via CDNs, rapid deployment of new features.
7. Simulation in Augmented and Virtual Reality
Virtual Reality (VR) Fundamentals:
-
Definition: Immersive, interactive, computer-generated 3D environment.
-
Components:
-
HMD (Head-Mounted Display): Stereoscopic screens, lenses.
-
Tracking System: 6-DOF (position + orientation) tracking (optical, inertial, magnetic).
-
Input Devices: Controllers, gloves, motion capture.
-
Rendering PC: High-performance GPU for low-latency rendering.
-
-
How VR Works (Immersion Loop):
-
User Action (head movement, controller input).
-
Tracking captures motion.
-
Rendering updates view from new perspective.
-
Display shows updated scene on HMD.
-
Repeat at >90 FPS to avoid cybersickness.
-
Augmented Reality (AR) Methods:
-
Marker-Based (Fiducial): Uses visual markers (QR codes, ARTags). Camera detects marker, calculates pose, overlays virtual content.
-
Marker-Less:
-
Sensor-Based: Uses GPS, compass, accelerometer (e.g., smartphone AR maps).
-
Vision-Based (SLAM): Simultaneous Localization and Mapping. Builds map of environment & tracks camera position within it (e.g., Microsoft HoloLens).
-
AR vs VR:
| Feature | AR | VR |
|---|---|---|
| Environment | Real world + virtual overlay. | Purely virtual. |
| Immersion | Low; user aware of real world. | High; user isolated from real world. |
| Hardware | Often smartphones/tablets, see-through HMDs. | Opaque HMDs. |
| Example | Pokémon GO, Microsoft HoloLens. | Oculus Quest, HTC Vive. |
Stereo Technology:
-
Hardware:
-
HMDs: Separate screen for each eye with lenses.
-
Shutter Glasses: Active; LCD lenses alternate opacity synced with monitor refresh.
-
Polarized Projectors: Passive; two projectors with orthogonal polarization, screen preserves polarization.
-
Autostereoscopic: No glasses needed (e.g., Nintendo 3DS, lenticular lenses).
-
-
Software:
-
Stereoscopic Rendering: Render scene twice from slightly offset camera positions (inter-pupillary distance).
-
Depth Perception Algorithms: Calculate disparity maps, adjust convergence.
-
Geometric Modeling for VR:
-
Wireframe: Only edges/vertices. Fast, but no surface.
-
Surface (Mesh): Vertices + faces (polygons). Standard for real-time.
-
Solid: Includes volume. Used for engineering, not real-time VR.
-
3D Formats: OBJ (geometry/materials), FBX (animation), glTF (runtime, "JPEG of 3D").
Real-Time Computer Graphics Pipeline:
-
Vertex Processing: Transform vertices (model → world → view → projection). Apply vertex shaders.
-
Primitive Assembly: Group vertices into triangles/lines.
-
Rasterization: Convert primitives to fragments (potential pixels).
-
Fragment Processing: Apply fragment shaders (texturing, lighting). Output to framebuffer.
-
Techniques:
-
LOD (Level of Detail): Use simpler models for distant objects.
-
Occlusion Culling: Don't render objects hidden behind others.
-
Shading Models: Flat, Gouraud, Phong.
-
Interpolation & Translation in Virtual Environments:
-
Interpolation (Smooth Animation):
-
Linear: $$\displaystyle P(t) = (1-t)P_0 + tP_1 $$. Simple, constant velocity.
-
Spline (Cubic, B-spline): Smooth curves through control points. $$\displaystyle C^1 $$ or $$\displaystyle C^2 $$ continuity.
-
Polynomial (Hermite, Bezier): Defined by points and tangents.
-
-
Translation (Movement):
-
Object Movement: Update object's position/orientation matrix.
-
Camera Motion: Update view matrix (fly-through, first-person).
-
Smooth Path Following: Interpolate along pre-defined spline path.
-
Simulation Types in VR:
-
Behavior-Based: Rule-driven agents (FSM - Finite State Machines), AI (pathfinding, decision trees). "What should happen?"
-
Physics-Based: Simulate physical laws (rigid body dynamics, soft body deformation, fluid dynamics). "How does it move?" Uses engines (PhysX, Bullet).
Collision Detection:
-
Algorithms:
-
Bounding Volume: Simple shapes around objects.
-
AABB (Axis-Aligned Bounding Box): Fast, axis-aligned.
-
Bounding Sphere: Rotation invariant, but looser fit.
-
-
Spatial Partitioning: Divide space to reduce checks.
- Octrees (3D), BSP Trees (Binary Space Partition).
-
-
Integration in VR System:
-
Broad Phase: Use spatial partitioning/AABB to find potential collisions.
-
Narrow Phase: Precise test (triangle-triangle, distance) on candidates.
-
Response: Apply physics (bounce, stop) or trigger events (sound, animation).
-
VR Toolkits & Frameworks:
-
Features: Cross-platform (PC, mobile, web), input handling, physics integration, networking (multi-user), asset pipeline.
-
Examples:
-
Unity (C#): Popular, asset store, easy prototyping.
-
Unreal Engine (C++/Blueprint): High-fidelity graphics.
-
OpenVR / OpenXR: Vendor-neutral APIs for HMD/input.
-
WebXR: JavaScript API for browser-based VR/AR.
-
VRML (Virtual Reality Modeling Language):
-
Purpose: 3D scene description for web (precursor to X3D).
-
Basic Concepts:
-
Nodes:
Shape(geometry + appearance),Transform(position/rotation/scale),Group. -
Prototypes: Define reusable custom nodes.
-
Scripts: Add animation/logic via JavaScript/VRMLScript.
-
Routes: Connect event outputs to inputs (e.g.,
position_changed→set_translation).
-
Acoustic Hardware in VR:
-
3D Audio Systems:
-
HRTF (Head-Related Transfer Function): Filters sound based on direction relative to head. Simulates elevation/distance.
-
Surround Sound: Multiple speakers around user.
-
Bone Conduction: Vibrate skull, bypassing ear canal (e.g., for military).
-
-
Devices: Headphones (most common), speaker arrays, bone conduction transducers.
Radiosity:
-
Theory: Global illumination method. Simulates diffuse light inter-reflection between surfaces. Based on energy conservation.
-
Key Concept: Form Factor ($$\displaystyle F_{ij} $$): Fraction of light leaving surface $i$ that arrives directly at surface $j$. Depends on geometry, visibility.
-
Algorithms:
-
Progressive Refinement: Solve most significant form factors first.
-
Shooting Method: For each "shooting" (emitter) patch, distribute energy to all receiving patches.
-
-
Applications: Realistic lighting in architectural visualization, VR walkthroughs. Computationally expensive, often pre-computed.
Applications of VR:
-
Digital Entertainment: Immersive games, cinematic VR, theme park rides.
-
Training & Simulation:
-
Flight Simulators: Pilot training, aircraft design.
-
Medical Surgery: Practice procedures, surgical planning.
-
Military: Combat training, vehicle operation.
-
Marker-Less Tracking in AR:
-
Techniques:
-
Inertial Measurement (IMU): Accelerometer, gyroscope for head/hand tracking (drift over time).
-
Visual Odometry: Track features between video frames to estimate camera motion.
-
Feature Matching: Detect & match keypoints (SIFT, SURF, ORB) between current frame and known map.
-
-
Challenges:
-
Drift: Accumulated error in IMU/visual tracking.
-
Occlusion: Tracking lost when features obscured.
-
Lighting Changes: Affects feature detection.
-
8. Advanced Simulation Techniques and Applications
AI Techniques in Simulation:
-
Neural Networks / Surrogate Modeling:
-
Train NN on input-output data from expensive simulation.
-
Use trained NN as fast surrogate model for optimization or real-time control.
-
-
Fuzzy Logic:
-
Handle vague inputs (e.g., "high traffic", "fast service").
-
Define fuzzy sets & rules (IF arrival_rate IS high THEN servers IS increase).
-
Defuzzify output (e.g., centroid method) for control actions.
-
-
Expert Systems:
-
Encode human expert knowledge as IF-THEN rules.
-
Used within simulation for decision-making (e.g., dispatch rules in manufacturing).
-
Pure Pursuit Problem:
-
Context: Path tracking for autonomous vehicles/robots.
-
Algorithm:
-
Define look-ahead distance $$\displaystyle L_d $$.
-
Find look-ahead point on desired path at distance $$\displaystyle L_d $$ ahead of vehicle.
-
Calculate curvature needed to reach that point: $$\displaystyle \kappa = \frac{2 \cdot y_{lap}}{L_d^2} $$.
-
Convert curvature to steering angle $$\displaystyle \delta = \arctan(\kappa \cdot L) $$, where $L$ is wheelbase.
-
-
Simulation Use: Test path following controllers under different $$\displaystyle L_d $$ values, vehicle dynamics.
Simulation of Classification Languages:
-
Integrate machine learning classifiers (decision trees, SVM) inside simulation models.
-
Example: In a manufacturing simulation, use a trained classifier to dynamically assign jobs to machines based on real-time features (job type, machine load, due date).
-
Flow: Simulation state → feature vector → classifier → decision (e.g., routing) → update simulation.
Differential Equations in Continuous Simulation:
-
ODEs (Ordinary Differential Equations): Model system dynamics where state derivatives depend on state/time.
$$\displaystyle \frac{d\mathbf{x}}{dt} = \mathbf{f}(\mathbf{x}, t, \mathbf{u}) $$
where $\mathbf{x}$=state vector, $\mathbf{u}$=input/control.
-
Solving Methods:
-
Euler's Method (Explicit): $$\displaystyle x_{n+1} = x_n + h \cdot f(x_n, t_n) $$. Simple, but conditionally stable.
-
Runge-Kutta 4th Order (RK4):
$$\displaystyle k_1 = h f(t_n, x_n) $$
$$\displaystyle k_2 = h f(t_n + h/2, x_n + k_1/2) $$
$$\displaystyle k_3 = h f(t_n + h/2, x_n + k_2/2) $$
$$\displaystyle k_4 = h f(t_n + h, x_n + k_3) $$
$$\displaystyle x_{n+1} = x_n + \frac{1}{6}(k_1 + 2k_2 + 2k_3 + k_4) $$.
More accurate, widely used.
-
Case Studies:
-
Autopilot Simulation:
-
Components: Sensors (IMU, GPS, air data), Controller (PID, LQR, Model Predictive Control), Actuators (elevators, rudder), Aircraft dynamics model (6-DOF ODEs).
-
Modeling: Nonlinear 6-DOF equations of motion. Linearize for controller design.
-
Validation: Compare simulated flight path with flight test data; hardware-in-the-loop (HIL).
-
-
Traffic Simulation:
-
Queuing Models: Intersections as queues (M/G/c).
-
Car-Following Models (Microscopic): Gipps' model: $$\displaystyle v_n(t+\Delta t) = \min\{v_n(t) + a\Delta t, v_{n-1}(t) + \frac{(v_{n-1}(t) - v_n(t))\Delta t}{\tau}, v_{max}, \frac{s_n(t)}{\tau + h}\} $$.
Where $$\displaystyle v_n $$=speed of vehicle $n$, $$\displaystyle s_n $$=gap to leader, $\tau$=reaction time.
-
Macroscopic: Fluid dynamics analog (LWR model).
-
-
Manufacturing System Simulation:
-
Model assembly lines, workstations, buffers, material handling.
-
Bottleneck Analysis: Identify station with highest utilization/queue.
-
Optimization: Vary batch sizes, number of servers, scheduling rules (FCFO, SPT) to maximize throughput/minimize WIP.
-
[!TIP] Exam Focus: Be ready to explain one case study (e.g., autopilot or traffic) with key components and modeling approach.