From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Closed-loop PID Controller with Measurement Studio

I'm in the process of implementing a PID controller in C# with Measurement Studio. I realise that Windows XP cannot provide real-time performance, but as the cycle-time is quite slow I'm wondering whether this is really a problem.
 
I'm intending to have the controller driven from the .NET Timer class, and will be be using a cycle-time of 100mS.
 
Although I'm familiar with the implementation of a PID, any example code for C# would be very useful.
 
Any recommendations or advice on what I'm doing will be greatly appreciated!
 
Many thanks,
 
Michael
0 Kudos
Message 1 of 6
(4,250 Views)
If you can use .NET Framework 2.0, consider using the Stopwatch class instead of the Timer class. Stopwatch utilizes the computer's multimedia timer (if available) to provide better accuracy and resolution than the Timer class.
Message 2 of 6
(4,243 Views)
Drohacek,
 
Although my gratitude is a little late, I would like to thank you for pointing me in the direction of the Stopwatch class, this has been very useful.
 
Many thanks,
 
Michael
0 Kudos
Message 3 of 6
(4,157 Views)
You're welcome; I glad it was helpful.
0 Kudos
Message 4 of 6
(4,134 Views)

BTW, what PID controller can be programmed with C#?  What programming hardware do you need to do this?

 

Thanks,

Scott

0 Kudos
Message 5 of 6
(4,132 Views)
Nervermind, misunderstood topic.
0 Kudos
Message 6 of 6
(4,121 Views)