Page 1 of 1

Posting non-error messages to the PME

Posted: 09 September 2025, 11:36
by desyk
Hello all,

Is it possible to post non-error messages to the PME using COBIA (e.g. warnings/info)? If so, are there any examples on how to do so available? I am aware of the Simulation Context Interface, which includes the LogMessage and PopUpMessage functions, and I have also checked out the ThermoClientPMETest example from the COBIA source code, but I have not figured out how to properly use it yet. Any advice would be appreciated.

Re: Posting non-error messages to the PME

Posted: 10 September 2025, 06:00
by jasper
Any PME that supports this (mostly all) will set the simulation context.

There, you can query for the ICapeDiagnostics interface. Make that a class member.

Then, use LogMessage from the ICapeDiagnostics.

Example:

Code: Select all

	CAPEOPEN_1_2::CapeDiagnostic diagnostic;
	
	void putSimulationContext(/*in*/ CAPEOPEN_1_2::CapeSimulationContext context) {
		diagnostic=context; //may not be implemented
	}

	void LogMessage(CapeStringImpl &messsage) {
		if (diagnostic) {
			diagnostic.LogMessage(messsage);
		}
	}