Obviously a 2 GHz Pentium cannot simulate a 3 GHz Pentium in real-time.
I managed to simulate a 16MHz microcontroller at quarter speed on a 2GHz Pentium tho,
using C# code on .NET 1.1; this means I needed some 500 Pentium cycles to simulate one
The reason for such a factor should be clear: the simulator has to do sequentially
what a microprocessor is capable of doing in parallel (a lot of the chip's hardware
can work in parallel), such as:
- memory translation
- memory protection
- code fetch
- instruction decoding
- operand fetch
- ALU simulation
- flags adjustment
- peripheral processing (e.g. timer countdown, and occasionally interrupt vector
prioritizing and vectoring).
The most costly items in the list seem to be instruction decoding (a switch does not
come cheap) and flag adjustment (setting the zero, negative, carry, ... flags is
not cheap especially without using assembly code).
Since this was one of my first major apps in C# it is conceivable I could revisit
and somewhat improve the performance, but I dont expect that to be very much.
My simulation included ALU, memory and simple peripherals, targetting exact register
and memory behavior, but not exact timing simulation. If you want cycle accurate
simulation be prepared to add some code and get a slower simulation...
i ll control mechanic robot arm.and i ll control it by visual c#.like this:
visual c#---microcontroller------motordrivers---and i ll feedback from motor axesses than i ll send them to visual c# again.
second part of my projects is that i ll do real time simulation.i must model robot arm and it ll get my angle variables from outside and it ll be rotate according to my variables.how can i do like this simulation?what kind of way can be easy for me?
thanks for your kindness
To me simulation is calculating somethings behavior based on a mathematical model, without
having the actual object in existence, or without having it provide information
(such as measured position, angle, velocity, ...)
What you describe sounds more like visualisation: again you create a mathematical model
but now you let it mimic the observed behavior of the real object, by taking
measurements and feeding these in your model.
Anyway I think you can do this in C# (or another hi-level language) like so:
1. create a form with a Panel (for some reason I prefer drawing into a panel);
in the end you will want that to be a double-buffered panel (NET 2.0 knows about
that, under 1.1 you need to derive from Panel and use SetStyles)
2. create some classes that represent parts of the robot arm (upper arm, under arm,
wrist, hand, ...); let them all inherit from a base class "Part".
3. create the model by instantiating the above classes and keep all those instances
in an ArrayList "myModel".
4. give each part class a Paint() method that paints itself in the Panel, so your
entire drawing could consist of foreach(Part p of myModel) p.Paint();
5. introduce a coordinate system (say xyz)
6. assume all angles are known (from measurements)
7. all parts have known lengths and one has a known position; all the others
can be calculated provided you know the direction; some math is involved here.
8. create a periodic timer (I would suggest a Forms.Timer) that iterates over your
model, so it:
- performs all measurements
- recalculates all positions
- redraws the entire model
- the position calculation and drawing seems rather straightforward, they wont
hamper a smooth display
- the most critical part AFAIK would be performing the measurements and getting them
into the PC. You should try to evaluate the time it will take to do all measurements once
before developing all the code, since that may prove it is not possible to get
enough iterations per second, and/or you have to change your micro-to-PC communication
and/or you have to introduce threads (plus the problem that not all measurements
belong to the same point in time).
BTW: you will have noticed I didnt model any motors, the above just knows
positions/angles and visualizes everything.
I built a client \ server chat.
Both server and client are 2 programs which are on 2 home computers.
1 computer acts as the server (... Sockets.TcpListener ...) the other is the client who try to connect.
i want the server side will be in a remote server and not in home computer.
does web service is the place to put the code?
to start the listen im using a thread:
listenerThread = New Threading.Thread(AddressOf DoListenServer)
how should i start these lines in the web service?
Once i start listen thread ill not be able to kill thread if it is in a remote server and not home computer.
what is the way to communicate between clients handing by server where it is a remote server?
A Web Service is not really a good candidate for a chat server. It's possiblt, but you'll have to rewrite large portions of your server and client apps.
If your server is already written properly, you should be able to put it on any machine and run it without modification. All you need to do is supply the client app with the IP of the server running the server app.
I built client server application which using tcp protocol
example code :
listener = New Sockets.TcpListener(System.Net.IPAddress.Any, PORT_NUM)
If im the server and I behind router, i cannot communicate with a client side only if i open a port in my router.
I wonder how all multiplayer's games work if no one needs to open any port?
Can it be the server side is a not at home computer but a real server that control many clients?
Should i need to run a thread in the server that manage all players (all players are the clients?) ?
if this the way (using a thread that always run in the server and manage all players from home computers which are the clients)
What will happened if the thread stuck or the server shutdown, this will kill all users(players).
Ill appreciate any help building multiplayer's gaming manage by server side (or any other good technology for multiplayer's)
If a machine has multiple versions of .NET Framework installed say 1.1 and 2.0. Further still if there are .NET assemblies that are built on both flavours. And if we have a mix of ASP.NET pages that are written in 1.1 and 2.0. I presume that all pages are hosted as one application.
1)where would you ideally place the version specific assemblies.
2) Which version of the web.config would you deploy on the web root, since i understand they are different between 1.1 and 2.0 ?
3) Is it a fair statement that if there are some ASP.NET 2.0 specific pages then deploy them in a different folder that has 2.0 specific web.config ?
4) Would there be issues if we host this on IIS 6.0 since the same application pool cannot process multiple .NET Versioned components. Refer http://dotnetmystery.blogspot.com
And if we have a mix of ASP.NET pages that are written in 1.1 and 2.0. I presume that all pages are hosted as one application.
It was looking good up to here.
Only one version of ASP.NET can be registered with IIS. There is *no* way you can say that different pages within the one site are different versions, and apart from that, you can only run one version on a web server at a time.
What you want, can't be done at all.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
My idea was to have a mix of ASP.NET pages that are written in 1.1 and 2.0, and have that hosted as one single Web application. Currently our application has a mix of ASP, ASP.NET 1.1, but since we are integrating a new application into the current one, we want the new code to be written in ASP.NET 2.0 and migrate all the existing ASP and ASP.NET 1.1 to ASP.NET 2.0 pages at a later point of time. Since all this is one appln, we would like to have this run as one appln.
But reflecting on your thoughts, i guess you are right , that we cant be doing this, since IIS routes different ASP.NET versions to different ASP.NET Worker processes, rather they are defined so in IIS metabase, so they would never execute as one application.
I'm sorry, Christian, but you're wrong: different 'web applications' can be run with different .NET versions. However, all web applications sharing a worker process (pool) must have the same .NET version.
A 'web application' differs from a virtual directory, and has a different icon (IIS 5.x uses an open box icon rather than a folder icon; IIS 6.0 uses a 'gear' icon rather than a folder). To convert a folder into a web application, click Create under 'Application Settings' in the folder's properties in the IIS management console.
In IIS 5.x (Windows 2000 and XP), this is automatic - the appropriate version of the ISAPI Filter is loaded depending on what the metabase has configured, which then loads the appropriate worker (aspnet_wp.exe) process. ASP.NET 2.0 adds a new ASP.NET page to the application's property sheet which permits the version to be selected. If this page isn't present, ASP.NET 2.0 is probably not installed correctly. To install it, but keep any existing web applications using ASP.NET 1.1, run aspnet_regiis -ir.
The IIS 5.x process model supports in-process, shared process or dedicated process hosting. All applications set to 'shared process' use the same dllhost.exe worker process. However, ASP.NET always creates its own worker processes - your code does not run in dllhost.exe.
In IIS 6.0, the worker process (w3wp.exe) has native support for ASP.NET hosting. Web applications can run in different 'application pools'. An application pool uses at least one process, and potentially more than one, to run the set of applications in the pool. However, the ASP.NET version required for each application is not checked. Only one version of the .NET CLR can be loaded into a process. If you configure an application pool with a set of applications that require different versions, you will have problems as the first application to load into a worker process dictates which version of the CLR is loaded. It's best to keep your .NET 2.0 applications in a separate pool from your .NET 1.1 applications to avoid problems with CLR version mismatches.
A web application can only use one version of the Framework. You would have to place the pages developed for the other version into a different folder (this could be a subfolder) and create a new Application (click Create under Application Settings in the folder's properties in the IIS management console).
You should place the appropriate version of web.config under the root that matches the version of ASP.NET you have selected for the root. The application you create for the other version should have its own web.config: settings are not inherited from the root configuration.
If running on IIS 6.0, you should place your ASP.NET 1.1 applications in a different application pool to the ASP.NET 2.0 applications to ensure that they get separate worker processes.
I don't know... Let me see... Hamster Dance song plays... ... well what do you know - It works!! Of course, it gives you the "Did you mean: ruby on rails tutorials" correction, but hey, results abound!
Dave Kreskowiak Microsoft MVP - Visual Basic
Last Visit: 20-Sep-20 4:12 Last Update: 20-Sep-20 4:12