# Difference between two results given by causal simulation and acausal simulation in Xcos

**URL:** <https://scilab.discourse.group/t/difference-between-two-results-given-by-causal-simulation-and-acausal-simulation-in-xcos/715>\
**Category:** Xcos\
**Created:** [November 9, 2024, 9:38am UTC](https://scilab.discourse.group/t/difference-between-two-results-given-by-causal-simulation-and-acausal-simulation-in-xcos/715 "2024-11-09T09:38:30Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![dhoang62](https://avatars.discourse-cdn.com/v4/letter/d/278dde/32.png) [@dhoang62](https://scilab.discourse.group/u/dhoang62)\
**Post date:** [November 9, 2024, 9:38am UTC](https://scilab.discourse.group/t/difference-between-two-results-given-by-causal-simulation-and-acausal-simulation-in-xcos/715/1 "2024-11-09T09:38:30Z")

</div>

Hi,  
I have studied the RLC circuit given on the web page [Electronics | Scilab](https://www.scilab.org/software/xcos/electronics).  
I have assigned the values: R = 20 ohms, L = 0.1 henry and C = 0.001 farad.  
I have found the output voltage Ua according to the input voltage Ue (as a unit step function as on the web page). I have solved the problem in 3 ways: analytical method, causal simulation and non-causal simulation in Xcos.  
The graphs of output voltage Ua given by analytical method and causal simulation are the same, but the result given by causal simulation is different.  
But if I assign a value of 1 ohm to R, the results given by all three ways are the same.  
I do not understand why. I posted here all the images for the case R = 20 ohms.  
I look forward to receiving everyone’s help. Thank you in advance.

 ![2024-11-09_200353](https://global.discourse-cdn.com/free1/uploads/utc/original/1X/ddfd2c06247fb8e1949c746b72b0a8c8bc5f8316.jpeg)

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [November 12, 2024, 6:06pm UTC](https://scilab.discourse.group/t/difference-between-two-results-given-by-causal-simulation-and-acausal-simulation-in-xcos/715/2 "2024-11-12T18:06:18Z")

</div>

Hello,

Can you share the two diagrams (you can attach them to your above post) ?

S.

---

<div class="post-metadata">

**Author:** ![davidcl](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/davidcl/32/1029_2.png) [@davidcl](https://scilab.discourse.group/u/davidcl)\
**Post date:** [November 13, 2024, 3:16pm UTC](https://scilab.discourse.group/t/difference-between-two-results-given-by-causal-simulation-and-acausal-simulation-in-xcos/715/3 "2024-11-13T15:16:53Z")

</div>

Hello,

This is likely an issue with your equations or the parameter’s initial values.  
Be sure to have the exact initial conditions on the integral values; they might not be `0` at the start.

---

<div class="post-metadata">

**Author:** ![dhoang62](https://avatars.discourse-cdn.com/v4/letter/d/278dde/32.png) [@dhoang62](https://scilab.discourse.group/u/dhoang62)\
**Post date:** [November 15, 2024, 3:05am UTC](https://scilab.discourse.group/t/difference-between-two-results-given-by-causal-simulation-and-acausal-simulation-in-xcos/715/4 "2024-11-15T03:05:23Z")

</div>

Hi,  
Thank you for replying to my email. Can I continue to communicate with you in French? I am in Vietnam but my French is good, my English is much worse.

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [November 18, 2024, 10:59am UTC](https://scilab.discourse.group/t/difference-between-two-results-given-by-causal-simulation-and-acausal-simulation-in-xcos/715/5 "2024-11-18T10:59:09Z")

</div>

Hello,

Considering the diagrams you sent me, you are not measuring tension at the right point in the acausal diagram. Your causal diagram amounts to measure the tension of the condensator, like this :

 ![Screenshot 2024-11-18 at 11.56.19 AM](https://global.discourse-cdn.com/free1/uploads/utc/original/1X/18a8f83ca632e1a61f5917b881e786fce556763b.png)  
See the compared step responses (for R=10) below:  
 ![Screenshot 2024-11-19 at 14.07.56](https://global.discourse-cdn.com/free1/uploads/utc/original/1X/73992d29385da42d88efb01ac7f9efa66954ae48.png)

---

<div class="post-metadata">

**Author:** ![dhoang62](https://avatars.discourse-cdn.com/v4/letter/d/278dde/32.png) [@dhoang62](https://scilab.discourse.group/u/dhoang62)\
**Post date:** [November 22, 2024, 9:02am UTC](https://scilab.discourse.group/t/difference-between-two-results-given-by-causal-simulation-and-acausal-simulation-in-xcos/715/6 "2024-11-22T09:02:18Z")

</div>

Hello,

Thank you for your enthusiastic help. I apologize for the delay in responding to you as I had to finish my semester work at the university in the last few days.

The causal simulation diagram I made is based on the equation given on the site [Electronics | Scilab](https://www.scilab.org/software/xcos/electronics), which allows to determine the output voltage Ua as a function of the input voltage Ue. The voltage measured at the output of my causal simulation diagram is Ua, the total voltage across R and C. I do not understand why, as you said, this voltage is only the voltage across the capacitor in the non-causal simulation diagram, while in this diagram I also measure the total voltage across R and C.  
However, the difference between the two causal and non-causal simulations only appears when the resistance R = 10 ohms and 20 ohms. With R = 1 ohm, they are the same. I did not make any changes to the two simulation diagrams in the 3 cases for different values ​​of R, except for the value of this element.

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [November 22, 2024, 11:27am UTC](https://scilab.discourse.group/t/difference-between-two-results-given-by-causal-simulation-and-acausal-simulation-in-xcos/715/7 "2024-11-22T11:27:39Z")

</div>

Hello,

Your causal simulation does not have the same diagram as the one at [Electronics | Scilab](https://www.scilab.org/software/xcos/electronics). Please check that. Your diagram corresponds to the serial RLC circuit on Wikipedia’s French RLC page ([Circuit RLC — Wikipédia](https://fr.wikipedia.org/wiki/Circuit_RLC)).

S.

---

<div class="post-metadata">

**Author:** ![federicoma](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/federicoma/32/647_2.png) [@federicoma](https://scilab.discourse.group/u/federicoma)\
**Post date:** [November 26, 2024, 10:41am UTC](https://scilab.discourse.group/t/difference-between-two-results-given-by-causal-simulation-and-acausal-simulation-in-xcos/715/8 "2024-11-26T10:41:36Z")

</div>

Hi, can you share the scilab/xcos source file with me too?  
Thank you

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [November 26, 2024, 10:49am UTC](https://scilab.discourse.group/t/difference-between-two-results-given-by-causal-simulation-and-acausal-simulation-in-xcos/715/9 "2024-11-26T10:49:32Z")

</div>

Hello (welcome to Scilab’s Discourse!)

Here they are:

[AC\_R=10.zcos|attachment](https://scilab.discourse.group/uploads/short-url/8iwXWp443lM8FpkU7JHzhmnm205.zcos) (3.9 KB)  
[C\_R=10.zcos|attachment](https://scilab.discourse.group/uploads/short-url/9Q56HtSLQnfhg0T5VI9xsKED5Rm.zcos) (3.9 KB)

S.

---

<div class="post-metadata">

**Author:** ![federicoma](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/federicoma/32/647_2.png) [@federicoma](https://scilab.discourse.group/u/federicoma)\
**Post date:** [November 26, 2024, 11:10am UTC](https://scilab.discourse.group/t/difference-between-two-results-given-by-causal-simulation-and-acausal-simulation-in-xcos/715/10 "2024-11-26T11:10:01Z")

</div>

Thank you so much for the files.
