Author Topic: Thermodynamic Cycles Program  (Read 4729 times)

0 Members and 1 Guest are viewing this topic.

Offline APoloG13

  • LV2 Member (Next: 40)
  • **
  • Posts: 32
  • Rating: +0/-0
    • View Profile
Thermodynamic Cycles Program
« on: December 26, 2016, 11:22:27 pm »
Hello everyone;

I'm starting this topic because i want to start a project which could be (or at least I think would be) interesting and useful. The project is based on the AssTermo-D and the main propose is to create a Thermodynamic Cycles program which could be useful to all students with Technical Thermodynamics.

Basically, insert the objects (furnace, compressor, turbine, exchanger...) to create the cycle that the user wants and specify some of their attribute (efficiency, pressure, temperature, work...) to do the main calculations, providing the fluid properties from the AssTermo-D archive which is a great source.

I've the knowledge of what calculations have to do but no idea of programming (and don't know which type of code will be better if C, Lua, Basic...), anyone have interest on helping me or guide me?

Thanks for the attention.

P.D : I got the idea from this old HP48 file http://www.hpcalc.org/details/6258 I didn't prove it cause don't know how to open it but could be useful.

Offline SpiroH

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 715
  • Rating: +153/-23
    • View Profile
Re: Thermodynamic Cycles Program
« Reply #1 on: December 27, 2016, 09:49:10 am »
Hello @APoloG13,

After a bit of googling I just found this for TI-Nspire (among others): 'Asstermo-D-Agua '.  For me the page is in portuguese, i dunno if you can read it (if not try google translate)
http://asstermo.github.io/
http://asstermo.github.io/ManualAsstermoD018Agua

Hope it helps.

Offline APoloG13

  • LV2 Member (Next: 40)
  • **
  • Posts: 32
  • Rating: +0/-0
    • View Profile
Re: Thermodynamic Cycles Program
« Reply #2 on: December 27, 2016, 10:02:55 am »
Hello @APoloG13,

After a bit of googling I just found this for TI-Nspire (among others): 'Asstermo-D-Agua '.  For me the page is in portuguese, i dunno if you can read it (if not try google translate)
http://asstermo.github.io/
http://asstermo.github.io/ManualAsstermoD018Agua

Hope it helps.

Hello @SpiroH,

I know that there are a few types of AssTermo, and that's the key. The idea is to implement those in a program for doing thermodynamical cycles or alone calculations(motor, compressor, exchangers...).

For example, you have air and a isoentrpoic compresor, know P inlet and H outlet and the efficiency. Introducing those valĂșes the program will gave you the missing ones.

Offline SpiroH

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 715
  • Rating: +153/-23
    • View Profile
Re: Thermodynamic Cycles Program
« Reply #3 on: December 27, 2016, 10:17:57 am »
Well, then i think you are just asking for programming advice. IMO before porting the concept to a calculator (which, by definition, has much more limited resources) I would advise you to try out your algorithms, on a desktop computer, using a high level language, for instance Java, which is pretty easy, with many examples to be found on the net.
Next, once the program behaves according to your expectations you could port it to a calc using, for instance, Lua which is readily available for TI-Nspire. At first it may seem a duplication of efforts, but again IMO, you being a beginner, it can save you lots of debugging time. ;)


Offline coops

  • LV3 Member (Next: 100)
  • ***
  • Posts: 58
  • Rating: +3/-0
    • View Profile
Re: Thermodynamic Cycles Program
« Reply #4 on: December 27, 2016, 11:53:27 am »
Welcome!

So ya, I originally had this idea for a couple of years now. I'm a mechanical engineer, so when I took thermo cycles I thought that all of this could be done with a calc easy. My final project was to use microsoft excel to model a power plant cycle (aka boiler, turbine, condensor, with inefficiencies, etc) and set it up so all you have to do is place in the values you need and it spits out the appropriate values for the other systems.

I honestly think the programming and graphical part is not too difficult. The hard part is storing all the table values that you'd normally look up.

I only know axe a little bit, but the math could get too complex for that language. I could do C++ or java, but that wouldn't work for the calc. ASM is probably best, but I have no idea how to program that.

I'll do some digging for that excel file if you want to check that out for ideas

Offline APoloG13

  • LV2 Member (Next: 40)
  • **
  • Posts: 32
  • Rating: +0/-0
    • View Profile
Re: Thermodynamic Cycles Program
« Reply #5 on: December 27, 2016, 02:27:02 pm »
Thanks for the advice and coops of you find that excel and you let me take a look of it... could be very usefull, also I thing that the hardest part would be the tables (i have beber programed anything) but hope using muy Excel knowledge as a base will help.

And coops with Ndless the calc can run C programming (don't know if C++) maybe can we collab
« Last Edit: December 27, 2016, 02:30:38 pm by APoloG13 »

Offline Legimet

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +29/-0
    • View Profile
Re: Thermodynamic Cycles Program
« Reply #6 on: December 27, 2016, 05:13:55 pm »
Yes, you can use C++. Did you get the SDK working?

Offline APoloG13

  • LV2 Member (Next: 40)
  • **
  • Posts: 32
  • Rating: +0/-0
    • View Profile
Re: Thermodynamic Cycles Program
« Reply #7 on: December 27, 2016, 05:23:32 pm »
Still not, the internet of my home is down so I will have to wait.

Offline APoloG13

  • LV2 Member (Next: 40)
  • **
  • Posts: 32
  • Rating: +0/-0
    • View Profile
Re: Thermodynamic Cycles Program
« Reply #8 on: December 28, 2016, 11:46:38 am »
@coops did you find the excel?

Offline coops

  • LV3 Member (Next: 100)
  • ***
  • Posts: 58
  • Rating: +3/-0
    • View Profile
Re: Thermodynamic Cycles Program
« Reply #9 on: December 28, 2016, 09:49:31 pm »
It's your lucky day! I was able to find them! I did 2 projects for my 2 thermo classes. You'll have to enable macros for the thermo properties to appear. I'm pretty sure they're correct, but there's no guarantee that these were the final drafts that I turned in...

The first thermo is more graphically oriented, with pictures to help visualize (even though the pics dont do anything! :P). The second has everything in a nice chart. Any cells highlighted in yellow are input values, any green are energy producing/output, and any red cells are energy consuming/input.

I would imagine programming this would'nt be too hard. If I were to program this, I'd start with the chart and have all the thermodynamic properties (temp, pressure, enthalpy, entropy, etc) in a chart, an interpolating algorithm for those in between properties, a conversion from standard to metric algorithm, etc. All you would need to do is plug in 2 thermodynamic properties, and all the rest could be found.

Check the properties and functions tabs in the excel files to get an idea of what I mean. You put in 2 thermodynamic properties, and you can find all the rest.

The graphical side and linking everything together would pull off of the chart thermodynamic properties. After that, the program would work though each stage of the cycle to find all the values for each system.

I think this would be good for brainstorming
« Last Edit: December 28, 2016, 09:55:13 pm by coops »

Offline APoloG13

  • LV2 Member (Next: 40)
  • **
  • Posts: 32
  • Rating: +0/-0
    • View Profile
Re: Thermodynamic Cycles Program
« Reply #10 on: December 29, 2016, 11:34:35 am »
Thanks for the excels @coops I'm trying to understand them and are giving me a lot of ideas.

I'm thinking how to do everything for make it easy for everyone, talking from my programming unknown so don't know if what I say is possible or not so feel free to say I'm wrong.

Start with one or two substance and have one archive or table with the properties, so when the program starts, ask for the substance you will study in your cycle (air, water, ammonia, R-134a..) and what type of cycle you have open or close.

After that, you can select the configuration you of your cycle by choosing the elements for example i want to study a Rankine Cycle, so I insert the cooler, the pump, the heater and the turbine and by clicking for example on the turbine show what can be calculated, the assumptions and the missing parameters (Like CyclePad does).

Then you set the connection streams in the order you want and automatically calculates as soon has the cycle is ended or the element have all the information it needs.

The results of each can be shown on alternate window.

Don't know if I explained myself correctly or I'm too much ambitious  ???


Offline APoloG13

  • LV2 Member (Next: 40)
  • **
  • Posts: 32
  • Rating: +0/-0
    • View Profile
Re: Thermodynamic Cycles Program
« Reply #11 on: December 30, 2016, 06:26:45 pm »
I'm stuck... definitely need help.

Have the assthermo has a base and know what I want to do but don't have the knowledge for create a program  :mad:

I analyzed the results of asstermo with the EES and are prefect. The next step is, how?

How can I make a function that grabs the results of the AssThermo and make calculations for a single element or a whole cycle with the assumptions?

@SpiroH @Legimet @coops... any idea?
« Last Edit: December 30, 2016, 08:05:32 pm by APoloG13 »

Offline SpiroH

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 715
  • Rating: +153/-23
    • View Profile
Re: Thermodynamic Cycles Program
« Reply #12 on: December 31, 2016, 09:56:53 am »
Hi @APoloG13,

If you want just to plot some graphs out of data, Excel is probably the easiest way to go. Eventually you'll just need to learn a bit of BASIC language.
IMO you just need to start somewhere, so start with Excel's plotting facilities. Next, take a '<What ever language you like> for Dummies' book and try to get the same results.
You see, there are no 'free lunches' you'll have to spend some time learning how to use a programming language. Have a great rest of this 2016 year. Wish you all the best for 2017.

Offline APoloG13

  • LV2 Member (Next: 40)
  • **
  • Posts: 32
  • Rating: +0/-0
    • View Profile
Re: Thermodynamic Cycles Program
« Reply #13 on: January 01, 2017, 09:45:03 pm »
I'm starting with the basic @SpiroH and made a few "programs" (if I can name it like that).

I've one question, you can have different .tns but use it as one?

Like have a .tns for the data storage with interpolations... and the other for calculations using the data obtained on the other .tns.

Happy new Year!!

Offline mdr1

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 303
  • Rating: +21/-2
    • View Profile
Re: Thermodynamic Cycles Program
« Reply #14 on: January 08, 2017, 01:47:04 am »
If you are using C/C++, yes, you can create a file containing the data, rename it to give it the ".tns" extension, transfer it to your calculator as well as the program. Then, the program can look for this file by its name and open it.