Jump to content

SkySurveyBanner.jpg.21855908fce40597655603b6c9af720d.jpg

How difficult would this be to program?


Earl

Recommended Posts

Id like a program which interfaces with the Ascom Poth driver for dome, which at dawn (so a differnet time throughout the year) will home the dome then slew to the sun to keep the solar panel tracking the sun thoughout the day, then at sunset will park the dome / free it up for regular astro use,

The dome rotation is mains powered so thats not a concern.

Link to comment
Share on other sites

  • Replies 29
  • Created
  • Last Reply

Interesting project......

For someone who knows the ASCOM object model (and a suitable development package), I would have thought fairly straightforward...

The maths to work out the current position of the sun is well documented, so it's probably not that difficult.

Something along the lines of:

Start

Create DOME object

Connect to ASCOM driver

Park DOME to HOME

Unpark DOME

Repeat every 15 mins:

- Calculate Sun position

- Is it Sunset?

-- NO

--- Slew to Sun

-- YES

---- exit repeat block

Park DOME to HOME

Disconnect from ASCOM driver

Destroy DOME object

(If only it were that easy!)

Link to comment
Share on other sites

Interesting project......

For someone who knows the ASCOM object model (and a suitable development package), I would have thought fairly straightforward...

The maths to work out the current position of the sun is well documented, so it's probably not that difficult.

Something along the lines of:

Start

Create DOME object

Connect to ASCOM driver

Park DOME to HOME

Unpark DOME

Repeat every 15 mins:

- Calculate Sun position

- Is it Sunset?

-- NO

--- Slew to Sun

-- YES

---- exit repeat block

Park DOME to HOME

Disconnect from ASCOM driver

Destroy DOME object

(If only it were that easy!)

But it is! That is exactly the point ASCOM - simplicity.

/per

Link to comment
Share on other sites

Will the amount of power generated by the solar cells be more than the power required to keep moving the dome and power the computer responsible for this? Also, out of interest, if you have mains power to the dome, what are the solar cells for?

Link to comment
Share on other sites

Will the amount of power generated by the solar cells be more than the power required to keep moving the dome and power the computer responsible for this? Also, out of interest, if you have mains power to the dome, what are the solar cells for?

The Solar power is for charging the stutter control this is an independent wireless system.

Link to comment
Share on other sites

Earl, there are probably plenty of sample of code littered around the net for working out how to do it....

You could download the free MS visual studio development tools and give them a whizz - then you get a choice of .Net, F#, C#, C++ I think.

Link to comment
Share on other sites

I'm afraid I never got much beyond:

10 Print "Gareth was here"

20 Goto 10

If you understand what that does you're either showing your age, or Basic is still used/taught (I honestly don't knwo if either apply) or, more likey, it's so obvious you don't need to be told!

It was fun back in the days when various shops had spectrums, commodores, acorns, BBC B computers etc out on show and switched on!!!!  Now I'm showing my age.

Link to comment
Share on other sites

I don't think I'd work too hard to calculate the current position of the Sun, personally.

I'd probably calculate the az values for sunrise and sunset, and the times for both, and work out how long the dome motor needs to be running to turn through some given angle.  Then at dawn I'd move the dome to the correct postition and every half hour run the motor for enough time to bring the dome back to position.  Then move "home" at sunset.

James

Link to comment
Share on other sites

I would be interested to see what improvement in collected energy you get from tracking the sun all day, than to just pointing it south at dawn and leaving it there. After all the big solar farms they are building these days do not move at all, and they are purpose built to collect solar energy

Link to comment
Share on other sites

I'm afraid I never got much beyond:

10 Print "Gareth was here"

20 Goto 10

If you understand what that does you're either showing your age, or Basic is still used/taught (I honestly don't knwo if either apply) or, more likey, it's so obvious you don't need to be told!

It was fun back in the days when various shops had spectrums, commodores, acorns, BBC B computers etc out on show and switched on!!!!  Now I'm showing my age.

As an 'upgrade' to this:

10 Print "Gareth was here   ";

20 GOTO 10

;)

Link to comment
Share on other sites

The ASCOM dome object, regardless of dome brand and model, takes an Az angle as command argument, so there is no need to calculate dome movement time or anything of that sort. The whole point of using a driver is to hide details like that from the controlling application.

The ASCOM platform also contains all the calculation objects needed to determine the exact position of the sun from geographical coordinates and time.

I assume the solar panel is on the outside of the dome, which means that the normally complicated process of calculating scope and dome slit geometry are not needed.

So, my code would have one main window with a button to connect a dome, a box where you enter the position of the solar panel on the dome, and one for your geographical position. A timer would trigger every 15 seconds or so and calculate the sun position Az, subtract the solar panel Az on the dome and then simply issue a slew command to the dome.

This is a small application. Would you like it in C# or VB?

/per

Link to comment
Share on other sites

Per if you happy to do that I would be very appreciative, which ever language I dont mind, but I do want to learn from it too.

The Solar panel is mounted undeneath the shutter, ill add a photo.

post-6688-0-13552300-1425456792_thumb.jp

Link to comment
Share on other sites

OK, piece of cake. I'll try to get it out the door tonight. I will do it in VB for simplicity and familiarity for folks. We'll publish binary and code here so that everyone may learn a bit from it.

/per

Link to comment
Share on other sites

As an 'upgrade' to this:

10 Print "Gareth was here   ";

20 GOTO 10

;)

10 PRINT "Gareth was here   ";

20 POKE 23692,255

30 GOTO 10

Of course this now only runs on the speccy, what is all this cross platform stuff about anyway!

Link to comment
Share on other sites

Just to clarify why for people.

Making sure the shutter control is charged to its best s very important as its an independently powered  mission critical component.

Anything to avoid the issue of it loosing charge especially is worth tackling.

Once again many thanks Per.

Link to comment
Share on other sites

Software has evolved from the days of "10 goto"...

Here's some fun code:

       private void Draw()        {            g.Clear(pbWind.Parent.BackColor);            for (float i = 0.0F; i < 360.0F; i += 5.0F )            {                float x2 = (float)Math.Cos((i + 270.0F) * Math.PI / 180.0F) * ((float)bm.Width - 10.0F) / 2.0F + (float)bm.Width / 2.0F;                float y2 = (float)Math.Sin((i + 270.0F) * Math.PI / 180.0F) * ((float)bm.Height - 10.0F) / 2.0F + (float)bm.Height / 2.0F;                float x1 = (float)Math.Cos((i + 270.0F) * Math.PI / 180.0F) * ((float)bm.Width - 10.0F) / 2.0F * 0.95F + (float)bm.Width / 2.0F;                float y1 = (float)Math.Sin((i + 270.0F) * Math.PI / 180.0F) * ((float)bm.Height - 10.0F) / 2.0F * 0.95F + (float)bm.Height / 2.0F;                g.DrawLine(new Pen(Color.FromArgb(92, 92, 92)), x1, y1, x2, y2);            }            for (float i = 0.0F; i < 360.0F; i += 15.0F)            {                float x2 = (float)Math.Cos((i + 270.0F) * Math.PI / 180.0F) * ((float)bm.Width - 10.0F) / 2.0F + (float)bm.Width / 2.0F;                float y2 = (float)Math.Sin((i + 270.0F) * Math.PI / 180.0F) * ((float)bm.Height - 10.0F) / 2.0F + (float)bm.Height / 2.0F;                float x1 = (float)Math.Cos((i + 270.0F) * Math.PI / 180.0F) * ((float)bm.Width - 10.0F) / 2.0F * 0.9F + (float)bm.Width / 2.0F;                float y1 = (float)Math.Sin((i + 270.0F) * Math.PI / 180.0F) * ((float)bm.Height - 10.0F) / 2.0F * 0.9F + (float)bm.Height / 2.0F;                g.DrawLine(new Pen(Color.FromArgb(92, 92, 92)), x1, y1, x2, y2);            }            for (float i = 0.0F; i < 360.0F; i += 45.0F)            {                float x2 = (float)Math.Cos((i + 270.0F) * Math.PI / 180.0F) * ((float)bm.Width - 10.0F) / 2.0F + (float)bm.Width / 2.0F;                float y2 = (float)Math.Sin((i + 270.0F) * Math.PI / 180.0F) * ((float)bm.Height - 10.0F) / 2.0F + (float)bm.Height / 2.0F;                float x1 = (float)Math.Cos((i + 270.0F) * Math.PI / 180.0F) * ((float)bm.Width - 10.0F) / 2.0F * 0.85F + (float)bm.Width / 2.0F;                float y1 = (float)Math.Sin((i + 270.0F) * Math.PI / 180.0F) * ((float)bm.Height - 10.0F) / 2.0F * 0.85F + (float)bm.Height / 2.0F;                g.DrawLine(new Pen(Color.FromArgb(92, 92, 92),2.0F), x1, y1, x2, y2);            }            foreach (reading w in windDirections.readings)            {                int grey = 72 - (int)((float)((DateTime.Now.Ticks - w.timestamp.Ticks) / 10000000) / (float)windDirections.seconds * 40F);                float x = (float)Math.Cos((w.value + 270.0F) * Math.PI / 180.0F) * ((float)bm.Width - 10.0F) / 5.0F + (float)bm.Width / 2.0F;                float y = (float)Math.Sin((w.value + 270.0F) * Math.PI / 180.0F) * ((float)bm.Height - 10.0F) / 5.0F + (float)bm.Height / 2.0F;                g.DrawLine(new Pen(Color.FromArgb(grey, grey, grey), 2.0F), (float)bm.Width / 2.0F, (float)bm.Height / 2.0F, x, y);            }float angAvg = (windDirections.angularAvg + 270.0F) * (float)Math.PI / 180.0F;float angArr1 = (windDirections.angularAvg + 260.0F) * (float)Math.PI / 180.0F;float angArr2 = (windDirections.angularAvg + 280.0F) * (float)Math.PI / 180.0F;//Point 1 is half-way from middle to periphyfloat avgx1 = (float)Math.Cos(angAvg) * ((float)bm.Width - 10.0F) / 4.0F + (float)bm.Width / 2.0F;float avgy1 = (float)Math.Sin(angAvg) * ((float)bm.Height - 10.0F) / 4.0F + (float)bm.Height / 2.0F;//Point 2 is on periphyfloat avgx2 = (float)Math.Cos(angAvg) * ((float)bm.Width - 10.0F) / 2.0F + (float)bm.Width / 2.0F;float avgy2 = (float)Math.Sin(angAvg) * ((float)bm.Height - 10.0F) / 2.0F + (float)bm.Height / 2.0F;//Point 3 is 10° less and a bit in - forms part of the arrow headfloat arrx1 = (float)Math.Cos(angArr1) * ((float)bm.Width - 10.0F) / 3.0F + (float)bm.Width / 2.0F;float arry1 = (float)Math.Sin(angArr1) * ((float)bm.Height - 10.0F) / 3.0F + (float)bm.Height / 2.0F;//Point 4 is 10° more and a bit in - forms part of the arrow headfloat arrx2 = (float)Math.Cos(angArr2) * ((float)bm.Width - 10.0F) / 3.0F + (float)bm.Width / 2.0F;float arry2 = (float)Math.Sin(angArr2) * ((float)bm.Height - 10.0F) / 3.0F + (float)bm.Height / 2.0F;//float arrowX1 = (float)Math.Cos(((windDirections.angularAvg) + 270.0F) * Math.PI / 180.0F) * ((float)bm.Width - 10.0F) / 2.0F + (float)bm.Width / 2.0F;Pen pen = (windDirections.Count > 0 ? new Pen(Color.FromArgb(32, 96, 32), 2.0F) : new Pen(Color.FromArgb(96, 32, 32), 2.0F));            g.DrawLine(pen, avgx1, avgy1, avgx2, avgy2);g.DrawLine(pen, avgx1, avgy1, arrx1, arry1);g.DrawLine(pen, avgx1, avgy1, arrx2, arry2);if (windDirections.Count > 0){string ws = windSpeeds.avg.ToString("0.0") + " (" + windSpeeds.max.ToString("0.0") + ")";string wd = (windDirections.angularAvg).ToString("000");System.Drawing.Font f = new Font("Arial", 14.0F);float wswidth = g.MeasureString(ws, f).Width;float wdwidth = g.MeasureString(wd, f).Width;g.DrawString(ws, f, Brushes.Silver, (float)bm.Width / 2.0F - wswidth / 2.0F, (float)bm.Height * 0.3F);g.DrawString(wd, f, Brushes.Silver, (float)bm.Width / 2.0F - wdwidth / 2.0F, (float)bm.Height * 0.6F);}pbWind.Invalidate();        }
That creates this:
post-9361-0-84869600-1425467767.png
Which is part of a weather station instrumentation app that I am working on for fun.
Anyway, dome swinger coming up (in VB) :)
/per
Link to comment
Share on other sites

Nope. No can do...

However, I have written a dome slave to sun application as promised, right here on the high speed train between Gothenburg and Stockholm. It is a simple thing that appears to work just fine, and anyone is free to have away at it. You need Visual Studio Visual Basic version, 2013. Or you can grab the executable out of the Release directory.

Your location needs to be entered, Use degrees and minutes or decimal degrees. The format is displayed in the user interface and the aplication has a reasonably sophisticated parser. Nothing will happen if you enter errounous information (I think;)).

Your solar panel position on the dome is counted from North (0 degrees). If it is on the east side enter 90, west is 270 and so on.

Start by clicking "Select" and choose/setup your dome. The app will remember the dome string and you will not need to do this on subsequent runs.

Then click "Connect". Your dome position should show up in the user interface. Click "Slave" to initiate slaving to sun angle.

The dome will be slewed to sun angle minus solar panel position every two seconds. Only Azimuth is slewed and the shutter is left untouched.

Reasonable error handling has been put into the application, but there is room for more. I have notied a few application starts with no reasonable sun angle being displayed, but I am on Windows 10 pre-release so I don't think it is worth investigating right now. If you see strange sun angle, just restart the application.

The ZIP is a complete Visual Studio solution.

post-9361-0-33968100-1425583963.png

Download from: http://filer.frejvall.se/Domesun.zip

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.