Foundations — Software-in-the-Loop (SIL) simulation — all software, simulated hardware
5.5.22 · D1· Coding › Embedded Systems & Real-Time Software › Software-in-the-Loop (SIL) simulation — all software, simula
Is page pe kuch bhi assume nahi kiya gaya. Har woh word, arrow, aur symbol jo parent note mein use hua tha, yahan sab kuch zero se build kiya gaya hai, ek aisi tartib mein jahan har idea apne pehle waale idea pe tika ho.
0. Woh picture jis par poora topic tika hai
Kisi bhi symbol se pehle, loop ko khud dekho. Baaki sab kuch sirf in boxes ya arrows mein se kisi ek par ek label hai.
Topic ko yeh kyun chahiye: "loop" word SIL ke naam mein aata hai. Agar tum circle nahi dekh paa rahe, toh timing, feedback, ya "software ko pata nahi ki yeh fake hai" waali koi bhi idea samajh nahi aayegi.
1. Signal — woh cheez jo arrows par flow karti hai
Picture: ek wire jo ek value carry karta hai. Real car mein yeh wire ek real cable hoti hai; SIL mein yeh do functions ke beech pass kiya gaya ek variable hai. Same meaning, alag medium.
Kyun chahiye: parent note "sensor data", "control outputs", "CAN bus messages", "ADC readings" ke baare mein baat karta hai. Inme se har ek ek signal hai — loop picture mein ek arrow par travel karta ek number.
2. Sensor aur Actuator — do endpoints
Picture: sensor = ek aankhh (world → number), actuator = ek haath (number → world). Code aankhh aur haath ke beech mein baithta hai.
Kyun chahiye: SIL ki poori trick hai aankhh aur haath ko equations se replace karna. Yeh samajhne ke liye ki kya replace ho raha hai, pehle yeh jaanna zaroori hai ki woh kya karte hain.
3. Plant — woh machine jo control ki ja rahi hai
Picture: ek factory ("plant") socho jo ek input command leti hai aur dheere dheere ek output behaviour produce karti hai.
Kyun chahiye: parent ka central component "plant model" hai. Agar tum yeh nahi jaante ki plant physical system hai, controller se alag, toh tum plant ko model nahi kar sakte.
4. Model — reality ka maths stand-in
Dono curves dekho: real machine (orange dots) aur model (blue line) perfectly match nahi karte — aur yeh theek hai. Model ko bas itna close hona hai ki software ki kisi buri decision ko reveal kar sake.
Kyun chahiye: SIL hardware ko ek model se replace karta hai. "Fidelity", "low/medium/high fidelity", "model error" — yeh sab statements hain is baare mein ki blue line orange dots ko kitne closely hug karti hai.
5. State — plant ki memory
Picture: ek snapshot. Duniya ko freeze karo; us frozen frame par likhe numbers hi state hain.
Kyun chahiye: parent likhta hai velocity_next = velocity - .... Matlab: new state old state se compute hua. Loop actually hai "state → software → command → new state → repeat".
6. Discrete time vs continuous time
Yeh sabse deep symbol hai jo parent use karta hai, isliye hum ise ek picture ke saath dheere dheere build karte hain.
- Real plant continuous time mein rehta hai.
- Tumhara controller ek computer program hai; woh sirf ticks par run kar sakta hai. Isliye woh discrete time mein rehta hai.
Parent ke symbols, decoded:
Kyun chahiye: poora "cosimulation / solver / stability" section is baare mein hai ki smooth plant ko code ke discrete ticks par kaise fit karein. Yeh miss karo toh parent ka Euler formula gibberish lagega.
7. Smooth physics ko steps mein badalna — Euler idea
Figure s03 wapas dekho: seedhe blue jumps Euler steps hain. Jab bahut bada hota hai, jumps orange curve se bahut zyada overshoot karte hain — yahi hai woh "numerical instability / divergence" jiske baare mein parent warn karta hai.
8. Feedback aur closed-loop
Picture: yahi figure s01 se arrows ka circle hai. Koi bhi arrow todo aur loop open ho jaata hai.
Kyun chahiye: SIL ek closed-loop test hai — poori value yahi hai ki software ke outputs uske paas naye inputs banke waapis aate hain, bilkul reality ki tarah.
9. HAL — swappable adaptor
Picture: ek wall socket. Tumhara appliance (core logic) ek standard socket mein plug karta hai. Wall ke peeche shayad solar, coal, ya battery ho — appliance kabhi nahi jaanta. Wall ke peeche kya hai badalna = HAL badalna.
Kyun chahiye: HAL split ke bina same production code ko PC par run karne ka koi tarika nahi hota. Poori technique is ek swappable layer par depend karti hai.
10. Proportionality — aur padhna
Picture: paper fold karna — har fold thickness double karta hai. Parent ka claim "bug-fix cost \$$, $10\times$100\times$1000\times$ stages ke across hai" exactly yahi hai: har baad waala stage cost multiply karta hai. Isliye bugs ko jaldi (SIL mein) fix karna itna sasta hai.
Prerequisite map
Ise upar se neeche padho: signals sensors ko baat karne dete hain; sensors loop close karte hain; plants ko model kiya jaata hai; models time mein se state carry karte hain; time Euler step force karta hai; HAL real code ko loop mein join hone deta hai; cost explain karta hai kyun hum yeh karte hain. Saare arrows SIL par converge karte hain.
Equipment checklist
Right side cover karo aur har ek ka answer do; deep-dives par tabhi aage badho jab sab green hon.
Ek phrase mein signal kya hai?
Sensor vs actuator?
Plant kya hota hai?
Model kya hota hai?
State ka kya matlab hai?
Continuous aur discrete time mein fark?
ka kya matlab hai, aur 100 Hz par iska value?
aur Euler formula words mein padho.
bahut bada kyun nahi ho sakta?
Open-loop vs closed-loop?
HAL kya karta hai?
Bug-fix cost stages ke across exponentially kyun badhti hai?
Yeh bhi dekho: parent topic, aur jab yeh foundations solid lag jaayein: Hardware-in-the-Loop (HIL), Unit Testing for Embedded Systems, Real-Time Operating Systems (RTOS), Sensor Fusion Algorithms.