Post Reply 
Control Systems: HP prime app, now with frequency, time domain and root locus plots
03-29-2019, 02:27 PM (This post was last modified: 05-18-2021 08:46 AM by hata.)
Post: #1
Control Systems: HP prime app, now with frequency, time domain and root locus plots
This new Control Systems App for the HP Prime is used to study the frequency and time domain responses of control systems consisting of a process and a controller, as well as stability - the app produces Root Locus Plots.
• In the frequency domain, open loop response with and without controller and resulting closed loop response (unity feedback loop) can be determined / compared.
• In the time domain, the app calculates the open loop and unity feedback loop response to reference changes as well as to disturbances (appearing between controller and process). It also calculates and visualizes the controller output. Input types: Dirac pulse, unit step and ramp.

Although the app type is ‘Parametric’, the app does not rely on the built in HP Prime parametric plot mechanism but on custom plotting routines, including custom mouse movement handling, key press detection and custom soft key menus to accomplish functionality that would not be possible otherwise. The app is entirely menu based (no need to type in commands).

The app takes as input the transfer function of a process as well as the settings of a (PID) controller.
Plot types: Nyquist, Nichols, Bode, Time domain response, root locus.
Bode plot will show magnitude and phase angle charts on one screen, or you can choose to plot magnitude or phase angle only (enlarged). Bode plots real log scales for frequency and magnitude. Magnitude can be displayed in dB as well.
Time domain plot will also show controller output or error signal.
Root locus plot will highlight all roots for a given gain and indicate whether the system is stable.

An extensive user quide is included in the zipped folder attached.
Have a look at the screen captures attached to this thread.

Note: a previous version of this app (only capable of plotting frequency response, and still relying on standard HP Prime plotting) was posted in a different thread ("Control Systems app for HP Prime").

Please let me know your comments and feedback.

Update May 2021: new Control Systems App version v3.01 available (attached), fixing a few issues (see this thread) and tested with new HP Prime version 2.1.14588 (2021 05 05). Updated manual included as well

       


Attached File(s)
.zip  HP Prime-control systems v3.00 20180329.zip (Size: 953.5 KB / Downloads: 302)
.zip  HP Prime-control systems v3.01 20210517.zip (Size: 1,010.3 KB / Downloads: 300)
Find all posts by this user
Quote this message in a reply
03-29-2019, 03:03 PM
Post: #2
RE: Control Systems: HP prime app, now with frequency, time domain and root locus plots
I haven't tried it yet, but I'm sure I'll be fully satisfied. You are great!
however as soon as I have tested it I'll let you know what I think.

Domenico
Find all posts by this user
Quote this message in a reply
03-30-2019, 02:30 PM
Post: #3
RE: Control Systems: HP prime app, now with frequency, time domain and root locus plots
When I open the app the Symb view on the manual is not showed, instead this screen appeared:

What actually is being showed:
[Image: Screenshot-2.png]

What should have been showed:
[Image: Screenshot-3.png]
Find all posts by this user
Quote this message in a reply
03-31-2019, 08:17 AM
Post: #4
RE: Control Systems: HP prime app, now with frequency, time domain and root locus plots
As is explained in the manual, you first need to go into the program editor, just to allow the HP Prime to compile the program correctly (just enter and exit again).
Then, start the app again. It will work.
Regards
Find all posts by this user
Quote this message in a reply
03-31-2019, 07:52 PM
Post: #5
RE: Control Systems: HP prime app, now with frequency, time domain and root locus plots
Thanks a lot, the app works greatly!!

Very good job!!

Does the program looks for root locus over K>100 ?

Is there any way to set up minimum K range and maximum K range to show root locus? (and step options?)
Find all posts by this user
Quote this message in a reply
04-01-2019, 07:44 AM
Post: #6
RE: Control Systems: HP prime app, now with frequency, time domain and root locus plots
Hi
In Plot Setup, page 3, you can set the range of K values and the sample size.
The K-range for the plot is centered around the current controller gain (if no controller is selected, then this 'center' gain is 1).

Example: suppose controller gain is 200 .
Select K range: controller gain x 0.02 - x 50 ==> this will plot for a gain range from 4 to 10000.
Select sample size 50.
==> the plot will contain the roots for K = 4, K = 4.68, K = 5.47, ....., K = 200 (centerpoint), ..., K = 8.55 E3, K = 1 E4 (so, in fact, the sample size will be 51 = uneven, to allow K = 200 as center point).
You can quickly go to center point and end points by pressing Shift and then the left or right arrows.
Note that K values form a geometric progression (each K value is calculated by multiplying the previous K value by a fixed factor).

BUT you can display the roots for ANY K value (also outside the selected range) by pressing Goto and then filling in that K value (when the plot is displayed).
If you enter K = 0, the roots for the OPEN LOOP system will be shown.

Use the OPTIMIZE softkey to adjust the plot if necessary.

You might want to check out the manual ! Most is explained there :-)

Thanks for your feedback
Herwig
Find all posts by this user
Quote this message in a reply
04-01-2019, 10:40 PM
Post: #7
RE: Control Systems: HP prime app, now with frequency, time domain and root locus plots
I've understood that, I mean if I wanted to set It manually, for example from K= 0.05 to 1000 with 0.05 step.

But your app is great!! Very nice job done!!
Find all posts by this user
Quote this message in a reply
04-07-2019, 12:35 PM (This post was last modified: 04-07-2019 12:36 PM by hata.)
Post: #8
RE: Control Systems: HP prime app, now with frequency, time domain and root locus plots
Hi Chandler

No, you can't specify the end points of the range, you specify the midpoint (= controller gain) AND you specify the relative range from a dropdown list (e.g. x 0.02 - x 50) - which gives you the endpoints of course.
In case you don't have a controller (only a process): select controller type 'P' (proportional) and enter the desired mid-point for the open loop gain range.
If the open loop gain (center point) is already baked in the process (transfer function) itself, than enter '1' as desired mid-point for open loop gain, or select controller type 'none'.
Note that the two last options in the dropdown list for open loop gain range allow you to enter one endpoint for the range - because the range lies completely to the left (x 0.01 - x 1) resp. to the right (x 1 - x 100) of this endpoint then.

Also note that there is not a fixed linear step involved between samples, but a factor by which the frequency of each sample is increased to calculate the frequency of the next sample: the samples form a geometric series. This makes more sense, because in the high frequency range you want this step to be greater than in the low frequency range. Compare with a Bode chart, which is logarithmic for the same reason.
You don't choose the factor yourself - it is calculated for you based on the number of samples you want (drop down menu) and the open loop gain range (drop down menu).

Hope this helps.
Regards
Find all posts by this user
Quote this message in a reply
04-08-2019, 01:20 PM
Post: #9
RE: Control Systems: HP prime app, now with frequency, time domain and root locus plots
Very impressive, great work. I have a some reading to do.

Eddie
Visit this user's website Find all posts by this user
Quote this message in a reply
04-10-2019, 09:58 AM
Post: #10
RE: Control Systems: HP prime app, now with frequency, time domain and root locus plots
OK, thanks ... happy reading, then !
Let me know if you have any question.
Regards
Herwig
Find all posts by this user
Quote this message in a reply
07-03-2019, 09:20 AM
Post: #11
RE: Control Systems: HP prime app, now with frequency, time domain and root locus plots
For those also using Emu of HP Prime:

The original 3.0 App was working well, but after backup plus restore and even after simply closing and opening the HP Prime Emu software 2.1.14181 (2018 10 16) a chrash screen on Windows and Android poped up in my case.

I tried to track down to the line of code or the function call responsible for this. Unfortunately without success: no dedicated block / line repetitively caused the chrash.

Surprisingly a workaround was moving all the App code into a new prog and let App function START, PlotSetup, Symb, Plot, Num and VIEWs calling exported prog functions. No further code modifications were necesarry to prevent chrashing!? Also leaving the variables unchanged inside the App was ok. So the App handling on the Emu seems to be a bit poor.

But I don't mind. I'm happy being able to use hata's really cool tool with the workaround.
Find all posts by this user
Quote this message in a reply
07-12-2019, 10:34 AM (This post was last modified: 07-12-2019 10:38 AM by hata.)
Post: #12
RE: Control Systems: HP prime app, now with frequency, time domain and root locus plots
Hello FrankP
First of all, great that you like the tool.
Thanks for solving this issue, I ran into the same problem with my Samsung S9+ smartphone, but didn't bother because I use my 'real' HP Prime most of the time and I also didn't have any issues with the virtual calculator for Windows.
I verified your approach and ... it worked.
For those having the same issue, these are the steps you could take:

1. create a new program (e;g. 'Control Systems-main') and move the complete App code to that program
2. Always in that new program: rename the App key custom functions START, PlotSetup, Symb, Plot, Num to, say, CtrlSysSTART, ... CtrlSysNum (in the '*** forward declaration ***' section and in the '*** App key custom functions ***' section)
3. EXPORT these functions (put 'EXPORT' in front of these 5 names in the '*** App key custom functions ***' section)

In the Control Systems App:
1. Throw everything out except:
- the #pragma ... line
- the 5 routines in the '*** App key custom functions ***' section
2. Replace the body of the five routines in this section with a simple call to the corresponding functions in the newly created program

Example:
START()
BEGIN
CtrlSysSTART();
END;

That's all !

Please note that the newly created program will only compile without errors if you have selected the Control Systems App from the Apps view

FrankP, thanks again !
Find all posts by this user
Quote this message in a reply
07-13-2019, 02:14 AM
Post: #13
RE: Control Systems: HP prime app, now with frequency, time domain and root locus plots
(07-12-2019 10:34 AM)hata Wrote:  Please note that the newly created program will only compile without errors if you have selected the Control Systems App from the Apps view

FrankP, thanks again !

Hello hata Smile Thanks for your Apps and your fix for that.

Could you please release a new version without that bug??? It would be so nice Smile

Thanks and have great day
Find all posts by this user
Quote this message in a reply
07-13-2019, 09:47 AM
Post: #14
RE: Control Systems: HP prime app, now with frequency, time domain
Hi Hata,

hope I found the problemous lines of code: When using your original 3.00 App and moving the 2 CAS functions CalcZeros and CalcIncLaplace from the Control App code into a seperate programm the HP Emu survies backup + restore and also restarts. No other changes were necesarry. ;-)

A much better solution than the workaround of moving all code out of the App. Maybe simply adding the 2 CAS functions into Grid?

I hope you can reproduce this behaviour on your Android. By the way: The Windows HP Emu Software bahaving the same as my Android is running on Win8.1 PCs (also chrashing with CAS in App code / no chrash anymore when CAS in seperate programm).

Hope this could by a solution for the Emu users. Your App is worth it!

FrankP
Find all posts by this user
Quote this message in a reply
07-15-2019, 02:08 PM
Post: #15
RE: Control Systems: HP prime app, now with frequency, time domain and root locus plots
Hi Archanus and FrankP

I confirm: moving the two small CAS routines (at the end of the Control Systems App code) to a separate program is sufficient to make the App behave correctly on my Samsung 9+ smartphone virtual HP Prime calculator (as said, I never had this issue on my Windows 10 virtual calculator or with a HP Prime).
No other actions are necessary (no renaming, no adding of EXPORT keywords, ...).

So, one of these days I'll release a new version, but in the meantime everyone should be able to make this small adaptation (needed for virtual calculators only).

I really appreciate your feedback and suggestions (and the fact that you like the App, of course :-) ).

Best regards
Find all posts by this user
Quote this message in a reply
12-22-2019, 12:09 AM
Post: #16
RE: Control Systems: HP prime app, now with frequency, time domain and root locus plots
Fantastic program!! In my university lot of students use this program. Nice Job!!!!
Find all posts by this user
Quote this message in a reply
09-18-2020, 05:54 PM
Post: #17
RE: Control Systems: HP prime app, now with frequency, time domain and root locus plots
First want to congratulate you on doing such great work on this amazing app, been using it on my Control Systems and System Analysis courses in EE, it elevates the HP Prime to greater heights.

Just wanna point out a weird behavior I noticed: Once i enter the app and compile it (press check after entering the code through shift-program) and do a memory backup (Shift-mem-backup) and try to restore that backup my HP PRIME g2 crashes and reboots.

Hope you are doing well.
Find all posts by this user
Quote this message in a reply
09-19-2020, 04:08 PM
Post: #18
RE: Control Systems: HP prime app, now with frequency, time domain and root locus plots
(09-18-2020 05:54 PM)dah145 Wrote:  First want to congratulate you on doing such great work on this amazing app, been using it on my Control Systems and System Analysis courses in EE, it elevates the HP Prime to greater heights.

Just wanna point out a weird behavior I noticed: Once i enter the app and compile it (press check after entering the code through shift-program) and do a memory backup (Shift-mem-backup) and try to restore that backup my HP PRIME g2 crashes and reboots.

Hope you are doing well.

Nevermind, I found the solution just a couple of post up.
Find all posts by this user
Quote this message in a reply
09-20-2020, 10:03 AM
Post: #19
RE: Control Systems: HP prime app, now with frequency, time domain and root locus plots
Hello,

After many try, I always get SYNTAX ERROR IN LINE 1421.

I surely do something wrong but what ?

Good sunday.

Gérard.
Find all posts by this user
Quote this message in a reply
05-07-2021, 03:11 PM
Post: #20
RE: Control Systems: HP prime app, now with frequency, time domain and root locus plots
It installed and runs fine on my emulator on the pc. But when I install it on my handheld, I go to look at the code and I get a syntax error at the BEGIN line, I think its line 231. I'm probably doing something incorrectly. But I'm not sure what. Does anyone have any ideas?
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)