Monday, April 28, 2008, 1:00 AM
Last update for the miniblog. Finished up the webpage by making a
nifty banner in MS Paint and putting it at the top of most of the
pages.
Thursday, April 24, 2008, 2:00 AM
Did a lot of work on the web page. Made a sidebar image in
Photoshop, wrote the Download and Train OS page, and found all of my
files, zipped them, and uploaded them to the site. The green/grey
style is no more. Once I make a nice header image, the web page
should be pretty much complete.
Also, that nice XML file I wrote? Gone. Lost to the abyss.
Non-existant.
Wednesday, April 23, 2008, 9:30 PM
Finally done! Now that I've enjoyed a little bit of
not-working-on-senior-project time, I'll detail how yesterday
finished up.
- 9:00 - 11:00 AM - Realized I forgot the Disaster menu, so I implemented it. It wasn't very hard to do.
- 11:00 AM - 12:00 PM - Fixed a few bugs, made sure the simulator ran on a SNC network computer, and typed up the presentation (it had already been written, but only on paper).
- 12:00 - 1:00 PM - Fixed the Track XML to look a bit less rigid and a bit closer to scale.
- 1:00 PM - Presentation
So, thanks to all the people who showed up to support me and me project, and to those who people who supported me even though they couldn't make it.
Tuesday, April 22, 2008, 1:30 AM
Here are the rest of the night's updates:
- Communications routine accepts requests for AIU status, and returns the status of sensors 0-13.
- Made an Add Train dialog box, so not all trains have to start in the same spot and have the same speed, position, etc.
Tuesday, April 22, 2008, 12:00 AM
The sensors are fully implemented. That was a bit easier than I
expected.
Monday, April 21, 2008, 11:40 PM
Sensors are now built and drawn to the screen.
Monday, April 21, 2008, 10:30 PM
Fixed the direction button. It was a pretty dumb error too... I
changed the positions of the front end and back end according to
a formula I drew up, which was perfect on paper. However, both
depended on each other, so when I updated one, I screwed up the
other. Insert temporary variable, fix problem.
I was pretty frustrated about it too. Grr.
Monday, April 21, 2008, 10:00 PM
Collision detection is now working perfectly. No more false
positives, and it seems to be catching all of the right errors.
The "very fast" simulator speed was very nice for testing this.
Now for that direction change button...
Monday, April 21, 2008, 7:30 PM
You can now set a custom simulator speed. Yay for quick, nifty
updates.
Monday, April 21, 2008, 3:30 PM
Talked with Blahnik and figured out what was wrong with the status
updates (well, at the very least, I got it to work). I was using a
Queue structure before, but I changed it to a List of Strings, and
it all worked fine. Must have been something with the way VB shares
Queues or something.
Monday, April 21, 2008, 1:45 AM
Finishing up for the night. Again, got a bit of progress, but I need
a few more things before I can call this project "finished".
The simulator is now tracking the rear end of the train. The train
was a dot before; now it's two dots connected by a thick line. Had
to redo a lot of the drawing routine to draw the back end as well.
Tommorrow, I'll have to fix the button that changes the train's
direction... I broke that pretty badly now that the train's no
longer a single point that just has to turn around.
Also, I have some collision detection in place. If two trains
collide and neither track went through a junction in that timer
tick, then the collision works perfectly. Need to put detection in
for when trains do cross junctions. The structures are in place to
do this now... I just need to go through the very complicated
train movement logic to find the places where I need to update the
"collision table" that tracks the locations of possible collisions.
No sensors yet, but I plan to implement those as a part of the
collision system. Basically, I'll see if the trains "collide" with
the sensors, and that's what will set them off.
Sunday, April 20, 2008, 10:45 PM
The Simulator can also read requests to switch turnouts and can
read and implement the reset packet, which the OS doesn't send
anyway. The stuff's in place to respond to AIU requests, once
sensors are a part of the system.
Crunch time. There are a few major things that need to be done yet,
and time's running out. Major things on the list: Track train's
rear end, detect collisions, implement sensors.
Sunday, April 20, 2008, 8:30 PM
The Simulator can now parse packets from the Train OS that switch a
given train's direction and speed. Unfortunately, can't get my
reading thread to write status updates to the simulator's text box.
I'll ask about that on Monday, I think.
Sunday, April 20, 2008, 1:30 AM
Did a lot of work on communicating between the Train OS and the
Simulator. Learned how to create threads in VB, so now my ReadFile
no longer stops everything else. Compiled, built, and fixed the
Train OS so that it works on my machine, and so the DCC Manager
tells me what it's trying to send to the simulator. I managed to
set the pipe up correctly, so my program is now receiving messages
from the OS... it just doesn't know what to do with them. That's
next on the agenda.
Saturday, April 19, 2008, 8:30 PM
Been busy implementing the interface. Most of the buttons work now,
so I'm able to change the turnouts, as well as the train speed and
direction in real time, within the program's control.
Saturday, April 19, 2008, 5:00 PM
The user can now toggle the turnouts. For a touch of realism, it
takes a little bit of time for the turnout to fully switch (and
any train that hits it in that time de-rails).
Saturday, April 19, 2008, 4:30 PM
The program has been refitted for the new design model and is in
working order once again. Two trains will now be able to collide in
the four-way intersection, once I implement that.
Saturday, April 19, 2008, 2:39 PM
I was thinking about how to implement collisions, and it occurred to
me that, under the current design, it would be impossible for trains
to collide on the four-way intersection in the middle of the track.
After some thinking, I came up with a pretty good solution, but it
requires me to tweak the structure a little bit.
Previously, the Junction table held a value that marked which
Turnout was associated with it. I have to do it the other way around
now; the Turnouts have a Junction associated with them, allowing for
multiple Turnouts on the same Junction. Then if the program finds
more than one turnout, it looks for whichever Turnout contains the
train's current segment and uses that to determine where the train
should go.
Friday, April 18, 2008, 10:00 AM
Fixed the drawing routine. My problems were caused by two minor
bugs.
Next: Add Train dialog box and make the simulator track the train's
rear end.
Friday, April 18, 2008, 1:30 AM
The train logic is finished and has been working flawlessly. I've
been having fun changing the turnout data and watching the train
take different paths.
What isn't flawless, however, is the drawing routine. Actually, it
needs a bit of work. It usually works, but on certain sections of
track, it draws the train in random locations not remotely near
the track (it pretty much either works or fails for the entire
section, so I think parts of it are correct). I'll look into it more
tomorrow.
Wednesday, April 16, 2008, 8:00 PM
Started and nearly finished writing logic for trains' movement from
segment to segment. Logic is finished for when trains approach a
turnout, but isn't written if the train comes to a junction without
a turnout.
Wednesday, April 16, 2008, 1:00 AM
Had to redo all of Monday's work, because I hadn't saved it
properly. I'm pretty frustrated by that, needless to say. It's done
again, though, and it's redone in a way that makes one of my
previous problems go away.
Tuesday, April 15, 2008, 1:00 PM
Preparing to write logic for trains to move though turnouts. Since
turnouts will have thier own status, I've begun writing a class for
them. I'll store a collection of turnouts, similar to trains. Class
is mostly done, so now I have to worry about building the turnout
objects and chaing the train's move logic to use them.
Monday, April 14, 2008, 11:45 PM
"It's the final countdown!"
Some time ago, when I was thinking about how to write the train's
logic for moving from segment to segment, I realized that my track
data needed to store one more crucial piece of information: where
the turnouts are, and which segments will be available once the
train gets there. I had no way to determine this.
Thankfully, I've solved this now. I've added a new type of object to
the track XML file: a turnout. Turnouts have unique names, an id,
and they are attached to a junction (one per junction). They are
connected to three segments: the first, the "source" connects to two
"branches", but each "branch" connects only to the "source". In
other words, the source splits into the branches, and the branches
merge into the source.
Also, the Track Editor now loads, displays, validates, and saves
turnout data. Thankfully, I designed that pretty well, and adding
full functionality for another table didn't take much time.
Thursday, April 10, 2008, 12:15 PM
Finished talking with Pankratz about named pipes. They finally work!
So, the next step will be to figure out what Kratz's OS is sending
to the hardware, make it use my pipes instead, and use that to call
appropriate simulator functions.
Wednesday, April 9, 2008, 8:00 PM
I'm going to Purdue. Yay!
Continued the epic struggle against named pipes, and lost again. I
understand this stuff a lot better now, but it still doesn't work.
I'm hoping I can clear some of this up tomorrow. Unfortunately, all
of the Internet resources that teach named pipes use Visual C++, not
Visual Basic. Here's the example that I've implemented and tweaked,
but it's not transmitting meaningful data yet:
[1]
Good Visual C++ reference:
[2]
Tuesday, April 8, 2008, 1:00 PM
Fought against named pipes for quite a while this morning. Didn't
end up accomplishing much, unfortunately. I understand this stuff
better than I used to, but I think I may have to fight the code for
a bit longer to find out exactly how this stuff works.
Thursday, April 3, 2008, 9:30 PM
Finally got some more work done on the project; it's been quite a
while. Looked up how to write named pipes in Windows and built a
very basic pipe to connect an external program to the simulator. The
pipe works, so I can now work on sending meaningful messages to/from
the simulator.
Tuesday, March 25, 2008, 1:00 PM
The train is now drawn in the correct spot when it is on a track
with a bend.
Next: Learn about socket stuff and develop a
way to make the train travel on any track.
Tuesday, March 11, 2008, 1:00 PM Did some work on detecting which bend the train is on. Developed a sort routine for the bend table, which needs to sort by two columns. Drawing the train on bent tracks shouldn't be too far off.
Sunday, March 9, 2008, 9:50 PM
Made some great progress today. Thankfully, the code I wrote
yesterday actually supported multiple trains, so I found that the
program had no trouble running two trains at once. Found a
convenient way to redraw the trains every second without erasing and
redrawing the track, which takes much longer. Developed the
algorithm to figure out where the train should be placed on the
screen and draw it (the trains ignore bends for now and just run
from node to node, ignoring where the track actually is).
Took a screenshot, too. Four trains are running simulataneously; one
has been deleted. All of them are running around the outside loop,
going directly from green dot to green dot. Here's what it looks
like: Image
Friday, March 7, 2008, 9:50 AM
A train is finally on the track. I made the framework for the train
class, wrote a simple function to make the train move around the
outside of the track, and made it move on the timer and print to the
status window. I'll post a screenshot when I get a chance.
Note for Later: I'll have to redefine
turnouts in the XML. I have to know which segments the train can
move to next. It's hard-coded for now.
Thursday, March 6, 2008, 9:30 PM
I think I've finished the track editor validation. Hopefully. Also,
I spent a while today measuring the actual track and some of the
trains that run on it, so when I start making the actual simulation
(hopefully soon), it will be determining the train's position and
speed based on realistic values.
Thursday, March 6, 2008, 11:30 PM
I reworked the track editor validation procedure, and it's about
half done. It's a lot better than before, and I've now written
procedures to check for nulls, duplicate primary key values,
valid foreign keys, valid numeric values, and other things that
involve a bunch of database jargon.
Tuesday, March 4, 2008, 1:00 PM
Thought I was done with the editor. I was wrong. There's a lot of
validation to be done... tried to use the track editor on my own,
and it crashed when I tried to open my new track. So, I had to
rethink how I validated my data and redo it. I have the better part
of it done, but I'll have to validate as I load the data as well.
Thursday, February 28, 2008, 4:20 PM
Finished the track editor. It now saves to XML, so I guess it's
done. Divided as much as I could into modules, and made the code
much easier to work with. Also, I added a timer, so it now
accurately simulates a track with no trains.
Tuesday, February 26, 2008, 1:00 PM
Finished the validation in the track editor. I'm working on getting
it to save... it's not working correctly yet, but I think it's
close.
Tuesday, February 26, 2008, 1:06 AM
Refined the track editor quite a bit. It loads the XML file and
places all of the data in the right tables. Instead of loading from
that file "track.xml" every time, it now asks which file you want
through a file dialog box. The first table prevents you from
entering duplicate names. If the user has already loaded an XML file
in the simulator, the track editor will contain that track data when
it opens. I'll add some validation, get it to save, and most of my
work on that module will hopefully be finished.
Thursday, February 21, 2008, 7:00 PM
Drew up a quick diagram of the main modules and processes of the
program. Blue boxes refer to processes with their own window.
Image
Got some progress on the track editing routine. Made a framework.
Basically, I have four spreadsheet-like grid boxes that the user
will use to input data, and then that data will be validated and
saved to XML files.
Here's the screenshot:
Image
Tuesday, February 19, 2008, 11:30 AM
Fixed bug in the last note. Added "bends" to the XML file. A bend is
basically a sensor with position, but is not a sensor. It contains
the distance from node1 and its position. Rewrote the
segment-drawing function to draw bends.
Next: Add bends to XML.
Tuesday, February 19, 2008, 1:25 AM
Had some problems with the drawing. The screen would erase whenever
I switched windows. After a lot of searching, I found out how to
avoid that by using a buffer. It's working well now.
Changed program to display small images (green circles for now)
at the junctions instead of lines. Also, I've managed to get the
track segment drawing routine done.
Here's what it looks like now:
Image
Next: Check out bug when track is loaded
twice. Add drawing nodes to data format. Draw sensors.
Tuesday, February 12, 2008, 7:30 PM
Replaced the entire parser with one line of code. Wish I would have
known about DataSet.ReadXml sooner.
The simulator is now displaying the track's junctions, positioning
them based on the XML data. Nothing sophisticated, but it works.
Here's a screenshot of the working track drawing routine:
Image
Compare it to the track layout:
Image
Tuesday, February 12, 2008, 5:30 PM
The program correctly parses all of the junctions and spits the data
out in the Status text box. The rest of the parser should be
very easy.
Next: Put the data in something meaningful.
The VB DataSet class looks promising.
Tuesday, February 12, 2008, 3:00 PM
I actually had a lot of trouble with the XML parser. Changed the DTD
to an XSD, since DTD's are not used much anymore, apparently. But,
things are working again, so I can move forward.
I'll upload the XSD file here later.
Monday, February 11, 2008, 10:56 AM
The application can now read from my XML file. Yay! It isn't parsing
it yet, though.
Monday, February 11, 2008, 12:46 AM
Doing some web page work. Got it to work in IE, finally.
I've been looking at the XML and comparing it to Kratz's track
representation. I updated the one I posted earlier.
Here's an explanation of the XML: The basic element of the track is
a node, which has a location and perhaps turnout information.
Segments connect those nodes, and have stored lengths. Sensors
can be placed on segments, and their positions are stored as
distance from the segment's "node1", whichever one that is.
Sensors would also have AIU data.
It occurred to me not long ago that drawing the track based on this
data might be extremely difficult (at the very least, it would
take an absurd amount of time to develop the algorithm with the way
the track data is currently represented). I'll likely have to store
some way to tell the computer the shape of the track, but I'm not
sure what yet. Perhaps more nodes. A lot more nodes. Dozens, at
least. It's just an idea at this point.
Thrusday, February 7, 2008, 6:45 PM
Wrote timeline. Here's a useful resource for using XML in VB:
[1]
Tuesday, February 5, 2008, 12:26 PM
Checked some of the previous projects for references.
Here are some of Chris Kratz's that may help:
[1]
[2]
[3]
And here are his track definitions. I'll use my own format, but
his data should be good:
[1]
[2]
Idea: I was worried about error conditions, but that shouldn't be
bad at all. I could use a dropdown menu of possible errors, and let
the user trigger them. For instance, one option could cause a train
to stop responding, and then it wouldn't respond to certain
commands.
Note to Self: Make webpage look good in IE. Check it in Opera.
Monday, February 4, 2008, 2:20 PM
Doing some research on past railroad projects to learn something
about the railroad itself, and making up some time for the progress
I didn't make last week.
- Observations:
- Previous projects may have used an absolute coordinate system to store track information. I'll be looking in to this.
- The simulator will have to run pre-made programs, so I'm starting to consider what the API needs to do.
- Also, I need to start thinking about how my simulator will run pre-made railroad programs. It's fair to force people to use my API, I think, but they shouldn't have to use my environment. No ideas on this topic yet.
Tuesday, January 29, 2008, 12:48 PM
Finished the XML file. Also made a DTD to validate it.
Here's the DTD: DTD
Monday, January 28, 2008, 2:54 PM
Looked up the actual track layout and started converting it to XML.
Here's the XML: XML
Here's the track layout: Image
Monday, January 28, 2008, 2:09 PM
I've decided to put the track format in XML. That should make the
files easy to understand. I'm working on the inital track layout.
Sunday, January 27, 2008, 3:24 PM
Did a lot of work on the VB application. List of updates, since I'm
accidentally doing this at the end of my work period instead of
throughout:
- Created a simple VB program that will become the simulator.
- Designed the bare bones of the program, and analyzed the project's scope.
- Created a bunch of controls for things I want to be done eventually.
- Considered making and drawing custom tracks. I'll store track sections connected by nodes. Track sections will have lengths; nodes will have positions in percentages, so it can be easily reproduced if the screen size increases.
- Wrote the bare bones for a track-drawing routine.
Near Future: Learn more about the railroad to see what the simulator should do. Draw the track.
Wednesday, January 23, 2008, 3:02 PM
Webpage looks a bit better now. Cross-browser compatibility
sucks. At least the CSS is nice and tidy now.
I'm thinking the best way to make the custom tracks is to store the
lengths of each track. I think it's the easiest for the user.
Near Future: Building a basic VB program.
Tuesday, January 22, 2008, 3:10 PM
Got the Problem Spec today and uploaded it. Made minor webpage
changes.
The biggest worry so far is the custom track design. Making a track
layout that makes sense to both computer and user may be tough.
Monday, January 21, 2008, 2:39 PM
Started writing the webpage today. It's simple, but it works. The
whole webpage consists of the main page and this one.