Jump to content

[Plugin][0.17] PowerTech v0.2.6.1


Alchemist

Recommended Posts

This is the thread for PowerTech plugin. Fort part releases see this thread.

Download PowerTech.dll v0.2.6.1

v0.2.6 (23 July 2012)

* New part resource request system (now the panels can easily refill all your batteries, wherever they are)

* EPS-compatible panel type (for ZO2 0.6 / EPS 0.1)

* Fuel gauge module for resource tanks

* Improvements and bugfixes for panel animation.

* Now colors can be set with config files

v0.2.5 (30 May 2012)

* Custom rotation axis can be set for the solar panels.

* Heat management options for the solar panels (advanced classes)

* Ability to generate PartResources for the solar panels (advanced classes)

* ZO2 Regenerator (2 versions)

v0.2.4 (24 May 2012)

* Now animations introduced in KSP 0.15 can be used for panel deploying!

* New possibility for panel rotation definition

* panelcenter parameter for panels that generate power (for better ship shadow check)

* Minor bugfixes

v0.2.3 (20 May 2012)

* Updated the right-click menu.

* The PowerSat satellites can be switched between \'active flight' and 'debris' by right-click menu

* Advanced version of the panel module with power gauge and efficiency calculation - to be used as a base for parts that produce electricity for other addons.

* Zoxygene-compatible version of the panels included in the plugin.

v0.2.2 (18 May 2012)

*0.15 compatible version

*Panels and satellites can be deployed and undeployed by right-click menu.

v0.2.1

*Added couple more features for the panels

v0.2.0 (6 Apr 2012)

*Fixed mac compatibility issue (thanks exegesis for reporting it)

*Added PowerSat attitude control during timewarp and attitude reset when loading the flight scene.

v0.1.1 (4 Apr 2012)

*Fixed parser error in case it finds a folder without part.cfg

*Solar panels now can have NightGlide mode - turn parallel to surface velocity if in planetary shadow (default: on for the solar panels; off for PowerSat)

*Panel state and attitude now affect drag (if you deploy them in the atmosphere)

Disclaimer: you are free to use the .dll for your addons, but please give the link to this topic for the newest version of the plugin. I will do my best in order to not to break compatibility with existing parts and persistent worlds when releasing the new versions.

Also please post here links to your addons if you made something good with my modules - I would like to list them here.

You can use fragments of source code for your plugins, just give a credit if you borrow something significant.

Credits: l00 or shadow detection code, r4m0n for muMech tank interface and several small features. And of course SQUAD for this amazing game and especially Harverster for the game itself and N3X15 for plugin support.

PowerSat

Automated communications satellite with multiple advanced features:

Currently implemented:

*Deployable and rotating solar panels (and they can have their collider meshes)

*The satellite changes its vessel name to '%SatID% %mother craft name%' instead of '%mother craft name% Debris'

*Attitude control (gyroscopic) - the satellite points to the ground

*Solar panel orientation - the satellite uses roll control and panel rotation to turn the solar panels to the Sun.

*You can easily set any number of moving parts by part.cfg. Including additional deployable antennas.

*The solar panels can have NightGlide mode

*Panel state and attitude affect drag

*PowerSat recognized as comsat in The_Duck\'s Satellite Relay Network.

*Attitude control during timewarp and automatic attitude adjustment when loading already deployed satellite.

*Right-click menu allows to deploy and undeploy the satellite and also switch its state between active flight and debris

Planned:

*Other attitude control modes: other celestial body or some absolute direction (for telescopes and interplanetary relay satellites)

*Orbit correction engine

*Control panel

*Orbit correction autopilot

*Special control panels and autopilot programs for stationary/synchronous orbits

Specifications for part making:

The most complicated part are animated panels and other elements (you can also have deployable antennas, for example)

State in model: deployed, panels in the position they would be in the moment they are deployed (before rotation activation). Panel rotation axis should be left to right.

Pivot point: for each moving part the pivot is the center of rotation. Set it to the correct position.

Moving part colliders: name should be collider_ + name of the object (like collider_Segment1 for Segment1). Pivot should be in the same point as the pivot of the part.

Setting it in part.cfg:

movingParts (integer) - number of animated elements. Set it before configuring the animations

For each object set the following values

mPartNumber (integer) number of the part (position in array) you are configuring. From 0 to movingParts-1.

animName (string) - name of the object in the model

animrange1 (float) - deploy animation range (in degrees, relative to parent part). Set it 0 (or don\'t set at all) if the object has no deploy animation.

animaxis1 (vector) - axis of rotation for deploy animation of the part

animaxis2 (vector) - axis of rotation for panel rotation animation (usually needed only for panel root part, set it 0,0,0 or leave unmodified if the current part doesn\'t need it)

animParent (integer) - index of the parent part

Note that rotation axis are often changed for parts that have parents set, so if it turns wrong way, just try to change axis

Attention: because of 0.15 security measures the parser can\'t reach the part.cfg. Put a copy of it (or just the panel code) in PluginData/powertech directory with name partname.cfg, where partname is the name parameter of the part.

New! Animations for panels/satellite deploying.

Just 2 (or even 1) paameters to enable the animation if it\'s set in the model:

FoldAnimationName (string) - name of the animation

FoldDefState (float) - state of the panels in the start of the animation: 1 - unfolded l, 0- folded (default 1, recommended to have them deployed)

Can also be used parallel with the old way, but they can\'t directly affect the same objects in the same moment.

The rotation is still handled the old way (there should be precise control of the attitude), but you can now define up to 2 panel root objects (just ensure that the other segments of the panel are children of this object) wit normal .cfg tools (so that you can make this without additional .cfg)

rotRoot1 (string) - name of the object (if it\'s not directly parented to the model, you need to specify the entire path starting with the child of the model object)

rotAx1 (Vector3) - axis of rotation (note that logically it\'s x axis of the mode, but you can alter it a bit)

rotRoot2 & rotAx2 - analogically if you have to define the second rotation (like the second panel of the satellite)

Problems with the model and animation setup? Add this to part.cfg

 showDebug = true

and it will write the full hierarchy of the model and list all the defined animations!

Other part.cfg parameters:

ejectionForce (float) - the same as for decoupler

phase1 (float) - delay before panel deploying (seconds)

phase2 (float) - panel deploying time (seconds)

panelRotateRate (float) - how fast can the panels rotate (*pi rad/s or *180degrees/s)

maxTorque, Kp, Kd (float) - attitude control gyroscope parameters (equivalent to SAS module\'s)

doubleSidedPanels (boolean) - set true, if the panels are double-sided - it will turn the closest side to the Sun

panelInitRot (float) - panel orientation in the model: 0 - forward, 0,5 - up, -0.5 - down, +-1 - back

SatID (String) - name added to the satellite\'s vessel name, when it\'s deployed

NightGlide (boolean) - turn the panels parallel to the surface velocity if in the planetary shadow

maximum_drag (float) - drag if the panels are deployed and perpendicular to the surface velocity

minimum_drag (float) - drag if the panels are not deployed on parallel to the surface velocity

showAsActiveVessel - if true, the satellite will appear as active flight in the map view.

Official sample parts: PowerSat

Other addons that use this part module: DynaSat by Maraz

SolarPanels_PowerTech

Deployable solar panels that turn to the Sun. Based on PowerSat panel code.

*Deployable and rotating solar panels (and they can have their collider meshes)

*Solar panel orientation - the the solar panels turn themselves to the Sun (if it isn\'t on the rotation axis)

*You can easily set any number of moving parts by part.cfg.

*The solar panels can have NightGlide mode - turn parallel to the ground speed if in planetary shadow.

*Panel state and attitude affect drag

*Can be deployed and undeployed by right-click menu.

Specifications for part making:

See modeling and panel configuring specifications of PowerSat.

New Now you can set logical rotation axis (if it's not x axis) of the panels (not implemented for PowerSat yet, it will come with customizable attitude controller for it). For this you\'ll need the following 2 vectors:

1) rotAxis - the axis of rotation

2) FaceDir - the direction of the front side of the panels in the moment they are deployed (perpendicular to the plane of the panel). For rotating panels should be perpendicular to the axis of rotation. (but you can also create a non-rotating panel (RotatingPanels = false), set this parameter for them to determine the direction they face)

Other part.cfg parameters:

phase1 (float) - delay before panel deploying (seconds). Default 0.

phase2 (float) - panel deploying time (seconds). Default 5 seconds.

panelRotateRate (float) - how fast can the panels rotate (*pi rad/s or *180degrees/s)

doubleSidedPanels (boolean) - set true, if the panels are double-sided - it will turn the closest side to the Sun

panelInitRot (float) - panel orientation in the model: 0 - forward, 0,5 - up, -0.5 - down, +-1 - back (set 0 or leave default if using custom rotation axis/panel facing direction definition)

NightGlide (boolean) - turn the panels parallel to the surface velocity if in the planetary shadow

maximum_drag (float) - drag if the panels are deployed and perpendicular to the surface velocity

minimum_drag (float) - drag if the panels are not deployed or parallel to the surface velocity

RotatingPanels (boolean) - if false, the panels won\'t rotate

rightRotate (int) - if 1, the panel (entire part), when placing it on the right side of the craft will be flipped 180 degrees; if -1, the same will happen on the left side

IsRadiator (boolean) - if true the radiator panel will turn parallel to the sunlight to minimize overheating (use to make deployable and rotating radiators)

IconColor (Color) - color of the icon. Not sure about .cfg, but definitely can be changed in derived modules)

Official sample parts: Soyuz solar panels (animated by PowerTech)

Other addons that use this part module: DynaVolt (DynaSat) by Maraz (with alternate configuration versions for derived modules), Kosmos

SolarPanels_adv_PowerTech

This advanced class is derived from SolarPanels_PowerTech. They calculate their efficiency (based on attitude and distance from the Sun) and also have separate variables for exposion of both sides (if yo want to make a module with heat management) when deployed. It also draws a gauge for panel efficiency.

The new values that can be overloaded or used by derived modules (and some of them can also be set in .cfg)

MaxOverload (float) - maximal efficiency when going closer to the Sun

ShowIndicators (boolean) - display the efficiency gauge.

indicatorName (string) - text on the gauge (default Power)

panelcenter - center of the deployed panel (for proper ship shadow detection).

NEW

The panels now have radiator abilities

deployedHeatDissipation (float) - for how much the dissipation will be increased if the panels are deployed. Don\'t forget to set heatConductivity and heatDissipation parameters of the part, too.

FrontExposionOverheat (float)

BackExposionOverheat (float)

- these 2 parameters determine how much heat will the panels generate if exposed to the Sun. They are separate for the 2 sides to allow creating asymmetric constructions like panel with radiator on the rear side.

NEW

The panels now can work with PartResource system:

partResGenerator (bool) - set true to enable resorce generation

ResID (String) - the name of the resource (default Energy);

power (float) - the base value for power generation

Parameters accessible in the derived modules:


public Color MsgTextColor=XKCDColors.White;
public Color ProgressBarBgColor = XKCDColors.DarkBlue;
public Color ProgressBarColor = XKCDColors.White;
  public Color MsgBgColor =XKCDColors.DarkBlue;

- colors of the gauge and text. can be overloaded to match the color of your plugin


public float PanelFrontExposed = 0; //front side lighting for heat management
public float PanelBackExposed = 0; //back side lighting for heat management
  public float PowerEff = 0f; //use this for power output

use these variables for power generation and heat management in the derived classes

EPS_SOURCE_Spanel_PowerTech - EPS panels - PowerTech edition

The module combines panel functionality of EPS 0.1/Zoxygene 0.6 and PowerTech.

To be used with Zoxygene addon (v0.6+)

Once deployed, the panels turn themselves to the Sun and produce power for EPS systems depending on attitude.

The panels are derived from SolarPanels_adv_PowerTech

New configurable variables are:

MaxPwrGain - the gain if efficiency is 1

ZO2pwr_PowerTech - Zoxygen recharge panels - PowerTech edition

The module combines panel functionality of Zoxygene and PowerTech.

To be used with Zoxygene addon (v0.5-0.5.2). Warning! Not compatible with Zoxygene 0.6 use EPS type instead!

Once deployed, the panels turn themselves to the Sun and produce Zoxygene depending on attitude.

The panels are derived from SolarPanels_adv_PowerTech

New configurable variables are:

MaxZO2Gain - the gain if efficiency is 1.

ZO2pwr_Regenerator - Zoxygene regenerator, consumes energy from PartResource system. Has 2 operation modes: Safe mode (keeping ZO2 level in the main system from falling below 50%) and Full recharge (recharging the tanks to 95-99% of the maximum capacity). This efficient module avoids wasting power if the ZO2 tanks are overfilled).

Has 3 parameters:

MaxZO2Gain (float) - maximal production of Zoxygen (default 0.02)

MaxPowerConsumption (float) - maximal consumption of energy (default 0.2)

partResID (String) - the name of the required resource (default Energy)

SurfaceSAS [work in progress]

Advanced attitude controllers with surface-relative and other modes, that work even in timewarp.

PowerTech - MuMechLib adapter-plugin:

PowerTech_MuMech.dll v1.0.4.3- compilled for PowerTech.dll v0.2.6.1, MuMechLib.dll v1.9.2, KSP 0.17

SolarPanels_PowerTech_MuMech - PowerTech animated panels compatible with with MuMech variable tanks

PowerTech-MuMechLib adapter-plugin required

also requires both PowerTech.dll and MuMechLib.dll

Besides what is available for SolarPanels_adv_PowerTech, it has couple parameters from MuMechSolarPanel:

ResID (String) - type of the recharged 'fuel' (default Energy)

power (float) - amount recharged per second (default 0.1)

partResGenerator (bool) - if set to True the panel will recharge both MuMech and PartResource

Edited by Alchemist
Link to comment
Share on other sites

PowerSat [work in progress]

PowerTech Communications Satellite is automated satellite with multiple advanced features:

Currently implemented:

*Deploying and rotating solar panels

*The satellite changes its vessel name to '%SatID% %mother craft name%' instead of '%mother craft name% Debris'

*Attitude control (gyroscopic) - the satellite points to the ground

*Solar panel orientation - the satellite uses roll control and panel rotation to turn the solar panels to the Sun.

Planned:

*Attitude control during timewarp and automatic attitude adjustment when loading already deployed satellite.

*Orbit correction engine

*Control panel

*Orbit correction autopilot

*Special control panels and autopilot programs for stationary/synchronous orbits

First video of deploy sequence

http://youtu.be/YZ0V4dWn5x8

This is very awesome. I\'d love to see how you managed the attitude control - it could help a lot in a future multiplayer plugin.

Also, I\'m not sure if attitude control during timewarp is possible, but for attitude control for when loading a satellite, you could try either changing the .sfs file and forcing a reload, or you could stick some stuff in a in statement in onPartStart() to make it realign when you load it.

Link to comment
Share on other sites

This is very awesome. I\'d love to see how you managed the attitude control - it could help a lot in a future multiplayer plugin.

Also, I\'m not sure if attitude control during timewarp is possible, but for attitude control for when loading a satellite, you could try either changing the .sfs file and forcing a reload, or you could stick some stuff in a in statement in onPartStart() to make it realign when you load it.

During timewarp (and not only, but it\'s too cheaty off rails) it is possible to affect attitude by giving commands to vessel.rigidbody (it works, I just need to do some vector maths to make it work correctly). The same for instant turning at the moment when the vessel is loaded (I\'ll use this feature only if the satellite was at correct attitude when it was unloaded).

Link to comment
Share on other sites

During timewarp (and not only, but it\'s too cheaty off rails) it is possible to affect attitude by giving commands to vessel.rigidbody (it works, I just need to do some vector maths to make it work correctly). The same for instant turning at the moment when the vessel is loaded (I\'ll use this feature only if the satellite was at correct attitude when it was unloaded).

That\'s awesome. I\'d like to see this progress!

Link to comment
Share on other sites

Nice addon. Can I suggest that you swap the naming convention so that the SatID goes after the mothership name? That way you get 'Comsat 1' instead of '1 Comsat' (for example).

Also, is there a way for it to check for conflicting/existing ID\'s (i.e. if you\'ve already launched 'Comsat 6', it automatically becomes 'Comsat 7')?

Link to comment
Share on other sites

Nice addon. Can I suggest that you swap the naming convention so that the SatID goes after the mothership name? That way you get 'Comsat 1' instead of '1 Comsat' (for example).

Also, is there a way for it to check for conflicting/existing ID\'s (i.e. if you\'ve already launched 'Comsat 6', it automatically becomes 'Comsat 7')?

Well, by SatID I meant satellite name (default is PowerSat, but it\'s configurable). So it\'s called 'PowerSat Kerbal Communications' instead of 'Kerbal Communications Debris'

Link to comment
Share on other sites

Finally made a parser for reading the solar panels and other elements that can come in any number from part.cfg. So, it\'s almost ready for the first release (just need some work on the sample models themselves).

And there will also be solar panels for space stations (based on PowerSat panel code), that turn to the Sun.

Link to comment
Share on other sites

I\'m working on a new attitude control module (codename SurfaceSAS for one of the main uses - surface orientation of satellites and stations). One of the features will be that it works even when the vessel is not controlled (aka 'no more strange rotation of the docking target') and during timewarp. And even shifts the vessel to the correct attitude when loading the scene.

Yes, this feature really works and is already implemented in PowerSat!

One more thing - it will have 2 modes: Semi-manual where it remembers the attitude when the vessel is goes to rails / is unloaded / gets SAS activated and Automatic when it turns to preconfigured direction.

Now the question - for attitude control it remembers relative position of 2 vectors. It turns to match the primary one, then rotates around it to match the secondary one as close as possible (for both there will also be a setting that allows or disallows to go opposite to that direction). What possibilities should be implemented for the attitude vectors?

The current list is:

1) Surface - vertically to the body, the craft is orbiting

2) Prograde - direction of propagation

3) Sun - turns to the Sun

4) Planet - allows to specify a celestial body (for telescopes and interplanetary relay satellites)

5) North - current celestial body rotation axis

6) Normal - orbit normal

Of course, the most useful modes will be Surface-Sun for satellites (the way PowerSat works) and Surface-Prograde for stations, but if you have some more ideas for the direction list, just write me.

Link to comment
Share on other sites

You also need an 'Anti-Sun' position which positions the smallest surface area/face to the sun for radiators/heat control.

Also stations will need to have 4 modes active (Surface - Prograde - Sun - Anti-Sun) since its solar panels will need to face the sun but radiators will need to be turned to present minimum surface to the sun.

The only other one I\'d think would be useful, especially for down-the-road is some sort of autotrack function where if PowerSat is implemented on a probe or just an antenna in conjunction with another addon like the Satellite Relay System, the antenna/probe will automatically align with the first target in its relay chain.

Link to comment
Share on other sites

That attitude control is the rotation of the entire craft and it can be based only on 2 vectors. But there can also be additional moving parts with their own attitude modes, so that a station can have Surface-Prograde attitude control mode and the panels and radiators have additional solar attitude mode to maximize or minimize the amount of sunlight falling on them.

Maybe, I\'ll also make an animated antenna part that turns to the closest satellite.

Link to comment
Share on other sites

  • 2 weeks later...

Very nice !

I hope that some good modeller will soon make satellites compatible with this technology.

Meanwhile, is there a quick way to make existing parts at least partly compatible (so that, say, they change their name when deployed, even though they will not have moving parts of course)?

I thought maybe changing something in cfg file of the part to make it recognizable as a powersat (maybe name or module ?)

Thanks

Maraz

Link to comment
Share on other sites

Very nice !

I hope that some good modeller will soon make satellites compatible with this technology.

Meanwhile, is there a quick way to make existing parts at least partly compatible (so that, say, they change their name when deployed, even though they will not have moving parts of course)?

I thought maybe changing something in cfg file of the part to make it recognizable as a powersat (maybe name or module ?)

Thanks

Maraz

module = PowerSat

See the OP for the other properties.

And you don\'t have to add animations if have no panels.

Link to comment
Share on other sites

Trying the stock Powersat now.

Is it normal that the satellite is present in orbital view, but not listed among active flights?

(pls see screenshot)

Thanks

Maraz

Yes, it should be handled as debris (except for the name). However in future version, when it will have a control panel, I might add a feature to toggle them between 'debris' and 'active flight' (I don\'t think it\'s a very good idea to have several dozens of them listed in the active flights list all the time).

Link to comment
Share on other sites

Maybe that will reveal why some of my sats are showing up as flyable when others aren\'t...

MechJeb somehow does this. I just have to figure out how.

Update: This parameter is vessel.orbit.objectType. Didn\'t expect it to be there

Link to comment
Share on other sites

module = PowerSat

See the OP for the other properties.

And you don\'t have to add animations if have no panels.

Thanks,

I managed to build a small satellite using Powersat technology.

It uses Silisko\'s Probodobodyne parts, it has no moving objects but it orients towards Kerbin and has the 'Powersat' string in its name.

Also thanks for clarifications about Powersat flight/debris status.

Maraz

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...