Jump to content

How can I make a thermoelectric generator?


AtomicTech

Recommended Posts

@AtomicTech You'll have to commit some module abuse and see if/how things work out.

Spoiler

Give the part the radiator module just so it pulls heat from parts as usual. Give it the ablator module and set it to consume a transferrable resource (so it can be refilled on the fly) and set ElectricCharge as the "charred resource." (This parameter exists and is used by RO mods to produce "CharredAblator" resource which I presume is to dampen the mass loss of the shield. Ablator resource is probably excessively heavy like anything else in stock.) Also set the ablation threshold to a low value so that it starts ablating at lower temperatures.

But it may fail in some situations and like @artwhaley just pointed at, this is much better done as a dll and it should be a (relatively) very simple concept to deliver: A proper Carnot cycle generator (heat engine) which only cares about the part's current temperature vs an ideal cold temperature.

Link to comment
Share on other sites

9 minutes ago, JadeOfMaar said:

@AtomicTech For lack of insight, I must say you're going to have to find someone who's seasoned in KSP's code and in writing dlls and have them tutor you.

Copy that; when I asked the question I was hoping that I would get some links or something but that means that I have to go pestering LGG again.

Thanks :)

Link to comment
Share on other sites

4 hours ago, AtomicTech said:

Copy that; when I asked the question I was hoping that I would get some links or something but that means that I have to go pestering LGG again.

Thanks :)

Is still a decent place to get started.    

https://github.com/taraniselsu/TacExamples/blob/main/02-SimplePartModule/Source/SimplePartModule.cs  Has a really well commented example of a part module, which is what you'll want to make.    

It's been YEARS since I've done anything in KSP plugins...  so yeah... LGG is obviously the leading expert...  But basically...  you'll create a class that extends partmodule.   You'll create KSPFields to create the places where in the part config file you set up the conversion rate and efficiency and anything else you need.   You also need an internal variable that tracks when the last update was.

Then, in the On Fixed Update event, you subtract the part temp from the ambient temp...  if the differential is enough for your part to work, you substract the current time from the last update time...   multiply that times the conversion rate and subtract that from the part temp...  then multiply that number times the efficiency and add it to the vessel electric charge...   

The actual programming is going to be super quick, it's going to take longer to get visual studio set up and get through your first couple of examples before you try your real project!    But it's a great thing to learn!

 

Link to comment
Share on other sites

29 minutes ago, artwhaley said:

Is still a decent place to get started.    

https://github.com/taraniselsu/TacExamples/blob/main/02-SimplePartModule/Source/SimplePartModule.cs  Has a really well commented example of a part module, which is what you'll want to make.    

It's been YEARS since I've done anything in KSP plugins...  so yeah... LGG is obviously the leading expert...  But basically...  you'll create a class that extends partmodule.   You'll create KSPFields to create the places where in the part config file you set up the conversion rate and efficiency and anything else you need.   You also need an internal variable that tracks when the last update was.

Then, in the On Fixed Update event, you subtract the part temp from the ambient temp...  if the differential is enough for your part to work, you substract the current time from the last update time...   multiply that times the conversion rate and subtract that from the part temp...  then multiply that number times the efficiency and add it to the vessel electric charge...   

The actual programming is going to be super quick, it's going to take longer to get visual studio set up and get through your first couple of examples before you try your real project!    But it's a great thing to learn!

 

Awesome! Thanks!

When I get some time, I'll try and learn it :)

Link to comment
Share on other sites

Did you have a specific use case in mind for this?   What kind of parts were you thinking about making?   Have you made parts before?   

I don't mind helping with the plugin if you've got a cool thing planned and are doing all the partmaking stuff!   I'll have to get all set back up to do it, too, but it's not THAT bad.  lol.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...