NTNUJAVA Virtual Physics LaboratoryEnjoy the fun of physics with simulations! Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
September 21, 2019, 04:02:19 am

A man paints with his brains and not with his hands. ..."Michelangelo (1475-1564, Italian sculptor, painter, architect and poet)"

 Pages: [1] 2   Go Down
 Author Topic: Hydrosystem with two tanks connected one after another  (Read 34057 times) 0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
pavwell
Jr. Member

Offline

Posts: 25

 « Embed this message on: March 17, 2010, 03:10:03 pm » posted from:Zilina,Zilina,Slovakia

Hello ! Could anyone help me with creating EJS aplication of Hydrosystem with two tanks connected one after another ?
Thanks a lot !!
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3082

 « Embed this message Reply #1 on: March 17, 2010, 04:17:57 pm » posted from:Taipei,T'ai-pei,Taiwan

Please describe the whole system in detail!
If I can not understand the system and the physics model involved, there is no way I can create a simulation.
 Logged
pavwell
Jr. Member

Offline

Posts: 25

 « Embed this message Reply #2 on: March 17, 2010, 04:52:27 pm » posted from:Zilina,Zilina,Slovakia

I will send you email where i subcribe my problem.
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3082

 « Embed this message Reply #3 on: March 17, 2010, 09:35:42 pm » posted from:Taipei,T'ai-pei,Taiwan

$s_1 \frac{dh_1}{dt}=q_1 -\alpha_1 \sqrt{h_1-h_2}$

$s_2 \frac{dh_2}{dt}=\alpha_1 \sqrt{h_1-h_2}-\alpha_2\sqrt{h_2}$

You did provide me information about:
$\alpha_1=0.0000208, s1=0.002025m^2, 0.0000163, s2=0.002025m^2$

However, you did not provide range for $q_1, h_1,h_2$ and maximum height for both tank.

Embed a running copy of this simulation

Embed a running copy link(show simulation in a popuped window)
Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
• Please feel free to post your ideas about how to use the simulation for better teaching and learning.
• Post questions to be asked to help students to think, to explore.
• Upload worksheets as attached files to share with more users.
Let's work together. We can help more users understand physics conceptually and enjoy the fun of learning physics!
 twotanks.gif (5.08 KB, 522x223 - viewed 343 times.) Logged
pavwell
Jr. Member

Offline

Posts: 25

 « Embed this message Reply #4 on: March 17, 2010, 11:07:38 pm » posted from:Lutila,Banska Bystrica,Slovakia

Thanks a lot for these solution.
 Logged
pavwell
Jr. Member

Offline

Posts: 25

 « Embed this message Reply #5 on: March 18, 2010, 03:04:51 pm » posted from:Zilina,Zilina,Slovakia

Please, if it possible, could you modify this project to change open loop system to close loop system with simple PID controller ?
And one more task is possible modify system to turn off automaticly inflow when liquid levels of tank1 and tank 2 get maximum range ?
Maximum range both of tanks set to 0,14
 « Last Edit: March 18, 2010, 03:22:35 pm by pavwell » Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3082

 « Embed this message Reply #6 on: March 18, 2010, 05:18:30 pm » posted from:Taipei,T'ai-pei,Taiwan

Please explain in detail what it mean to be a close loop with simple PID controller?
It will be easier for me to design the simulation if you can provide me detail information as possible.
You can add picture as attached file.

 Logged
pavwell
Jr. Member

Offline

Posts: 25

 « Embed this message Reply #7 on: March 18, 2010, 05:47:01 pm » posted from:Zilina,Zilina,Slovakia

Please, could you modify system as I write in next two tasks ??

1.is possible modify system to turn off automaticly inflow when liquid levels of tank1 and tank 2 get maximum range ?
2.Please set maximum range both of tanks set to 0,14 and please, reconfigure range of visualization to better see line of h1 . it is too high
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3082

 « Embed this message Reply #8 on: March 18, 2010, 05:57:08 pm » posted from:Taipei,T'ai-pei,Taiwan

I can modify it according to your request.
However, you never give me information about the height , and q1 for the system.
The default value are the best I can guest.
It will  be better if you give me detail information about your system.
Height and range of possible q1 values.
 Logged
pavwell
Jr. Member

Offline

Posts: 25

 « Embed this message Reply #9 on: March 18, 2010, 06:24:15 pm » posted from:Zilina,Zilina,Slovakia

O.k. I try to discribe Controlled close loop system . I set in input value box some value of level h2 and by heigh of level h2 I can control value of inflow. h2 is in feedback to inflow. Is this clearle to you ?
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3082

 « Embed this message Reply #10 on: March 18, 2010, 08:36:12 pm » posted from:Taipei,T\'ai-pei,Taiwan

I do not understand what you just described???

Quote
2.Please set maximum range both of tanks set to 0,14 and please, reconfigure range of visualization to better see line of h1 . it is too high
You said that h1 is too high. Would you please provide a suitable value for h1?
And please provide me a suitable value for maximum height!
 Logged
pavwell
Jr. Member

Offline

Posts: 25

 « Embed this message Reply #11 on: March 18, 2010, 08:40:02 pm » posted from:Zilina,Zilina,Slovakia

Meaning too high i think not value of h1 but value of plot window where is shown h1. This plot window i would like to see larger

And please, set the maximum value of h1 on 0,14 and maximum of h2 also on 0,14.

Just another question for you..Do you have any experience with cooperating EJS and MATLAB ??
 « Last Edit: March 18, 2010, 08:41:45 pm by pavwell » Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3082

 « Embed this message Reply #12 on: March 18, 2010, 11:29:52 pm » posted from:Taipei,T\'ai-pei,Taiwan

Quote

Meaning too high i think not value of h1 but value of plot window where is shown h1. This plot window i would like to see larger Smiley
I did not changed it because I do not know how much larger you need.
I can not guest what you want in your mind.  Please describe it in detail.
However, I did change the way it was displayed (scale).

Quote
And please, set the maximum value of h1 on 0,14 and maximum of h2 also on 0,14.
I just modified the code so that q1 will be turn off when h1>0.140
And q1 will be tuen on when h1
Quote
Just another question for you..Do you have any experience with cooperating EJS and MATLAB ??
I do not have MATLAB so I have never use that feature.
However, it is only available for EJS version 3.47 or earlier.
I have heard that some users from swissland did use MATLAB with EJS for their research work.
 Logged
pavwell
Jr. Member

Offline

Posts: 25

 « Embed this message Reply #13 on: March 19, 2010, 12:00:43 am » posted from:Lutila,Banska Bystrica,Slovakia

Thanks for your very good work Dont have by the way any contact on swissland studnets ??
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3082

 « Embed this message Reply #14 on: March 19, 2010, 01:19:48 pm » posted from:Taipei,T\'ai-pei,Taiwan

Sorry! I do not know.
 Logged
pavwell
Jr. Member

Offline

Posts: 25

 « Embed this message Reply #15 on: March 19, 2010, 01:24:57 pm » posted from:Zilina,Zilina,Slovakia

Hello
Please, I have big appeal on you. If it possible, could you write this hydro system in EJS version 3.4 especialy for me But I need one version of system at EJS able to communicate with MATLAB. And as you wrote to me, EJS 4.2 have not this option.
THANKS A LOT !!!
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3082

 « Embed this message Reply #16 on: March 19, 2010, 01:37:09 pm » posted from:Taipei,T\'ai-pei,Taiwan

Because you have to write code to connect to MATLAB with EJS.
So you need to learn to use EJS.

Right click and select open ejs model to open EJS and learn how it was created.
And you can do similar thing with EJS 3.4 or earlier EJS version (which support MATHLAB).

I do not have any experience with EJS connect to MATHLAB, so you should learn EJS in order to do it.
And you can use the version I created as an example to learn it.
I will try to help when you learn to use EJS. But I would not be able to help when EJS need to communicate with MATHLAB. So you better learn to create it with EJS 3.4 by yourself. I think this is the best for you to do it by yourself.
 Logged
pavwell
Jr. Member

Offline

Posts: 25

 « Embed this message Reply #17 on: March 19, 2010, 01:43:34 pm » posted from:Zilina,Zilina,Slovakia

Of course I tried do this yesterday, but for i have problem with creating both of tanks and inflow at EJS old version. I have EJS 4.2 as new version and EJS 3.4 as old version. And i tried to do this yesterday at EJS 3.4. But in this version is not options like in 4.2 version for building polygon and other model parts Therefore i appeal you for help. Ploting is o.k. This part of project I built in old version without problems. But with creating tanks i have problem
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3082

 « Embed this message Reply #18 on: March 19, 2010, 02:07:51 pm » posted from:Taipei,T\'ai-pei,Taiwan

I do not have EJS 3.4 but I do have EJS3.45

The tank created in the above simulations was using polygon element.
The height h1/h2 was change by changing y coordinate for 4 points belongs to polygon.
You should be able to do it with EJS 3.45 and above.
 Logged
pavwell
Jr. Member

Offline

Posts: 25

 « Embed this message Reply #19 on: March 19, 2010, 02:16:57 pm » posted from:Zilina,Zilina,Slovakia

...EJS 3.45 is also o.k could you make in this version thank you so much !!!
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3082

 « Embed this message Reply #20 on: March 19, 2010, 02:45:21 pm » posted from:Taipei,T\'ai-pei,Taiwan

I think you should learn how to use it if you really want to connect to MathLAB.

 Logged
pavwell
Jr. Member

Offline

Posts: 25

 « Embed this message Reply #21 on: March 19, 2010, 02:47:28 pm » posted from:Zilina,Zilina,Slovakia

O.K. I will upload my xml file couple of hours later because now I am at work and on this project i work at home.
 Logged
pavwell
Jr. Member

Offline

Posts: 25

 « Embed this message Reply #22 on: March 20, 2010, 02:36:54 am » posted from:Lutila,Banska Bystrica,Slovakia

Hello...I found simple example on PI controller of level tank...I attach you a xml file..If it possible just like that use it for my model , please add similiar PI controller to my model..Thanks !
 *** There are 1 more attached files. You need to login to acces it! Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3082

 « Embed this message Reply #23 on: March 20, 2010, 09:22:03 am » posted from:Taipei,T\'ai-pei,Taiwan

You did a nice job with the EJS view. I am impressed.
I move two tab pages in evolution to constrain page.

Normally, we only put relations which will changed with time in evolution page.
like the rate equation. And the solver will use suitable to calculate the best value for next time step.
I also change the solver from midpoint method to Runge-Kutta 4th order method.
You should use this one for most of the simulation. Midpoint method is only good for constant acceleration or similar relations. It is not good for other cases (numerical error will accumulate).

I also change code so that the "play" button will toggle between "play" and "pause".

You sould be albe to create a two level system from this one.

Add one more equation in evolution page and rearrange GUI elements to model two level tanks!
Good job! Keep going!
 tank.gif (10.01 KB, 369x484 - viewed 348 times.) *** There are 1 more attached files. You need to login to acces it! Logged
pavwell
Jr. Member

Offline

Posts: 25

 « Embed this message Reply #24 on: March 20, 2010, 01:34:14 pm » posted from:Lutila,Banska Bystrica,Slovakia

No no This is not my job...I found this model at directory _examples in EJS install directory...I am not good enough in EJS I am very beginer...So could you change your two tanks model by this one tank model, please Thanks a lot !!
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3082

 « Embed this message Reply #25 on: March 20, 2010, 03:10:45 pm » posted from:Taipei,T\'ai-pei,Taiwan

I can do it easily. However, I am not going to do it. Because it should be your job. (It is not my job).

If you are a beginer, then you should try to do it by yourself. And I will try to help.
I will feel sorry if I did the homework for you.

Adding a view element is not difficult. Just select an element(click it) from right hand side element list,
then click it inside the drawingPanel. Then assign proper value to it's property (coordinate...etc)
Please check out EJS tutorial (How to create simulation with EJS) (there are step by step examples).
or check out SWF movie show step by step instructions to create java simulation with EJS.

I will try to help if you try to lean to use it. Otherwise, there is no way you can learn to use it to communicate with MATHLAB. If you learn to do it by yourself, then you can do it for other problems, too! That is the way student learn and gain ability. I should not do all the work for you.

Do you feel if fair, if I did all the work for your classmate and he get better grade because someone did all the homework for him? (Actually, for long time effect, the classmate will be loss in the job market, because he did not learn the require ability).

I promise to help if you try to learn it. However, I should not do all the work for you. otherwise, you would learn nothing.

Try to modified from the above examples and you will find it is not really so difficult as you thought.
If you do find problem, write it down and attached the xml file and I will try to help.
This is the best I can do! O.K!
 Logged
pavwell
Jr. Member

Offline

Posts: 25

 « Embed this message Reply #26 on: March 20, 2010, 03:15:45 pm » posted from:Lutila,Banska Bystrica,Slovakia

Thanks a lot !!!! I will try Have a nice day
 Logged
pavwell
Jr. Member

Offline

Posts: 25

 « Embed this message Reply #27 on: March 21, 2010, 03:18:57 am » posted from:Lutila,Banska Bystrica,Slovakia

I attach my xml file which I created at EJS 3.47. Please check it because it is not exactly as in your model created at EJS 4.2. I dont know how set to fill tank with blue color and another options. Thanks.
 *** There are 1 more attached files. You need to login to acces it! Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3082

 « Embed this message Reply #28 on: March 21, 2010, 09:27:05 am » posted from:Taipei,T\'ai-pei,Taiwan

Those two polygons did not show up because you did not set "number of points"
It was different from current, which you need to set it.
The current version use all the number of elements from x,y array.

I also remove marker property, unless you really want those markers.
Please check out the version I have moified.
 *** There are 1 more attached files. You need to login to acces it! Logged
maxxb
Newbie

Offline

Posts: 12

 « Embed this message Reply #29 on: April 16, 2010, 04:09:17 am »

Hi,
I am a french student and I think I am doing the same project as you. But I am blocked I don't how to link the view and the equations... Could you help me please ?
Here is my work...
 *** There are 1 more attached files. You need to login to acces it! Logged
 Pages: [1] 2   Go Up
A man paints with his brains and not with his hands. ..."Michelangelo (1475-1564, Italian sculptor, painter, architect and poet)"