TChart Application
From Tallus LLC Wiki
Contents |
About
The TChart application provides database driven charts and graphs for CQC and MainLobby3 Server.
TChart is a stand alone application that integrates with both MLServer from Cinemar and CQC's home automation software server.
Hardware Requirements
Software Requirements
Tested with Mainlobby3 Server 3.0.588.
MLComDevice plugin 1.2.3 installed on MLServer. One MLComDevice license comes with a TChart license sale.
MainLobby3 Client 3.0.107 (or newer)
CQC Server v 2.6
FieldGenerator v .64
To be installed on TChart.exe PC:
[Microsoft .NET Framework 3.5]
SP1
TChart.exe executable 0.2.5 (or newer)
Hardware Installation
Download Link
The plugin installs in a 30 day trial mode. Once you have decided to purchase it from [Tallus's shopping cart], just apply the software license you will receive from Tallus via email on purchase of the plugin. After the plugin is installed, the license is then applied to the TChart Software Registration Menu (in TChart: Event Log Tab/License Keys) which you must then Activate to that PC by sending your purchased license, your PC's Hardware ID (found at bottom of the Registration Menu window) to: info(at)talluscorp.com. You will soon receive an Activation code via email that is applied to the Registration Menu which makes that plugin permenant to that PC.
You should perform the above within the 30 day trial period to enjoy uninterrupted usage of the plugin with no rework needed between trial and licensed useage. Please allow up to two days for Tallus processing time for your requests. Most requests are processed within a few hours.
Software Installation
If you are installing to a pre Vista PC, you will need to have MDAC Version 2.8 installed on your MLServer PC prior to installation. You can check your current MDAC version by using:
If you have an earlier version you can get MDAC Version 2.8 at the following link:
Please note that since TChart is a standalone executable, it does not have to run on the same machine as MLServer. It will communicate with MLServer using TCP/IP and you would need to make sure that the computer running TChart can communicate to the computer running MLServer. TChart creates a JPG of your desired chart. The JPG should be created in a directory that your display client software can display.
During the installation, the installer will query whether you want to install .NET Version 3.5 SP1. If you are unsure whether the library is already installed, make sure that you check this box and allow the installation to occur. This library is required for the plugin to work properly.
Start the TChart program. If the plugin is running in Trial or Expired licensing, the licensing menu page will appear so you can update the licensing. Once on Permanent licensing, the program will open directly to the configuration screen. You can also have MLSchedule (Tallus MLServer3 plugin) open the TChart application in minimized mode, which is the typical implementation.
Licensing
The application will install with a 30 day trial. Once purchased, you will receive an email from Tallus with your license key that you should Copy / Paste into the applications's License field. If successful, you will see the Licensing Key Icon on the right side of that field go Green.
Copy the Machine ID value into an email that you should send to support (at) talluscorp (dot) com with a request for your TChart Activation code. Once Tallus receives that request, you will be emailed back the Activation Key that you would Copy / Paste into the Activation Key field. Click the Activate button on the bottom left and you should see "This is a permanent license key" message at the top of the licensing window. TChart application is then permanently licensed for that PC.
Configuration
Controller Configuration Tab
TChart supports making charts for multiple databases.
You will need to select a unique Name and TCP Port (Default = 9900) to connect to MLComDevice (MainLobby) or FieldGenerator (CQC), as well as the resolution (Width X Height), Type and Path of the created images. The Full path of the database and its MainTable are also required (see the Database section for more details). Finally you can decide if you want to Enable the TCP monitoring (enable the connection).
Note that if TChart.exe is not on the same PC as MLServer, the Image path must reference the MLServer PC and the Image folder must be shared on the network so TChart.exe can write to it.
User configuration settings are saved to the TChart-Config.xml file in the TChart directory.
Graphics Tab
Here you can test charts from actual data in your databases. Select the variable (i.e. Sacramento_Storage_Temperature) and file name. You can also set the Start and End dates for the sample chart. If you specify a starting date before the data content or an end date passed the data content, the axises will be properly adjusted to match the actual data.
Secondary Tables Tab
Here you can consult the list of secondary tables making up that database.
Chart Options Tab
In order to create a chart at the touch of a button, it is required to predefine some templates first. You can select the Title, X and Y axis labels, Background color and so on. Pressing the Test button will update the sample chart, to give you a preview of your selected choices.
The Title, X Axis and Y Axis labels accept the {{Parameter}} variable, as well as the current date/time variables: {{Date}}, {{Time}}, {{ShortTime}}, {{Year}}, {{Month}}, {{Day}}, {{Hour}}, {{Minute}}, {{Second}}. By adding the prefix Start_ or End_, it is possible to use the info related to the actual data, i.e. "Data Plot from {{Start_Time}} through {{End_Time}}".
Chart Colors and Symbols Tab
Since it is possible to plot up to 10 sets of data on the same charts, this is where you can specify the associated Symbols and Colors.
Chart Events Tab
To help debug issues, events might output some indication on this tab, as well as in the associated TChart.log file. You can also access the About and License forms from here. You can also choose for the application to launch minimized to the System Tray.
Database
TChart tries to provide as much flexibility as possible, but this comes at the price of a strict database structure.
- All tables have to be auto-incremented.
- The table with the actual data (MainTable) starts with the ID column, followed by the Parameter's column(s) (string), the PropertyValue column (float or integer) and the DateTimeStamp column (DateTime).
- For each Parameter, a table called "Tbl + {parameter name}" will needs to be created (secondary tables).
Eventually, the DateTimeStamp column could be replaced by a more generic one.
The secondary table gives an easy access to the various parameter's values (i.e. TblFacilities might contain Boston, Sacramento, New York, etc.), without having to pre-analyze the MainTable.
Commands
TChart accepts a series of commands over the TCP port configured for the specific database. Typically, those commands would originate from MLComDevice (MainLobby users) or Field Generator (CQC users). The format is the following:
FieldChanged|<Command>
So a MainLobby user could simply use:
MLComDevice|<Device>~Send~<Command>
For a <Device> called myDevice in MLComDevice, adding the value of a variable to the database would look like:
MLComDevice|myDevice~Send~Add?Variable?{{Variable}}
The <Device> would be defined in MLComDevice plugin as a TCP Control device with UTF-8 encoding on the same IP and port TChart.exe is set to (IP would be the network address of the TChart.exe PC and the default port TChart uses is 9900). MLComDevice has the "TChart_myDB" Family choice. Name your new device "myDevice" to maintain same naming as used in this Wiki. Click "Save as new" button to create your new MLComDevice Device.
Alternatively, a Trigger could be set in MLComDevice:
<Trigger> = Add~<Var> <Code> = Add?<Var>
used with the command:
MLComDevice|myDevice~Add~Variable?{{Variable}}
The list of allowed commands is made of:
Add
This is the method to add data to the database, assuming that you are not filling it directly from another application/driver/plugin. The time stamp will be automatically added, based on the clock of the computer running TChart. The format is:
- Add?<Column1>_<Column2>..._<ColumnN>?<Value>
- Add?Boston_Storage_Humidity?59.6
- Add?Boston_Storage_Humidity?{{Boston_Storage_Humidity}}
Where
<ColumnX> are the individual parameter describing the data. <Value> the actual value of interest that will be used in the chart.
AddToTable
This method will add a value to a secondary table. This should only be used if data are directly added to the database, bypassing the Add method and after verifying that the value is not already present in the table. The format is:
- AddToTable?<TableName>?<Value> - AddToTable?TblFacilities?Boston
DelFromTable
This is a quick method of deleting values from the secondary tables. The format is:
- DelFromTable?<TableName>?<Value> - DelFromTable?TblFacilities?Boston
List
This method will list the values in a secondary table. By calling List on the various secondary table, it is possible for example to build the command required to create a chart...
- List?<TableName> - List?TblFacilities
Next
This method will allow scrolling thru the valid choices in the database. By calling List on the various secondary table, it is possible for example to build the command required to create a chart...
- Next?<TableName> - Next?TblFacilities (would cycle through all Facilities in the database)
Plot
And finally, the method to actually create all those charts. While the templates of those charts are defined in the UI itself (see the Configuration section), this is where you select which set(s) of data will be used. The format is:
- Plot?<Chart>?<Parameters>{?<Start>?<End>?<Filename>}
- Plot?TempChart?Sacramento_Storage_Temperature
- Plot?TempChart?Sacramento_Storage_Temperature?2009-04-05 16:00
- Plot?TempChart?Sacramento_Storage_Temperature?2009-04-05 4:00pm?2009-04-05 6:00pm
- Plot?TempChart?Sacramento:Boston_Storage_Temperature?2009-04-05 4:00pm?2009-04-05 6:00pm?Results
- Plot?TempChart?Sacramento:Boston_Storage_Temperature?-600?-60?Results
Where
<TempChart> is the name of a chart as configured on the Chart option tab. <ParameterX> are the individual parameter describing the data. Using "Sacramento:Boston:New York" would results in 3 plots on that chart (limit of 10 sets of data). <Start> is a valid database "date format" according to the user's regional settings, or a number of minutes from now. <End> is a valid database "date format" according to the user's regional settings, or a number of minutes from now. <Filename> is used to overwrite the default filename (i.e. <Database>_<Paramater1>...<ParameterN>.<Image extension> = Database_Sacramento_Storage_Temperature.jpg).
The last 3 items are optional, so you could use ???filename (note: three question marks in a row) if you wanted to plot all the data but use a specific filename.
Command Example Usage:
Plot a Temperature Chart
- MLComDevice|myDb~Send~Plot?myChart?Sacramento_Storage_Temperature
Plot two charts on a single graph
- MLComDevice|myDb~Send~Plot?TempChart?Sacramento:Boston_Storage_Temperature?2009-04-05 4:00pm?2009-04-05 6:00pm?Results
This will plot both Sacramento_Storage_Temperature as well as Boston_Storage_Temperature for the same date range. Note that if there isn't data for, say Boston, then only Sacramento's temp would be plotted.
Previous
This method will allow scrolling thru the valid choices in the database. By calling List on the various secondary table, it is possible for example to build the command required to create a chart...
- Previous?<TableName> - Previous?TblFacilities (would cycle back through all Facilities in the database)
Examples
Chart a MLServer variable value over time
Let say you are doing some environment monitoring... You want to know the humidity and temperature in many facilities... So you would end up with a bunch of MLServer variables like {{Location}}_{{Facility}}_{{Property}} = {{degrees}}, and would like to plot them.
- So first you would create a MS Access database to hold the data. The main table needs to be called TblData, its first column (ID) would be auto-incremented, the second could be called "Locations" (string), the third called "Facilities", the fourth "Properties" (string), the fifth called "PropertyValue" (float), and the last "DateTimeStamp" (DateTime). For each part of the variable (i.e. {{Locations}}, {{Facilities}}, {{Property}}, etc.) a secondary table would be created (i.e. TblLocations, , TblFacilities, TblProperties), composed of an auto-increment and a second column (string).
- Second, you would configure TChart to monitor a TCP port (i.e. 9900), access the database and create chart templates according to your specifications.
- Third, you need to get the data into the database. In MLServer create a Rule that says:
Whenever Sacramento_Storage_Temperature changes value.....Then MLComDevice|myDB~Send~Add?Sacramento_Storage_Temperature?{{Sacramento_Storage_Temperature}}
This will send the value of your variable to TChart's database (example is set for "myDB.mdb") that now can be charted. Note that Sacramento_Storage_Temperature cannot be set using a "SetVariableFast" command. It can only be set using the standard SetVariable|Sacramento_Storage_Temperature~55 command. The Fast option does not get processed through MLServer Rules so no rule will fire when the value changes.
- And finally, you would make a single or double plot like:
MLComDevice|myDB~Send~Plot?TemperatureChart?Sacramento_Storage_Temperature. MLComDevice|myDB~Send~Plot?TemperatureChart?Sacramento:Boston_Storage_Temperature.
So, following the chain of events: A MLServer variable value changes....The Rule sees that change and fires the "update TChart's database" command. Once the database is updated, you can then request TChart to generate a new chart .jpg using the MLComDevice|myDb~Send~Plot?myChart?Sacramento_Storage_Temperature command. Once the jpg is created....MainLobby client can display the results using a JPG loader library "button" that references that jpg.
TOBD2 integration example
Let say you are monitoring 10 cars in a rally... You want to know their speed, consumption, the temperature of the motor and so on... So you would end up with a bunch of MLServer variables like {{Car}}_{{Property}} = {{Value}}, and would like to plot them.
- So first you would create a MS Access database to hold the data. The main table needs to be called TblData, its first column (ID) would be auto-incremented, the second could be called "Cars" (string), the third called "Properties" (string), the fourth called "PropertyValue" (int or float), and the last "DateTimeStamp" (DateTime). For each part of the variable (i.e. {{Car}}, {{Property}}, etc.) a secondary table would be created (i.e. TblCars, TblProperties), composed of an auto-increment and a column of string.
- Second, you would configure TChart to monitor a TCP port (i.e. 9900), access the database and create chart templates according to your specifications.
- Third, you need to get the data into the database. Ideally, the plugin/application updating the MLServer variables should also be sending a command to TChart to update the database:
MLComDevice|myDB~Send~Add?Car1_Temperature?99
- And finally, you would make a plot like:
MLComDevice|myRally~Send~Plot?SpeedChart?Car1:Car2:Car3_Speed
to see the speed of the 3 cars on a single chart.
Version History
Version 0.2.8
- Added more error catching.
Version 0.2.7
- The "start time" and "end time" now accepts a number of minutes from now.
Version 0.2.6
- Moved the Logger part out of the invoke...
Version 0.2.5
- Now the font dialog does more than just handling the font name.
- The Title, X Axis and Y Axis will now accept the {{Parameter}} variable, as well as the current date/time variables: {{Date}}, {{Time}}, {{ShortTime}}, {{Year}}, {{Month}}, {{Day}}, {{Hour}}, {{Minute}}, {{Second}}. By adding the prefix Start_ or End_, it is possible to use the info related to the actual data, i.e. "Data Plot from {{Start_Time}} through {{End_Time}}".
Version 0.2.4
- Added more Chart options.
Version 0.2.3
- Can now build the chart from data using combo boxes.
- Added some Active_<Table> and ActiveSelection variables, to use with the new Next?<Table> and Previous?<Table> command.
Version 0.2.2
- Added Minimize to Tray option.
Version 0.2.1
- It is now possible to adjust the padding on charts (i.e. the percentage of the range to add before and after the graph to avoid having the first/last point on the axis).
Version 0.1.1 to 0.2.0
- Added CQC support.
- Fix: the image resolution was not reported properly in the UI.
- Made it possible to copy the selected parts of the log to the clip board.
- Added context menus to delete existing Charts or Database associations.
- Moved the secondary tables to a subtab of the settings tab.
- Removed the necessity of using "FieldChanged|" for the commands.
- Charts in the UI now rescale according to the application's window dimensions.
- Added a default chart.
- Can now create a chart in the UI from the database data.
- Went for an hybrid solution for the separators (Add?Sacramento_Storage_Humidity?65.7).
- Replaced '?' as a separator by '_'.
- Can now use actual dates for {StartDate} and {EndDate}, according to the regional settings, i.e.: Plot?MyDb?Sacramento?Storage?Humidity:Temperature?#2009-04-05 16:30#?#2009-04-05 17:00#?myfile.
- Can now plot multiple sets of data on the same chart, using Plot?{ChartName}?{Column1}:{Column1b}?{Column2}...{ColumnN}.
- Now creates images from the actual database content.
- Added 3 optional parameters to Plot, {StartDate}?{EndDate}?{Filename}, though only {FileName} is currently enabled.
Version 0.0.1 to 0.1.0
- Can create the default image, with user's settings, using Plot?{ChartName}?{Column1}?{Column2}...{ColumnN}.
- Enabled the possibility of tesing new chart options.
- Added more charting options...
- Added more image options...
- Changed the default chart.
- Added the ZedGraph charting component...
- The database values can now be integer, float or double.
- Added the command "DelFromTable?{Table}?{Value}".
- Added the command "Add?{Column1}?{Column2}...{ColumnN}?{Value}".
- Start of the database handling.
- Added the commands "AddToTable?{Table}?{Value}" and ""List?{Table}".
- Can save/read configuration.
- Proof of concept.
- Basic UI.








