# How to understand the simulation results using basic components in Simscape->foundation library-->mechanical?

2 views (last 30 days)
liqun fang on 11 Jun 2021
Edited: liqun fang on 14 Jun 2021
Q1:As shown in the figure below, based on the actual physical process, the top result spring should be elongated and the bottom result should be shortened. However, the simulation results show that both springs are shortened. Why???
Q2:
As shown in the figure below, based on the actual physical process, we have F=P_A*S_A-P_B*S_B=16000-10000=6000N.
According Newton's laws, we can deduce the following figure. So the scoep2 and scope 7 will display positive 6000N.
But the simulation result is different from Newton's law. The scope2 is positive 6000N and is right. The scope7 is negative 7000N and is different from positive 6000N. So the simulation disobey Newton's law . Why???
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

### Answers (1)

Yifeng Tang on 12 Jun 2021
Hello Liqun,
The direction in Simscape is usually defined by the movement (towards/away) of R port with respect to the C port. One common beginner mistake is to confuse left/right on Simulink canvas as positive/negative. Flip a block on canvas does not imply direction change. However, switch R and C port connection can flip the sign of almost all sensor readings.
The documentation of each block defines which direction is regarded as positive. You may refer to those to make sure you are modeling what you have in mind.
Another good resource is the Simscape Onramp, available starting R2021a: https://www.mathworks.com/learn/tutorials/simscape-onramp.html
Hope this helps.
##### 3 CommentsShow 1 older commentHide 1 older comment
Yifeng Tang on 14 Jun 2021
Hey Liqun,
Maybe it helps for you to consider this example I just made up:
The mass in the middle is in equilibrium when the two forces applied are in the same direction (C-R connection) but opposite sign (PS constant values). You may try to use 100 N for both sources, and the total force on the mass will be 200N and the mass will accelerate.
If you still feel confused, look at the model below, which is identical to the one above, except that some blocks are flipped. It's exactly the same model, but may change your thought process on the signs and directions.
liqun fang on 14 Jun 2021
Edited: liqun fang on 14 Jun 2021
Thank you for your reply again. Actually , I can understand your model that you create for my plobelm. For node C in the figure below, considering the positive direction, the node C balance equation is equal to F1=F2+F3. It looks like KCL in the Principles of Electric Circuits. That's right as you explained and I can understand.
But for my Q2 , the basic model is hydraulic cylinder. Considering the generalized node C, based on the KCL, we can get the results as you explained and the simulation results displayed. And the scope7 should be negative 7000N. I can understand the results, but what I mean is that it violates the actual process . Just like the actual physical process ,the below figure is just right. So the scope7 should be positive 6000N. That is my confusion.

Sign in to comment.

### Categories

Find more on Foundation and Custom Domains in Help Center and File Exchange

R2016b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!